update 6.7

This commit is contained in:
chardub
2025-09-28 15:53:01 -04:00
parent ef5e023ae0
commit 318ff90d8d
696 changed files with 111759 additions and 198230 deletions

View File

@@ -0,0 +1,23 @@
class Game_Temp
attr_accessor :unimportedSprites
attr_accessor :nb_imported_sprites
attr_accessor :loading_screen
attr_accessor :custom_sprites_list
attr_accessor :base_sprites_list
attr_accessor :forced_alt_sprites
attr_accessor :transfer_box_autosave
attr_accessor :moving_furniture
attr_accessor :moving_furniture_oldPlayerPosition
attr_accessor :moving_furniture_oldItemPosition
attr_accessor :original_direction #generic - for if we need to save a direction for whatever reason
attr_accessor :starter_options
alias pokemonEssentials_GameTemp_original_initialize initialize
def initialize
pokemonEssentials_GameTemp_original_initialize
@custom_sprites_list ={}
@base_sprites_list ={}
@base_sprites_list ={}
@moving_furniture = nil
@original_direction = nil
end
end

View File

@@ -0,0 +1,5 @@
##############
# ANIMATIONS
################
DUST_ANIMATION_ID=2
VIRUS_ANIMATION_ID=10

View File

@@ -0,0 +1,133 @@
#############
# VARIABLES #
#############
VAR_CURRENT_MART=291
VAR_CURRENT_CITY_NUMERICAL_ID=14 #for wondertrade/pokemarts
VAR_SPEED_UP_TOGGLE_SPEED=23
VAR_SINGLE_POKEMON_MODE=251
SINGLE_POKEMON_MODE_VAR=251 #c'est appellé comme ca en qqpart dans un event pis ca me tente pas de chercher ou
VAR_LEAGUE_REMATCH_TIER = 350
VAR_WILD_FUSION_RATE=210
VAR_ODDKEYSTONE_NB=252
VAR_DEFAULT_BATTLE_TYPE = 242
VAR_BATTLE_FACTORY_TOKENS = 243
VAR_NB_GYM_REMATCHES = 162
VAR_CUSTOM_SPRITES_ENABLED= 196
VAR_COMMAND_WINDOW_INDEX=249
VAR_STANDARD_WONDERTRADE_LEFT=248
VAR_PREMIUM_WONDERTRADE_LEFT=111
VAR_PREMIUM_WONDERTRADE_LEFT=111
VAR_RIVAL_STARTER=250
VAR_RIVAL_NAME=12
VAR_LEGENDARY_STARTERS_CHOICES=349
VAR_PLAYER_STARTER_CHOICE=7
VAR_RIVAL_STARTER_HEAD_CHOICE=212
VAR_RIVAL_STARTER_BODY_CHOICE=213
VAR_FUSION_ICON_STYLE=220
VAR_SHINY_HUE_OFFSET=275
VAR_CURRENT_HIDDEN_MAP = 226
VAR_FUSE_COUNTER = 126
VAR_STAT_RARE_CANDY=265
VAR_STAT_LEADER_REMATCH=162
VAR_STAT_NB_FUSIONS=126
VAR_STAT_NB_ELITE_FOUR=174
VAR_STAT_NB_WONDERTRADES=164
VAR_STAT_CLOWN_TIP_TOTAL=100
VAR_STAT_NB_SANDCASTLES=163
VAR_STAT_GAMBLER_WINS=43
VAR_STAT_GAMBLER_LOSSES=44
VAR_STAT_HOTELS_SPENT=225
VAR_NB_EGGS_HATCHED=298
VAR_STAT_QUESTS_ACCEPTED=96
VAR_STAT_QUESTS_COMPLETED=98
VAR_NB_ROCKET_MISSIONS = 286
VAR_BOUTIQUE_OUTFIT=290
VAR_FISHING_CONTEST_RECORD=294
VAR_FISHING_CONTEST_NERF=333
VAR_ORICORIO_FLOWERS = 276
VAR_STAT_NB_SECRETS=193
VAR_STAT_FUSION_QUIZ_HIGHEST_SCORE=267
VAR_STAT_FUSION_QUIZ_NB_TIMES=268
VAR_STAT_FUSION_QUIZ_TOTAL_PTS=269
VAR_KARMA=222
VAR_NB_QUEST_ACTIVE=97
VAR_NB_QUEST_COMPLETED=98
VAR_LUNAR_FEATHERS=282
VAR_FOSSIL=271
VAR_SSANNE_MENU=313
VAR_TEMP_SSANNE_ORDER=314
VAR_TEMP_SSANNE_PLATE=325
VAR_SSANNE_DISHES_HELD_ARRAY=316
VAR_BATTLE_TOWER_MIN_BST = 257
VAR_BATTLE_TOWER_MAX_BST = 258
VAR_GALLERY_FEATURED_ARTIST = 259
VAR_GALLERY_FEATURED_SPRITES = 260
VAR_GALLERY_ALL_ARTIST_SPRITES = 261
VAR_GALLERY_SELECTED_ARTIST = 263
VAR_NEXT_ARTIST_FORMATTED = 264
VAR_RADIO_POINTS=266
VAR_TRAINER_GENDER=52
VAR_TRAINER_AGE=99
VAR_ROCKET_NAME=25
VAR_NB_CRIMES_REPORTED=300
VAR_EXOTIC_POKEMON_ID=327
VAR_TYPE_EXPERTS_BEATEN=332
TOTAL_NB_TYPE_EXPERTS=331
#Randomizer
VAR_RANDOMIZER_WILD_POKE_BST=197
VAR_RANDOMIZER_TRAINER_BST=195
VAR_GYM_TYPES_ARRAY=151
VAR_CURRENT_GYM_TYPE=152
#constellations
VAR_CONSTELLATION_IVYSAUR=301
VAR_CONSTELLATION_WARTORTLE=302
VAR_CONSTELLATION_ARCANINE=303
VAR_CONSTELLATION_MACHOKE=304
VAR_CONSTELLATION_RAPIDASH=305
VAR_CONSTELLATION_GYARADOS=306
VAR_CONSTELLATION_ARTICUNO=307
VAR_CONSTELLATION_MEW=308
VAR_CONSTELLATION_POLITOED=309
VAR_CONSTELLATION_URSARING=310
VAR_CONSTELLATION_LUGIA=311
VAR_CONSTELLATION_HOOH=312
VAR_CONSTELLATION_CELEBI=313
VAR_CONSTELLATION_SLAKING=314
VAR_CONSTELLATION_JIRACHI=315
VAR_CONSTELLATION_TYRANTRUM=316
VAR_CONSTELLATION_SHARPEDO=317
VAR_CONSTELLATION_ARCEUS=318
VAR_LATEST_CONSTELLATION=319
VAR_TRAINER_CARD_BACKGROUND_PRICE=329
VAR_GALLERY_TEAM_FLAGS=330
VAR_REGI_PUZZLE_SWITCH_PRESSED = 1122
VAR_HOENN_STARTER = 1002
VAR_HOENN_CHOSEN_STARTER_INDEX = 1003
VAR_ORICORIO_TO_FIND=1021

View File

@@ -0,0 +1,32 @@
# This is for settings that are used in scripts since it's a chore to change them everywhere to include the module name
NUM_BADGES = Settings::NB_BADGES
EGGINITIALLEVEL = Settings::EGG_LEVEL
#this is fucking stupid but apparently necessary
FALSE = false
TRUE = true
DIRECTION_ALL = 0
DIRECTION_LEFT = 4
DIRECTION_RIGHT = 6
DIRECTION_DOWN = 2
DIRECTION_UP = 8
TRIGGER_ACTION_BUTTON = 0
TRIGGER_PLAYER_TOUCH= 1
TRIGGER_EVENT_TOUCH= 2
TRIGGER_AUTORUN = 3
TRIGGER_PARRALLEL_PROCESS = 4
GENDER_FEMALE=0
GENDER_MALE=1
MELOETTA_BAND_NAME = _INTL("Miss Melody and the Mystic Musicians")
SUCKY_BAND_NAME = _INTL("MooMoo Milk")
NB_POKEMON = Settings::NB_POKEMON#809#420 #351 #aussi CONST_NB_POKE
CONST_NB_POKE = NB_POKEMON
DOSSIERCUSTOMSPRITES = "CustomBattlers"
BATTLERSPATH = "Battlers"

View File

@@ -0,0 +1,110 @@
###
# Maps
# ##
MAP_TEMPLATE_EVENTS = Settings::GAME_ID == :IF_KANTO ? 175 : 21
MAP_SECRET_BASES=64
##
# Template events
#
TEMPLATE_EVENT_SILHOUETTE = 7
TEMPLATE_EVENT_SURF_SPLASH = 2
TEMPLATE_EVENT_SECRET_BASE_FURNITURE = 3
##
# Tilesets
#
TILESET_SECRET_BASE = 37
KANTO_OUTDOOR_MAPS = [
78, # Route 1
185, # Secret Garden
86, # Route 2
90, # Route 2 (north)
655, # Hidden Forest
40, # Viridian River
490, # Route 3
106, # Route 4
12, # Route 5
16, # Route 6
413, # Route 7
409, # Route 8
351, # Route 9 (east)
495, # Route 9 (west)
154, # Route 10
155, # Route 11
159, # Route 12
440, # Route 14
444, # Route 15
712, # Creepy house
438, # Route 16
146, # Route 17
517, # Route 18
437, # Route 13
57, # Route 19
227, # Route 19 (underwater)
56, # Route 19 (surf race)
58, # Route 20
480, # Route 20 underwater 1
228, # Route 20 underwater 2
171, # Route 22
8, # Route 24
9, # Route 25
143, # Route 23
145, # Route 26
147, # Route 27
58, # Route 21
# CITIES
42, # Pallet Town
79, # Viridian City
1, # Cerulean City
387, # Cerulean City (race)
19, # Vermillion City
36, # S.S. Anne deck
95, # Celadon city
436, # Celadon city dept store (roof)
472, # Fuchsia city
50, # Lavender town
108, # Saffron city
98, # Cinnabar island
167, # Crimson city
303, # indigo plateau
380, # Pewter city
827, # Mt. Moon summit
#
# DUNGEONS
#
102, # Mt. Moon
103, # Mt. Moon
105, # Mt. Moon
496, # Mt Moon
104, # Mt. Moon
494, # Mt. Moon Square
140, # Diglett cave
398, # Diglett cave
399, # Diglett cave
349, # Rock tunnel
350, # Rock tunnel
512, # Rock tunnel (outdoor)
445, # Safari Zone 1
484, # Safari Zone 2
485, # Safari Zone 3
486, # Safari Zone 4
487, # Safari Zone 5
491, # Viridian Forest
529, # Mt. Silver entrance
777, # Mt. Silver outdoor 1
781, # Mt. Silver outdoor 2
782, # Mt. Silver
783, # Mt. Silver summit
400, # Pokemon Tower
401, # Pokemon Tower
402, # Pokemon Tower
403, # Pokemon Tower
467, # Pokemon Tower
468, # Pokemon Tower
469, # Pokemon Tower
]

View File

@@ -0,0 +1,2 @@
# frozen_string_literal: true

View File

@@ -0,0 +1,196 @@
#############
# SWITCHES #
#############
#Game mode switches
SWITCH_NEW_GAME_PLUS = 972
SWITCH_BEAT_MT_SILVER = 918
BEAT_MT_SILVER = 918 #don't remove this - used in some events
SWITCH_REVERSED_MODE = 47
SWITCH_GAME_DIFFICULTY_EASY = 665
SWITCH_GAME_DIFFICULTY_HARD = 666
SWITCH_RANDOMIZED_MODE_INTRO=957
SWITCH_MODERN_MODE=974
SWITCH_EXPERT_MODE=772
SWITCH_LEGENDARY_MODE=1129
SWITCH_V5_1=825
SWITCH_NO_LEVELS_MODE=774
SWITCH_DOUBLE_ABILITIES=773
SWITCH_SINGLE_SPECIES_MODE=790
#Gameplay
SWITCH_DURING_INTRO = 917
SWITCH_CHOOSING_STARTER=3
SWITCH_GOT_BADGE_1 = 4
SWITCH_GOT_BADGE_2 = 5
SWITCH_GOT_BADGE_3 = 6
SWITCH_GOT_BADGE_4 = 7
SWITCH_GOT_BADGE_5 = 8
SWITCH_GOT_BADGE_6 = 9
SWITCH_GOT_BADGE_7 = 10
SWITCH_GOT_BADGE_8 = 11
SWITCH_BEAT_THE_LEAGUE = 12
SWITCH_GOT_BADGE_9 = 38
SWITCH_GOT_BADGE_10 = 39
SWITCH_GOT_BADGE_11 = 40
SWITCH_GOT_BADGE_12 = 41
SWITCH_GOT_BADGE_13 = 43
SWITCH_GOT_BADGE_14 = 44
SWITCH_GOT_BADGE_15 = 45
SWITCH_GOT_BADGE_16 = 50
SWITCH_LEAGUE_TIER_2= 1151
SWITCH_LEAGUE_TIER_3= 1152
SWITCH_LEAGUE_TIER_4= 1153
SWITCH_LEAGUE_TIER_5= 1154
SWITCH_KANTO_DARKNESS = 701
SWITCH_KANTO_DARKNESS_STAGE_1 = 702
SWITCH_KANTO_DARKNESS_STAGE_2 = 703
SWITCH_KANTO_DARKNESS_STAGE_3 = 704
SWITCH_KANTO_DARKNESS_STAGE_4 = 705
SWITCH_ORICORIO_QUEST_PINK = 672
SWITCH_ORICORIO_QUEST_RED = 673
SWITCH_ORICORIO_QUEST_BLUE = 674
SWITCH_ORICORIO_QUEST_IN_PROGRESS = 680
SWITCH_PICKED_HELIC_FOSSIL= 65
SWITCH_PICKED_DOME_FOSSIL= 66
SWITCH_PICKED_LILEEP_FOSSIL= 589
SWITCH_PICKED_ANORITH_FOSSIL= 90
SWITCH_PICKED_ARMOR_FOSSIL= 616
SWITCH_PICKED_SKULL_FOSSIL= 617
SWITCH_NIGHTMARE_EFFECT= 805
SWITCH_SS_ANNE_DEPARTED = 88
SWITCH_SNORLAX_GONE_ROUTE_12 = 110
SWITCH_TELEPORT_NPC = 122
SWITCH_GOT_DIVE = 317
SWITCH_GOT_ROCK_CLIMB = 661
SWITCH_GOT_WATERFALL = 388
SWITCH_JOHTO_STARTERS=884
SWITCH_HOENN_STARTERS=885
SWITCH_SINNOH_STARTERS=886
SWITCH_KALOS_STARTERS=888
SWITCH_MIXED_STARTERS=889
SWITCH_CUSTOM_STARTERS=883
SWITCH_JOINED_TEAM_ROCKET=1037
SWITCH_PINKAN_SIDE_ROCKET=1099
SWITCH_PINKAN_SIDE_POLICE=1100
SWITCH_LEAVING_PINKAN_ISLAND=1113
SWITCH_BLOCK_PINKAN_WHISTLE=1111
SWITCH_PINKAN_FINISHED=1119
SWITCH_TRIPLE_BOSS_BATTLE = 824
SWITCH_SILVERBOSS_BATTLE = 675
SWITCH_CAUGHT_DARKRAI = 724
SWITCH_CAUGHT_MELOETTA = 750
SWITCH_FINISHED_ROCKET_QUESTS_CERULEAN = 1116
SWITCH_FINISHED_ROCKET_QUESTS_CELADON = 1106
##Randomizer & System
SWITCH_RANDOM_WILD_TO_FUSION=953
SWITCH_RANDOMIZED_AT_LEAST_ONCE = 855
ENABLED_DEBUG_MODE_AT_LEAST_ONCE = 842
SWITCH_RANDOM_WILD = 778
SWITCH_RANDOM_WILD_AREA = 777
SWITCH_RANDOM_TRAINERS = 987
SWITCH_RANDOM_STARTERS = 954
SWITCH_RANDOM_STARTER_FIRST_STAGE = 771
SWITCH_RANDOM_ITEMS_GENERAL=759
SWITCH_RANDOM_ITEMS=751
SWITCH_RANDOM_FOUND_ITEMS=755
SWITCH_RANDOM_ITEMS_DYNAMIC = 958
SWITCH_RANDOM_ITEMS_MAPPED = 752
SWITCH_RANDOM_TMS = 758
SWITCH_RANDOM_GIVEN_ITEMS = 756
SWITCH_RANDOM_GIVEN_TMS = 757
SWITCH_RANDOM_SHOP_ITEMS = 754
SWITCH_RANDOM_FOUND_TMS = 959
SWITCH_WILD_RANDOM_GLOBAL=956
SWITCH_RANDOM_STATIC_ENCOUNTERS=955
SWITCH_RANDOM_WILD_ONLY_CUSTOMS=664
SWITCH_RANDOM_GYM_PERSIST_TEAMS=663
SWITCH_GYM_RANDOM_EACH_BATTLE = 668
SWITCH_RANDOM_GYM_CUSTOMS=662
SWITCH_RANDOMIZE_GYMS_SEPARATELY = 667
SWITCH_RANDOMIZED_GYM_TYPES=921
SWITCH_RANDOM_GIFT_POKEMON = 780
SWITCH_RANDOM_HELD_ITEMS = 843
SWITCH_DEFINED_RIVAL_STARTER=840
SWITCH_RANDOMIZED_WILD_POKEMON_TO_FUSIONS=829
SWITCH_RANDOM_WILD_LEGENDARIES=1031
SWITCH_RANDOM_TRAINER_LEGENDARIES=1032
SWITCH_RANDOM_GYM_LEGENDARIES=1033
SWITCH_DONT_RANDOMIZE=890
#Other switches
SWITCH_RACE_BIKE = 984
SWITCH_IS_REMATCH=200
SWITCH_SINGLE_POKEMON_MODE=790
SWITCH_SINGLE_POKEMON_MODE_HEAD=791
SWITCH_SINGLE_POKEMON_MODE_BODY=792
SWITCH_SINGLE_POKEMON_MODE_RANDOM=793
SWITCH_FISHING_AUTOHOOK = 916
SWITCH_FUSED_WILD_POKEMON=35
SWITCH_FORCE_FUSE_NEXT_POKEMON=37
SWITCH_FORCE_ALL_WILD_FUSIONS=828
SWITCH_USED_AN_INCENSE=798
SWITCH_FIRST_RIVAL_BATTLE=46
SWITCH_BATTLE_FACTORY_INCLUDE_ALL = 775
SWITCH_SUPER_SLOW_SPEED=649
SWITCH_LOUNGE_BATTLE_LEVEL = 240
SWITCH_CANNOT_CATCH_POKEMON = 75
SWITCH_UNLOCKED_POKEMON_HATS = 770
SWITCH_ILEX_FOREST_SPOOKED_POKEMON = 1021
SWITCH_FINISHED_ARCEUS_EVENT = 498
SWITCH_LOCK_PLAYER_MOVEMENT = 815
SWITCH_TEAMED_WITH_ERIKA_SEWERS=141
SWITCH_BAND_DRUMMER = 1004
SWITCH_BAND_ACOUSTIC_GUITAR = 1005
SWITCH_BAND_ELECTRIC_GUITAR = 1006
SWITCH_BAND_HARP = 1007
SWITCH_BAND_FLUTE = 1008
SWITCH_SELECTING_CLOTHES = 804
SWITCH_KANTO_HAIR_COLLECTION = 1059
SWITCH_JOHTO_HAIR_COLLECTION = 1060
SWITCH_HOENN_HAIR_COLLECTION = 1061
SWITCH_SINNOH_HAIR_COLLECTION = 1062
SWITCH_UNOVA_HAIR_COLLECTION = 1063
SWITCH_KALOS_HAIR_COLLECTION = 1064
SWITCH_ALOLA_HAIR_COLLECTION = 1065
SWITCH_GALAR_HAIR_COLLECTION = 1066
SWITCH_PALDEA_HAIR_COLLECTION = 1067
SWITCH_GEN10_HAIR_COLLECTION = 1068
SWITCH_UPDATED_TO_SPRITESHEETS_SPRITES=1117
#OUTFITS
#
WEARING_ROCKET_OUTFIT = 1038
## Hoenn only
SWITCH_SPORES_REPEL =2050

View File

@@ -0,0 +1,12 @@
##############
# COMMON EVENTS
################
COMMON_EVENT_REGI_TABLET = 84
COMMON_EVENT_SILHOUETTE = 87
COMMON_EVENT_HOTEL = 12
COMMON_EVENT_SINGLESPECIES_MODE = 73
COMMON_EVENT_OUTFIT = 80
COMMON_EVENT_FIX_GAME = 16
COMMON_EVENT_IDLE_HAT = 100
COMMON_EVENT_PINKAN_WHISTLE = 106
COMMON_EVENT_PINKAN_BACK_TO_BEGIN = 103

View File

@@ -136,7 +136,7 @@ def search_event_scripts(target_string)
if command.parameters[0].include?(target_string)
results << {
map_id: map_id,
event_id: event_id,
main_event_id: event_id,
page_index: page_index + 1,
command_index: cmd_index + 1
}
@@ -152,7 +152,7 @@ def search_event_scripts(target_string)
else
echoln "Found occurrences of '#{target_string}':"
results.each do |res|
echoln "Map #{res[:map_id]}, Event #{res[:event_id]}, Page #{res[:page_index]}, Command #{res[:command_index]}"
echoln "Map #{res[:map_id]}, Event #{res[:main_event_id]}, Page #{res[:page_index]}, Command #{res[:command_index]}"
end
end
end

View File

@@ -46,7 +46,7 @@
# s = Sprite.new(vp)
# s.bitmap = Bitmap.new(Graphics.width, Graphics.height)
# s.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0,0,0))
# mapid = pbListScreen(_INTL("Export Map"),MapLister.new(pbDefaultMap))
# mapid = pbListScreen("Export Map",MapLister.new(pbDefaultMap))
# if mapid > 0
# player = $game_map.map_id == mapid
# if player
@@ -63,13 +63,13 @@
# options << :events if cmds[1].split("")[1] == "X"
# options << :player if player && cmds[2].split("")[1] == "X"
# msgwindow = Window_AdvancedTextPokemon.newWithSize(
# _INTL("Saving... Please be patient."),
# "Saving... Please be patient.",
# 0, Graphics.height - 96, Graphics.width, 96, vp
# )
# msgwindow.setSkin(MessageConfig.pbGetSpeechFrame)
# Graphics.update
# pbExportMap(mapid, options)
# msgwindow.setText(_INTL("Successfully exported the map."))
# msgwindow.setText("Successfully exported the map.")
# 60.times { Graphics.update; Input.update }
# pbDisposeMessageWindow(msgwindow)
# break
@@ -97,8 +97,8 @@
#
# DebugMenuCommands.register("exportmap", {
# "parent" => "fieldmenu",
# "name" => _INTL("Export a Map"),
# "description" => _INTL("Choose a map to export it to a PNG."),
# "name" => "Export a Map",
# "description" => "Choose a map to export it to a PNG.",
# "effect" => proc { |sprites, viewport|
# pbExportAMap
# }

View File

@@ -1,8 +1,8 @@
#
# DebugMenuCommands.register("exportmap", {
# "parent" => "fieldmenu",
# "name" => _INTL("Export Map Image"),
# "description" => _INTL("Select a map and save its image as a png."),
# "name" => "Export Map Image",
# "description" => "Select a map and save its image as a png.",
# "effect" => proc {
# pbExportMapSelection
# }
@@ -10,7 +10,7 @@
#
# def pbExportMapSelection
# loop do
# map_id = pbListScreen(_INTL("Export Map"), MapLister.new(pbDefaultMap))
# map_id = pbListScreen("Export Map", MapLister.new(pbDefaultMap))
# break if map_id <= 0
# commands = ["Events", "Player", "Dependent Events", "Fog", "Panorama", "Map Name", "Game Name"]
# if $game_map.map_id != map_id
@@ -21,7 +21,7 @@
# if !options.include?(:Cancel)
# ret = MapExporter.export(map_id, options)
# mapname = pbGetMapNameFromId(map_id)
# pbMessage(_INTL("Sucessfully exported map image of Map {1} ({2}) to the Exported Maps folder in the games's root.", map_id, mapname))
# pbMessage("Sucessfully exported map image of Map {1} ({2}) to the Exported Maps folder in the games's root.", map_id, mapname)
# return
# end
# end
@@ -41,7 +41,7 @@
# commands.each_with_index do |s, i|
# cmd_sym = s.gsub(/\s+/, "").to_sym
# x = sym_commands.include?(cmd_sym) ? "[x]" : "[ ]"
# sel_commands.push(_INTL("{1} {2}",x, s))
# sel_commands.push("{1} {2}",x, s)
# end
# sel_commands.push("Export Map...")
# cmdwindow.commands = sel_commands

View File

@@ -209,6 +209,7 @@ end
def displayTeamFlag(frame)
selected_flags = pbGet(VAR_GALLERY_TEAM_FLAGS)
echoln pbGet(VAR_GALLERY_TEAM_FLAGS)
flag_image_id = 10
frame_image_id = 9
flag = selected_flags[frame]
@@ -257,7 +258,7 @@ def display_specific_pokemon_statistics()
species_sprites = list_all_sprite_credits_for_pokemon(species)
unique_sprites = filter_unique_sprites_nb_for_pokemon(species_sprites)
percent = (unique_sprites.length.to_f / (NB_POKEMON * 2)) * 100
pbMessage "#{species.real_name} completion: \\C[1]#{sprintf('%.2f', percent)}%\\C[0]"
pbMessage(_INTL("{1} completion: \\C[1]{2}%\\C[0]",species.real_name,sprintf('%.2f', percent)))
contributors_string = ""
top_contributors = get_top_contributors_for_pokemon(species_sprites, 5)
@@ -266,7 +267,7 @@ def display_specific_pokemon_statistics()
contributors_string += " (#{top_contributors[spriter]} sprites)"
contributors_string += "<br>" unless index == top_contributors.length - 1
end
pbMessage("#{species.real_name} top contributors:<br>#{contributors_string}")
pbMessage(_INTL("{1} top contributors:<br>{2}",species.real_name,contributors_string))
end
def display_team_flag_statistics(species)
@@ -274,9 +275,9 @@ def display_team_flag_statistics(species)
flag_pokemon_name = species.name
echoln evolution_line
if evolution_line.length > 1
pbMessage("This flag stands as a tribute to the artists who have devoted their talents to portraying \\C[1]#{flag_pokemon_name}\\C[0] and its evolution line in all its forms.")
pbMessage(_INTL("This flag stands as a tribute to the artists who have devoted their talents to portraying \\C[1]{1}\\C[0] and its evolution line in all its forms.",flag_pokemon_name))
else
pbMessage("This flag stands as a tribute to the artists who have devoted their talents to portraying \\C[1]#{flag_pokemon_name}\\C[0] in all its forms.")
pbMessage(_INTL("This flag stands as a tribute to the artists who have devoted their talents to portraying \\C[1]{1}\\C[0] in all its forms.",flag_pokemon_name))
end
all_sprites = []
family_unique_sprites_nb = []
@@ -288,14 +289,14 @@ def display_team_flag_statistics(species)
unique_sprites_nb = unique_sprites.length.to_f
family_unique_sprites_nb << unique_sprites_nb
percent = (unique_sprites.length.to_f / (NB_POKEMON * 2)) * 100
pbMessage "#{species.real_name} completion: \\C[1]#{sprintf('%.2f', percent)}%\\C[0]" if evolution_line.length > 1
pbMessage(_INTL("{1} completion: \\C[1]{2}%\\C[0]",species.real_name,sprintf('%.2f', percent))) if evolution_line.length > 1
end
overall_total = 0
family_unique_sprites_nb.each { |nb|
overall_total += nb
}
overall_percent = (overall_total / ((NB_POKEMON * 2)*family_unique_sprites_nb.length))*100
pbMessage "Team #{flag_pokemon_name} overall completion: \\C[3]#{sprintf('%.2f', overall_percent)}%\\C[0]"
pbMessage(_INTL("Team {1} overall completion: \\C[3]{2}%\\C[0]",flag_pokemon_name,sprintf('%.2f', overall_percent)))
family_line_sprites = {}
for pokemon_sprites in all_sprites
@@ -306,10 +307,10 @@ def display_team_flag_statistics(species)
top_contributors = get_top_contributors_for_pokemon(family_line_sprites, 5)
top_contributors.keys.each_with_index do |spriter, index|
contributors_string += "\\C[1]#{spriter}\\C[0]"
contributors_string += " (#{top_contributors[spriter]} sprites)"
contributors_string += _INTL(" ({1} sprites)",top_contributors[spriter])
contributors_string += "<br>" unless index == top_contributors.length - 1
end
pbMessage("Team #{flag_pokemon_name} top contributors:<br>#{contributors_string}")
pbMessage(_INTL("Team {1} top contributors:<br>{2}",flag_pokemon_name,contributors_string))
end
@@ -320,10 +321,10 @@ end
def display_special_banner()
flag_id = "500000"
flag_name = "Team 500,000"
flag_name = _INTL("Team 500,000")
price = 10000
banner_title = "Half-million Milestone Banner"
banner_title = _INTL("Half-million Milestone Banner")
flag_path = "Trainer Card/backgrounds/#{flag_id}"
flag_image_id = 10
@@ -335,10 +336,10 @@ def display_special_banner()
$game_screen.pictures[frame_image_id].show("teamFlagFrame", 0, x_position, y_position, 50, 50)
pbMessage("\"#{banner_title}\"")
pbMessage("A banner honoring the 500,000 members of the community who have come together to inspire countless others.")
pbMessage(_INTL("A banner honoring the 500,000 members of the community who have come together to inspire countless others."))
pbWait(10)
percent = get_total_completion_percent()
pbMessage("All Pokémon completion: \\C[1]#{sprintf('%.2f', percent)}%")
pbMessage(_INTL("All Pokémon completion: \\C[1]{1}%",sprintf('%.2f', percent)))
prompt_flag_purchase(flag_id, flag_name, price)
$game_screen.pictures[flag_image_id].erase
@@ -349,16 +350,16 @@ def prompt_flag_purchase(flag_id, flag_name, price)
$Trainer.unlocked_card_backgrounds = [] if ! $Trainer.unlocked_card_backgrounds
if !$Trainer.unlocked_card_backgrounds.include?(flag_id) && $Trainer.money >= price
pbWait(20)
if pbConfirmMessage("\\GWould you to purchase the \\C[1]#{flag_name}\\C[0] flag as a background for your \\C[1]Trainer Card\\C[0] for $#{price}?")
if pbConfirmMessage(_INTL("\\GWould you to purchase the \\C[1]{1}\\C[0] flag as a background for your \\C[1]Trainer Card\\C[0] for ${2}?",flag_name,price))
pbSEPlay("Mart buy item")
$Trainer.money -= price
unlock_card_background(flag_id)
pbMessage("\\GYou purchased the \\C[1]#{flag_name}\\C[0] Trainer Card background!")
if pbConfirmMessage("Swap your current Trainer Card for the newly purchased one?")
pbMessage(_INTL("\\GYou purchased the \\C[1]{1}\\C[0] Trainer Card background!",flag_name))
if pbConfirmMessage(_INTL("Swap your current Trainer Card for the newly purchased one?"))
pbSEPlay("GUI trainer card open")
$Trainer.card_background = flag_id
else
pbMessage("You can swap the background at anytime when viewing your Trainer Card.")
pbMessage(_INTL("You can swap the background at anytime when viewing your Trainer Card."))
end
end
end
@@ -401,7 +402,7 @@ def displayGalleryFrame(frame)
pif_sprite = pbGet(VAR_GALLERY_FEATURED_SPRITES)[frame]
if !pif_sprite.is_a?(PIFSprite)
pbMessage("The frame is empty...")
pbMessage(_INTL("The frame is empty..."))
return
end
species = getPokemonSpeciesFromPifSprite(pif_sprite)

View File

@@ -6,7 +6,7 @@
# textPos = []
# textX = (@side==0) ? 10 : self.bitmap.width-8
# # Draw Pokémon's name
# textPos.push([_INTL("{1}'s",@battler.name),textX,-4,@side==1,
# textPos.push(["{1}'s",@battler.name,textX,-4,@side==1,
# TEXT_BASE_COLOR,TEXT_SHADOW_COLOR,true])
# # Draw Pokémon's ability
# textPos.push([@battler.abilityName,textX,26,@side==1,
@@ -106,7 +106,7 @@ class FusionSelectOptionsScene < PokemonOption_Scene
else
@nickname = @pokemon2.name
end
}, "Select the Pokémon's nickname")
}, _INTL("Select the Pokémon's nickname"))
end
if @abilityList != nil

View File

@@ -0,0 +1,222 @@
class DoublePreviewScreen
SELECT_ARROW_X_LEFT= 100
SELECT_ARROW_X_RIGHT= 350
SELECT_ARROW_X_CANCEL= 230
SELECT_ARROW_Y_SELECT= 0
SELECT_ARROW_Y_CANCEL= 210
ARROW_GRAPHICS_PATH = "Graphics/Pictures/selHand"
CANCEL_BUTTON_PATH = "Graphics/Pictures/previewScreen_Cancel"
BACKGROUND_PATH = "Graphics/Pictures/shadeFull_"
CANCEL_BUTTON_X= 140
CANCEL_BUTTON_Y= 260
def initialize(species_left, species_right)
@species_left = species_left
@species_right = species_right
@typewindows = []
@picture1 = nil
@picture2 = nil
@draw_types = nil
@draw_level = nil
@draw_sprite_info = nil
@selected = 0
@last_post=0
@sprites = {}
initializeBackground
initializeSelectArrow
initializeCancelButton
end
def getBackgroundPicture
return BACKGROUND_PATH
end
def getSelection
selected = startSelection
@sprites["cancel"].visible=false
#@sprites["arrow"].visible=false
#todo: il y a un fuck en quelque part.... en attendant ca marche inversé ici
return @species_left if selected == 0
return @species_right if selected == 1
return -1
end
def startSelection
loop do
Graphics.update
Input.update
updateSelection
if Input.trigger?(Input::USE)
return @selected
end
if Input.trigger?(Input::BACK)
return -1
end
end
end
def updateSelection
currentSelected = @selected
updateSelectionIndex
if @selected != currentSelected
updateSelectionGraphics
end
end
def updateSelectionIndex
if Input.trigger?(Input::LEFT)
@selected = 0
elsif Input.trigger?(Input::RIGHT)
@selected = 1
end
if @selected == -1
if Input.trigger?(Input::UP)
@selected = @last_post
end
else
if Input.trigger?(Input::DOWN)
@last_post = @selected
@selected = -1
end
end
end
def updateSelectionGraphics
if @selected == 0
@sprites["arrow"].x = SELECT_ARROW_X_LEFT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
elsif @selected == 1
@sprites["arrow"].x = SELECT_ARROW_X_RIGHT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
else
@sprites["arrow"].x = SELECT_ARROW_X_CANCEL
@sprites["arrow"].y = SELECT_ARROW_Y_CANCEL
end
pbUpdateSpriteHash(@sprites)
end
def draw_window(dexNumber, level, x, y, isShiny=false, bodyShiny = false, headShiny=false)
body_pokemon = getBodyID(dexNumber)
head_pokemon = getHeadID(dexNumber, body_pokemon)
# picturePath = getPicturePath(head_pokemon, body_pokemon)
# bitmap = AnimatedBitmap.new(picturePath)
spriteLoader = BattleSpriteLoader.new
bitmap = GameData::Species.front_sprite_bitmap(dexNumber)
bitmap.shiftAllColors(dexNumber, bodyShiny, headShiny)
bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
pif_sprite = spriteLoader.obtain_fusion_pif_sprite(head_pokemon,body_pokemon)
#hasCustom = picturePath.include?("CustomBattlers")
#hasCustom = customSpriteExistsBase(body_pokemon,head_pokemon)
hasCustom = customSpriteExists(body_pokemon,head_pokemon)
previewwindow = PictureWindow.new(bitmap)
previewwindow.x = x
previewwindow.y = y
previewwindow.z = 100000
drawFusionInformation(dexNumber, level, x)
if !$Trainer.seen?(dexNumber)
if pif_sprite.local_path()
previewwindow.picture.pbSetColor(170, 200, 250, 200) #blue
elsif hasCustom
previewwindow.picture.pbSetColor(150, 255, 150, 200) #green
else
previewwindow.picture.pbSetColor(255, 255, 255, 200) #white
end
end
return previewwindow
end
def drawFusionInformation(fusedDexNum, level, x = 0)
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@typewindows << drawPokemonType(fusedDexNum, viewport, x + 55, 220) if @draw_types
drawFusionPreviewText(viewport, "Lv. " + level.to_s, x + 80, 40,) if @draw_level
drawSpriteInfoIcons(getPokemon(fusedDexNum),viewport) if @draw_sprite_info
end
def initializeSelectArrow
@sprites["arrow"] = IconSprite.new(0, 0, @viewport)
@sprites["arrow"].setBitmap(ARROW_GRAPHICS_PATH)
@sprites["arrow"].x = SELECT_ARROW_X_LEFT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
@sprites["arrow"].z = 100001
end
def initializeCancelButton()
@sprites["cancel"] = IconSprite.new(0, 0, @viewport)
@sprites["cancel"].setBitmap(CANCEL_BUTTON_PATH)
@sprites["cancel"].x = CANCEL_BUTTON_X
@sprites["cancel"].y = CANCEL_BUTTON_Y
@sprites["cancel"].z = 100000
end
def initializeBackground()
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["background"].setBitmap(getBackgroundPicture)
@sprites["background"].x = 0
@sprites["background"].y = 0
@sprites["background"].z = 99999
end
def drawFusionPreviewText(viewport, text, x, y)
label_base_color = Color.new(248, 248, 248)
label_shadow_color = Color.new(104, 104, 104)
overlay = BitmapSprite.new(Graphics.width, Graphics.height, viewport).bitmap
textpos = [[text, x, y, 0, label_base_color, label_shadow_color]]
pbDrawTextPositions(overlay, textpos)
end
#todo
# Adds the icons indicating if the fusion has alt sprites and if the final evo has a custom sprite
# also add a second icon to indidcate if the final evolution has a custom
def drawSpriteInfoIcons(fusedPokemon, viewport)
#pokedexUtils = PokedexUtils.new
#hasAltSprites = pokedexUtils.pbGetAvailableAlts(fusedPokemon).size>1
#pokedexUtils.getFinalEvolution(fusedPokemon).real_name
#todo
end
def dispose
@picture1.dispose
@picture2.dispose
for typeWindow in @typewindows
typeWindow.dispose
end
pbDisposeSpriteHash(@sprites)
end
def drawPokemonType(pokemon_id, viewport, x_pos = 192, y_pos = 264)
width = 66
viewport.z = 1000001
overlay = BitmapSprite.new(Graphics.width, Graphics.height, viewport).bitmap
pokemon = GameData::Species.get(pokemon_id)
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
type1_number = GameData::Type.get(pokemon.type1).id_number
type2_number = GameData::Type.get(pokemon.type2).id_number
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if pokemon.type1 == pokemon.type2
overlay.blt(x_pos + (width / 2), y_pos, typebitmap.bitmap, type1rect)
else
overlay.blt(x_pos, y_pos, typebitmap.bitmap, type1rect)
overlay.blt(x_pos + width, y_pos, typebitmap.bitmap, type2rect)
end
return viewport
end
end

View File

@@ -0,0 +1,432 @@
module GameData
class FusedSpecies < GameData::Species
attr_reader :growth_rate
attr_reader :body_pokemon
attr_reader :head_pokemon
def initialize(id)
if id.is_a?(Integer)
body_id = getBodyID(id)
head_id = getHeadID(id, body_id)
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
return GameData::FusedSpecies.new(pokemon_id)
end
id = normalize_id(id)
body_id = get_body_number_from_symbol(id)
head_id = get_head_number_from_symbol(id)
@body_pokemon = GameData::Species.get(body_id)
@head_pokemon = GameData::Species.get(head_id)
@id = id
@id_number = calculate_dex_number()
@species = @id
@form = 0
@real_name = calculate_name()
@real_form_name = nil
@type1 = calculate_type1()
@type2 = calculate_type2()
#Stats
@base_stats = calculate_base_stats()
@evs = calculate_evs()
adjust_stats_with_evs()
@base_exp = calculate_base_exp()
@growth_rate = calculate_growth_rate()
@gender_ratio = calculate_gender() #todo
@catch_rate = calculate_catch_rate()
@happiness = calculate_base_happiness()
#Moves
@moves = calculate_moveset()
@tutor_moves = calculate_tutor_moves() # hash[:tutor_moves] || []
@egg_moves = calculate_egg_moves() # hash[:egg_moves] || []
#Abilities
@abilities = calculate_abilities() # hash[:abilities] || []
@hidden_abilities = calculate_hidden_abilities() # hash[:hidden_abilities] || []
#wild held items
@wild_item_common = get_wild_item(@head_pokemon.wild_item_common, @body_pokemon.wild_item_common) # hash[:wild_item_common]
@wild_item_uncommon = get_wild_item(@head_pokemon.wild_item_uncommon, @body_pokemon.wild_item_uncommon) # hash[:wild_item_uncommon]
@wild_item_rare = get_wild_item(@head_pokemon.wild_item_rare, @body_pokemon.wild_item_rare) # hash[:wild_item_rare]
@evolutions = calculate_evolutions() # hash[:evolutions] || []
#breeding
@egg_groups = [:Undiscovered] #calculate_egg_groups() # hash[:egg_groups] || [:Undiscovered]
@hatch_steps = calculate_hatch_steps() # hash[:hatch_steps] || 1
@incense = nil #hash[:incense]
#pokedex
@pokedex_form = @form #ignored
@real_category = calculate_category()
@real_pokedex_entry = calculate_dex_entry()
@height = average_values(@head_pokemon.height, @body_pokemon.height)
@weight = average_values(@head_pokemon.weight, @body_pokemon.weight)
@color = @head_pokemon.color
@shape = @body_pokemon.shape
#sprite positioning
@back_sprite_x = @body_pokemon.back_sprite_x
@back_sprite_y = @body_pokemon.back_sprite_y
@front_sprite_x = @body_pokemon.front_sprite_x
@front_sprite_y = @body_pokemon.front_sprite_y
@front_sprite_altitude = @body_pokemon.front_sprite_altitude
@shadow_x = @body_pokemon.shadow_x
@shadow_size = @body_pokemon.shadow_size
# #unused attributes from Species class
#
# @shape = :Head
# @habitat = :None
# @generation = 0
# @mega_stone = nil
# @mega_move = nil
# @unmega_form = 0
# @mega_message = 0
end
#Input formats:
# :1_x_2
# :BULBASAUR_x_IVYSAUR
# :B2H1
#
# Output: :B2H1
def normalize_id(id)
if id.to_s.include?("/")
full_id_split = id.to_s.split("/")
# Detect if both sides are numeric
if full_id_split[0] =~ /^\d+$/ && full_id_split[1] =~ /^\d+$/
head_dex = full_id_split[0].to_i
body_dex = full_id_split[1].to_i
else
head_species = full_id_split[0].to_sym
body_species = full_id_split[1].to_sym
head_dex = getDexNumberForSpecies(head_species)
body_dex = getDexNumberForSpecies(body_species)
end
return "B#{body_dex}H#{head_dex}".to_sym
else #Passed internal ID directly, just return it
return id
end
end
def get_body_number_from_symbol(id)
return id.to_s.match(/\d+/)[0].to_i
end
def get_head_number_from_symbol(id)
return id.to_s.match(/(?<=H)\d+/)[0].to_i
end
def get_body_species
return @body_pokemon.id_number
end
def get_head_species
return @head_pokemon.id_number
end
def get_body_species_symbol
return @body_pokemon.id
end
def get_head_species_symbol
return @head_pokemon.id
end
def adjust_stats_with_evs
GameData::Stat.each_main do |s|
@base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0
@evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0
end
end
#FUSION CALCULATIONS
def calculate_dex_number()
return (@body_pokemon.id_number * NB_POKEMON) + @head_pokemon.id_number
end
def calculate_type1()
return @head_pokemon.type2 if @head_pokemon.type1 == :NORMAL && @head_pokemon.type2 == :FLYING
return @head_pokemon.type1
end
def calculate_type2()
return @body_pokemon.type1 if @body_pokemon.type2 == @type1
return @body_pokemon.type2
end
def calculate_base_stats()
head_stats = @head_pokemon.base_stats
body_stats = @body_pokemon.base_stats
fused_stats = {}
#Head dominant stats
fused_stats[:HP] = calculate_fused_stats(head_stats[:HP], body_stats[:HP])
fused_stats[:SPECIAL_DEFENSE] = calculate_fused_stats(head_stats[:SPECIAL_DEFENSE], body_stats[:SPECIAL_DEFENSE])
fused_stats[:SPECIAL_ATTACK] = calculate_fused_stats(head_stats[:SPECIAL_ATTACK], body_stats[:SPECIAL_ATTACK])
#Body dominant stats
fused_stats[:ATTACK] = calculate_fused_stats(body_stats[:ATTACK], head_stats[:ATTACK])
fused_stats[:DEFENSE] = calculate_fused_stats(body_stats[:DEFENSE], head_stats[:DEFENSE])
fused_stats[:SPEED] = calculate_fused_stats(body_stats[:SPEED], head_stats[:SPEED])
return fused_stats
end
def calculate_base_exp()
head_exp = @head_pokemon.base_exp
body_exp = @body_pokemon.base_exp
return average_values(head_exp, body_exp)
end
def calculate_catch_rate
return get_lowest_value(@body_pokemon.catch_rate, @head_pokemon.catch_rate)
end
def calculate_base_happiness
return @head_pokemon.happiness
end
def calculate_moveset
return combine_arrays(@body_pokemon.moves, @head_pokemon.moves)
end
def calculate_egg_moves
return combine_arrays(@body_pokemon.egg_moves, @head_pokemon.egg_moves)
end
def calculate_tutor_moves
return combine_arrays(@body_pokemon.tutor_moves, @head_pokemon.tutor_moves)
end
def get_wild_item(body_item, head_item)
rand_num = rand(2)
if rand_num == 0
return body_item
else
return head_item
end
end
def calculate_abilities()
abilities_hash = []
ability1 = @body_pokemon.abilities[0]
ability2 = @head_pokemon.abilities[0]
abilities_hash << ability1
abilities_hash << ability2
return abilities_hash
end
# def calculate_abilities(pokemon1, pokemon2)
# abilities_hash = []
#
# ability1 = pokemon1.abilities[0]
# ability2 = pokemon2.abilities[1]
# if !ability2
# ability2 = pokemon2.abilities[0]
# end
# abilities_hash << ability1
# abilities_hash << ability2
# return abilities_hash
# end
def calculate_hidden_abilities()
abilities_hash = []
#First two spots are the other abilities of the two pokemon
ability1 = @body_pokemon.abilities[1]
ability2 = @head_pokemon.abilities[1]
ability1 = @body_pokemon.abilities[0] if !ability1
ability2 = @head_pokemon.abilities[0] if !ability2
abilities_hash << ability1
abilities_hash << ability2
#add the hidden ability for the two base pokemon
hiddenAbility1 = @body_pokemon.hidden_abilities[0]
hiddenAbility1 = ability1 if !hiddenAbility1
hiddenAbility2 = @head_pokemon.hidden_abilities[0]
hiddenAbility2 = ability2 if !hiddenAbility2
abilities_hash << hiddenAbility1
abilities_hash << hiddenAbility2
return abilities_hash
end
def calculate_name()
body_nat_dex = GameData::NAT_DEX_MAPPING[@body_pokemon.id_number] ? GameData::NAT_DEX_MAPPING[@body_pokemon.id_number] : @body_pokemon.id_number
head_nat_dex = GameData::NAT_DEX_MAPPING[@head_pokemon.id_number] ? GameData::NAT_DEX_MAPPING[@head_pokemon.id_number] : @head_pokemon.id_number
begin
prefix = GameData::SPLIT_NAMES[head_nat_dex][0]
suffix = GameData::SPLIT_NAMES[body_nat_dex][1]
if prefix[-1] == suffix[0]
prefix = prefix[0..-2]
end
suffix = suffix.capitalize if prefix.end_with?(" ")
return prefix + suffix
rescue
print("species with error: " + @species.to_s)
end
end
def calculate_evolutions()
body_evolutions = @body_pokemon.evolutions
head_evolutions = @head_pokemon.evolutions
fused_evolutions = []
#body
for evolution in body_evolutions
evolutionSpecies = evolution[0]
evolutionSpecies_dex = GameData::Species.get(evolutionSpecies).id_number
fused_species = _INTL("B{1}H{2}", evolutionSpecies_dex, @head_pokemon.id_number)
fused_evolutions << build_evolution_array(evolution, fused_species)
end
#head
for evolution in head_evolutions
evolutionSpecies = evolution[0]
evolutionSpecies_dex = GameData::Species.get(evolutionSpecies).id_number
fused_species = _INTL("B{1}H{2}", @body_pokemon.id_number, evolutionSpecies_dex)
fused_evolutions << build_evolution_array(evolution, fused_species)
end
return fused_evolutions
end
#Change the evolution species depending if head & body and keep the rest of the data the same
def build_evolution_array(evolution_data, new_species)
fused_evolution_array = []
fused_evolution_array << new_species.to_sym
#add the rest
for data in evolution_data
next if evolution_data.index(data) == 0
fused_evolution_array << data
end
return fused_evolution_array
end
def calculate_dex_entry
body_entry = @body_pokemon.real_pokedex_entry.gsub(@body_pokemon.real_name, @real_name)
head_entry = @head_pokemon.real_pokedex_entry.gsub(@head_pokemon.real_name, @real_name)
return split_and_combine_text(body_entry, head_entry, ".")
end
def get_random_dex_entry()
begin
file_path = Settings::POKEDEX_ENTRIES_PATH
json_data = File.read(file_path)
all_body_entries = HTTPLite::JSON.parse(json_data)
body_entry = all_body_entries[@body_pokemon.id_number.to_s].sample
body_entry = body_entry.gsub(/#{@body_pokemon.real_name}/i, @real_name)
body_entry = clean_json_string(body_entry).gsub(@body_pokemon.real_name, @real_name)
head_entry = all_body_entries[@head_pokemon.id_number.to_s].sample
head_entry = head_entry.gsub(/#{@head_pokemon.real_name}/i, @real_name)
head_entry = clean_json_string(head_entry).gsub(@head_pokemon.real_name, @real_name)
rescue
body_entry = @body_pokemon.real_pokedex_entry.gsub(@body_pokemon.real_name, @real_name)
head_entry = @head_pokemon.real_pokedex_entry.gsub(@head_pokemon.real_name, @real_name)
end
echoln body_entry
echoln head_entry
combined_entry = split_and_combine_text(body_entry, head_entry, ".")
combined_entry += "." unless combined_entry.end_with?(".")
return combined_entry
end
def calculate_egg_groups
body_egg_groups = @body_pokemon.egg_groups
head_egg_groups = @head_pokemon.egg_groups
return :Undiscovered if body_egg_groups.include?(:Undiscovered) || head_egg_groups.include?(:Undiscovered)
return combine_arrays(body_egg_groups, head_egg_groups)
end
def calculate_hatch_steps
return average_values(@head_pokemon.hatch_steps, @body_pokemon.hatch_steps)
end
def calculate_evs()
return average_map_values(@body_pokemon.evs, @head_pokemon.evs)
end
def calculate_category
return split_and_combine_text(@body_pokemon.category, @head_pokemon.category, " ")
end
def calculate_growth_rate
growth_rate_priority = [:Fast, :Medium, :Parabolic, :Fluctuating, :Erratic, :Slow] #todo rearrange order for balance?
body_growth_rate = @body_pokemon.growth_rate
head_growth_rate = @head_pokemon.growth_rate
base_growth_rates = [body_growth_rate, head_growth_rate]
for rate in growth_rate_priority
return rate if base_growth_rates.include?(rate)
end
return :Medium
end
#TODO
# ################## UNFINISHED ####################
def calculate_gender
return :Genderless
end
############################# UTIL METHODS ###############################
#Takes 2 strings, splits and combines them using the beginning of the first one and the end of the second one
# (for example for pokedex entries)
def split_and_combine_text(beginingText_full, endText_full, separator)
beginingText_split = beginingText_full.split(separator, 2)
endText_split = endText_full.split(separator, 2)
beginningText = beginingText_split[0]
endText = endText_split[1] && endText_split[1] != "" ? endText_split[1] : endText_split[0]
return beginningText + separator + " " + endText
end
def calculate_fused_stats(dominantStat, otherStat)
return ((2 * dominantStat) / 3) + (otherStat / 3).floor
end
def average_values(value1, value2)
return ((value1 + value2) / 2).floor
end
def average_map_values(map1, map2)
averaged_map = map1.merge(map2) do |key, value1, value2|
((value1 + value2) / 2.0).floor
end
return averaged_map
end
def get_highest_value(value1, value2)
return value1 > value2 ? value1 : value2
end
def get_lowest_value(value1, value2)
return value1 < value2 ? value1 : value2
end
def combine_arrays(array1, array2)
return array1 + array2
end
end
end

View File

@@ -0,0 +1,38 @@
# class PokemonFusionScene
# HEAD_SPRITE_STARTING_POS = Graphics.width / 2
#
#
# def pbStartScreen(pokemon_head,pokemon_body,pokemon_fused)
#
# @pokemon_head = pokemon_head
# @pokemon_body = pokemon_body
#
# @pokemon_fused = pokemon_fused
#
# @sprites = {}
# @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
# @viewport.z = 99999
#
# initialize_background()
# initialize_sprites()
# end
#
# def initialize_background()
# addBackgroundOrColoredPlane(@sprites, "background", "DNAbg",
# Color.new(248, 248, 248), @viewport)
# end
#
# def initialize_sprites()
# pokeHead_number = GameData::Species.get(@pokemon_head.species).id_number
# pokeBody_number = GameData::Species.get(@pokemon_body.species).id_number
#
# @sprites["poke_head"] = PokemonSprite.new(@viewport)
# @sprites["poke_head"].setPokemonBitmapFromId(pokeHead_number, false, @pokemon_head.shiny?)
#
# @sprites["poke_head"].ox = @sprites["rsprite1"].bitmap.width / 2
# @sprites["poke_head"].x = Graphics.width / 2
# @sprites["poke_head"].zoom_x = Settings::FRONTSPRITE_SCALE
#
# end
#
# end

View File

@@ -0,0 +1,115 @@
class FusionSelectOptionsScene < PokemonOption_Scene
attr_accessor :selectedAbility
attr_accessor :selectedNature
attr_accessor :hasNickname
attr_accessor :nickname
def initialize(abilityList,natureList, pokemon1, pokemon2)
@abilityList = abilityList
@natureList = natureList
@selectedAbility=nil
@selectedNature=nil
@selBaseColor = Color.new(48,96,216)
@selShadowColor = Color.new(32,32,32)
@show_frame=false
@hasNickname = false
@nickname = nil
@pokemon1=pokemon1
@pokemon2=pokemon2
end
def initUIElements
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
_INTL("Select your Pokémon's ability and nature"), 0, 0, Graphics.width, 64, @viewport)
@sprites["textbox"] = pbCreateMessageWindow
@sprites["textbox"].letterbyletter = false
pbSetSystemFont(@sprites["textbox"].contents)
@sprites["title"].opacity=0
end
def pbStartScene(inloadscreen = nil)
super
@sprites["option"].opacity=0
end
def getAbilityName(ability)
return GameData::Ability.get(ability.id).real_name
end
def getAbilityDescription(ability)
return GameData::Ability.get(ability.id).real_description
end
def getNatureName(nature)
return GameData::Nature.get(nature.id).real_name
end
def getNatureDescription(nature)
change= GameData::Nature.get(nature.id).stat_changes
return _INTL("Neutral nature") if change.empty?
positiveChange = change[0]
negativeChange = change[1]
return _INTL("+ {1}\n- {2}",GameData::Stat.get(positiveChange[0]).name,GameData::Stat.get(negativeChange[0]).name)
end
def shouldSelectNickname
if @pokemon1.nicknamed? && @pokemon2.nicknamed?
@hasNickname=true
return true
end
if @pokemon1.nicknamed? && !@pokemon2.nicknamed?
@hasNickname=true
@nickname = @pokemon1.name
return false
end
if !@pokemon1.nicknamed? && @pokemon2.nicknamed?
@hasNickname=true
@nickname = @pokemon2.name
return false
end
@hasNickname=false
return false
end
def pbGetOptions(inloadscreen = false)
options = []
if shouldSelectNickname
options << EnumOption.new(_INTL("Nickname"), [_INTL(@pokemon1.name), _INTL(@pokemon2.name)],
proc { 0 },
proc { |value|
if value ==0
@nickname = @pokemon1.name
else
@nickname = @pokemon2.name
end
}, _INTL("Select the Pokémon's nickname"))
end
options << EnumOption.new(_INTL("Ability"), [_INTL(getAbilityName(@abilityList[0])), _INTL(getAbilityName(@abilityList[1]))],
proc { 0 },
proc { |value|
@selectedAbility=@abilityList[value]
}, [getAbilityDescription(@abilityList[0]), getAbilityDescription(@abilityList[1])]
)
options << EnumOption.new(_INTL("Nature"), [_INTL(getNatureName(@natureList[0])), _INTL(getNatureName(@natureList[1]))],
proc { 0 },
proc { |value|
@selectedNature=@natureList[value]
}, [getNatureDescription(@natureList[0]), getNatureDescription(@natureList[1])]
)
return options
end
def isConfirmedOnKeyPress
return true
end
end

View File

@@ -0,0 +1,240 @@
class FusionMovesOptionsScene < PokemonOption_Scene
attr_accessor :move1
attr_accessor :move2
attr_accessor :move3
attr_accessor :move4
def initialize(poke1, poke2)
@poke1 = poke1
@poke2 = poke2
@move1 = @poke1.moves[0]
@move2 = @poke1.moves[1]
@move3 = @poke1.moves[2]
@move4 = @poke1.moves[3]
@index1=0
@index2=0
@index3=0
@index4=0
@selBaseColor = Color.new(48,96,216)
@selShadowColor = Color.new(32,32,32)
end
def initUIElements
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
_INTL(""), 0, 0, Graphics.width, 64, @viewport)
@sprites["textbox"] = pbCreateMessageWindow
@sprites["textbox"].letterbyletter = false
pbSetSystemFont(@sprites["textbox"].contents)
end
def pbStartScene(inloadscreen = false)
super
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 9999
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
@changedColor = true
for i in 0...@PokemonOptions.length
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
end
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
_INTL("Select moves"), 0, 0, Graphics.width, 64, @viewport)
@sprites["title"].setSkin("Graphics/Windowskins/invisible")
@sprites["option"].setSkin("Graphics/Windowskins/invisible")
@sprites["textbox"].setSkin("Graphics/Windowskins/invisible")
# @sprites["textbox"].text = "Select moves"
updateDescription(0)
pbFadeInAndShow(@sprites) { pbUpdate }
end
def draw_empty_move_info
# code here
end
def draw_move_info(pokemonMove)
move = GameData::Move.get(pokemonMove.id)
move_base_color = Color.new(50, 40, 230)
move_base_shadow = Color.new(14, 14, 114)
label_base_color = Color.new(248, 248, 248)
label_shadow_color = Color.new(104, 104, 104)
value_base_color = Color.new(248, 248, 248)
value_shadow_color = Color.new(104, 104, 104)
@sprites["title"].text = _INTL("{1}", move.real_name)
damage = move.base_damage == 0 ? "-" : move.base_damage.to_s
accuracy = move.accuracy == 0 ? "100" : move.accuracy.to_s
pp = move.total_pp.to_s
if !move
damage="-"
accuracy="-"
pp="-"
end
textpos = [
[_INTL("Type"), 20, 84, 0, label_base_color, label_shadow_color],
[_INTL("Category"), 20, 116, 0, label_base_color, label_shadow_color],
[_INTL("Power"), 20, 148, 0, label_base_color, label_shadow_color],
[_INTL("{1}", damage), 140, 148, 0, value_base_color, value_shadow_color],
[_INTL("Accuracy"), 20, 180, 0, label_base_color, label_shadow_color],
[_INTL("{1}%", accuracy), 140, 180, 0, value_base_color, value_shadow_color],
[_INTL("PP"), 20, 212, 0, label_base_color, label_shadow_color], #move.total_pp
[_INTL("{1}", pp), 140, 212, 0, value_base_color, value_shadow_color] #move.total_pp
]
imagepos = []
yPos = 90
type_number = GameData::Type.get(move.type).id_number
category = move.category
imagepos.push(["Graphics/Pictures/types", 120, 94, 0, type_number * 28, 64, 28]) #248
imagepos.push(["Graphics/Pictures/category", 120, 124, 0, category * 28, 64, 28])
if !move
imagepos=[]
end
@sprites["overlay"].bitmap.clear
pbDrawTextPositions(@sprites["overlay"].bitmap, textpos)
pbDrawImagePositions(@sprites["overlay"].bitmap, imagepos)
end
def draw_pokemon_type
type1_number = GameData::Type.get(@poke1.type1).id_number
type2_number = GameData::Type.get(@poke1.type2).id_number
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if @poke1.type1 == @poke1.type2
overlay.blt(130, 78, @typebitmap.bitmap, type1rect)
else
overlay.blt(96, 78, @typebitmap.bitmap, type1rect)
overlay.blt(166, 78, @typebitmap.bitmap, type2rect)
end
end
def updateDescription(index)
index = 0 if !index
begin
move = getMoveForIndex(index)
draw_move_info(move)
new_description = getMoveDescription(move)
@sprites["textbox"].text = _INTL(new_description)
rescue
@sprites["textbox"].text = getDefaultDescription
end
end
def getDefaultDescription
return _INTL("No move selected")
end
def getMoveForIndex(index)
case index
when 0
return @move1
when 1
return @move2
when 2
return @move3
when 3
return @move4
end
return nil
end
def pbFadeInAndShow(sprites, visiblesprites = nil)
return if !@changedColor
super
end
def getMoveName(move)
return " - " if !@sprites["option"] && !move
move = @poke1.moves[@sprites["option"].index] if !move
return GameData::Move.get(move.id).real_name
end
def getMoveDescription(move)
return " - " if !@sprites["option"] && !move
move = @poke1.moves[@sprites["option"].index] if !move
return GameData::Move.get(move.id).real_description
end
def pbGetOptions(inloadscreen = false)
options = [
EnumOption.new(_INTL(""), [_INTL(getMoveName(@poke1.moves[0])), _INTL(getMoveName(@poke2.moves[0]))],
proc { 0 },
proc { |value|
@move1 = value == 0 ? @poke1.moves[0] : @poke2.moves[0]
}, [getMoveDescription(@poke1.moves[0]), getMoveDescription(@poke2.moves[0])]
),
EnumOption.new(_INTL(""), [_INTL(getMoveName(@poke1.moves[1])), _INTL(getMoveName(@poke2.moves[1]))],
proc { 0 },
proc { |value|
@move2 = value == 0 ? @poke1.moves[1] : @poke2.moves[1]
}, [getMoveDescription(@poke1.moves[1]), getMoveDescription(@poke2.moves[1])]
),
EnumOption.new(_INTL(""), [_INTL(getMoveName(@poke1.moves[2])), _INTL(getMoveName(@poke2.moves[2]))],
proc { 0 },
proc { |value|
@move3 = value == 0 ? @poke1.moves[2] : @poke2.moves[2]
}, [getMoveDescription(@poke1.moves[2]), getMoveDescription(@poke2.moves[2])]
),
EnumOption.new(_INTL(""), [_INTL(getMoveName(@poke1.moves[3])), _INTL(getMoveName(@poke2.moves[3]))],
proc { 0 },
proc { |value|
@move4 = value == 0 ? @poke1.moves[3] : @poke2.moves[3]
}, [getMoveDescription(@poke1.moves[3]), getMoveDescription(@poke2.moves[3])]
)
]
return options
end
def isConfirmedOnKeyPress
return true
end
def initOptionsWindow
optionsWindow = Window_PokemonOptionFusionMoves.new(@PokemonOptions, 0,
@sprites["title"].height, Graphics.width,
Graphics.height - @sprites["title"].height - @sprites["textbox"].height)
optionsWindow.viewport = @viewport
optionsWindow.visible = true
return optionsWindow
end
end
class Window_PokemonOptionFusionMoves < Window_PokemonOption
def initialize(options, x, y, width, height)
super
@mustUpdateOptions=true
@mustUpdateDescription=true
@confirmed=false
end
def drawCursor(index,rect)
if self.index==index
pbCopyBitmap(self.contents, @selarrow.bitmap,rect.x+175,rect.y)
end
return Rect.new(rect.x+16,rect.y,rect.width-16,rect.height)
end
def dont_draw_item(index)
return index == @options.length
end
end

View File

@@ -0,0 +1,50 @@
class FusionPreviewScreen < DoublePreviewScreen
attr_reader :poke1
attr_reader :poke2
attr_reader :fusedPokemon
attr_reader :fusedPokemon
attr_writer :draw_types
attr_writer :draw_level
BACKGROUND_PATH = "Graphics/Pictures/DNAbg"
def initialize(poke1,poke2, usingSuperSplicers=false)
super(poke1,poke2)
@draw_types = true
@draw_level = true
@draw_sprite_info=true
#@viewport = viewport
@poke1 = poke1
@poke2 = poke2
@fusedPokemon=nil
if poke1.isShiny?
shiny = true
poke1_shiny = true
end
if poke2.isShiny?
shiny = true
poke2_shiny = true
end
new_level = calculateFusedPokemonLevel(poke1.level, poke2.level, usingSuperSplicers)
fusion_left = (poke1.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number
fusion_right = (poke2.species_data.id_number) * NB_POKEMON + poke1.species_data.id_number
@picture1 = draw_window(fusion_left,new_level,20,30,shiny,poke1_shiny,poke2_shiny)
@picture2 = draw_window(fusion_right,new_level,270,30,shiny,poke2_shiny,poke1_shiny)
@sprites["picture1"] = @picture1
@sprites["picture2"] = @picture2
end
def getBackgroundPicture
super
end
end

View File

@@ -193,7 +193,7 @@ end
# def get_unfused_sprite_path(dex_number_id, localOnly = false)
# dex_number = dex_number_id.to_s
# folder = dex_number.to_s
# substitution_id = _INTL("{1}", dex_number)
# substitution_id = "{1}", dex_number
#
# if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(substitution_id)
# substitutionPath = $PokemonGlobal.alt_sprite_substitutions[substitution_id]
@@ -203,7 +203,7 @@ end
# random_alt = "" if !random_alt || localOnly
#
#
# filename = _INTL("{1}{2}.png", dex_number,random_alt)
# filename = "{1}{2}.png", dex_number,random_alt
#
# path = Settings::CUSTOM_BASE_SPRITES_FOLDER + filename
# if pbResolveBitmap(path)
@@ -273,7 +273,7 @@ end
# end
#
#
# pokemon_name = _INTL("{1}.{2}",head_id, body_id)
# pokemon_name = "{1}.{2}",head_id, body_id
#
# #get altSprite letter
# random_alt = get_random_alt_letter_for_custom(head_id, body_id) #nil if no main
@@ -285,7 +285,7 @@ end
# end
#
#
# filename = _INTL("{1}{2}.png", pokemon_name, random_alt)
# filename = "{1}{2}.png", pokemon_name, random_alt
# #Try local custom sprite
# local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" + filename
# if pbResolveBitmap(local_custom_path)

View File

@@ -3,9 +3,9 @@ def playerHasFusionItems()
end
def selectSplicer()
dna_splicers_const = "DNA Splicers"
super_splicers_const = "Super Splicers"
infinite_splicers_const = "Infinite Splicers"
dna_splicers_const = _INTL("DNA Splicers")
super_splicers_const = _INTL("Super Splicers")
infinite_splicers_const = _INTL("Infinite Splicers")
dnaSplicersQt = $PokemonBag.pbQuantity(:DNASPLICERS)
superSplicersQt = $PokemonBag.pbQuantity(:SUPERSPLICERS)
@@ -13,16 +13,16 @@ def selectSplicer()
infiniteSplicers2Qt = $PokemonBag.pbQuantity(:INFINITESPLICERS2)
options = []
options.push(_INTL "{1}", infinite_splicers_const) if infiniteSplicers2Qt > 0 || infiniteSplicersQt > 0
options.push(_INTL("{1} ({2})", super_splicers_const, superSplicersQt)) if superSplicersQt > 0
options.push(_INTL("{1} ({2})", dna_splicers_const, dnaSplicersQt)) if dnaSplicersQt > 0
options.push("#{infinite_splicers_const}") if infiniteSplicers2Qt > 0 || infiniteSplicersQt > 0
options.push("#{super_splicers_const} (#{superSplicersQt})") if superSplicersQt > 0
options.push("#{dna_splicers_const} (#{dnaSplicersQt})") if dnaSplicersQt > 0
if options.length <= 0
pbDisplay(_INTL("You have no fusion items available."))
return nil
end
cmd = pbShowCommands("Use which splicers?", options)
cmd = pbShowCommands(_INTL("Use which splicers?"), options)
if cmd == -1
return nil
end
@@ -61,7 +61,7 @@ def species_has_body_of(checked_species, checked_against)
end
bodySpecies = get_body_species_from_symbol(checked_species)
ret = bodySpecies == checked_against
#echoln _INTL("{1} HAS BODY OF {2} : {3} (body is {4})",checked_species,checked_against,ret,bodySpecies)
#echoln "{1} HAS BODY OF {2} : {3} (body is {4})",checked_species,checked_against,ret,bodySpecies
return ret
end
@@ -71,7 +71,7 @@ def species_has_head_of(checked_species, checked_against)
end
headSpecies = get_head_species_from_symbol(checked_species)
ret = headSpecies == checked_against
#echoln _INTL("{1} HAS HEAD OF {2} : {3}",checked_species,checked_against,ret)
#echoln "{1} HAS HEAD OF {2} : {3}",checked_species,checked_against,ret
return ret
end
@@ -142,7 +142,7 @@ end
def obtainPokemonSpritePath(bodyId, headId, include_customs = true)
#download_pokemon_sprite_if_missing(bodyId, headId)
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", headId, bodyId)
picturePath = "Graphics/Battlers/#{headId}/#{headId}.#{bodyId}.png"
if include_customs && customSpriteExistsBodyHead(bodyId, headId)
pathCustom = getCustomSpritePath(bodyId, headId)
@@ -154,7 +154,7 @@ def obtainPokemonSpritePath(bodyId, headId, include_customs = true)
end
def getCustomSpritePath(body, head)
return _INTL("#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}{1}/{1}.{2}.png", head, body)
return "#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}#{head}/#{head}.#{body}.png"
end
def customSpriteExistsForm(species, form_id_head = nil, form_id_body = nil)
@@ -170,7 +170,7 @@ def customSpriteExistsForm(species, form_id_head = nil, form_id_body = nil)
spritename += "." + body.to_s
spritename += "_" + form_id_body.to_s if form_id_body
pathCustom = _INTL("Graphics/.CustomBattlers/indexed/{1}/{2}.png", folder, spritename)
pathCustom = "Graphics/.CustomBattlers/indexed/#{folder}/#{spritename}.png"
return true if pbResolveBitmap(pathCustom) != nil
return download_custom_sprite(head, body) != nil
end
@@ -304,9 +304,29 @@ def get_head_number_from_symbol(id)
end
def get_fusion_symbol(head_id, body_id)
if head_id.is_a?(Symbol)
head_id = get_head_number_from_symbol(head_id)
end
if body_id.is_a?(Symbol)
body_id = get_body_number_from_symbol(body_id)
end
return "B#{body_id}H#{head_id}".to_sym
end
def get_readable_fusion_name(fusion_species)
head_dex = get_head_number_from_symbol(fusion_species)
body_dex = get_body_number_from_symbol(fusion_species)
return fusion_species if head_dex > NB_POKEMON || body_dex > NB_POKEMON
head_species = GameData::Species.get(head_dex)
body_species = GameData::Species.get(body_dex)
return "#{head_species.name}/#{body_species.name}"
end
def getFusionSpecies(body, head)
body_num = getDexNumberForSpecies(body)
head_num = getDexNumberForSpecies(head)
@@ -399,6 +419,14 @@ def getSpeciesRealName(species_symbol)
return species.real_name
end
def playerHasFusedPokemonInTeam()
$Trainer.party.each do |pokemon|
if pokemon.isFusion?
return true
end
end
return false
end
def get_triple_fusion_components(species_id)
dex_num = GameData::Species.get(species_id).id_number
@@ -476,3 +504,7 @@ def get_triple_fusion_components(species_id)
end
def gotFusedPokemonAsStarter()
return $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] || $game_switches[SWITCH_LEGENDARY_MODE]
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
class SpritesBitmapCache
@@cache = {} # Cache storage for individual sprites
@@usage_order = [] # Tracks usage order for LRU eviction
def getCache()
return @@cache
end
def get_bitmap(pif_sprite)
sprite_key = get_cache_key(pif_sprite)
if @@cache.key?(sprite_key)
mark_key_as_recently_used(sprite_key)
return @@cache[sprite_key].clone
end
return nil
end
def mark_key_as_recently_used(sprite_key)
@@usage_order.delete(sprite_key)
@@usage_order << sprite_key
end
#Keys format: [type]_B[body]H[head]_letter
# ex:
# AUTOGEN_B12H12_
# CUSTOM_B12H12_a
# BASE_BH12_a
# etc.
def get_cache_key(pif_sprite)
return "#{pif_sprite.type.to_s}_B#{pif_sprite.body_id}H#{pif_sprite.head_id}_#{pif_sprite.alt_letter}".to_sym
end
#Keys format: AUTOGEN_B12H12_a
def add(pif_sprite,bitmap)
sprite_key = get_cache_key(pif_sprite)
echoln "adding key #{sprite_key} to cache"
@@cache[sprite_key] = bitmap.clone
if @@cache.size >= Settings::SPRITE_CACHE_MAX_NB
# Evict least recently used (first in order)
oldest_key = @@usage_order.shift
@@cache.delete(oldest_key)
echoln "Evicted: #{oldest_key} from sprite cache"
end
@@usage_order << sprite_key
end
def clear
@@cache = {}
@@usage_order = []
end
end

View File

@@ -0,0 +1,98 @@
class PIFSpriteExtracter
COLUMNS = 20 # Number of columns in the spritesheet
@@spritesheet_cache = SpritesBitmapCache.new
#factor by which the sprite needs to be resized to get it to base game resolution (288x288)
def get_resize_scale
return 1
end
def load_sprite(pif_sprite,download_allowed=true)
begin
start_time = Time.now
bitmap = @@spritesheet_cache.get_bitmap(pif_sprite)
loaded_from_spritesheet=false
if !bitmap
download_new_spritesheet(pif_sprite) if should_update_spritesheet?(pif_sprite) && download_allowed
if pbResolveBitmap(getSpritesheetPath(pif_sprite))
bitmap = load_bitmap_from_spritesheet(pif_sprite)
loaded_from_spritesheet=true
@@spritesheet_cache.add(pif_sprite, bitmap)
else
return nil
end
end
sprite_bitmap = AnimatedBitmap.from_bitmap(bitmap)
sprite_bitmap.scale_bitmap(get_resize_scale())
end_time = Time.now
source = loaded_from_spritesheet ? :"spritesheet" : "cache"
echoln "Loaded sprite for <head:#{pif_sprite.head_id}, body: #{pif_sprite.body_id}, variant: #{pif_sprite.alt_letter}> from #{source} in #{end_time - start_time} seconds"
return sprite_bitmap
rescue Exception
e = $!
echoln "Error loading sprite: #{e}" if bitmap
end
end
def download_new_spritesheet(pif_sprite)
spritesheet_file = getSpritesheetPath(pif_sprite)
if download_spritesheet(pif_sprite,spritesheet_file)
$updated_spritesheets << spritesheet_file
update_downloaded_spritesheets_list()
return true
end
return false
end
def update_downloaded_spritesheets_list()
File.open(Settings::UPDATED_SPRITESHEETS_CACHE, "w") do |file|
$updated_spritesheets.each { |line| file.puts(line) }
end
end
def get_sprite_position_on_spritesheet(body_id,sprite_size,nb_column)
row = body_id / nb_column
col = body_id % nb_column
# echoln "(#{col},#{row})"
# Define the area of the sprite on the spritesheet
sprite_x_position = col * sprite_size
sprite_y_position = row * sprite_size
return sprite_x_position, sprite_y_position
end
def extract_bitmap_to_file(pif_sprite, dest_folder)
# Create the directory if it doesn't exist
Dir.mkdir(dest_folder) unless Dir.exist?(dest_folder)
single_sprite_bitmap=load_sprite(pif_sprite)
# Save the single sprite bitmap to a file
file_path = "#{dest_folder}/#{head_id}.#{body_id}.png"
single_sprite_bitmap.save_to_png(file_path)
# Dispose of the single sprite bitmap
single_sprite_bitmap.dispose
# Return the path to the saved PNG file
return file_path
end
#Implemented for base and custom, not autogen
def should_update_spritesheet?(spritesheet_file)
return false
end
def getSpritesheetPath(pif_sprite)
return nil #implement in subclasses
end
def clear_cache()
@@spritesheet_cache.clear
end
end
class PokemonGlobalMetadata
attr_accessor :current_spritepack_date
end

View File

@@ -0,0 +1,160 @@
class AutogenExtracter < PIFSpriteExtracter
SPRITESHEET_FOLDER_PATH = "Graphics\\Battlers\\spritesheets_autogen\\"
SPRITE_SIZE = 96 # Size of each sprite in the spritesheet
COLUMNS = 10 # Number of columns in the spritesheet
SHEET_WIDTH = SPRITE_SIZE * COLUMNS # 2880 pixels wide spritesheet
@instance = new
def self.instance
@@instance ||= new # If @@instance is nil, create a new instance
@@instance # Return the existing or new instance
end
def load_bitmap_from_spritesheet(pif_sprite)
body_id = pif_sprite.body_id
spritesheet_file = getSpritesheetPath(pif_sprite)
spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
# Extract individual sprite
sprite_x_position, sprite_y_position = get_sprite_position_on_spritesheet(body_id, SPRITE_SIZE, COLUMNS)
src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
bitmap.blt(0, 0, spritesheet_bitmap, src_rect)
# Dispose of spritesheet if it's no longer needed
spritesheet_bitmap.dispose
return bitmap
end
def getSpritesheetPath(pif_sprite)
head_id = pif_sprite.head_id
return "#{SPRITESHEET_FOLDER_PATH}#{head_id}.png"
end
def get_resize_scale
return 3
end
#
# # Check cache before loading from disk
# sprite_bitmap = @@spritesheet_cache.fetch(pif_sprite) do
# # Load spritesheet from disk if necessary
# echoln "Loading spritesheet from disk: #{spritesheet_file}"
# spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
#
# # Extract individual sprite
# sprite_x_position, sprite_y_position = get_sprite_position_on_spritesheet(body_id, SPRITE_SIZE, COLUMNS)
# src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
#
# sprite = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
# sprite.blt(0, 0, spritesheet_bitmap, src_rect)
#
# # Dispose of spritesheet if it's no longer needed
# spritesheet_bitmap.dispose
#
# sprite
# end
# animatedBitmap = AnimatedBitmap.from_bitmap(sprite_bitmap)
#
# end_time = Time.now
# echoln "finished load sprite in #{end_time - start_time} seconds"
# echoln animatedBitmap
# return animatedBitmap
# end
def load_sprite_with_spritesheet_cache(pif_sprite)
start_time = Time.now
head_id = pif_sprite.head_id
body_id = pif_sprite.body_id
spritesheet_file = "#{SPRITESHEET_FOLDER_PATH}#{head_id}.png"
# Check cache before loading from disk
spritesheet_bitmap = @@spritesheet_cache.fetch(spritesheet_file) do
echoln "Loading spritesheet from disk: #{spritesheet_file}"
AnimatedBitmap.new(spritesheet_file).bitmap
end
sprite_x_position, sprite_y_position = get_sprite_position_on_spritesheet(body_id, SPRITE_SIZE, COLUMNS)
src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap.blt(0, 0, spritesheet_bitmap, src_rect)
#spritesheet_bitmap.dispose # Dispose since not needed
animatedBitmap = AnimatedBitmap.from_bitmap(sprite_bitmap)
end_time = Time.now
echoln "finished load sprite in #{end_time - start_time} seconds"
return animatedBitmap
end
end
# def extract_bitmap_to_file(head_id, body_id, folder)
# # Create the directory if it doesn't exist
# Dir.mkdir(folder) unless Dir.exist?(folder)
#
# # Load the entire spritesheet
# spritesheet_file = "#{SPRITESHEET_FOLDER_PATH}#{head_id}.png"
# spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
#
# # Calculate the 0-based row and column from the sprite index
# zero_index = body_id - 1
# row = zero_index / COLUMNS
# col = zero_index % COLUMNS
#
# # Define the area of the sprite on the spritesheet
# sprite_x_position = col * SPRITE_SIZE
# sprite_y_position = row * SPRITE_SIZE
#
# # Create a new bitmap for the single sprite
# single_sprite_bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
# single_sprite_bitmap.blt(0, 0, spritesheet_bitmap, Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE))
#
# # Dispose of the spritesheet bitmap if its no longer needed
# spritesheet_bitmap.dispose
#
# # Save the single sprite bitmap to a file
# file_path = "#{folder}/#{head_id}.#{body_id}.png"
# single_sprite_bitmap.save_to_png(file_path)
#
# # Dispose of the single sprite bitmap
# single_sprite_bitmap.dispose
#
# # Return the path to the saved PNG file
# return file_path
# end
#end
#
#
# class SpritesBitmapCache
# @@cache = {} # Cache storage for individual sprites
# @@usage_order = [] # Tracks usage order for LRU eviction
#
# def self.fetch(pif_sprite)
# sprite_key = "B#{pif_sprite.body_id}H#{pif_sprite.head_id}".to_sym
# if @@cache.key?(sprite_key)
# # Move key to the end to mark it as recently used
# @@usage_order.delete(sprite_key)
# @@usage_order << sprite_key
# return @@cache[sprite_key]
# end
#
# # Load sprite via block if not found in cache
# sprite_bitmap = yield
#
# if @@cache.size >= Settings::SPRITE_CACHE_MAX_NB
# # Evict least recently used (first in order)
# oldest_key = @@usage_order.shift
# @@cache.delete(oldest_key)
# echoln "Evicted: #{oldest_key} from sprite cache"
# end
#
# # Add new sprite to cache and track its usage
# @@cache[sprite_key] = sprite_bitmap
# @@usage_order << sprite_key
# sprite_bitmap
# echoln @@cache
# end
# end

View File

@@ -0,0 +1,61 @@
class BaseSpriteExtracter < PIFSpriteExtracter
@instance = new
def self.instance
@@instance ||= new # If @@instance is nil, create a new instance
@@instance # Return the existing or new instance
end
SPRITESHEET_FOLDER_PATH = "Graphics/CustomBattlers/spritesheets/spritesheets_base/"
SPRITE_SIZE = 96 # Original sprite size
NB_COLUMNS_BASESPRITES = 10
SHEET_WIDTH = SPRITE_SIZE * NB_COLUMNS_BASESPRITES # 2880 pixels wide spritesheet
def load_bitmap_from_spritesheet(pif_sprite)
alt_letter = pif_sprite.alt_letter
spritesheet_file = getSpritesheetPath(pif_sprite)
spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
letter_index = letters_to_index(alt_letter)
sprite_x_position, sprite_y_position = get_sprite_position_on_spritesheet(letter_index, SPRITE_SIZE, NB_COLUMNS_BASESPRITES)
src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap.blt(0, 0, spritesheet_bitmap, src_rect)
spritesheet_bitmap.dispose # Dispose since not needed
return sprite_bitmap
end
def letters_to_index(letters)
letters = letters.downcase # Ensure input is case-insensitive
index = 0
letters.each_char do |char|
index = index * 26 + (char.ord - 'a'.ord + 1)
end
#echoln "index: #{index}"
return index
end
def load_sprite_directly(head_id, body_id, alt_letter = "")
load_sprite(PIFSprite.new(:CUSTOM, head_id, body_id, alt_letter))
end
def getSpritesheetPath(pif_sprite)
dex_number = getDexNumberForSpecies(pif_sprite.head_id)
return "#{SPRITESHEET_FOLDER_PATH}#{dex_number}.png"
end
def should_update_spritesheet?(pif_sprite)
return false if !$updated_spritesheets
return false if !downloadAllowed?()
return false if requestRateExceeded?(Settings::CUSTOMSPRITES_RATE_LOG_FILE,Settings::CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW,Settings::CUSTOMSPRITES_RATE_MAX_NB_REQUESTS,false)
spritesheet_file = getSpritesheetPath(pif_sprite)
return true if !pbResolveBitmap(spritesheet_file)
return !$updated_spritesheets.include?(spritesheet_file)
end
def get_resize_scale
return 3
end
end

View File

@@ -0,0 +1,279 @@
class BattleSpriteLoader
def initialize
@download_allowed = true
end
def load_pif_sprite_directly(pif_sprite)
if pif_sprite.local_path && pbResolveBitmap(pif_sprite.local_path)
return AnimatedBitmap.new(pif_sprite.local_path)
end
extractor = get_sprite_extractor_instance(pif_sprite.type)
return extractor.load_sprite(pif_sprite)
end
#random alt
def load_pif_sprite(pif_sprite)
case pif_sprite.type
when :CUSTOM, :AUTOGEN
load_fusion_sprite(pif_sprite.head_id, pif_sprite.body_id)
when :BASE
load_base_sprite(pif_sprite.head_id)
end
end
# Only preloads if the pokemon's sprite has been assigned an alt letter
def preload_sprite_from_pokemon(pokemon)
return if !pokemon
substitution_id = get_sprite_substitution_id_from_dex_number(pokemon.species)
# echoln substitution_id
# echoln $PokemonGlobal.alt_sprite_substitutions
pif_sprite = $PokemonGlobal.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
if !pif_sprite
pif_sprite = get_pif_sprite_from_species(pokemon.species)
end
preload(pif_sprite)
end
#loads a sprite into cache without actually returning it
# Does not download spritesheet
def preload(pif_sprite)
echoln "preloading"
previous_download_allowed = @download_allowed
@download_allowed = false
load_pif_sprite(pif_sprite)
@download_allowed = previous_download_allowed
end
def clear_sprites_cache(type)
extractor = get_sprite_extractor_instance(type)
extractor.clear_cache
end
def load_from_dex_number(dex_number)
if dex_number > NB_POKEMON
if dex_number > ZAPMOLCUNO_NB #Triple Fusion
return load_triple_fusion_sprite(dex_number)
else
#Regular fusion
body_id = getBodyID(dex_number)
head_id = getHeadID(dex_number, body_id)
return load_fusion_sprite(head_id, body_id)
end
else
#base pokemon
return load_base_sprite(dex_number)
end
end
def registerSpriteSubstitution(pif_sprite)
substitution_id = get_sprite_substitution_id_from_dex_number(pif_sprite.species)
$PokemonGlobal.alt_sprite_substitutions[substitution_id] = pif_sprite
end
def obtain_fusion_pif_sprite(head_id,body_id)
substitution_id = get_sprite_substitution_id_for_fusion(head_id, body_id)
pif_sprite = $PokemonGlobal.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
#pif_sprite.dump_info if pif_sprite
if !pif_sprite
pif_sprite = select_new_pif_fusion_sprite(head_id, body_id)
local_path = check_for_local_sprite(pif_sprite)
if local_path
pif_sprite.local_path = local_path
pif_sprite.type = :CUSTOM
end
substitution_id = get_sprite_substitution_id_for_fusion(head_id, body_id)
$PokemonGlobal.alt_sprite_substitutions[substitution_id] = pif_sprite if $PokemonGlobal
end
return pif_sprite
end
def load_fusion_sprite(head_id, body_id)
pif_sprite = obtain_fusion_pif_sprite(head_id,body_id)
if pif_sprite.local_path
return AnimatedBitmap.new(pif_sprite.local_path)
end
extractor = get_sprite_extractor_instance(pif_sprite.type)
loaded_sprite = extractor.load_sprite(pif_sprite, @download_allowed)
if !loaded_sprite
loaded_sprite = handle_unloaded_sprites(extractor,pif_sprite)
end
return loaded_sprite
end
def load_base_sprite(dex_number)
substitution_id = get_sprite_substitution_id_from_dex_number(dex_number)
pif_sprite = $PokemonGlobal.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
if !pif_sprite
pif_sprite = select_new_pif_base_sprite(dex_number)
$PokemonGlobal.alt_sprite_substitutions[substitution_id] = pif_sprite if $PokemonGlobal
end
if pif_sprite.local_path
return AnimatedBitmap.new(pif_sprite.local_path)
end
extractor = get_sprite_extractor_instance(pif_sprite.type)
loaded_sprite = extractor.load_sprite(pif_sprite)
if !loaded_sprite
loaded_sprite = handle_unloaded_sprites(extractor,pif_sprite)
end
return loaded_sprite
end
def handle_unloaded_sprites(extractor,pif_sprite)
if(extractor.is_a?(CustomSpriteExtracter)) #Custom failed to load, load an autogen (which should always be there)
new_extractor = get_sprite_extractor_instance(:AUTOGEN)
return new_extractor.load_sprite(pif_sprite)
else
$Trainer.seen_qmarks_sprite=true if $Trainer
#If autogen or base sprite aren't able to load a sprite then we have nothing else to load -> show a ? instead.
return AnimatedBitmap.new(Settings::DEFAULT_SPRITE_PATH)
end
end
#Always loaded from local individual sprites
def load_triple_fusion_sprite(dex_number)
sprite_path = getSpecialSpriteName(dex_number)
return AnimatedBitmap.new(sprite_path)
end
def get_sprite_extractor_instance(type)
case type
when :AUTOGEN
return AutogenExtracter.instance
when :CUSTOM
return CustomSpriteExtracter.instance
when :BASE
return BaseSpriteExtracter.instance
else
raise ArgumentError, "Unknown sprite type: #{type}"
end
end
def check_for_local_sprite(pif_sprite)
return pif_sprite.local_path if pif_sprite.local_path
if pif_sprite.type == :BASE
sprite_path = "#{Settings::CUSTOM_BASE_SPRITES_FOLDER}#{pif_sprite.head_id}#{pif_sprite.alt_letter}.png"
else
sprite_path = "#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}#{pif_sprite.head_id}/#{pif_sprite.head_id}.#{pif_sprite.body_id}#{pif_sprite.alt_letter}.png"
end
return pbResolveBitmap(sprite_path)
end
def get_pif_sprite_from_species(species)
substitution_id = get_sprite_substitution_id_from_dex_number(species)
pif_sprite = $PokemonGlobal.alt_sprite_substitutions[substitution_id] if $PokemonGlobal
return pif_sprite if pif_sprite
species_data = GameData::Species.get(species)
if species_data.id_number <= NB_POKEMON #base pokemon
return select_new_pif_base_sprite(species_data.id_number)
else #isFusion
return select_new_pif_fusion_sprite(species_data.get_head_species, species_data.get_body_species)
end
end
#
# Flow:
# # if none found in cache, look for custom sprite in custom spritesheet (download if can't find spritesheet or new spritepack released)
# if none found, load from autogen spritesheet
def select_new_pif_fusion_sprite(head_id, body_id)
species_symbol = "B#{body_id}H#{head_id}".to_sym
spritename = get_fusion_spritename(head_id,body_id)
customSpritesList = $game_temp.custom_sprites_list[species_symbol]
alt_letter = ""
if customSpritesList
alt_letter = get_random_alt_letter_for_custom(head_id,body_id,true)
type = :CUSTOM
type = :AUTOGEN if !alt_letter
else
type = :AUTOGEN
end
if $PokemonTemp.forced_alt_sprites && $PokemonTemp.forced_alt_sprites.include?(spritename)
alt_letter = $PokemonTemp.forced_alt_sprites[spritename]
end
return PIFSprite.new(type, head_id, body_id, alt_letter)
end
def select_new_pif_base_sprite(dex_number)
random_alt = get_random_alt_letter_for_unfused(dex_number, true) #nil if no main
random_alt = "" if !random_alt
return PIFSprite.new(:BASE, dex_number, nil, random_alt)
end
#todo refactor by using get_triple_fusion_components()
def getSpecialSpriteName(dexNum)
base_path = "Graphics/Battlers/special/"
case dexNum
when Settings::ZAPMOLCUNO_NB
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB + 1
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB + 2
return sprintf(base_path + "243.244.245")
when Settings::ZAPMOLCUNO_NB + 3
return sprintf(base_path +"340.341.342")
when Settings::ZAPMOLCUNO_NB + 4
return sprintf(base_path +"343.344.345")
when Settings::ZAPMOLCUNO_NB + 5
return sprintf(base_path +"349.350.351")
when Settings::ZAPMOLCUNO_NB + 6
return sprintf(base_path +"151.251.381")
when Settings::ZAPMOLCUNO_NB + 11
return sprintf(base_path +"150.348.380")
#starters
when Settings::ZAPMOLCUNO_NB + 7
return sprintf(base_path +"3.6.9")
when Settings::ZAPMOLCUNO_NB + 8
return sprintf(base_path +"154.157.160")
when Settings::ZAPMOLCUNO_NB + 9
return sprintf(base_path +"278.281.284")
when Settings::ZAPMOLCUNO_NB + 10
return sprintf(base_path +"318.321.324")
#starters prevos
when Settings::ZAPMOLCUNO_NB + 12
return sprintf(base_path +"1.4.7")
when Settings::ZAPMOLCUNO_NB + 13
return sprintf(base_path +"2.5.8")
when Settings::ZAPMOLCUNO_NB + 14
return sprintf(base_path +"152.155.158")
when Settings::ZAPMOLCUNO_NB + 15
return sprintf(base_path +"153.156.159")
when Settings::ZAPMOLCUNO_NB + 16
return sprintf(base_path +"276.279.282")
when Settings::ZAPMOLCUNO_NB + 17
return sprintf(base_path +"277.280.283")
when Settings::ZAPMOLCUNO_NB + 18
return sprintf(base_path +"316.319.322")
when Settings::ZAPMOLCUNO_NB + 19
return sprintf(base_path +"317.320.323")
when Settings::ZAPMOLCUNO_NB + 20 #birdBoss Left
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 21 #birdBoss middle
return sprintf(base_path + "144.145.146")
when Settings::ZAPMOLCUNO_NB + 22 #birdBoss right
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 23 #sinnohboss left
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 24 #sinnohboss middle
return sprintf(base_path +"343.344.345")
when Settings::ZAPMOLCUNO_NB + 25 #sinnohboss right
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 25 #cardboard
return sprintf(base_path +"invisible")
when Settings::ZAPMOLCUNO_NB + 26 #cardboard
return sprintf(base_path + "cardboard")
when Settings::ZAPMOLCUNO_NB + 27 #Triple regi
return sprintf(base_path + "447.448.449")
#Triple Kalos 1
when Settings::ZAPMOLCUNO_NB + 28
return sprintf(base_path + "479.482.485")
when Settings::ZAPMOLCUNO_NB + 29
return sprintf(base_path + "480.483.486")
when Settings::ZAPMOLCUNO_NB + 30
return sprintf(base_path + "481.484.487")
else
return sprintf(base_path + "000")
end
end
end

View File

@@ -0,0 +1,106 @@
class CustomSpriteExtracter < PIFSpriteExtracter
@instance = new
def self.instance
@@instance ||= new # If @@instance is nil, create a new instance
@@instance # Return the existing or new instance
end
SPRITESHEET_FOLDER_PATH = "Graphics/CustomBattlers/spritesheets/spritesheets_custom/"
SPRITE_SIZE = 96 # Original sprite size
SHEET_WIDTH = SPRITE_SIZE * COLUMNS # 2880 pixels wide spritesheet
def load_bitmap_from_spritesheet(pif_sprite)
body_id = pif_sprite.body_id
spritesheet_file = getSpritesheetPath(pif_sprite)
spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
sprite_x_position,sprite_y_position =get_sprite_position_on_spritesheet(body_id,SPRITE_SIZE,COLUMNS)
src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
sprite_bitmap.blt(0, 0, spritesheet_bitmap, src_rect)
spritesheet_bitmap.dispose # Dispose since not needed
return sprite_bitmap
end
def load_sprite_to_file(pif_sprite)
head_id = pif_sprite.head_id
body_id = pif_sprite.body_id
alt_letter = pif_sprite.alt_letter
base_folder = "#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}#{head_id}/"
individualSpriteFile = "#{base_folder}#{head_id}.#{body_id}#{alt_letter}.png"
if !pbResolveBitmap(individualSpriteFile)
animatedBitmap = load_sprite_from_spritesheet(pif_sprite)
Dir.mkdir(base_folder) unless Dir.exist?(base_folder)
animatedBitmap.bitmap.save_to_png(individualSpriteFile)
end
return AnimatedBitmap.new(individualSpriteFile)
end
def getSpritesheetPath(pif_sprite)
alt_letter = pif_sprite.alt_letter
head_id = pif_sprite.head_id
return "#{SPRITESHEET_FOLDER_PATH}#{head_id}/#{head_id}#{alt_letter}.png"
end
def should_update_spritesheet?(pif_sprite)
return false if !$updated_spritesheets
return false if !downloadAllowed?()
return false if requestRateExceeded?(Settings::CUSTOMSPRITES_RATE_LOG_FILE,Settings::CUSTOMSPRITES_ENTRIES_RATE_TIME_WINDOW,Settings::CUSTOMSPRITES_RATE_MAX_NB_REQUESTS,false)
spritesheet_file = getSpritesheetPath(pif_sprite)
return true if !pbResolveBitmap(spritesheet_file)
return !$updated_spritesheets.include?(spritesheet_file)
end
def load_sprite_directly(head_id,body_id,alt_letter="")
load_sprite(PIFSprite.new(:CUSTOM,head_id,body_id,alt_letter))
end
def get_resize_scale
return 3
end
#
# def extract_bitmap_to_file(head_id, body_id, alt_letter, folder)
# # Create the directory if it doesn't exist
# Dir.mkdir(folder) unless Dir.exist?(folder)
#
# # Load the entire spritesheet
# spritesheet_file = "#{SPRITESHEET_FOLDER_PATH}#{head_id}\\#{head_id}#{alt_letter}.png"
# spritesheet_bitmap = AnimatedBitmap.new(spritesheet_file).bitmap
#
# # Calculate the 0-based row and column from the sprite index
# index = body_id
# row = index / COLUMNS
# col = index % COLUMNS
#
# # Define the area of the sprite on the spritesheet
# sprite_x_position = col * SPRITE_SIZE
# sprite_y_position = row * SPRITE_SIZE
#
# # Create a new bitmap for the sprite at its original size
# sprite_bitmap = Bitmap.new(SPRITE_SIZE, SPRITE_SIZE)
#
# # Copy the sprite from the spritesheet to the new bitmap
# src_rect = Rect.new(sprite_x_position, sprite_y_position, SPRITE_SIZE, SPRITE_SIZE)
# sprite_bitmap.blt(0, 0, spritesheet_bitmap, src_rect)
#
# # Dispose of the spritesheet bitmap if its no longer needed
# spritesheet_bitmap.dispose
#
# # Save the sprite bitmap to a file
# file_path = "#{folder}/#{head_id}.#{body_id}.png"
# sprite_bitmap.save_to_png(file_path)
#
# # Dispose of the sprite bitmap
# sprite_bitmap.dispose
#
# # Return the path to the saved PNG file
# return file_path
# end
end

View File

@@ -0,0 +1,122 @@
# object representing a sprite which saves its position in the tileset
class PIFSprite
attr_accessor :type
attr_accessor :head_id
attr_accessor :body_id
attr_accessor :alt_letter
attr_accessor :local_path
# types:
# :AUTOGEN, :CUSTOM, :BASE
def initialize(type, head_id, body_id, alt_letter = "")
@type = type
@head_id = head_id
@body_id = body_id
@alt_letter = alt_letter
@local_path = nil
end
def dump_info()
echoln "Type: #{@type}"
echoln "Head: #{@head_id}"
echoln "Body: #{@body_id}"
echoln "Alt letter: #{@alt_letter}"
echoln "Local path: #{@local_path}"
end
def species
if @type == :BASE
return GameData::Species.get(@head_id).species
else
return "B#{@body_id}H#{@head_id}".to_sym
end
end
def exists()
filename = get_spritesheet_path()
echoln filename
return File.file?(filename)
end
def get_spritesheet_path()
case @type
when :BASE
path = "#{BaseSpriteExtracter::SPRITESHEET_FOLDER_PATH}#{@head_id}.png"
when :CUSTOM
path = "#{CustomSpriteExtracter::SPRITESHEET_FOLDER_PATH}#{@head_id}/#{@head_id}#{@alt_letter}.png"
when :AUTOGEN
path = "#{AutogenExtracter::SPRITESHEET_FOLDER_PATH}#{@head_id}.png"
else
return nil
end
echoln path
return path
end
end
def equals(other_pif_sprite)
return @type == other_pif_sprite.type &&
@head_id == other_pif_sprite.head_id &&
@body_id == other_pif_sprite.body_id &&
@alt_letter == other_pif_sprite.alt_letter &&
@local_path == other_pif_sprite.local_path
end
# little hack for old methods that expect a filename for a sprite
def to_filename()
case @type
when :CUSTOM
return "#{@head_id}.#{@body_id}#{@alt_letter}.png"
when :AUTOGEN
return "#{@head_id}.#{@body_id}.png"
when :BASE
return "#{@head_id}#{@alt_letter}.png"
end
end
def setup_from_spritename(spritename, type)
@type = type
cleaned_name = spritename.gsub(".png", "")
if cleaned_name =~ /(\d+)\.(\d+)([a-zA-Z]*)/
head_id = $1
body_id = $2
alt_letter = $3
end
@head_id = head_id
@body_id = body_id
@alt_letter = alt_letter
end
def self.from_spritename(spritename, type)
obj = allocate
obj.send(:setup_from_spritename, spritename, type)
obj
end
def new_pif_sprite_from_dex_num(type, dexNum, alt_letter)
body_id = getBodyID(dexNum)
head_id = getHeadID(dexNum, body_id)
return PIFSprite.new(type, head_id, body_id, alt_letter)
end
def pif_sprite_from_spritename(spritename, autogen = false)
spritename = spritename.split(".png")[0] # remove the extension
if spritename =~ /^(\d+)\.(\d+)([a-zA-Z]*)$/ # Two numbers with optional letters
type = :CUSTOM
head_id = $1.to_i # Head (e.g., "1" in "1.2.png")
body_id = $2.to_i # Body (e.g., "2" in "1.2.png")
alt_letter = $3 # Optional trailing letter (e.g., "a" in "1.2a.png")
elsif spritename =~ /^(\d+)([a-zA-Z]*)$/ # One number with optional letters
type = :BASE
head_id = $1.to_i # Head (e.g., "1" in "1.png")
alt_letter = $2 # Optional trailing letter (e.g., "a" in "1a.png")
else
echoln "Invalid sprite format: #{spritename}"
return nil
end
type = :AUTOGEN if autogen
return PIFSprite.new(type, head_id, body_id, alt_letter)
end

View File

@@ -0,0 +1,89 @@
def setSpriteSubstitution(pif_sprite)
end
def getSpriteSubstitutionForDex(dex_num)
end
def setSpriteSubstitution(head,body)
end
def set_updated_spritesheets
echoln
end
def initialize_alt_sprite_substitutions()
$PokemonGlobal.alt_sprite_substitutions = {} if !$PokemonGlobal.alt_sprite_substitutions
migrate_sprites_substitutions()
end
def get_sprite_substitution_id_for_fusion(head_id, body_id)
species_symbol = "B#{body_id}H#{head_id}".to_sym
return get_sprite_substitution_id_from_dex_number(species_symbol)
end
def get_sprite_substitution_id_from_dex_number(species_symbol)
species = GameData::Species.get(species_symbol)
if species.is_fusion
substitution_id = [species.get_head_species,species.get_body_species]
else
substitution_id= species.id_number
end
return substitution_id
end
def migrate_sprites_substitutions
return if $game_switches[SWITCH_UPDATED_TO_SPRITESHEETS_SPRITES]
new_substitutions = {}
old_number_pokemon = 470
for dex_number_key in $PokemonGlobal.alt_sprite_substitutions.keys
if $PokemonGlobal.alt_sprite_substitutions[dex_number_key].is_a?(String) && can_convert_to_int?(dex_number_key)
old_dex_number = dex_number_key.to_i
if old_dex_number > old_number_pokemon #fusion
body_id = getBodyID(old_dex_number,old_number_pokemon)
head_id = getHeadID(old_dex_number,body_id,old_number_pokemon)
new_id = [head_id,body_id]
type = :CUSTOM
else
new_id = old_dex_number
head_id = old_dex_number
body_id= nil
type = :BASE
end
file_path = $PokemonGlobal.alt_sprite_substitutions[dex_number_key]
alt_letter =get_alt_letter_from_path(file_path)
pif_sprite = PIFSprite.new(type,head_id,body_id,alt_letter)
new_substitutions[new_id] = pif_sprite
end
end
$PokemonGlobal.alt_sprite_substitutions = new_substitutions
$game_switches[SWITCH_UPDATED_TO_SPRITESHEETS_SPRITES] = true
end
def can_convert_to_int?(str)
Integer(str)
true
rescue ArgumentError
false
end
def get_alt_letter_from_path(filename)
# Remove the extension
base_name = filename.sub(/\.png$/, '')
# Check the last character
last_char = base_name[-1]
if last_char.match?(/\d/) # Check if the last character is a number
alt_letter = ""
else
# Reverse the base name and capture all letters until the first number
alt_letter = base_name.reverse[/[a-zA-Z]+/].reverse
end
return alt_letter
end

View File

@@ -47,7 +47,7 @@ class TripleFusion < Pokemon
part1 = split_string_with_syllables(@species1_data.name)[0]
part2 = split_string_with_syllables(@species2_data.name)[1]
part3 = split_string_with_syllables(@species3_data.name)[2]
return _INTL("{1}{2}{3}",part1,part2,part3).capitalize!
return "#{part1}#{part2}#{part3}".capitalize!
end

View File

@@ -139,8 +139,8 @@
# canLose = $PokemonTemp.battleRules["canLose"] || false
# # Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
# if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
# pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
# pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $Trainer.able_pokemon_count > 0
# pbMessage("SKIPPING BATTLE...") if $DEBUG
# pbMessage("AFTER WINNING...") if $DEBUG && $Trainer.able_pokemon_count > 0
# pbSet(outcomeVar,($Trainer.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
# $PokemonTemp.clearBattleRules
# $PokemonGlobal.nextBattleBGM = nil
@@ -176,7 +176,7 @@
# foeEndSpeeches.push(arg[3] || trainer.lose_text)
# foeItems.push(trainer.items)
# else
# raise _INTL("Expected NPCTrainer or array of trainer data, got {1}.", arg)
# raise "Expected NPCTrainer or array of trainer data, got {1}.", arg
# end
# end
# # Calculate who the player trainer(s) and their party are

View File

@@ -18,18 +18,18 @@ end
def pick_spriter_losing_dialog(spriter_name)
possible_dialogs = [
"Oh... I lost...",
"I did my best!",
"You're too strong!",
"You win!",
"What a fight!",
"That was fun!",
"Ohh, that's too bad",
"I should've sprited some stronger Pokémon!",
"So much for that!",
"Should've seen that coming!",
"I can't believe it!",
"What a surprise!"
_INTL("Oh... I lost..."),
_INTL("I did my best!"),
_INTL("You're too strong!"),
_INTL("You win!"),
_INTL("What a fight!"),
_INTL("That was fun!"),
_INTL("Ohh, that's too bad"),
_INTL("I should've sprited some stronger Pokémon!"),
_INTL("So much for that!"),
_INTL("Should've seen that coming!"),
_INTL("I can't believe it!"),
_INTL("What a surprise!")
]
index = select_number_from_seed(spriter_name,0,possible_dialogs.size-1)
return possible_dialogs[index]

View File

@@ -208,6 +208,11 @@ def getEvolution(speciesParam, halfToEvolve=nil)
end
end
#just a shortcut
def fusionOf(head,body)
return getFusionSpeciesSymbol(body,head)
end
def getFusionSpeciesSymbol(body, head)
body_num = dexNum(body)
head_num = dexNum(head)
@@ -274,13 +279,13 @@ end
def printDebugRematchInfo(nbRematch, expRate, newLevel, levelCap, originalLevel)
info = ""
info << "total rematched trainers: " + $PokemonGlobal.rematchedTrainers.length.to_s + "\n"
info << _INTL("total rematched trainers: ") + $PokemonGlobal.rematchedTrainers.length.to_s + "\n"
info << "nb times: " + nbRematch.to_s + "\n"
info << "lvl up every " + expRate.to_s + " times" + "\n"
info << "original level: " << originalLevel.to_s + "\n"
info << "new level: " + newLevel.to_s + "\n"
info << "level cap: " + levelCap.to_s
info << _INTL("nb times: ") + nbRematch.to_s + "\n"
info << _INTL("lvl up every {1} times",expRate.to_s) + "\n"
info << _INTL("original level: ") << originalLevel.to_s + "\n"
info << _INTL("new level: ") + newLevel.to_s + "\n"
info << _INTL("level cap: ") + levelCap.to_s
print info
end

View File

@@ -16,27 +16,136 @@ CARD_BACKGROUND_DEFAULT_PURCHASABLE = [
# a special npc somewhere.
CARD_BACKGROUND_CITY_EXCLUSIVES = {
"GRAYPOLY" => :PEWTER,
"EEVEELUTION" => :CELADON,
"GALAXYMAIL" => :SAFFRON,
"HEARTMAIL" => :CERULEAN,
"MAGIKARP_JUMP" => :CERULEAN,
"PIKACHU" => :VERMILLION,
"OMG" => :VERMILLION,
"SPOOKY_FOREST" => :LAVENDER,
"EEVEELUTION" => :CELADON,
"RAINBOWMAIL" => :CELADON,
"SEWERS" => :CELADON,
"CACTI" => :FUCHSIA,
"EEVEE_SLEEP" => :FUCHSIA,
"GALAXYMAIL" => :SAFFRON,
"FIGHTING_HANDSHAKE" => :SAFFRON,
"CINNABAR" => :CINNABAR,
"SPHEAL_MOON" => :CRIMSON,
"EEVEE_FLOWERS" => :KNOTISLAND,
"DESERT_SUNSET" => :KNOTISLAND,
"ROCKRUFF_EVO" => :KNOTISLAND,
"TOTODILE_BEACH" => :BOONISLAND,
"HAMMOCK" => :KINISLAND,
"SLEEPY_CAMERUPT" => :CHRONOISLAND,
"ILLUSION" => :GOLDENROD,
"BABIES" => :GOLDENROD,
"MUSHROOM_FOREST" => :AZALEA,
"NATIONAL_PARK" => :VIOLET,
"ROCKRUFF_FLOWERS" => :VIOLET,
"CRANIDOS_PARK" => :BLACKTHORN,
"CAMPFIRE" => :MAHOGANY,
"MOON_LAKE" => :MAHOGANY,
"STILL_LIFE" => :MAHOGANY,
"MOUNTAIN_NIGHT" => :MAHOGANY,
"SPOOKY_ATTIC" => :ECRUTEAK,
"UNDERDOG" => :ECRUTEAK,
}
#purchasable from pokemart after unlocking a
# certain switch
#flag => switch to unlock
CARD_BACKGROUND_UNLOCKABLES = {
#Unobtainable Pokemon team flags:
# Move these to the /flags folder if the Pokemon become implemented into the game
"SHIINOTIC_FLAG" => SWITCH_ALOLA_HAIR_COLLECTION,
"MALAMAR_FLAG" => SWITCH_KALOS_HAIR_COLLECTION,
"MUNNA_FLAG" => SWITCH_UNOVA_HAIR_COLLECTION,
"MUSHARNA_FLAG" => SWITCH_UNOVA_HAIR_COLLECTION,
"NUMEL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"SEALEO_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"SPHEAL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"SPINDA_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"SKITTY_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"TROPIUS_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
"WINGULL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
#Unlockables
"BLASTOISE" => SWITCH_BEAT_THE_LEAGUE,
"CHARIZARD" => SWITCH_BEAT_THE_LEAGUE,
"VENUSAUR" => SWITCH_BEAT_THE_LEAGUE,
"COMPUTER_HILLS" => SWITCH_BEAT_THE_LEAGUE,
"GAMEBOY_FUSIONS" => SWITCH_BEAT_THE_LEAGUE,
"GROUDON" => SWITCH_HOENN_HAIR_COLLECTION,
"KYOGRE" => SWITCH_HOENN_HAIR_COLLECTION,
"RAYQUAZA" => SWITCH_HOENN_HAIR_COLLECTION,
"HOENN_GREETINGS " => SWITCH_HOENN_HAIR_COLLECTION,
"RUBY" => SWITCH_HOENN_HAIR_COLLECTION,
"SAPPHIRE" => SWITCH_HOENN_HAIR_COLLECTION,
"EMERALD" => SWITCH_HOENN_HAIR_COLLECTION,
"BARS_BOACH" => SWITCH_HOENN_HAIR_COLLECTION,
"RIVALS" => SWITCH_HOENN_HAIR_COLLECTION,
"WEATHER_WAR" => SWITCH_BEAT_MT_SILVER,
"HOENN_STARTERS" => SWITCH_BEAT_MT_SILVER,
"GROUDON_FUSION" => SWITCH_BEAT_MT_SILVER ,
"KYOGRE_FUSION" => SWITCH_BEAT_MT_SILVER ,
"HOENN_CREDITS" => SWITCH_BEAT_MT_SILVER ,
"CYNTHIA" => SWITCH_BEAT_MT_SILVER ,
"TIME_GEAR" => SWITCH_BEAT_MT_SILVER ,
"RAYQUAZA_PATTERN" => SWITCH_BEAT_MT_SILVER,
"ARCEUS_COSMIC_STEPS" => SWITCH_FINISHED_ARCEUS_EVENT ,
"ARCEUS_SILVALLY" => SWITCH_FINISHED_ARCEUS_EVENT ,
"ARCEUS_SYMBOL" => SWITCH_FINISHED_ARCEUS_EVENT ,
"RESHIRAM" => SWITCH_UNOVA_HAIR_COLLECTION,
"ZEKROM" => SWITCH_UNOVA_HAIR_COLLECTION,
"MUNNA_PATTERN" => SWITCH_UNOVA_HAIR_COLLECTION,
"ZYGARDE_PATTERN" => SWITCH_KALOS_HAIR_COLLECTION,
"DUEL" => SWITCH_PALDEA_HAIR_COLLECTION,
"AKALA_ISLAND" => SWITCH_ALOLA_HAIR_COLLECTION,
"DARKRAI" => SWITCH_CAUGHT_DARKRAI,
"MOONLIGHT_BALL" => SWITCH_CAUGHT_MELOETTA,
"DIANCIE_CARBINK" => SWITCH_PINKAN_FINISHED,
"ROCKET_LOGO" => SWITCH_FINISHED_ROCKET_QUESTS_CERULEAN,
"MEOWTH_ROCKET" => SWITCH_FINISHED_ROCKET_QUESTS_CELADON,
"ROCKET_JAMES_INKAY" => SWITCH_PINKAN_FINISHED,
"BOULDERBADGE" => SWITCH_GOT_BADGE_1,
"CASCADEBADGE" => SWITCH_GOT_BADGE_2,
@@ -66,23 +175,26 @@ def getDisplayedName(card_id)
end
def purchaseCardBackground(price = 1000)
$Trainer.unlocked_card_backgrounds = [] if ! $Trainer.unlocked_card_backgrounds
purchasable_cards = []
current_city = pbGet(VAR_CURRENT_MART)
current_city = :PEWTER if !current_city.is_a?(Symbol)
for card in CARD_BACKGROUND_CITY_EXCLUSIVES.keys
purchasable_cards << card if current_city == CARD_BACKGROUND_CITY_EXCLUSIVES[card] && !$Trainer.unlocked_card_backgrounds.include?(card)
end
for card in CARD_BACKGROUND_DEFAULT_PURCHASABLE
purchasable_cards << card if !$Trainer.unlocked_card_backgrounds.include?(card)
end
for card in CARD_BACKGROUND_UNLOCKABLES.keys
purchasable_cards << card if $game_switches[CARD_BACKGROUND_UNLOCKABLES[card]] && !$Trainer.unlocked_card_backgrounds.include?(card)
end
for card in CARD_BACKGROUND_CITY_EXCLUSIVES.keys
purchasable_cards << card if current_city == CARD_BACKGROUND_CITY_EXCLUSIVES[card]
end
echoln $Trainer.unlocked_card_backgrounds
if purchasable_cards.length <= 0
pbMessage("There are no more Trainer Card backgrounds available for purchase!")
pbMessage(_INTL("There are no more Trainer Card backgrounds available for purchase!"))
return
end
@@ -93,27 +205,27 @@ def purchaseCardBackground(price = 1000)
name = getDisplayedName(card)
commands.push([index, name, card])
end
pbMessage("\\GWhich background would you like to purchase?")
chosen = pbListScreen("Trainer card", TrainerCardBackgroundLister.new(purchasable_cards))
pbMessage(_INTL("\\GWhich background would you like to purchase?"))
chosen = pbListScreen(_INTL("Trainer card"), TrainerCardBackgroundLister.new(purchasable_cards))
echoln chosen
if chosen != nil
name = getDisplayedName(chosen)
if pbConfirmMessage("\\GPurchase the \\C[1]#{name} Trainer Card background\\C[0] for $#{price.to_s}?")
if pbConfirmMessage(_INTL("\\GPurchase the \\C[1]{1} Trainer Card background\\C[0] for ${2}?", name, price.to_s))
if $Trainer.money < price
pbSEPlay("GUI sel buzzer", 80)
pbMessage("\\G\\C[2]Insufficient funds")
pbMessage(_INTL("\\G\\C[2]Insufficient funds"))
return false
end
pbSEPlay("Mart buy item")
$Trainer.money -= price
unlock_card_background(chosen)
pbSEPlay("Item get")
pbMessage("\\GYou purchased the #{name} Trainer Card background!")
if pbConfirmMessage("Would you like to swap your current Trainer Card for the newly purchased one?")
pbMessage(_INTL("\\GYou purchased the {1} Trainer Card background!", name))
if pbConfirmMessage(_INTL("Would you like to swap your current Trainer Card for the newly purchased one?"))
pbSEPlay("GUI trainer card open")
$Trainer.card_background = chosen
else
pbMessage("You can swap the background at anytime when viewing your Trainer Card.")
pbMessage(_INTL("You can swap the background at anytime when viewing your Trainer Card."))
end
echoln $Trainer.unlocked_card_backgrounds
return true
@@ -171,7 +283,7 @@ class TrainerCardBackgroundLister
card_name = getDisplayedName(@cardsList[i])
@commands.push(card_name)
end
@commands << "Cancel"
@commands << _INTL("Cancel")
return @commands
end

View File

@@ -0,0 +1,75 @@
class PokemonStorage
def wallpaperLottery
cmd_play = _INTL("Play!")
cmd_info = _INTL("Info")
cmd_cancel = _INTL("Cancel")
commands = [cmd_play, cmd_info, cmd_cancel]
$Trainer.quest_points = initialize_quest_points unless $Trainer.quest_points
choice = pbMessage(_INTL("\\qpWould you like to play the Wallpaper Lottery? (Costs \\C[1]1 Quest point\\C[0])"),commands,2)
case commands[choice]
when cmd_play
if $Trainer.quest_points <= 0
pbMessage(_INTL("You don't have any \\C[1]Quest points\\C[0]. Complete quests to obtain more!"))
return
end
locked_wallpapers = []
for i in BASICWALLPAPERQTY..allWallpapers.length-1
locked_wallpapers << i unless isAvailableWallpaper?(i)
end
if locked_wallpapers.empty?
pbMessage(_INTL("You don't have any wallpapers left to unlock!"))
return
end
unlocked_index = locked_wallpapers.sample
$Trainer.quest_points -= 1
$game_system.bgm_memorize
$game_system.bgm_stop
pbWait(8)
pbSEPlay("BW_exp")
pbWait(90)
$game_system.bgm_restore
obtain_wallpaper(unlocked_index)
when cmd_info
pbMessage(_INTL("The Wallpaper Lottery allows you to unlock \\C[1]new wallpapers\\C[0] for your PC boxes background."))
pbMessage(_INTL("Participating in the lottery costs \\C[1]1 Quest point\\C[0]. You obtain one Quest Point per quest that you complete."))
end
end
def obtain_wallpaper(wallpaper_id)
wallpaper_name = allWallpapers[wallpaper_id]
pbUnlockWallpaper(wallpaper_id)
path = "Graphics/Pictures/Storage/Wallpapers/box_#{wallpaper_id}"
pictureViewport = showPicture(path, 50,-45)
musical_effect = "Key item get"
pbMessage(_INTL("\\qp\\me[{1}]Obtained a new wallpaper: \\c[1]{2}\\c[0]!", musical_effect, wallpaper_name))
pictureViewport.dispose if pictureViewport
end
end
class WallpaperLotteryPC
def shouldShow?
return player_has_quest_journal?
end
def name
return _INTL("Wallpaper Lottery")
end
def access
pbMessage(_INTL("\\se[PC access]Accessed the Wallpaper Lottery."))
$PokemonStorage.wallpaperLottery
end
end
#===============================================================================
#
#===============================================================================
PokemonPCList.registerPC(WallpaperLotteryPC.new)

View File

@@ -42,6 +42,6 @@ end
def Kernel.getMapName(id)
mapinfos = pbLoadMapInfos
return "Unknown location" if !mapinfos[id]
return _INTL("Unknown location") if !mapinfos[id]
return mapinfos[id].name
end

View File

@@ -12,7 +12,7 @@ ItemHandlers::UseFromBag.add(:LANTERN, proc { |item|
})
ItemHandlers::UseInField.add(:LANTERN, proc { |item|
Kernel.pbMessage(_INTL("#{$Trainer.name} used the lantern."))
Kernel.pbMessage(_INTL("{1} used the lantern.", $Trainer.name))
if useLantern()
next 1
else
@@ -175,7 +175,7 @@ def changeHiddenAbility2(abilityList, scene, poke)
abilName2 = PBAbilities.getName(abID1)
abilName3 = PBAbilities.getName(abID2)
if (Kernel.pbMessage("Choose an ability.", [_INTL("{1}", abilName2), _INTL("{1}", abilName3)], 2)) == 0
if (Kernel.pbMessage(_INTL("Choose an ability."), [_INTL("{1}", abilName2), _INTL("{1}", abilName3)], 2)) == 0
poke.setAbility(2)
scene.pbDisplay(_INTL("{1}'s ability was changed to {2}!", poke.name, abilName2))
else
@@ -186,29 +186,29 @@ def changeHiddenAbility2(abilityList, scene, poke)
return true
end
ItemHandlers::UseOnPokemon.add(:ROCKETMEAL, proc { |item, pokemon, scene|
next pbHPItem(pokemon, 100, scene)
})
ItemHandlers::BattleUseOnPokemon.add(:ROCKETMEAL, proc { |item, pokemon, battler, scene|
next pbBattleHPItem(pokemon, battler, 100, scene)
})
ItemHandlers::UseOnPokemon.add(:FANCYMEAL, proc { |item, pokemon, scene|
next pbHPItem(pokemon, 100, scene)
})
ItemHandlers::BattleUseOnPokemon.add(:FANCYMEAL, proc { |item, pokemon, battler, scene|
next pbBattleHPItem(pokemon, battler, 100, scene)
})
ItemHandlers::UseOnPokemon.add(:COFFEE, proc { |item, pokemon, scene|
next pbHPItem(pokemon, 50, scene)
})
ItemHandlers::BattleUseOnPokemon.add(:COFFEE, proc { |item, pokemon, battler, scene|
next pbBattleHPItem(pokemon, battler, 50, scene)
})
# ItemHandlers::UseOnPokemon.add(:ROCKETMEAL, proc { |item, pokemon, scene|
# next pbHPItem(pokemon, 100, scene)
# })
#
# ItemHandlers::BattleUseOnPokemon.add(:ROCKETMEAL, proc { |item, pokemon, battler, scene|
# next pbBattleHPItem(pokemon, battler, 100, scene)
# })
#
# ItemHandlers::UseOnPokemon.add(:FANCYMEAL, proc { |item, pokemon, scene|
# next pbHPItem(pokemon, 100, scene)
# })
#
# ItemHandlers::BattleUseOnPokemon.add(:FANCYMEAL, proc { |item, pokemon, battler, scene|
# next pbBattleHPItem(pokemon, battler, 100, scene)
# })
#
# ItemHandlers::UseOnPokemon.add(:COFFEE, proc { |item, pokemon, scene|
# next pbHPItem(pokemon, 50, scene)
# })
#
# ItemHandlers::BattleUseOnPokemon.add(:COFFEE, proc { |item, pokemon, battler, scene|
# next pbBattleHPItem(pokemon, battler, 50, scene)
# })
ItemHandlers::UseOnPokemon.add(:RAGECANDYBAR, proc { |item, pokemon, scene|
if pokemon.level <= 1
@@ -266,8 +266,8 @@ ItemHandlers::UseFromBag.add(:DEBUGGER, proc { |item|
def useSleepingBag()
currentSecondsValue = pbGet(UnrealTime::EXTRA_SECONDS)
choices = ["1 hour", "6 hours", "12 hours", "24 hours", "Cancel"]
choice = Kernel.pbMessage("Sleep for how long?", choices, choices.length)
choices = [_INTL("1 hour"), _INTL("6 hours"), _INTL("12 hours"), _INTL("24 hours"), _INTL("Cancel")]
choice = Kernel.pbMessage(_INTL("Sleep for how long?"), choices, choices.length)
echoln choice
return 0 if choice == choices.length - 1
oldDay = getDayOfTheWeek()
@@ -299,7 +299,7 @@ end
def useFieldSleepingBag()
currentSecondsValue = pbGet(UnrealTime::EXTRA_SECONDS)
confirmed = Kernel.pbConfirmMessage("Sleep for an hour?")
confirmed = Kernel.pbConfirmMessage(_INTL("Sleep for an hour?"))
if confirmed
oldDay = getDayOfTheWeek()
timeAdded = 0
@@ -399,7 +399,7 @@ ItemHandlers::UseFromBag.add(:EMERGENCYWHISTLE, proc { |item|
ItemHandlers::UseFromBag.add(:MUSHROOMSPORES, proc { |item|
if $game_switches[SWITCH_SPORES_REPEL]
if pbQuantity(:MUSHROOMSPORES) >= 2
if pbConfirmMessage("Condense 2 spore samples into a Repel?")
if pbConfirmMessage(_INTL("Condense 2 spore samples into a Repel?"))
$PokemonBag.pbDeleteItem(:MUSHROOMSPORES,2)
pbReceiveItem(:REPEL)
next 1
@@ -408,7 +408,7 @@ ItemHandlers::UseFromBag.add(:MUSHROOMSPORES, proc { |item|
end
else
pbMessage("Collect another sample to condense them into a Repel.")
pbMessage(_INTL("Collect another sample to condense them into a Repel."))
next 1
end
end
@@ -430,7 +430,7 @@ ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
else
Kernel.pbMessage(_INTL("The Odd Keystone appears to be moving on its own."))
Kernel.pbMessage(_INTL("It seems as if some poweful energy is trying to escape from it."))
if (Kernel.pbMessage("Let it out?", ["No", "Yes"], 0)) == 1
if (Kernel.pbMessage(_INTL("Let it out?"), [_INTL("No"), _INTL("Yes")], 0)) == 1
pbWildBattle(:SPIRITOMB, 27)
pbSet(VAR_ODDKEYSTONE_NB, 0)
end
@@ -439,9 +439,9 @@ ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
})
def useFavoriteOutfit()
cmd_switch = isWearingFavoriteOutfit() ? "Take off favorite outfit" : "Switch to favorite outfit"
cmd_mark_favorite = "Mark current outfit as favorite"
cmd_cancel = "Cancel"
cmd_switch = isWearingFavoriteOutfit() ? _INTL("Take off favorite outfit") : _INTL("Switch to favorite outfit")
cmd_mark_favorite = _INTL("Mark current outfit as favorite")
cmd_cancel = _INTL("Cancel")
options = [cmd_switch, cmd_mark_favorite, cmd_cancel]
choice = optionsMenu(options)
@@ -463,12 +463,12 @@ def switchToFavoriteOutfit()
end
if isWearingFavoriteOutfit()
if (Kernel.pbConfirmMessage("Remove your favorite outfit?"))
if (Kernel.pbConfirmMessage(_INTL("Remove your favorite outfit?")))
last_worn_clothes_is_favorite = $Trainer.last_worn_outfit == $Trainer.favorite_clothes
last_worn_hat_is_favorite = $Trainer.last_worn_hat == $Trainer.favorite_hat
last_worn_hat2_is_favorite = $Trainer.last_worn_hat2 == $Trainer.favorite_hat2
if (last_worn_clothes_is_favorite && last_worn_hat_is_favorite && last_worn_hat2_is_favorite)
$Trainer.last_worn_outfit = getDefaultClothes()
$Trainer.last_worn_outfit = getDefaultClothes(getPlayerGenderId)
end
playOutfitChangeAnimation()
putOnClothes($Trainer.last_worn_outfit, true) #if $Trainer.favorite_clothes
@@ -480,7 +480,7 @@ def switchToFavoriteOutfit()
end
else
if (Kernel.pbConfirmMessage("Put on your favorite outfit?"))
if (Kernel.pbConfirmMessage(_INTL("Put on your favorite outfit?")))
echoln "favorite clothes: #{$Trainer.favorite_clothes}, favorite hat: #{$Trainer.favorite_hat}, favorite hat2: #{$Trainer.favorite_hat2}"
playOutfitChangeAnimation()
@@ -496,9 +496,9 @@ end
def useRocketUniform()
return 0 if !$game_switches[SWITCH_JOINED_TEAM_ROCKET]
if isWearingTeamRocketOutfit()
if (Kernel.pbConfirmMessage("Remove the Team Rocket uniform?"))
if (Kernel.pbConfirmMessage(_INTL("Remove the Team Rocket uniform?")))
if ($Trainer.last_worn_outfit == CLOTHES_TEAM_ROCKET_MALE || $Trainer.last_worn_outfit == CLOTHES_TEAM_ROCKET_FEMALE) && $Trainer.last_worn_hat == HAT_TEAM_ROCKET
$Trainer.last_worn_outfit = getDefaultClothes()
$Trainer.last_worn_outfit = getDefaultClothes(getPlayerGender)
end
playOutfitChangeAnimation()
putOnClothes($Trainer.last_worn_outfit, true)
@@ -507,7 +507,7 @@ def useRocketUniform()
return 0
end
else
if (Kernel.pbConfirmMessage("Put on the Team Rocket uniform?"))
if (Kernel.pbConfirmMessage(_INTL("Put on the Team Rocket uniform?")))
playOutfitChangeAnimation()
gender = pbGet(VAR_TRAINER_GENDER)
if gender == GENDER_MALE
@@ -524,7 +524,7 @@ end
def useDreamMirror
visitedMap = $PokemonGlobal.visitedMaps[pbGet(226)]
map_name = visitedMap ? Kernel.getMapName(pbGet(226)).to_s : "an unknown location"
map_name = visitedMap ? Kernel.getMapName(pbGet(226)).to_s : _INTL("an unknown location")
Kernel.pbMessage(_INTL("You peeked into the Dream Mirror..."))
@@ -665,9 +665,9 @@ end
def useSplicerFromField(item)
scene = PokemonParty_Scene.new
scene.pbStartScene($Trainer.party, "Select a Pokémon")
scene.pbStartScene($Trainer.party, _INTL("Select a Pokémon"))
screen = PokemonPartyScreen.new(scene, $Trainer.party)
chosen = screen.pbChoosePokemon("Select a Pokémon")
chosen = screen.pbChoosePokemon(_INTL("Select a Pokémon"))
pokemon = $Trainer.party[chosen]
fusion_success = pbDNASplicing(pokemon, scene, item)
screen.pbEndScene
@@ -752,34 +752,34 @@ ItemHandlers::UseOnPokemon.add(:INFINITEREVERSERS, proc { |item, pokemon, scene|
# if (pokemon.species <= NB_POKEMON)
# if pokemon.fused != nil
# if $Trainer.party.length >= 6
# scene.pbDisplay(_INTL("Your party is full! You can't unfuse {1}.", pokemon.name))
# scene.pbDisplay("Your party is full! You can't unfuse {1}.", pokemon.name)
# return false
# else
# $Trainer.party[$Trainer.party.length] = pokemon.fused
# pokemon.fused = nil
# pokemon.form = 0
# scene.pbHardRefresh
# scene.pbDisplay(_INTL("{1} changed Forme!", pokemon.name))
# scene.pbDisplay("{1} changed Forme!", pokemon.name)
# return true
# end
# else
# chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?"))
# chosen = scene.pbChoosePokemon("Fuse with which Pokémon?")
# if chosen >= 0
# poke2 = $Trainer.party[chosen]
# if (poke2.species <= NB_POKEMON) && poke2 != pokemon
# #check if fainted
# if pokemon.hp == 0 || poke2.hp == 0
# scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!"))
# scene.pbDisplay("A fainted Pokémon cannot be fused!")
# return false
# end
# if pbFuse(pokemon, poke2, supersplicers)
# pbRemovePokemonAt(chosen)
# end
# elsif pokemon == poke2
# scene.pbDisplay(_INTL("{1} can't be fused with itself!", pokemon.name))
# scene.pbDisplay("{1} can't be fused with itself!", pokemon.name)
# return false
# else
# scene.pbDisplay(_INTL("{1} can't be fused with {2}.", poke2.name, pokemon.name))
# scene.pbDisplay("{1} can't be fused with {2}.", poke2.name, pokemon.name)
# return false
#
# end
@@ -801,20 +801,20 @@ ItemHandlers::UseOnPokemon.add(:INFINITEREVERSERS, proc { |item, pokemon, scene|
# #
#
# if (pokemon.obtain_method == 2 || pokemon.ot != $Trainer.name) # && !canunfuse
# scene.pbDisplay(_INTL("You can't unfuse a Pokémon obtained in a trade!"))
# scene.pbDisplay("You can't unfuse a Pokémon obtained in a trade!")
# return false
# else
# if Kernel.pbConfirmMessageSerious(_INTL("Should {1} be unfused?", pokemon.name))
# if Kernel.pbConfirmMessageSerious("Should {1} be unfused?", pokemon.name)
# if pokemon.species > (NB_POKEMON * NB_POKEMON) + NB_POKEMON #triple fusion
# scene.pbDisplay(_INTL("{1} cannot be unfused.", pokemon.name))
# scene.pbDisplay("{1} cannot be unfused.", pokemon.name)
# return false
# elsif $Trainer.party.length >= 6 && !pcPosition
# scene.pbDisplay(_INTL("Your party is full! You can't unfuse {1}.", pokemon.name))
# scene.pbDisplay("Your party is full! You can't unfuse {1}.", pokemon.name)
# return false
# else
# scene.pbDisplay(_INTL("Unfusing ... "))
# scene.pbDisplay(_INTL(" ... "))
# scene.pbDisplay(_INTL(" ... "))
# scene.pbDisplay("Unfusing ... ")
# scene.pbDisplay(" ... ")
# scene.pbDisplay(" ... ")
#
# bodyPoke = getBasePokemonID(pokemon.species, true)
# headPoke = getBasePokemonID(pokemon.species, false)
@@ -859,9 +859,9 @@ ItemHandlers::UseOnPokemon.add(:INFINITEREVERSERS, proc { |item, pokemon, scene|
# pokemon.obtain_method = 0
# poke1.obtain_method = 0
#
# #scene.pbDisplay(_INTL(p1.to_s + " " + p2.to_s))
# #scene.pbDisplay(p1.to_s + " " + p2.to_s)
# scene.pbHardRefresh
# scene.pbDisplay(_INTL("Your Pokémon were successfully unfused! "))
# scene.pbDisplay("Your Pokémon were successfully unfused! ")
# return true
# end
# end
@@ -937,7 +937,7 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
move = scene.pbChooseMove(pokemon, _INTL("Boost Damage of which move?"))
if move >= 0
# if pokemon.moves[move].damage==0 || pokemon.moves[move].accuracy<=5 || pokemon.moves[move].dmgup >=3
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pokemon.moves[move].dmgup+=1
@@ -945,7 +945,7 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
# pokemon.moves[move].accuracy -=5
# movename=PBMoves.getName(pokemon.moves[move].id)
# scene.pbDisplay(_INTL("{1}'s damage increased.",movename))
# scene.pbDisplay("{1}'s damage increased.",movename)
# next true
scene.pbDisplay(_INTL("This item has not been implemented into the game yet. It had no effect."))
next false
@@ -956,12 +956,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
##New "stones"
# ItemHandlers::UseOnPokemon.add(:UPGRADE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -978,12 +978,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:DUBIOUSDISC, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1000,12 +1000,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:ICESTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1022,12 +1022,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
# #
# ItemHandlers::UseOnPokemon.add(:MAGNETSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1044,28 +1044,36 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
# easter egg for evolving shellder into slowbro's tail
ItemHandlers::UseOnPokemon.add(:SLOWPOKETAIL, proc { |item, pokemon, scene|
echoln pokemon.species
next false if pokemon.species != :SHELLDER
next evolveSlowpokeTail(item, pokemon, scene)
})
def evolveSlowpokeTail(item, pokemon, scene)
if pokemon.species != :SHELLDER
pbMessage(_INTL("It won't have any effect."))
return false
end
pbFadeOutInWithMusic(99999) {
evo = PokemonEvolutionScene.new
evo.pbStartScreen(pokemon, :B90H80)
evo.pbEvolution(false)
evo.pbEndScreen
scene.pbRefreshAnnotations(proc { |p| pbCheckEvolution(p, item) > 0 }) if scene.pbHasAnnotations?
if scene.respond_to?(:pbHasAnnotations) && scene.pbHasAnnotations?
scene.pbRefreshAnnotations(proc { |p| pbCheckEvolution(p, item) > 0 })
end
scene.pbRefresh
}
next true
})
return true
end
#
# ItemHandlers::UseOnPokemon.add(:SHINYSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1082,12 +1090,12 @@ ItemHandlers::UseOnPokemon.add(:SLOWPOKETAIL, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:DAWNSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1141,7 +1149,7 @@ ItemHandlers::BattleUseOnPokemon.add(:BALMMUSHROOM, proc { |item, pokemon, battl
# #TRACKER (for roaming legendaries)
# ItemHandlers::UseInField.add(:REVEALGLASS, proc { |item|
# if Settings::ROAMING_SPECIES.length == 0
# Kernel.pbMessage(_INTL("No roaming Pokémon defined."))
# Kernel.pbMessage("No roaming Pokémon defined.")
# else
# text = "\\l[8]"
# min = $game_switches[350] ? 0 : 1
@@ -1152,11 +1160,11 @@ ItemHandlers::BattleUseOnPokemon.add(:BALMMUSHROOM, proc { |item, pokemon, battl
# status = $PokemonGlobal.roamPokemon[i]
# if status == true
# if $PokemonGlobal.roamPokemonCaught[i]
# text += _INTL("{1} has been caught.",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "{1} has been caught.",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# else
# text += _INTL("{1} has been defeated.",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "{1} has been defeated.",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# end
# else
# curmap = $PokemonGlobal.roamPosition[i]
@@ -1164,21 +1172,21 @@ ItemHandlers::BattleUseOnPokemon.add(:BALMMUSHROOM, proc { |item, pokemon, battl
# mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
#
# if curmap == $game_map.map_id
# text += _INTL("Beep beep! {1} appears to be nearby!",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "Beep beep! {1} appears to be nearby!",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# else
# text += _INTL("{1} is roaming around {3}",
# text += "{1} is roaming around {3}",
# PBSpecies.getName(getID(PBSpecies, poke[0])), curmap,
# mapinfos[curmap].name, (curmap == $game_map.map_id) ? _INTL("(this route!)") : "")
# mapinfos[curmap].name, (curmap == $game_map.map_id) ? "(this route!)") : ""
# end
# else
# text += _INTL("{1} is roaming in an unknown area.",
# PBSpecies.getName(getID(PBSpecies, poke[0])), poke[1])
# text += "{1} is roaming in an unknown area.",
# PBSpecies.getName(getID(PBSpecies, poke[0])), poke[1]
# end
# end
# else
# #text+=_INTL("{1} does not appear to be roaming.",
# # PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],poke[2])
# #text+="{1} does not appear to be roaming.",
# # PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],poke[2]
# end
# text += "\n" if i < Settings::ROAMING_SPECIES.length - 1
# end
@@ -1242,18 +1250,18 @@ ItemHandlers::UseOnPokemon.add(:TRANSGENDERSTONE, proc { |item, pokemon, scene|
# abil2 = i[1] if i[1] == 1
# end
# if poke.abilityIndex() >= 2 || abil1 == abil2
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# if Kernel.pbConfirmMessage(_INTL("Do you want to change {1}'s ability?",
# poke.name))
# if Kernel.pbConfirmMessage("Do you want to change {1}'s ability?",
# poke.name)
#
# if poke.abilityIndex() == 0
# poke.setAbility(1)
# else
# poke.setAbility(0)
# end
# scene.pbDisplay(_INTL("{1}'s ability was changed!", poke.name))
# scene.pbDisplay("{1}'s ability was changed!", poke.name)
# next true
# end
# next false
@@ -1303,7 +1311,7 @@ def changeHiddenAbility2(abilityList, scene, poke)
abilName2 = PBAbilities.getName(abID1)
abilName3 = PBAbilities.getName(abID2)
if (Kernel.pbMessage("Choose an ability.", [_INTL("{1}", abilName2), _INTL("{1}", abilName3)], 2)) == 0
if (Kernel.pbMessage(_INTL("Choose an ability."), [_INTL("{1}", abilName2), _INTL("{1}", abilName3)], 2)) == 0
poke.setAbility(2)
scene.pbDisplay(_INTL("{1}'s ability was changed to {2}!", poke.name, abilName2))
else
@@ -1330,6 +1338,14 @@ ItemHandlers::BattleUseOnPokemon.add(:FANCYMEAL, proc { |item, pokemon, battler,
pbBattleHPItem(pokemon, battler, 100, scene)
})
ItemHandlers::UseOnPokemon.add(:COFFEE, proc { |item, pokemon, scene|
next pbHPItem(pokemon, 50, scene)
})
ItemHandlers::BattleUseOnPokemon.add(:COFFEE, proc { |item, pokemon, battler, choices, scene|
pbBattleHPItem(pokemon, battler, 50, scene)
})
ItemHandlers::UseOnPokemon.add(:RAGECANDYBAR, proc { |item, pokemon, scene|
if pokemon.level <= 1
scene.pbDisplay(_INTL("It won't have any effect."))
@@ -1376,19 +1392,19 @@ ItemHandlers::UseOnPokemon.add(:INCUBATOR_NORMAL, proc { |item, pokemon, scene|
scene.pbDisplay(_INTL("The egg is closer to hatching!"))
# if pokemon.steps_to_hatch <= 1
# scene.pbDisplay(_INTL("Incubating..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("The egg is ready to hatch!"))
# scene.pbDisplay("Incubating...")
# scene.pbDisplay("...")
# scene.pbDisplay("...")
# scene.pbDisplay("The egg is ready to hatch!")
# next false
# else
# scene.pbDisplay(_INTL("Incubating..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay(_INTL("..."))
# scene.pbDisplay("Incubating...")
# scene.pbDisplay("...")
# scene.pbDisplay("...")
# if pokemon.nbIncubatorsUsed >= 10
# scene.pbDisplay(_INTL("The egg is a bit closer to hatching"))
# scene.pbDisplay("The egg is a bit closer to hatching")
# else
# scene.pbDisplay(_INTL("The egg is closer to hatching"))
# scene.pbDisplay("The egg is closer to hatching")
# end
# pokemon.incrIncubator()
# next true
@@ -1578,7 +1594,7 @@ end
# newid = (pokemon.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number
# previewwindow = FusionPreviewScreen.new(pokemon, poke2)#PictureWindow.new(picturePath)
#
# if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?", newid)))
# if (Kernel.pbConfirmMessage("Fuse the two Pokémon?", newid))
# previewwindow.dispose
# fus = PokemonFusionScene.new
# if (fus.pbStartScreen(pokemon, poke2, newid))
@@ -1609,7 +1625,7 @@ def pbFuse(pokemon_body, pokemon_head, splicer_item)
end
end
# Todo: refactor this, holy shit this is a mess
# Todo: refactor this, this is a mess
def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
if pokemon.species_data.id_number > (NB_POKEMON * NB_POKEMON) + NB_POKEMON # triple fusion
scene.pbDisplay(_INTL("{1} cannot be unfused.", pokemon.name))
@@ -1634,12 +1650,12 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
keepInParty = 0
if $Trainer.party.length >= 6 && !pcPosition
message = "Your party is full! Keep which Pokémon in party?"
message = "Your party is full! Keep which Pokémon in party? The other will be released." if isOnPinkanIsland()
message = _INTL("Your party is full! Keep which Pokémon in party?")
message = _INTL("Your party is full! Keep which Pokémon in party? The other will be released.") if isOnPinkanIsland()
scene.pbDisplay(_INTL(message))
selectPokemonMessage = "Select a Pokémon to keep in your party."
selectPokemonMessage = "Select a Pokémon to keep in your party. The other will be released" if isOnPinkanIsland()
choice = Kernel.pbMessage(selectPokemonMessage, [_INTL("{1}", PBSpecies.getName(bodyPoke)), _INTL("{1}", PBSpecies.getName(headPoke)), "Cancel"], 2)
selectPokemonMessage = _INTL("Select a Pokémon to keep in your party.")
selectPokemonMessage = _INTL("Select a Pokémon to keep in your party. The other will be released") if isOnPinkanIsland()
choice = Kernel.pbMessage(selectPokemonMessage, ["#{PBSpecies.getName(bodyPoke)}", "#{PBSpecies.getName(headPoke)}", _INTL("Cancel")], 2)
if choice == 2
return false
else
@@ -1699,8 +1715,14 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
end
fused_pokemon_learned_moved = pokemon.learned_moves
pokemon.learned_moves = fused_pokemon_learned_moved
poke2.learned_moves = fused_pokemon_learned_moved
fused_pokemon_learned_moved = [] if !fused_pokemon_learned_moved
pokemon.moves.each do |move|
fused_pokemon_learned_moved << move.id unless fused_pokemon_learned_moved.include?(move.id)
end
fused_pokemon_learned_moved.each do |move|
pokemon.add_learned_move(move)
poke2.add_learned_move(move)
end
pokemon.ability_index = pokemon.body_original_ability_index if pokemon.body_original_ability_index
poke2.ability_index = pokemon.head_original_ability_index if pokemon.head_original_ability_index
@@ -1775,9 +1797,9 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
pokemon.obtain_method = 0
poke1.obtain_method = 0
# scene.pbDisplay(_INTL(p1.to_s + " " + p2.to_s))
# scene.pbDisplay(p1.to_s + " " + p2.to_s)
scene.pbHardRefresh
scene.pbDisplay(_INTL("Your Pokémon were successfully unfused! "))
scene.pbDisplay(_INTL("Your Pokémon were successfully unfused!"))
return true
end
end
@@ -1806,7 +1828,7 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
move = scene.pbChooseMove(pokemon, _INTL("Boost Damage of which move?"))
if move >= 0
# if pokemon.moves[move].damage==0 || pokemon.moves[move].accuracy<=5 || pokemon.moves[move].dmgup >=3
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pokemon.moves[move].dmgup+=1
@@ -1814,7 +1836,7 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
# pokemon.moves[move].accuracy -=5
# movename=PBMoves.getName(pokemon.moves[move].id)
# scene.pbDisplay(_INTL("{1}'s damage increased.",movename))
# scene.pbDisplay("{1}'s damage increased.",movename)
# next true
scene.pbDisplay(_INTL("This item has not been implemented into the game yet. It had no effect."))
next false
@@ -1825,12 +1847,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
##New "stones"
# ItemHandlers::UseOnPokemon.add(:UPGRADE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1847,12 +1869,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:DUBIOUSDISC, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1869,12 +1891,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:ICESTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1891,12 +1913,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:MAGNETSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1913,12 +1935,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
# ItemHandlers::UseOnPokemon.add(:SHINYSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1935,12 +1957,12 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
#
# ItemHandlers::UseOnPokemon.add(:DAWNSTONE, proc { |item, pokemon, scene|
# if (pokemon.isShadow? rescue false)
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# end
# newspecies = pbCheckEvolution(pokemon, item)
# if newspecies <= 0
# scene.pbDisplay(_INTL("It won't have any effect."))
# scene.pbDisplay("It won't have any effect.")
# next false
# else
# pbFadeOutInWithMusic(99999) {
@@ -1972,6 +1994,15 @@ ItemHandlers::UseInField.add(:DEVONSCOPE, proc { |item|
pbQuestlog()
})
ItemHandlers::UseFromBag.add(:NOTEBOOK, proc { |item|
pbQuestlog()
next 1
})
ItemHandlers::UseInField.add(:NOTEBOOK, proc { |item|
pbQuestlog()
})
# TRACKER (for roaming legendaries)
ItemHandlers::UseInField.add(:REVEALGLASS, proc { |item|
track_pokemon()
@@ -2019,7 +2050,7 @@ def track_pokemon()
# nbRoaming = 0
# if Settings::ROAMING_SPECIES.length == 0
# Kernel.pbMessage(_INTL("No roaming Pokémon defined."))
# Kernel.pbMessage("No roaming Pokémon defined.")
# else
# text = "\\l[8]"
# min = $game_switches[350] ? 0 : 1
@@ -2030,11 +2061,11 @@ def track_pokemon()
# status = $PokemonGlobal.roamPokemon[i]
# if status == true
# if $PokemonGlobal.roamPokemonCaught[i]
# text += _INTL("{1} has been caught.",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "{1} has been caught.",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# else
# text += _INTL("{1} has been defeated.",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "{1} has been defeated.",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# end
# else
# nbRoaming += 1
@@ -2043,21 +2074,21 @@ def track_pokemon()
# mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
#
# if curmap == $game_map.map_id
# text += _INTL("Beep beep! {1} appears to be nearby!",
# PBSpecies.getName(getID(PBSpecies, poke[0])))
# text += "Beep beep! {1} appears to be nearby!",
# PBSpecies.getName(getID(PBSpecies, poke[0]))
# else
# text += _INTL("{1} is roaming around {3}",
# PBSpecies.getName(getID(PBSpecies, poke[0])), curmap,
# mapinfos[curmap].name, (curmap == $game_map.map_id) ? _INTL("(this route!)") : "")
# text += "{1} is roaming around {3}",
# PBSpecies.getName(getID(PBSpecies, poke[0]), curmap,
# mapinfos[curmap].name, (curmap == $game_map.map_id) ? "(this route!)") : ""
# end
# else
# text += _INTL("{1} is roaming in an unknown area.",
# PBSpecies.getName(getID(PBSpecies, poke[0])), poke[1])
# text += "{1} is roaming in an unknown area.",
# PBSpecies.getName(getID(PBSpecies, poke[0])), poke[1]
# end
# end
# else
# #text+=_INTL("{1} does not appear to be roaming.",
# # PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],poke[2])
# #text+="{1} does not appear to be roaming.",
# # PBSpecies.getName(getID(PBSpecies,poke[0])),poke[1],poke[2]
# end
# #text += "\n" if i < Settings::ROAMING_SPECIES.length - 1
# end
@@ -2095,7 +2126,7 @@ ItemHandlers::UseInField.add(:BOXLINK, proc { |item|
304, 306, 307 # Victory road
]
if blacklisted_maps.include?($game_map.map_id)
Kernel.pbMessage("There doesn't seem to be any network coverage here...")
Kernel.pbMessage(_INTL("There doesn't seem to be any network coverage here..."))
else
pbFadeOutIn {
scene = PokemonStorageScene.new
@@ -2104,4 +2135,70 @@ ItemHandlers::UseInField.add(:BOXLINK, proc { |item|
}
end
next 1
})
def changeOricorioFormFromItem(pokemon,form_name,new_form)
if !(Kernel.isPartPokemon(pokemon, :ORICORIO_1) ||
Kernel.isPartPokemon(pokemon, :ORICORIO_2) ||
Kernel.isPartPokemon(pokemon, :ORICORIO_3) ||
Kernel.isPartPokemon(pokemon, :ORICORIO_4))
scene.pbDisplay(_INTL("It had no effect."))
return false
end
if changeOricorioForm(pokemon, new_form)
pbMessage(_INTL("{1} switched to the {2} style", pokemon.name, form_name))
pbSet(1, pokemon.name)
return true
else
pbMessage(_INTL("{1} remained the same...", pokemon.name, form_name))
return false
end
end
ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, poke, scene|
form_name = "Baile"
form = 1
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::BattleUseOnPokemon.add(:REDNECTAR, proc { |item, poke, scene|
form_name = "Baile"
form = 1
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, poke, scene|
form_name = "Pom-Pom"
form = 2
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::BattleUseOnPokemon.add(:YELLOWNECTAR, proc { |item, poke, scene|
form_name = "Pom-Pom"
form = 1
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, poke, scene|
form_name = "Pa'u"
form = 3
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::BattleUseOnPokemon.add(:PINKNECTAR, proc { |item, poke, scene|
form_name = "Pa'u"
form = 3
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::UseOnPokemon.add(:BLUENECTAR, proc { |item, poke, scene|
form_name = "Sensu"
form = 4
next changeOricorioFormFromItem(poke,form_name,form)
})
ItemHandlers::BattleUseOnPokemon.add(:BLUENECTAR, proc { |item, poke, scene|
form_name = "Sensu"
form = 4
next changeOricorioFormFromItem(poke,form_name,form)
})

View File

@@ -0,0 +1,14 @@
# nerf: remove x kg from each generated pokemon
def generate_weight_contest_entries(species, level, resultsVariable, nerf = 0)
# echoln "Generating Pokemon"
pokemon1 = pbGenerateWildPokemon(species, level) # Pokemon.new(species,level)
pokemon2 = pbGenerateWildPokemon(species, level) # Pokemon.new(species,level)
new_weights = []
new_weights << calculate_pokemon_weight(pokemon1, nerf)
new_weights << calculate_pokemon_weight(pokemon2, nerf)
echoln new_weights
echoln "(nerfed by -#{nerf})"
pbSet(resultsVariable, new_weights.max)
end

View File

@@ -0,0 +1,69 @@
def fossilsGuyBattle(level = 20, end_message = "")
team = getFossilsGuyTeam(level)
customTrainerBattle("Miguel",
:SUPERNERD,
team,
level,
end_message
)
end
def getFossilsGuyTeam(level)
base_poke_evolution_level = 20
fossils_evolution_level_1 = 30
fossils_evolution_level_2 = 50
fossils = []
base_poke = level <= base_poke_evolution_level ? :B88H109 : :B89H110
team = []
team << Pokemon.new(base_poke, level)
# Mt. Moon fossil
if $game_switches[SWITCH_PICKED_HELIC_FOSSIL]
fossils << :KABUTO if level < fossils_evolution_level_1
fossils << :KABUTOPS if level >= fossils_evolution_level_1
elsif $game_switches[SWITCH_PICKED_DOME_FOSSIL]
fossils << :OMANYTE if level < fossils_evolution_level_1
fossils << :OMASTAR if level >= fossils_evolution_level_1
end
# S.S. Anne fossil
if $game_switches[SWITCH_PICKED_LILEEP_FOSSIL]
fossils << :ANORITH if level < fossils_evolution_level_1
fossils << :ARMALDO if level >= fossils_evolution_level_1
elsif $game_switches[SWITCH_PICKED_ANORITH_FOSSIL]
fossils << :LILEEP if level < fossils_evolution_level_1
fossils << :CRADILY if level >= fossils_evolution_level_1
end
# Celadon fossil
if $game_switches[SWITCH_PICKED_ARMOR_FOSSIL]
fossils << :CRANIDOS if level < fossils_evolution_level_2
fossils << :RAMPARDOS if level >= fossils_evolution_level_2
elsif $game_switches[SWITCH_PICKED_SKULL_FOSSIL]
fossils << :SHIELDON if level < fossils_evolution_level_2
fossils << :BASTIODON if level >= fossils_evolution_level_2
end
skip_next = false
for index in 0..fossils.length
if index == fossils.length - 1
team << Pokemon.new(fossils[index], level)
else
if skip_next
skip_next = false
next
end
head_poke = fossils[index]
body_poke = fossils[index + 1]
if head_poke && body_poke
newPoke = getFusionSpecies(dexNum(body_poke), dexNum(head_poke))
team << Pokemon.new(newPoke, level)
skip_next = true
end
end
end
return team
end

View File

@@ -39,29 +39,29 @@ end
def getRegularConditionExample()
list = [
"a Sandslash fusion which has the electric type will be able to learn the move Zing Zap.",
"any Pokémon that is both Flying and Fighting type will be able to learn the move Flying Press.",
"the move Shadow Bone can only be learned by ghost-type Marowak fusions.",
"any Pokémon that is both Ghost and Grass type will be able to learn the move Trick or Treat.",
"the move Forest's Curse can only be learned by Ghost/Grass typed Pokémon.",
"a grass-type fusion of a spiky Pokémon such as Jolteon will be able to learn the move Spiky Shield.",
"only a ground-type fusion of Grimer or Muk will be able to learn the move Shore Up.",
"any ice-type fusion that can already learn the move Crabhammer will also be able to learn the move Ice Hammer.",
"only water-type fusions of a ninja-like Pokémon such as Ninjask or Zoroark will be able to learn the move Water Shuriken.",
_INTL("a Sandslash fusion which has the electric type will be able to learn the move Zing Zap."),
_INTL("any Pokémon that is both Flying and Fighting type will be able to learn the move Flying Press."),
_INTL("the move Shadow Bone can only be learned by ghost-type Marowak fusions."),
_INTL("any Pokémon that is both Ghost and Grass type will be able to learn the move Trick or Treat."),
_INTL("the move Forest's Curse can only be learned by Ghost/Grass typed Pokémon."),
_INTL("a grass-type fusion of a spiky Pokémon such as Jolteon will be able to learn the move Spiky Shield."),
_INTL("only a ground-type fusion of Grimer or Muk will be able to learn the move Shore Up."),
_INTL("any ice-type fusion that can already learn the move Crabhammer will also be able to learn the move Ice Hammer."),
_INTL("only water-type fusions of a ninja-like Pokémon such as Ninjask or Zoroark will be able to learn the move Water Shuriken."),
]
return list.sample
end
def getlegendaryConditionExample()
list = [
"any Rotom fusion that can already learn the move Thunder Punch can also be taught the move Plasma Fists.",
"only an Electric-type fusion of a legendary Ice-type Pokémon will be able to learn the move Freeze Shock.",
"only a Fire-type fusion of a legendary Ice-type Pokémon will be able to learn the move Ice Burn.",
"any Pokémon that is both Flying and Dark type will be able to learn the move Oblivion Wing.",
"a ground-type fusion of a spiky Pokémon such as Ferrothorn will be able to learn the move Thousand Arrows.",
"any steel-type Pokémon that can already learn the move Double Slap will be able to learn Double Iron Bash.",
"any Pokémon that is both Fairy and Rock type will be able to learn the move Diamond Storm.",
"any water-type Pokémon that can already learn the move Eruption can also be taught the move Steam Eruption",
_INTL("any Rotom fusion that can already learn the move Thunder Punch can also be taught the move Plasma Fists."),
_INTL("only an Electric-type fusion of a legendary Ice-type Pokémon will be able to learn the move Freeze Shock."),
_INTL("only a Fire-type fusion of a legendary Ice-type Pokémon will be able to learn the move Ice Burn."),
_INTL("any Pokémon that is both Flying and Dark type will be able to learn the move Oblivion Wing."),
_INTL("a ground-type fusion of a spiky Pokémon such as Ferrothorn will be able to learn the move Thousand Arrows."),
_INTL("any steel-type Pokémon that can already learn the move Double Slap will be able to learn Double Iron Bash."),
_INTL("any Pokémon that is both Fairy and Rock type will be able to learn the move Diamond Storm."),
_INTL("any water-type Pokémon that can already learn the move Eruption can also be taught the move Steam Eruption"),
]
return list.sample
end

View File

@@ -17,7 +17,8 @@ class FusionQuiz
@selected_pokemon = nil
@head_id = nil
@body_id = nil
@choices = []
@body_choices = []
@head_choices = []
@abandonned = false
@score = 0
@current_streak = 0
@@ -56,7 +57,7 @@ class FusionQuiz
round_multiplier += round_multiplier_increase
else
pbMessage(_INTL("This concludes our quiz! You've cumulated {1} points in total.", @score))
pbMessage("Thanks for playing with us today!")
pbMessage(_INTL("Thanks for playing with us today!"))
end
end
end_quiz()
@@ -93,29 +94,29 @@ class FusionQuiz
correct_answers = []
#OBSCURED
correct_answers << new_question(calculate_points_awarded(base_points_q1, round_multiplier), "Which Pokémon is this fusion's body?", @body_id, true, true)
pbMessage("Next question!")
correct_answers << new_question(calculate_points_awarded(base_points_q2, round_multiplier), "Which Pokémon is this fusion's head?", @head_id, true, true)
correct_answers << new_question(calculate_points_awarded(base_points_q1, round_multiplier), _INTL("Which Pokémon is this fusion's body?"), @body_id, nil, true, :BODY)
pbMessage(_INTL("Next question!"))
correct_answers << new_question(calculate_points_awarded(base_points_q2, round_multiplier), _INTL("Which Pokémon is this fusion's head?"), @head_id, nil, true, :HEAD)
#NON-OBSCURED
if !correct_answers[0] || !correct_answers[1]
show_fusion_picture(false)
pbMessage("Okay, now's your chance to make up for the points you missed!")
pbMessage(_INTL("Okay, now's your chance to make up for the points you missed!"))
if !correct_answers[0] #1st question redemption
new_question(calculate_points_awarded(base_points_q1_redemption, round_multiplier), "Which Pokémon is this fusion's body?", @body_id, true, false)
new_question(calculate_points_awarded(base_points_q1_redemption, round_multiplier), "Which Pokémon is this fusion's body?", @body_id, @body_choices, false, :BODY)
if !correct_answers[1]
pbMessage("Next question!")
pbMessage(_INTL("Next question!"))
end
end
if !correct_answers[1] #2nd question redemption
new_question(calculate_points_awarded(base_points_q2_redemption, round_multiplier), "Which Pokémon is this fusion's head?", @head_id, true, false)
new_question(calculate_points_awarded(base_points_q2_redemption, round_multiplier), "Which Pokémon is this fusion's head?", @head_id, @head_choices, false, :HEAD)
end
else
pbSEPlay("Applause", 80)
pbMessage(_INTL("Wow! A perfect round! You get {1} more points!", perfect_round_points))
show_fusion_picture(false, 100)
pbMessage("Let's see what this Pokémon looked like!")
pbMessage(_INTL("Let's see what this Pokémon looked like!"))
end
current_streak_dialog()
hide_fusion_picture()
@@ -133,10 +134,10 @@ class FusionQuiz
return points
end
def new_question(points_value, question, answer_id, should_generate_new_choices, other_chance_later)
def new_question(points_value, question, answer_id, choices, other_chance_later,question_type)
points_value = points_value.to_i
answer_name = getPokemon(answer_id).real_name
answered_correctly = give_answer(question, answer_id, should_generate_new_choices)
answered_correctly = give_answer(question, answer_id, choices,question_type)
award_points(points_value) if answered_correctly
question_answer_followup_dialog(answered_correctly, answer_name, points_value, other_chance_later)
return answered_correctly
@@ -173,21 +174,21 @@ class FusionQuiz
def question_answer_followup_dialog(answered_correctly, correct_answer, points_awarded_if_win, other_chance_later = false)
if !other_chance_later
pbMessage("And the correct answer was...")
pbMessage(_INTL("And the correct answer was..."))
pbMessage("...")
pbMessage(_INTL("{1}!", correct_answer))
pbMessage("#{correct_answer}!")
end
if answered_correctly
pbSEPlay("itemlevel", 80)
increase_streak
pbMessage("That's a correct answer!")
pbMessage(_INTL("That's a correct answer!"))
pbMessage(_INTL("You're awarded {1} points for your answer. Your current score is {2}", points_awarded_if_win, @score.to_s))
else
pbSEPlay("buzzer", 80)
break_streak
pbMessage("Unfortunately, that was a wrong answer.")
pbMessage("But you'll get another chance at it!") if other_chance_later
pbMessage(_INTL("Unfortunately, that was a wrong answer."))
pbMessage(_INTL("But you'll get another chance at it!")) if other_chance_later
end
end
@@ -232,16 +233,16 @@ class FusionQuiz
pbSet(save_in_variable, @selected_pokemon)
end
def give_answer(prompt_message, answer_id, should_generate_new_choices)
def give_answer(prompt_message, answer_id, choices,question_type=:BODY)
question_answered = false
answer_pokemon_name = getPokemon(answer_id).real_name
while !question_answered
if @difficulty == :ADVANCED
player_answer = prompt_pick_answer_advanced(prompt_message, answer_id)
else
player_answer = prompt_pick_answer_regular(prompt_message, answer_id, should_generate_new_choices)
player_answer = prompt_pick_answer_regular(prompt_message, answer_id, choices,question_type)
end
confirmed = pbMessage("Is this your final answer?", ["Yes", "No"])
confirmed = pbMessage(_INTL("Is this your final answer?"), [_INTL("Yes"), _INTL("No")])
if confirmed == 0
question_answered = true
else
@@ -251,36 +252,61 @@ class FusionQuiz
return player_answer == answer_pokemon_name
end
def get_random_pokemon_from_same_egg_group(pokemon, previous_choices)
def get_random_pokemon_from_same_egg_group(pokemon, amount_required)
pokemon = ::GameData::Species.get(pokemon)
egg_groups = getPokemonEggGroups(pokemon)
while true
new_pokemon = rand(1, NB_POKEMON) + 1
# Get a list all pokemon in the same egg group
matching_egg_group = []
for num in 1..NB_POKEMON
next if pokemon.id_number == num
next if matching_egg_group.include?(num)
new_pokemon = ::GameData::Species.get(num)
new_pokemon_egg_groups = getPokemonEggGroups(new_pokemon)
if (egg_groups & new_pokemon_egg_groups).any? && !previous_choices.include?(new_pokemon)
return new_pokemon
matching_egg_group << num if (egg_groups & new_pokemon_egg_groups).any?
end
# Select random pokemon from the list
matching_egg_group.shuffle!
choices = []
for index in 1..amount_required
if matching_egg_group[index].nil?
# If there's not enough pokemon in the list (e.g. for Ditto), get anything
new_pokemon = rand(1..NB_POKEMON) until !choices.include?(new_pokemon) && new_pokemon != pokemon.id_number
choices << new_pokemon
else
choices << matching_egg_group[index]
end
end
return choices
end
def prompt_pick_answer_regular(prompt_message, real_answer, should_new_choices)
commands = should_new_choices ? generate_new_choices(real_answer) : @choices.shuffle
def prompt_pick_answer_regular(prompt_message, real_answer, choices, question_type=:BODY)
if choices && choices.is_a?(Array)
commands = choices.shuffle
else
commands = generate_new_choices(real_answer,question_type)
end
chosen = pbMessage(prompt_message, commands)
return commands[chosen]
end
def generate_new_choices(real_answer)
def generate_new_choices(real_answer,question_type=:BODY)
choices = []
choices << real_answer
choices << get_random_pokemon_from_same_egg_group(real_answer, choices)
choices << get_random_pokemon_from_same_egg_group(real_answer, choices)
choices << get_random_pokemon_from_same_egg_group(real_answer, choices)
choices.push(*get_random_pokemon_from_same_egg_group(real_answer, 3))
commands = []
choices.each do |dex_num, i|
species = getPokemon(dex_num)
commands.push(species.real_name)
end
@choices = commands
if question_type == :BODY
@body_choices = commands
else
@head_choices = commands
end
return commands.shuffle
end

View File

@@ -0,0 +1,83 @@
def turnEventTowardsEvent(turning, turnedTowards)
event_x = turnedTowards.x
event_y = turnedTowards.y
if turning.x < event_x
turning.turn_right # Event is to the right of the player
elsif turning.x > event_x
turning.turn_left # Event is to the left of the player
elsif turning.y < event_y
turning.turn_down # Event is below the player
elsif turning.y > event_y
turning.turn_up # Event is above the player
end
end
def turnPlayerTowardsEvent(event)
if event.is_a?(Integer)
event = $game_map.events[event]
end
event_x = event.x
event_y = event.y
if $game_player.x < event_x
$game_player.turn_right # Event is to the right of the player
elsif $game_player.x > event_x
$game_player.turn_left # Event is to the left of the player
elsif $game_player.y < event_y
$game_player.turn_down # Event is below the player
elsif $game_player.y > event_y
$game_player.turn_up # Event is above the player
end
end
def giveJigglypuffScribbles(possible_versions = [1, 2, 3, 4])
selected_scribbles_version = possible_versions.sample
case selected_scribbles_version
when 1
scribbles_id = HAT_SCRIBBLES1
when 2
scribbles_id = HAT_SCRIBBLES2
when 3
scribbles_id = HAT_SCRIBBLES3
when 4
scribbles_id = HAT_SCRIBBLES4
end
return if !scribbles_id
if !hasHat?(scribbles_id)
$Trainer.unlocked_hats << scribbles_id
end
putOnHat(scribbles_id, true, true)
end
# type:
# 0: default
# 1: wood
def sign(message, type = 0)
signId = "sign_#{type}"
formatted_message = "\\sign[#{signId}]#{message}"
pbMessage(formatted_message)
end
def setEventGraphicsToPokemon(species, eventId)
event = $game_map.events[eventId]
return if !event
event.character_name = "Followers/#{species.to_s}"
event.refresh
end
# time in seconds
def idleHatEvent(hatId, time, switchToActivate = nil)
map = $game_map.map_id
i = 0
while i < (time / 5) do
# /5 because we update 5 times per second
return if $game_map.map_id != map
i += 1
pbWait(4)
i = 0 if $game_player.moving?
echoln i
end
$game_switches[switchToActivate] = true if switchToActivate
obtainHat(hatId)
end

View File

@@ -1,5 +1,17 @@
class PokemonTemp
def pbClearAllTempEvents()
# def pbClearAllTempEvents()
# echoln @tempEvents
# @tempEvents.keys.each {|map_id|
# map = $MapFactory.getMap(map_id,false)
# @tempEvents[map_id].each { |event|
# map.events[event.id] = nil
# }
# }
# @tempEvents={}
# @silhouetteDirection=nil
# end
def pbClearSilhouetteTempEvents()
echoln @tempEvents
@tempEvents.keys.each {|map_id|
map = $MapFactory.getMap(map_id,false)
@@ -36,7 +48,7 @@ end
Events.onStepTaken += proc { |sender, e|
next if !$PokemonTemp.silhouetteDirection
if $PokemonTemp.silhouetteDirection && $PokemonTemp.silhouetteDirection == $game_player.direction
$PokemonTemp.pbClearAllTempEvents
$PokemonTemp.pbClearSilhouetteTempEvents
$PokemonTemp.silhouetteDirection = nil
end
}
@@ -52,7 +64,7 @@ Events.onStepTaken += proc { |sender, e|
steps_nb = minimum_steps if steps_nb<minimum_steps
next if $PokemonGlobal.stepcount % steps_nb != 0
next if !isOutdoor()
$PokemonTemp.pbClearAllTempEvents
$PokemonTemp.pbClearSilhouetteTempEvents
spawnSilhouette()
}
Events.onMapChange += proc { |sender, e|

View File

@@ -0,0 +1,19 @@
def displayPicture(image, x, y, z = 0)
pictureWindow = PictureWindow.new(image)
pictureWindow.z = z
pictureWindow.x = x
pictureWindow.y = y
pictureWindow.opacity = 0
return pictureWindow
end
def showPokemonInPokeballWithMessage(pif_sprite, message, x_position = nil, y_position = nil)
x_position = Graphics.width / 4 if !x_position
y_position = 10 if !y_position
background_sprite = displayPicture("Graphics/Pictures/Trades/trade_pokeball_open_back", x_position, y_position, 1)
foreground_sprite = displayPicture("Graphics/Pictures/Trades/trade_pokeball_open_front", x_position, y_position, 9999)
displaySpriteWindowWithMessage(pif_sprite, message, 90, -10, 201)
background_sprite.dispose
foreground_sprite.dispose
end

View File

@@ -0,0 +1,139 @@
# todo: make the flower disappear from the tileset somehow?
def oricorioEventPickFlower(flower_color)
quest_progression = pbGet(VAR_ORICORIO_FLOWERS)
if flower_color == :PINK
if !$game_switches[SWITCH_ORICORIO_QUEST_PINK]
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
pbWildBattle(:FOMANTIS, 10)
end
$game_switches[SWITCH_ORICORIO_QUEST_PINK] = true
pbMessage(_INTL("It's a flower with pink nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the pink flowers.", $Trainer.name))
elsif flower_color == :RED && quest_progression == 1
$game_switches[SWITCH_ORICORIO_QUEST_RED] = true
pbMessage(_INTL("It's a flower with red nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the red flowers.", $Trainer.name))
elsif flower_color == :BLUE && quest_progression == 2
$game_switches[SWITCH_ORICORIO_QUEST_BLUE] = true
pbMessage(_INTL("It's a flower with blue nectar."))
pbSEPlay("MiningAllFound")
pbMessage(_INTL("{1} picked some of the blue flowers.", $Trainer.name))
end
end
def hasOricorioInParty()
return $Trainer.has_species_or_fusion?(:ORICORIO_1) || $Trainer.has_species_or_fusion?(:ORICORIO_2) || $Trainer.has_species_or_fusion?(:ORICORIO_3) || $Trainer.has_species_or_fusion?(:ORICORIO_4)
end
def changeOricorioFlower(form = 1)
if $PokemonGlobal.stepcount % 25 == 0
if !hatUnlocked?(HAT_FLOWER) && rand(2) == 0
obtainHat(HAT_FLOWER)
$PokemonGlobal.stepcount += 1
else
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
pbWildBattle(:FOMANTIS, 10)
$PokemonGlobal.stepcount += 1
end
end
return unless hasOricorioInParty
message = ""
form_name = ""
if form == 1
message = _INTL("It's a flower with red nectar. ")
form_name = "Baile"
elsif form == 2
message = _INTL("It's a flower with yellow nectar. ")
form_name = "Pom-pom"
elsif form == 3
message = _INTL("It's a flower with pink nectar. ")
form_name = "Pa'u"
elsif form == 4
message = _INTL("It's a flower with blue nectar. ")
form_name = "Sensu"
end
message = message + _INTL("Show it to a Pokémon?")
if pbConfirmMessage(message)
pbChoosePokemon(1, 2,
proc { |poke|
!poke.egg? &&
(Kernel.isPartPokemon(poke, :ORICORIO_1) ||
Kernel.isPartPokemon(poke, :ORICORIO_2) ||
Kernel.isPartPokemon(poke, :ORICORIO_3) ||
Kernel.isPartPokemon(poke, :ORICORIO_4))
})
if (pbGet(1) != -1)
poke = $Trainer.party[pbGet(1)]
if changeOricorioForm(poke, form)
pbMessage(_INTL("{1} switched to the {2} style", poke.name, form_name))
pbSet(1, poke.name)
else
pbMessage(_INTL("{1} remained the same...", poke.name, form_name))
end
end
end
end
def changeOricorioForm(pokemon, form = nil)
oricorio_forms = [:ORICORIO_1, :ORICORIO_2, :ORICORIO_3, :ORICORIO_4]
body_id = pokemon.isFusion? ? get_body_species_from_symbol(pokemon.species) : pokemon.species
head_id = pokemon.isFusion? ? get_head_species_from_symbol(pokemon.species) : pokemon.species
oricorio_body = oricorio_forms.include?(body_id)
oricorio_head = oricorio_forms.include?(head_id)
target_form = case form
when 1 then :ORICORIO_1
when 2 then :ORICORIO_2
when 3 then :ORICORIO_3
when 4 then :ORICORIO_4
else return false
end
if oricorio_body && oricorio_head && body_id == target_form && head_id == target_form
return false
end
if form == 1
body_id = :ORICORIO_1 if oricorio_body
head_id = :ORICORIO_1 if oricorio_head
elsif form == 2
body_id = :ORICORIO_2 if oricorio_body
head_id = :ORICORIO_2 if oricorio_head
elsif form == 3
body_id = :ORICORIO_3 if oricorio_body
head_id = :ORICORIO_3 if oricorio_head
elsif form == 4
body_id = :ORICORIO_4 if oricorio_body
head_id = :ORICORIO_4 if oricorio_head
else
return false
end
head_number = getDexNumberForSpecies(head_id)
body_number = getDexNumberForSpecies(body_id)
newForm = pokemon.isFusion? ? getSpeciesIdForFusion(head_number, body_number) : head_id
$Trainer.pokedex.set_seen(newForm)
$Trainer.pokedex.set_owned(newForm)
pokemon.species = newForm
return true
end
# chance: out of 100
def lilypadEncounter(pokemon, minLevel, maxLevel, chance = 10)
minLevel, maxLevel = [minLevel, maxLevel].minmax
level = rand(minLevel..maxLevel)
event = $game_map.events[@event_id]
return if !event
if rand(0..100) <= chance
pbWildBattle(pokemon, level)
else
playAnimation(Settings::GRASS_ANIMATION_ID, event.x, event.y)
end
event.erase
end

View File

@@ -0,0 +1,5 @@
def isOutdoor()
current_map = $game_map.map_id
map_metadata = GameData::MapMetadata.try_get(current_map)
return map_metadata && map_metadata.outdoor_map
end

View File

@@ -0,0 +1,173 @@
# Necessary dor setting the various events within the pokemart map, uses the numbers as wondertrade
def get_city_numerical_id(city_sym)
return get_city_numerical_id_hoenn(city_sym) if Settings::GAME_ID == :IF_HOENN
current_city_numerical = {
:PEWTER => 1,
:CERULEAN => 2,
:VERMILLION => 3,
:LAVENDER => 4,
:CELADON => 5,
:FUCHSIA => 6,
:SAFFRON => 7,
:CINNABAR => 8,
:LEAGUE => 9,
:VIOLET => 10,
:AZALEA => 11,
:GOLDENROD => 12,
:ECRUTEAK => 13,
:MAHOGANY => 14,
:BLACKTHORN => 15,
:OLIVINE => 16,
:CIANWOOD => 17,
:KNOTISLAND => 18,
:BOONISLAND => 19,
:KINISLAND => 20,
:CHRONOISLAND => 21,
:CRIMSON => 22,
}
return current_city_numerical[city_sym]
end
POKEMART_MAP_ID = 357
POKEMART_DOOR_POS = [12, 12]
# city -> Symbol
def enter_pokemart(city)
pbSet(VAR_CURRENT_MART, city)
pbSet(VAR_CURRENT_CITY_NUMERICAL_ID, get_city_numerical_id(city))
echoln get_city_numerical_id(city)
pbFadeOutIn {
$game_temp.player_new_map_id = POKEMART_MAP_ID
$game_temp.player_new_x = POKEMART_DOOR_POS[0]
$game_temp.player_new_y = POKEMART_DOOR_POS[1]
$scene.transfer_player(true)
$game_map.autoplay
$game_map.refresh
}
end
def exit_pokemart()
return exit_pokemart_hoenn() if Settings::GAME_ID == :IF_HOENN
pokemart_entrances = {
:PEWTER => [380, 43, 24],
:CERULEAN => [1, 24, 22],
:VERMILLION => [19, 32, 13],
:LAVENDER => [50, 20, 23],
:CELADON => [95, 18, 15], # not a real pokemart
:FUCHSIA => [472, 7, 17],
:SAFFRON => [108, 53, 24],
:CINNABAR => [98, 30, 30],
:CRIMSON => [167, 21, 36],
:GOLDENROD => [237, 36, 33], # not a real pokemart
:AZALEA => [278, 34, 17],
:AZALEA_FLOODED => [338, 34, 17],
:VIOLET => [230, 20, 31],
:BLACKTHORN => [329, 16, 36],
:MAHOGANY => [631, 19, 19], # not a real pokemart
:ECRUTEAK => [359, 46, 38],
:OLIVINE => [138, 33, 23],
:CIANWOOD => [709.8, 46],
}
current_city = pbGet(VAR_CURRENT_MART)
current_city = :PEWTER if !current_city.is_a?(Symbol)
entrance_map = pokemart_entrances[current_city][0]
entrance_x = pokemart_entrances[current_city][1]
entrance_y = pokemart_entrances[current_city][2]
reset_pokemart_variables
pbFadeOutIn {
$game_temp.player_new_map_id = entrance_map
$game_temp.player_new_x = entrance_x
$game_temp.player_new_y = entrance_y
$scene.transfer_player(true)
$game_map.autoplay
$game_map.refresh
}
end
def reset_pokemart_variables
pbSet(VAR_CURRENT_CITY_NUMERICAL_ID, 0)
pbSet(VAR_CURRENT_MART, 0)
end
def pokemart_clothes_shop(current_city = nil, include_defaults = true)
current_city = pbGet(VAR_CURRENT_MART) if !current_city
echoln current_city
current_city = :PEWTER if !current_city.is_a?(Symbol)
current_city_tag = current_city.to_s.downcase
selector = OutfitSelector.new
list = selector.generate_clothes_choice(
baseOptions = include_defaults,
additionalIds = [],
additionalTags = [current_city_tag],
filterOutTags = [])
clothesShop(list)
end
def pokemart_hat_shop(include_defaults = true)
current_city = pbGet(VAR_CURRENT_MART)
current_city = :PEWTER if !current_city.is_a?(Symbol)
current_city_tag = current_city.to_s.downcase
selector = OutfitSelector.new
list = selector.generate_hats_choice(
baseOptions = include_defaults,
additionalIds = [],
additionalTags = [current_city_tag],
filterOutTags = [])
hatShop(list)
end
def get_mart_exclusive_items(city)
return get_mart_exclusive_items_hoenn if Settings::GAME_ID == :IF_HOENN
items_list = []
case city
when :PEWTER;
items_list = [:ROCKGEM, :NESTBALL]
when :VIRIDIAN;
items_list = []
when :CERULEAN;
items_list = [:WATERGEM, :NETBALL, :PRETTYWING]
when :VERMILLION;
items_list = [:LOVEBALL, :ELECTRICGEM]
when :LAVENDER;
items_list = [:GHOSTGEM, :DARKGEM, :DUSKBALL]
when :CELADON;
items_list = [:GRASSGEM, :FLYINGGEM, :QUICKBALL, :TIMERBALL,]
when :FUCHSIA;
items_list = [:POISONGEM, :REPEATBALL]
when :SAFFRON;
items_list = [:PSYCHICGEM, :FIGHTINGGEM, :FRIENDBALL]
when :CINNABAR;
items_list = [:FIREGEM, :ICEGEM, :HEAVYBALL]
when :CRIMSON;
items_list = [:DRAGONGEM, :LEVELBALL]
when :GOLDENROD;
items_list = [:EVERSTONE, :MOONSTONE, :SUNSTONE, :DUSKSTONE, :DAWNSTONE, :SHINYSTONE]
when :AZALEA;
items_list = [:BUGGEM]
when :VIOLET;
items_list = [:FLYINGGEM, :STATUSBALL]
when :BLACKTHORN;
items_list = [:DRAGONGEM, :CANDYBALL]
when :CHERRYGROVE;
items_list = [:BUGGEM, :PUREBALL]
when :MAHOGANY;
items_list = []
when :ECRUTEAK;
items_list = [:GHOSTGEM, :DARKGEM]
when :OLIVINE;
items_list = []
when :CIANWOOD;
items_list = []
when :KNOTISLAND;
items_list = []
when :BOONISLAND;
items_list = []
when :KINISLAND;
items_list = []
when :CHRONOISLAND;
items_list = []
end
return items_list
end

View File

@@ -0,0 +1,16 @@
def playPokeFluteAnimation
# return if $Trainer.outfit != 0
# $game_player.setDefaultCharName("players/pokeflute", 0, false)
# Graphics.update
# Input.update
# pbUpdateSceneMap
end
def restoreDefaultCharacterSprite(charset_number = 0)
meta = GameData::Metadata.get_player($Trainer.character_ID)
$game_player.setDefaultCharName(nil, 0, false)
$game_player.character_name = meta[1]
Graphics.update
Input.update
pbUpdateSceneMap
end

View File

@@ -0,0 +1,16 @@
def isPlayerMale()
return pbGet(VAR_TRAINER_GENDER) == GENDER_MALE
end
def isPlayerFemale()
return pbGet(VAR_TRAINER_GENDER) == GENDER_FEMALE
end
def getPlayerGenderId()
return pbGet(VAR_TRAINER_GENDER)
end
def isPostgame?()
return $game_switches[SWITCH_BEAT_THE_LEAGUE]
end

View File

@@ -0,0 +1,99 @@
def obtainStarter(starterIndex = 0)
if ($game_switches[SWITCH_LEGENDARY_MODE])
generated_list = pbGet(VAR_LEGENDARY_STARTERS_CHOICES)
if generated_list.is_a?(Array)
startersList = generated_list
else
startersList = generate_legendary_mode_starters
pbSet(VAR_LEGENDARY_STARTERS_CHOICES,startersList)
end
starter = startersList[starterIndex]
elsif ($game_switches[SWITCH_RANDOM_STARTERS])
starter = obtainRandomizedStarter(starterIndex)
else
startersList = Settings::DEFAULT_STARTERS
if $game_switches[SWITCH_JOHTO_STARTERS]
startersList = Settings::JOHTO_STARTERS
elsif $game_switches[SWITCH_HOENN_STARTERS]
startersList = Settings::HOENN_STARTERS
elsif $game_switches[SWITCH_SINNOH_STARTERS]
startersList = Settings::SINNOH_STARTERS
elsif $game_switches[SWITCH_KALOS_STARTERS]
startersList = Settings::KALOS_STARTERS
elsif $game_switches[SWITCH_MIXED_STARTERS]
if $game_temp.starter_options
startersList = $game_temp.starter_options
else
$game_temp.starter_options = generate_mixed_starters_list
startersList = $game_temp.starter_options
end
end
starter = startersList[starterIndex]
end
return GameData::Species.get(starter)
end
def generate_mixed_starters_list
grass_option = Settings::GRASS_STARTERS.sample
fire_option = Settings::FIRE_STARTERS.sample
water_option = Settings::WATER_STARTERS.sample
return [grass_option, fire_option, water_option]
end
# body0
# head 1
def setRivalStarter(starterIndex1, starterIndex2)
starter1 = obtainStarter(starterIndex1)
starter2 = obtainStarter(starterIndex2)
ensureRandomHashInitialized()
if $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] || $game_switches[SWITCH_LEGENDARY_MODE] # if fused starters, only take index 1
starter = obtainStarter(starterIndex1)
else
starter_body = starter1.id_number
starter_head = starter2.id_number
starter = getFusionSpecies(starter_body, starter_head).id_number
end
if $game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]
starterSpecies = GameData::Species.get(starter)
starter = GameData::Species.get(starterSpecies.get_baby_species(false)).id_number
end
pbSet(VAR_RIVAL_STARTER, starter)
$game_switches[SWITCH_DEFINED_RIVAL_STARTER] = true
return starter
end
def setStarterEasterEgg
should_apply_easter_egg = true
case $Trainer.name.downcase
when "ash"
starter = :PIKACHU
rival_starter_body = :EEVEE
rival_starter_head = :EEVEE
when "gary"
starter = :EEVEE
rival_starter_body = :PIKACHU
rival_starter_head = :PIKACHU
when "god"
starter = :BIDOOF
rival_starter_body = :ARCEUS
rival_starter_head = :OMANYTE
when "?"
starter = getSpecies(rand(NB_POKEMON))
rival_starter_body = getSpecies(rand(NB_POKEMON))
rival_starter_head = getSpecies(rand(NB_POKEMON))
when "schrroms", "frogman", "frogzilla", "chardub"
starter = fusionOf(:POLIWAG,:MACHAMP)
rival_starter_body = :POLIWAG
rival_starter_head = :MACHAMP
else
should_apply_easter_egg = false
end
if should_apply_easter_egg
pbSet(VAR_PLAYER_STARTER_CHOICE,getDexNumberForSpecies(starter))
pbSet(VAR_RIVAL_STARTER_HEAD_CHOICE,getDexNumberForSpecies(rival_starter_head))
pbSet(VAR_RIVAL_STARTER_BODY_CHOICE,getDexNumberForSpecies(rival_starter_body))
$game_switches[SWITCH_CUSTOM_STARTERS] = true
end
end

View File

@@ -16,7 +16,7 @@ class PokemonPokedexInfo_Scene
def drawPageForms()
#@selected_index=0
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_forms")
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
@@ -30,19 +30,19 @@ class PokemonPokedexInfo_Scene
@sprites["bgSelected_previous"] = IconSprite.new(0, 0, @viewport)
@sprites["bgSelected_previous"].x = X_POSITION_BG_PREVIOUS
@sprites["bgSelected_previous"].y = Y_POSITION_BG_SMALL
@sprites["bgSelected_previous"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms_selected_small"))
@sprites["bgSelected_previous"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_small")
@sprites["bgSelected_previous"].visible = false
@sprites["bgSelected_center"] = IconSprite.new(0, 0, @viewport)
@sprites["bgSelected_center"].x = X_POSITION_BG_SELECTED
@sprites["bgSelected_center"].y = Y_POSITION_BG_BIG
@sprites["bgSelected_center"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms_selected_large"))
@sprites["bgSelected_center"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_large")
@sprites["bgSelected_center"].visible = false
@sprites["bgSelected_next"] = IconSprite.new(0, 0, @viewport)
@sprites["bgSelected_next"].x = X_POSITION_BG_NEXT
@sprites["bgSelected_next"].y = Y_POSITION_BG_SMALL
@sprites["bgSelected_next"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms_selected_small"))
@sprites["bgSelected_next"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_small")
@sprites["bgSelected_next"].visible = false
@creditsOverlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap
@@ -347,20 +347,20 @@ class PokemonPokedexInfo_Scene
if @available.length > 1
if is_main_sprite()
if brief
pbMessage("This sprite will remain the displayed sprite")
pbMessage(_INTL("This sprite will remain the displayed sprite"))
return true
else
pbMessage("This sprite is already the displayed sprite")
pbMessage(_INTL("This sprite is already the displayed sprite"))
end
else
message = 'Would you like to use this sprite instead of the current sprite?'
if pbConfirmMessage(_INTL(message))
message = _INTL('Would you like to use this sprite instead of the current sprite?')
if pbConfirmMessage(message)
swap_main_sprite()
return true
end
end
else
pbMessage("This is the only sprite available for this Pokémon!")
pbMessage(_INTL("This is the only sprite available for this Pokémon!"))
end
return false
end

View File

@@ -0,0 +1,45 @@
def get_constellation_variable(pokemon)
case pokemon
when :IVYSAUR;
return VAR_CONSTELLATION_IVYSAUR
when :WARTORTLE;
return VAR_CONSTELLATION_WARTORTLE
when :ARCANINE;
return VAR_CONSTELLATION_ARCANINE
when :MACHOKE;
return VAR_CONSTELLATION_MACHOKE
when :RAPIDASH;
return VAR_CONSTELLATION_RAPIDASH
when :GYARADOS;
return VAR_CONSTELLATION_GYARADOS
when :ARTICUNO;
return VAR_CONSTELLATION_ARTICUNO
when :MEW;
return VAR_CONSTELLATION_MEW
# when :POLITOED; return VAR_CONSTELLATION_POLITOED
# when :URSARING; return VAR_CONSTELLATION_URSARING
# when :LUGIA; return VAR_CONSTELLATION_LUGIA
# when :HOOH; return VAR_CONSTELLATION_HOOH
# when :CELEBI; return VAR_CONSTELLATION_CELEBI
# when :SLAKING; return VAR_CONSTELLATION_SLAKING
# when :JIRACHI; return VAR_CONSTELLATION_JIRACHI
# when :TYRANTRUM; return VAR_CONSTELLATION_TYRANTRUM
# when :SHARPEDO; return VAR_CONSTELLATION_SHARPEDO
# when :ARCEUS; return VAR_CONSTELLATION_ARCEUS
end
end
def constellation_add_star(pokemon)
star_variables = get_constellation_variable(pokemon)
pbSEPlay("GUI trainer card open", 80)
nb_stars = pbGet(star_variables)
pbSet(star_variables, nb_stars + 1)
end
def clear_all_images()
for i in 1..99
# echoln i.to_s + " : " + $game_screen.pictures[i].name
$game_screen.pictures[i].erase
end
end

View File

@@ -0,0 +1,148 @@
KANTO_DARKNESS_STAGE_1 = [
50, # Lavender town
409, # Route 8
351, # Route 9 (east)
495, # Route 9 (west)
154, # Route 10
108, # Saffron city
1, # Cerulean City
387, # Cerulean City (race)
106, # Route 4
8, # Route 24
9, # Route 25
400, # Pokemon Tower
401, # Pokemon Tower
402, # Pokemon Tower
403, # Pokemon Tower
467, # Pokemon Tower
468, # Pokemon Tower
469, # Pokemon Tower
159, # Route 12
349, # Rock tunnel
350, # Rock tunnel
512, # Rock tunnel (outdoor)
12, # Route 5
]
KANTO_DARKNESS_STAGE_2 = [
95, # Celadon city
436, # Celadon city dept store (roof)
143, # Route 23
167, # Crimson city
413, # Route 7
438, # Route 16
146, # Route 17
106, # Route 4
19, # Vermillion City
36, # S.S. Anne deck
16, # Route 6
437, # Route 13
155, # Route 11
140, # Diglett cave
398, # Diglett cave
399, # Diglett cave
]
KANTO_DARKNESS_STAGE_3 = [
472, # Fuchsia city
445, # Safari Zone 1
484, # Safari Zone 2
485, # Safari Zone 3
486, # Safari Zone 4
487, # Safari Zone 5
444, # Route 15
440, # Route 14
712, # Creepy house
517, # Route 18
57, # Route 19
227, # Route 19 (underwater)
56, # Route 19 (surf race)
58, # Route 20
480, # Route 20 underwater 1
228, # Route 20 underwater 2
98, # Cinnabar island
58, # Route 21
827, # Mt. Moon summit
]
KANTO_DARKNESS_STAGE_4 = KANTO_OUTDOOR_MAPS
def darknessEffectOnCurrentMap()
return if !$game_switches
return if !$game_switches[SWITCH_KANTO_DARKNESS]
return darknessEffectOnMap($game_map.map_id)
end
def darknessEffectOnMap(map_id)
return if !$game_switches
return if !$game_switches[SWITCH_KANTO_DARKNESS]
return if !KANTO_OUTDOOR_MAPS.include?(map_id)
dark_maps = []
dark_maps += KANTO_DARKNESS_STAGE_1 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_1]
dark_maps += KANTO_DARKNESS_STAGE_2 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_2]
dark_maps += KANTO_DARKNESS_STAGE_3 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_3]
dark_maps = KANTO_OUTDOOR_MAPS if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_4]
return dark_maps.include?(map_id)
end
def apply_darkness()
$PokemonTemp.darknessSprite = DarknessSprite.new
darkness = $PokemonTemp.darknessSprite
darkness.radius = 276
while darkness.radius > 64
Graphics.update
Input.update
pbUpdateSceneMap
darkness.radius -= 4
end
$PokemonGlobal.flashUsed = false
$PokemonTemp.darknessSprite.dispose
Events.onMapSceneChange.trigger(self, $scene, true)
end
def isInMtMoon()
mt_moon_maps = [102, 103, 105, 496, 104]
return mt_moon_maps.include?($game_map.map_id)
end
def getMtMoonDirection()
maps_east = [380, # Pewter city
490, # Route 3
303, # indigo plateau
145, # Route 26
147, # Route 27
]
maps_south = [
8, # Route 24
9, # Route 25
143, # Route 23
167, # Crimson city
]
maps_west = [
106, # route 4
1, # cerulean
495, # route 9
351, # route 9
10 # cerulean cape
]
return 2 if maps_south.include?($game_map.map_id)
return 4 if maps_west.include?($game_map.map_id)
return 6 if maps_east.include?($game_map.map_id)
return 8 # north (most maps)
end
def getNextLunarFeatherHint()
nb_feathers = pbGet(VAR_LUNAR_FEATHERS)
case nb_feathers
when 0
return _INTL("Find the first feather in the northernmost dwelling in the port of exquisite sunsets...")
when 1
return _INTL("Amidst a nursery for Pokémon youngsters, the second feather hides, surrounded by innocence.")
when 2
return _INTL("Find the next one in the inn where water meets rest")
when 3
return _INTL("Find the next one inside the lone house in the city at the edge of civilization.")
when 4
return _INTL("The final feather lies back in the refuge for orphaned Pokémon...")
else
return _INTL("Lie in the bed... Bring me the feathers...")
end
end

View File

@@ -0,0 +1,66 @@
def playMeloettaBandMusic()
unlocked_members = []
unlocked_members << :DRUM if $game_switches[SWITCH_BAND_DRUMMER]
unlocked_members << :AGUITAR if $game_switches[SWITCH_BAND_ACOUSTIC_GUITAR]
unlocked_members << :EGUITAR if $game_switches[SWITCH_BAND_ELECTRIC_GUITAR]
unlocked_members << :FLUTE if $game_switches[SWITCH_BAND_FLUTE]
unlocked_members << :HARP if $game_switches[SWITCH_BAND_HARP]
echoln unlocked_members
echoln (unlocked_members & [:DRUM, :AGUITAR, :EGUITAR, :FLUTE, :HARP])
track = "band/band_1"
if unlocked_members == [:DRUM, :AGUITAR, :EGUITAR, :FLUTE, :HARP]
track = "band/band_full"
else
if unlocked_members.include?(:FLUTE)
track = "band/band_5a"
elsif unlocked_members.include?(:HARP)
track = "band/band_5b"
else
if unlocked_members.include?(:EGUITAR) && unlocked_members.include?(:AGUITAR)
track = "band/band_4"
elsif unlocked_members.include?(:AGUITAR)
track = "band/band_3a"
elsif unlocked_members.include?(:EGUITAR)
track = "band/band_3b"
elsif unlocked_members.include?(:DRUM)
track = "band/band_2"
end
end
end
echoln track
pbBGMPlay(track)
end
def apply_concert_lighting(light, duration = 1)
tone = Tone.new(0, 0, 0)
case light
when :GUITAR_HIT
tone = Tone.new(-50, -100, -50)
when :VERSE_1
tone = Tone.new(-90, -110, -50)
when :VERSE_2_LIGHT
tone = Tone.new(-40, -80, -30)
when :VERSE_2_DIM
tone = Tone.new(-60, -100, -50)
when :CHORUS_1
tone = Tone.new(0, -80, -50)
when :CHORUS_2
tone = Tone.new(0, -50, -80)
when :CHORUS_3
tone = Tone.new(0, -80, -80)
when :CHORUS_END
tone = Tone.new(-68, 0, -102)
when :MELOETTA_1
tone = Tone.new(-60, -50, 20)
end
$game_screen.start_tone_change(tone, duration)
end
def isTuesdayNight()
day = getDayOfTheWeek()
hour = pbGetTimeNow().hour
echoln hour
return (day == :TUESDAY && hour >= 20) || (day == :WEDNESDAY && hour < 5)
end

View File

@@ -76,10 +76,10 @@ FieldQuestColor = :PURPLE
LegendaryQuestColor = :GOLD
TRQuestColor = :DARKRED
QuestBranchHotels = "Hotel Quests"
QuestBranchField = "Field Quests"
QuestBranchRocket = "Team Rocket Quests"
QuestBranchLegendary = "Legendary Quests"
QuestBranchHotels = _INTL("Hotel Quests")
QuestBranchField = _INTL("Field Quests")
QuestBranchRocket = _INTL("Team Rocket Quests")
QuestBranchLegendary = _INTL("Legendary Quests")
class PokeBattle_Trainer
attr_accessor :quests
@@ -104,7 +104,7 @@ def showNewQuestMessage(title,description, show_description)
pbMEPlay("Voltorb Flip Win")
pbCallBub(3)
Kernel.pbMessage("\\C[6]NEW QUEST: " + title)
Kernel.pbMessage(_INTL("\\C[6]NEW QUEST: ") + title)
if show_description
pbCallBub(3)
Kernel.pbMessage("\\C[1]" + description)
@@ -118,9 +118,11 @@ end
def finishQuest(id, silent=false)
$Trainer.quest_points = initialize_quest_points unless $Trainer.quest_points
return if pbCompletedQuest?(id)
$Trainer.quest_points+=1
pbMEPlay("Register phone") if !silent
Kernel.pbMessage("\\C[6]Quest completed!") if !silent
Kernel.pbMessage(_INTL("\\qp\\C[6]Quest completed!")) if !silent
$game_variables[VAR_KARMA] += 1 # karma
@@ -262,8 +264,8 @@ class Questlog
end
#pbDrawOutlineText(@main, 0, 142 - 178, 512, 384, "Ongoing: " + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
#pbDrawOutlineText(@main, 0, 198 - 178, 512, 384, "Completed: " + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 142, 512, 384, "Ongoing: " + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 198, 512, 384, "Completed: " + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 142, 512, 384, _INTL("Ongoing: ") + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 198, 512, 384, _INTL("Completed: ") + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
12.times do |i|
Graphics.update
@@ -369,9 +371,9 @@ class Questlog
pbDrawOutlineText(@main, 188, 330, 512, 384, quest.location, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@main, 10, -178, 512, 384, quest.name, quest.color, Color.new(0, 0, 0))
if !quest.completed
pbDrawOutlineText(@main, 8, 250, 512, 384, "Not Completed", pbColor(:LIGHTRED), Color.new(0, 0, 0))
pbDrawOutlineText(@main, 8, 250, 512, 384, _INTL("Not Completed"), pbColor(:LIGHTRED), Color.new(0, 0, 0))
else
pbDrawOutlineText(@main, 8, 250, 512, 384, "Completed", pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
pbDrawOutlineText(@main, 8, 250, 512, 384, _INTL("Completed"), pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
end
10.times do |i|
Graphics.update
@@ -401,20 +403,20 @@ class Questlog
@sprites["text2"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
@text2 = @sprites["text2"].bitmap
pbSetSystemFont(@text2)
pbDrawOutlineText(@text2, 188, -122, 512, 384, "Quest received in:", Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -122, 512, 384, _INTL("Quest received in:"), Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -94, 512, 384, quest.location, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -62, 512, 384, "Quest received at:", Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -62, 512, 384, _INTL("Quest received at:"), Color.new(255, 255, 255), Color.new(0, 0, 0))
time = quest.time.to_s
txt = time.split(' ')[1] + " " + time.split(' ')[2] + ", " + time.split(' ')[3].split(':')[0] + ":" + time.split(' ')[3].split(':')[1] rescue "?????"
pbDrawOutlineText(@text2, 188, -36, 512, 384, txt, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -4, 512, 384, "Quest received from:", Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, -4, 512, 384, _INTL("Quest received from:"), Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, 22, 512, 384, quest.npc, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, 162, 512, 384, "From " + quest.npc, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 188, 162, 512, 384, _INTL("From ") + quest.npc, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 10, -178, 512, 384, quest.name, quest.color, Color.new(0, 0, 0))
if !quest.completed
pbDrawOutlineText(@text2, 8, 136, 512, 384, "Not Completed", pbColor(:LIGHTRED), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 8, 136, 512, 384, _INTL("Not Completed"), pbColor(:LIGHTRED), Color.new(0, 0, 0))
else
pbDrawOutlineText(@text2, 8, 136, 512, 384, "Completed", pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
pbDrawOutlineText(@text2, 8, 136, 512, 384, _INTL("Completed"), pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
end
@sprites["text2"].x = 512
16.times do
@@ -455,12 +457,12 @@ class Questlog
@sprites["char"].src_rect.height = (@sprites["char"].bitmap.height / 4).round
@sprites["char"].src_rect.width = (@sprites["char"].bitmap.width / 4).round
drawTextExMulti(@text, 188, 54, 318, 8, quest.desc, Color.new(255, 255, 255), Color.new(0, 0, 0))
pbDrawOutlineText(@text, 188, 162, 512, 384, "From " + quest.npc, Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text, 188, 162, 512, 384, _INTL("From {1}",quest.npc), Color.new(255, 172, 115), Color.new(0, 0, 0))
pbDrawOutlineText(@text, 10, -178, 512, 384, quest.name, quest.color, Color.new(0, 0, 0))
if !quest.completed
pbDrawOutlineText(@text, 8, 136, 512, 384, "Not Completed", pbColor(:LIGHTRED), Color.new(0, 0, 0))
pbDrawOutlineText(@text, 8, 136, 512, 384, _INTL("Not Completed"), pbColor(:LIGHTRED), Color.new(0, 0, 0))
else
pbDrawOutlineText(@text, 8, 136, 512, 384, "Completed", pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
pbDrawOutlineText(@text, 8, 136, 512, 384, _INTL("Completed"), pbColor(:LIGHTBLUE), Color.new(0, 0, 0))
end
@sprites["text"].x = -512
16.times do
@@ -513,9 +515,9 @@ class Questlog
@text2.clear if @text2 rescue nil
@sel_two = 0
@scene = 0
pbDrawOutlineText(@main, 0, 2, 512, 384, "Quest Log", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 142, 512, 384, "Ongoing: " + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 198, 512, 384, "Completed: " + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 2, 512, 384, _INTL("Quest Log"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 142, 512, 384, _INTL("Ongoing: ") + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 198, 512, 384, _INTL("Completed: ") + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
12.times do |i|
Graphics.update
@sprites["bg0"].opacity += 32 if i < 8
@@ -571,7 +573,7 @@ class Questlog
else
@sprites["down"].visible = false
end
pbDrawOutlineText(@main, 0, 2, 512, 384, "Ongoing Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 2, 512, 384, _INTL("Ongoing Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
else
for i in 0...@completed.size
break if i > 5
@@ -589,7 +591,7 @@ class Questlog
else
@sprites["down"].visible = false
end
pbDrawOutlineText(@main, 0, 2 - 178, 512, 384, "Completed Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 2 - 178, 512, 384, _INTL("Completed Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
end
end
else
@@ -621,7 +623,7 @@ class Questlog
else
@sprites["down"].visible = false
end
pbDrawOutlineText(@main, 0, 2, 512, 384, "Ongoing Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 2, 512, 384, _INTL("Ongoing Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
else
for i in 0...@completed.size
break if i > 5
@@ -638,7 +640,7 @@ class Questlog
else
@sprites["down"].visible = false
end
pbDrawOutlineText(@main, 0, 2 - 178, 512, 384, "Completed Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 2 - 178, 512, 384, _INTL("Completed Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
end
end
end
@@ -707,8 +709,8 @@ class Questlog
#pbDrawOutlineText(@main, 11, -124 + 52 * i, 512, 384, @ongoing[i].name, @ongoing[i].color, Color.new(0, 0, 0), 1)
end
pbDrawOutlineText(@main, 0, 175, 512, 384, "No ongoing quests", pbColor(:WHITE), pbColor(:BLACK), 1) if @ongoing.size == 0
pbDrawOutlineText(@main, 0, 2, 512, 384, "Ongoing Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 175, 512, 384, _INTL("No ongoing quests"), pbColor(:WHITE), pbColor(:BLACK), 1) if @ongoing.size == 0
pbDrawOutlineText(@main, 0, 2, 512, 384, _INTL("Ongoing Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
12.times do |i|
Graphics.update
@sprites["main"].opacity += 32 if i < 8
@@ -730,8 +732,8 @@ class Questlog
pbDrawOutlineText(@main, 11, getCellYPosition(i), 512, 384, @completed[i].name, @completed[i].color, Color.new(0, 0, 0), 1)
end
pbDrawOutlineText(@main, 0, 175, 512, 384, "No completed quests", pbColor(:WHITE), pbColor(:BLACK), 1) if @completed.size == 0
pbDrawOutlineText(@main, 0, 2, 512, 384, "Completed Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
pbDrawOutlineText(@main, 0, 175, 512, 384, _INTL("No completed quests"), pbColor(:WHITE), pbColor(:BLACK), 1) if @completed.size == 0
pbDrawOutlineText(@main, 0, 2, 512, 384, _INTL("Completed Quests"), Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
12.times do |i|
Graphics.update
@sprites["main"].opacity += 32 if i < 8
@@ -959,6 +961,7 @@ end
def fix_quest_ids
return unless $Trainer.quests
$Trainer.quests.each do |quest|
new_id = get_new_quest_id(quest.id)
if new_id != quest.id
@@ -1079,11 +1082,11 @@ def showQuestStatistics(eventId,includeRocketQuests=false)
end
end
pbCallBub(2, eventId)
pbMessage("Accepted quests: \\C[1]#{quests_accepted.length}")
pbMessage(_INTL("Accepted quests: \\C[1]{1}",quests_accepted.length))
pbCallBub(2, eventId)
pbMessage("Completed quests: \\C[1]#{quests_completed.length}")
pbMessage(_INTL("Completed quests: \\C[1]{1}",quests_completed.length))
pbCallBub(2, eventId)
pbMessage("In-progress: \\C[1]#{quests_in_progress.length}")
pbMessage(_INTL("In-progress: \\C[1]{1}",quests_in_progress.length))
end
def get_completed_quests(includeRocketQuests=false)
@@ -1119,9 +1122,9 @@ def getQuestReward(eventId)
next
end
pbCallBub(2, eventId)
pbMessage("Also, there's one more thing...")
pbMessage(_INTL("Also, there's one more thing..."))
pbCallBub(2, eventId)
pbMessage("As a gift for having helped so many people, I want to give you this.")
pbMessage(_INTL("As a gift for having helped so many people, I want to give you this."))
pbReceiveItem(reward.item, reward.quantity)
$PokemonGlobal.questRewardsObtained << reward.item
@@ -1133,11 +1136,11 @@ def getQuestReward(eventId)
pbCallBub(2, eventId)
if nb_to_next_reward <= 0
pbMessage("I have no more rewards to give you! Thanks for helping all these people!")
pbMessage(_INTL("I have no more rewards to give you! Thanks for helping all these people!"))
elsif nb_to_next_reward == 1
pbMessage("Help #{nb_to_next_reward} more person and I'll give you something good!")
pbMessage(_INTL("Help {1} more person and I'll give you something good!",nb_to_next_reward))
else
pbMessage("Help #{nb_to_next_reward} more people and I'll give you something good!")
pbMessage(_INTL("Help {1} more people and I'll give you something good!",nb_to_next_reward))
end
end

View File

@@ -0,0 +1,13 @@
#
# Rewards given by hotel questman after a certain nb. of completed quests
#
QUEST_REWARDS = [
QuestReward.new(1, :HM08, 1, _INTL("This HM will allow you to illuminate dark caves and should help you to progress in your journey!")),
QuestReward.new(5, :AMULETCOIN, 1, _INTL("This item will allows you to get twice the money in a battle if the Pokémon holding it took part in it!")),
QuestReward.new(10, :LANTERN, 1, _INTL("This will allow you to illuminate caves without having to use a HM! Practical, isn't it?")),
QuestReward.new(15, :LINKINGCORD, 3, _INTL("This strange cable triggers the evolution of Pokémon that typically evolve via trade. I know you'll put it to good use!")),
QuestReward.new(20, :SLEEPINGBAG, 1, _INTL("This handy item will allow you to sleep anywhere you want. You won't even need hotels anymore!")),
QuestReward.new(30, :MISTSTONE, 1, _INTL("This rare stone can evolve any Pokémon, regardless of their level or evolution method. Use it wisely!"), true),
QuestReward.new(50, :GSBALL, 1, _INTL("This mysterious ball is rumored to be the key to call upon the protector of Ilex Forest. It's a precious relic.")),
QuestReward.new(60, :MASTERBALL, 1, _INTL("This rare ball can catch any Pokémon. Don't waste it!"), true),
]

View File

@@ -0,0 +1,32 @@
def failAllIncompleteRocketQuests()
for trainer_quest in $Trainer.quests
finishTRQuest("tr_cerulean_1", :FAILURE) if trainer_quest.id == "tr_cerulean_1" && !pbCompletedQuest?("tr_cerulean_1")
finishTRQuest("tr_cerulean_2", :FAILURE) if trainer_quest.id == "tr_cerulean_2" && !pbCompletedQuest?("tr_cerulean_2")
finishTRQuest("tr_cerulean_3", :FAILURE) if trainer_quest.id == "tr_cerulean_3" && !pbCompletedQuest?("tr_cerulean_3")
finishTRQuest("tr_cerulean_4", :FAILURE) if trainer_quest.id == "tr_cerulean_4" && !pbCompletedQuest?("tr_cerulean_4")
finishTRQuest("tr_celadon_1", :FAILURE) if trainer_quest.id == "tr_celadon_1" && !pbCompletedQuest?("tr_celadon_1")
finishTRQuest("tr_celadon_2", :FAILURE) if trainer_quest.id == "tr_celadon_2" && !pbCompletedQuest?("tr_celadon_2")
finishTRQuest("tr_celadon_3", :FAILURE) if trainer_quest.id == "tr_celadon_3" && !pbCompletedQuest?("tr_celadon_3")
finishTRQuest("tr_celadon_4", :FAILURE) if trainer_quest.id == "tr_celadon_4" && !pbCompletedQuest?("tr_celadon_4")
end
end
def Kernel.setRocketPassword(variableNum)
abilityIndex = rand(233)
speciesIndex = rand(PBSpecies.maxValue - 1)
word1 = PBSpecies.getName(speciesIndex)
word2 = GameData::Ability.get(abilityIndex).name
password = _INTL("{1}'s {2}", word1, word2)
pbSet(variableNum, password)
end
def initialize_quest_points
return if $Trainer.quest_points
$Trainer.quest_points = get_completed_quests(false).length
end
def player_has_quest_journal?
return $PokemonBag.pbHasItem?(:DEVONSCOPE) || $PokemonBag.pbHasItem?(:NOTEBOOK)
end

View File

@@ -0,0 +1,150 @@
def define_quest(quest_id,quest_type,quest_name,quest_description,quest_location,npc_sprite)
case quest_type
when :HOTEL_QUEST
text_color = HotelQuestColor
when :FIELD_QUEST
text_color = FieldQuestColor
when :LEGENDARY_QUEST
text_color = LegendaryQuestColor
when :ROCKET_QUEST
text_color = TRQuestColor
end
new_quest = Quest.new(quest_id, quest_name, quest_description, npc_sprite, quest_location, quest_location, text_color)
QUESTS[quest_id] = new_quest
end
QUESTS = {
#Pokemart
"pokemart_johto" => Quest.new("pokemart_johto", _INTL("Johto Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Johto region."), "traveler_johto", _INTL("Cerulean City"), HotelQuestColor),
"pokemart_hoenn" => Quest.new("pokemart_hoenn", _INTL("Hoenn Pokémon"), _INTL("A traveler in the PokéMart you to show him a Pokémon native to the Hoenn region."), "traveler_hoenn", _INTL("Vermillion City"), HotelQuestColor),
"pokemart_sinnoh" => Quest.new("pokemart_sinnoh", _INTL("Sinnoh Pokémon"), _INTL("A traveler in the Department Center wants you to show him a Pokémon native to the Sinnoh region."), "traveler_sinnoh", _INTL("Celadon City"), HotelQuestColor),
"pokemart_unova" => Quest.new( "pokemart_unova", _INTL("Unova Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Unova region."), "traveler_unova", _INTL("Fuchsia City"), HotelQuestColor),
"pokemart_kalos" => Quest.new("pokemart_kalos", _INTL("Kalos Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Kalos region."), "traveler_kalos", _INTL("Saffron City"), HotelQuestColor),
"pokemart_alola" => Quest.new("pokemart_alola", _INTL("Alola Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Alola region."), "traveler_alola", _INTL("Cinnabar Island"), HotelQuestColor),
#Pewter hotel
"pewter_1" => Quest.new("pewter_1", _INTL("Mushroom Gathering"), _INTL("A lady in Pewter City wants you to bring her 3 TinyMushroom from Viridian Forest to make a stew."), "BW (74)", _INTL("Pewter City"), HotelQuestColor),
"pewter_2" =>Quest.new("pewter_2", _INTL("Lost Medicine"), _INTL("A youngster in Pewter City needs your help to find a lost Revive. He lost it by sitting on a bench somewhere in Pewter City."), "BW (19)", _INTL("Pewter City"), HotelQuestColor),
"pewter_3" =>Quest.new("pewter_3", _INTL("Bug Evolution "), _INTL("A Bug Catcher in Pewter City wants you to show him a fully-evolved Bug Pokémon."), "BWBugCatcher_male", _INTL("Pewter City"), HotelQuestColor),
"pewter_field_1" => Quest.new("pewter_field_1", _INTL("Nectar garden"), _INTL("An old man wants you to bring differently colored flowers for the city's garden."), "BW (039)", _INTL("Pewter City"), FieldQuestColor),
"pewter_field_2" => Quest.new("pewter_field_2", _INTL("I Choose You!"), _INTL("A Pikachu in the PokéMart has lost its official Pokémon League Hat. Find one and give it to the Pikachu!"), "YOUNGSTER_LeagueHat", _INTL("Pewter City"), FieldQuestColor),
"pewter_field_3" => Quest.new("pewter_field_3", _INTL("Prehistoric Amber!"), _INTL("Meetup with a scientist in Viridian Forest to look for prehistoric amber."), "BW (82)", _INTL("Pewter City"), FieldQuestColor),
#Cerulean hotel
"cerulean_1" => Quest.new("cerulean_1", _INTL("Playing Cupid"), _INTL("A boy in Cerulean City wants you bring a love letter to a Pokémon Breeder named Maude. She's probably somewhere in one of the routes near Cerulean City"), "BW (18)", _INTL("Cerulean City"), HotelQuestColor),
"cerulean_2" => Quest.new("cerulean_2", _INTL("Type Experts"), _INTL("Defeat all of the Type Experts scattered around the Kanto region ({1}/{2})",pbGet(VAR_TYPE_EXPERTS_BEATEN),TOTAL_NB_TYPE_EXPERTS), "expert-normal", _INTL("Cerulean City"), HotelQuestColor),
#Route 24
"cerulean_field_1" => Quest.new("cerulean_field_1", _INTL("Field Research (Part 1)"), _INTL("Professor Oak's aide wants you to catch an Abra."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
"cerulean_field_2" => Quest.new("cerulean_field_2", _INTL("Field Research (Part 2)"), _INTL("Professor Oak's aide wants you to encounter every Pokémon on Route 24."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
"cerulean_field_3" => Quest.new("cerulean_field_3", _INTL("Field Research (Part 3)"), _INTL("Professor Oak's aide wants you to catch a Buneary using the Pokéradar."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
#Vermillion City
"vermillion_2" => Quest.new("vermillion_2", _INTL("Fishing for Sole"), _INTL("A fisherman wants you to fish up an old boot. Hook it up with the old rod in any body of water."), "BW (71)", _INTL("Cerulean City"), HotelQuestColor),
"vermillion_1" => Quest.new("vermillion_1", _INTL("Unusual Types 1"), _INTL("A woman at the hotel wants you to show her a Water/Fire-type Pokémon"), "BW (58)", _INTL("Vermillion City"), HotelQuestColor),
"vermillion_3" => Quest.new("vermillion_3", _INTL("Seafood Cocktail "), _INTL("Get some steamed Krabby legs from the S.S. Anne's kitchen and bring them back to the hotel before they get cold"), "BW (36)", _INTL("Vermillion City"), HotelQuestColor),
"vermillion_field_1" => Quest.new("vermillion_field_1", _INTL("Building Materials "), _INTL("Get some wooden planks from Viridian City and some Bricks from Pewter City."), "BW (36)", _INTL("Vermillion City"), FieldQuestColor),
"vermillion_field_2" => Quest.new("vermillion_field_2", _INTL("Waiter on the Water"), _INTL("The S.S. Anne waiter wants you to take restaurant orders while he went to get a replacement cake."), "BW (53)", _INTL("S.S. Anne"), FieldQuestColor),
#Celadon City
"celadon_1" => Quest.new("celadon_1", _INTL("Sun or Moon"), _INTL("Show the Pokémon that Eevee evolves when exposed to a Moon or Sun stone to help the scientist with her research."), "BW (82)", _INTL("Celadon City"), HotelQuestColor),
"celadon_2" => Quest.new("celadon_2", _INTL("For Whom the Bell Tolls"), _INTL("Ring Lavender Town's bell when the time is right to reveal its secret."), "BW (40)", _INTL("Lavender Town"), HotelQuestColor),
"celadon_3" => Quest.new("celadon_3", _INTL("Hardboiled"), _INTL("A lady wants you to give her an egg to make an omelette.", "BW (24)"), _INTL("Celadon City"), HotelQuestColor),
"celadon_field_1" => Quest.new("celadon_field_1", _INTL("A stroll with Eevee!"), _INTL("Walk Eevee around for a while until it gets tired."), "BW (37)", _INTL("Celadon City"), FieldQuestColor),
#Fuchsia City
"fuchsia_1" => Quest.new("fuchsia_1", _INTL("Bicycle Race!"), _INTL("Go meet the Cyclist at the bottom of Route 17 and beat her time up the Cycling Road!"), "BW032", _INTL("Cycling Road"), HotelQuestColor),
"fuchsia_2" => Quest.new("fuchsia_2", _INTL("Lost Pokémon!"), _INTL("Find the lost Chansey's trainer!"), "113", _INTL("Fuchsia City"), HotelQuestColor),
"fuchsia_3" => Quest.new("fuchsia_3", _INTL("Cleaning up the Cycling Road"), _INTL("Get rid of all the Pokémon dirtying up the Cycling Road."), "BW (77)", _INTL("Fuchsia City"), HotelQuestColor),
"fuchsia_4" => Quest.new("fuchsia_4", _INTL("Bitey Pokémon"), _INTL("A fisherman wants to know what is the sharp-toothed Pokémon that bit him in the Safari Zone's lake."), "BW (71)", _INTL("Fuchsia City"), HotelQuestColor),
#Crimson City
"crimson_1" => Quest.new("crimson_1", _INTL("Shellfish Rescue"), _INTL("Put all the stranded Shellders back in the water on the route to Crimson City."), "BW (48)", _INTL("Crimson City"), HotelQuestColor),
"crimson_2" => Quest.new("crimson_2", _INTL("Fourth Round Rumble"), _INTL("Defeat Jeanette and her high-level Bellsprout in a Pokémon Battle"), "BW024", _INTL("Crimson City"), HotelQuestColor),
"crimson_3" => Quest.new("crimson_3", _INTL("Unusual Types 2"), _INTL("A woman at the hotel wants you to show her a Normal/Ghost-type Pokémon"), "BW (58)", _INTL("Crimson City"), HotelQuestColor),
"crimson_4" => Quest.new("crimson_4", _INTL("The Top of the Waterfall"), _INTL("Someone wants you to go investigate the top of a waterfall near Crimson City"), "BW (28)", _INTL("Crimson City"), HotelQuestColor),
#Saffron City
"saffron_1" => Quest.new("saffron_1", _INTL("Lost Puppies"), _INTL("Find all of the missing Growlithe in the routes around Saffron City."), "BW (73)", _INTL("Saffron City"), HotelQuestColor),
"saffron_2" => Quest.new("saffron_2", _INTL("Invisible Pokémon"), _INTL("Find an invisible Pokémon in the eastern part of Saffron City."), "BW (57)", _INTL("Saffron City"), HotelQuestColor),
"saffron_3" => Quest.new("saffron_3", _INTL("Bad to the Bone!"), _INTL("Find a Rare Bone using Rock Smash."), "BW (72)", _INTL("Saffron City"), HotelQuestColor),
"saffron_field_1" => Quest.new("saffron_field_1", _INTL("Dancing Queen!"), _INTL("Dance with the Copycat Girl!"), "BW (24)", _INTL("Saffron City (nightclub)"), FieldQuestColor),
#Cinnabar Island
"cinnabar_1" => Quest.new("cinnabar_1", _INTL("The transformation Pokémon"), _INTL("The scientist wants you to find some Quick Powder that can sometimes be found with wild Ditto in the mansion's basement."), "BW (82)", _INTL("Cinnabar Island"), HotelQuestColor),
"cinnabar_2" => Quest.new("cinnabar_2", _INTL("Diamonds and Pearls"), _INTL("Find a Diamond Necklace to save the man's marriage."), "BW (71)", _INTL("Cinnabar Island"), HotelQuestColor),
"cinnabar_3" => Quest.new("cinnabar_3", _INTL("Stolen artifact"), _INTL("Recover a stolen vase from a burglar in the Pokémon Mansion"), "BW (21)", _INTL("Cinnabar Island"), HotelQuestColor),
#Goldenrod City
"goldenrod_1" => Quest.new( "goldenrod_1", _INTL("Safari Souvenir!"), _INTL("Bring back a souvenir from the Fuchsia City Safari Zone"), "BW (28)", _INTL("Goldenrod City"), HotelQuestColor),
"goldenrod_2" => Quest.new("goldenrod_2", _INTL("The Cursed Forest"), _INTL("A child wants you to find a floating tree stump in Ilex Forest. What could she be talking about?"), "BW109", _INTL("Goldenrod City"), HotelQuestColor),
"goldenrod_police_1" => Quest.new("goldenrod_police_1", _INTL("Undercover police work!"), _INTL("Go see the police in Goldenrod City to help them with an important police operation."), "BW (80)", _INTL("Goldenrod City"), FieldQuestColor),
"pinkan_police" => Quest.new("pinkan_police", _INTL("Pinkan Island!"), _INTL("Team Rocket is planning a heist on Pinkan Island. You joined forces with the police to stop them!"), "BW (80)", _INTL("Goldenrod City"), FieldQuestColor),
#Violet City
"violet_1" => Quest.new("violet_1", _INTL("Defuse the Pinecones!"), _INTL("Get rid of all the Pineco on Route 31 and Route 30"), "BW (64)", _INTL("Violet City"), HotelQuestColor),
"violet_2" => Quest.new("violet_2", _INTL("Find Slowpoke's Tail!"), _INTL("Find a SlowpokeTail in some flowers, somewhere around Violet City!"), "BW (19)", _INTL("Violet City"), HotelQuestColor),
#Blackthorn City
"blackthorn_1" => Quest.new( "blackthorn_1", _INTL("Dragon Evolution"), _INTL("A Dragon Tamer in Blackthorn City wants you to show her a fully-evolved Dragon Pokémon."), "BW014", _INTL("Blackthorn City"), HotelQuestColor),
"blackthorn_2" => Quest.new("blackthorn_2", _INTL("Sunken Treasure!"), _INTL("Find an old memorabilia on a sunken ship near Cinnabar Island."), "BW (28)", _INTL("Blackthorn City"), HotelQuestColor),
"blackthorn_3" => Quest.new("blackthorn_3", _INTL("The Largest Carp"), _INTL("A fisherman wants you to fish up a Magikarp that's exceptionally high-level at Dragon's Den."), "BW (71)", _INTL("Blackthorn City"), HotelQuestColor),
#Ecruteak City
"ecruteak_1" => Quest.new("ecruteak_1", _INTL("Ghost Evolution"), _INTL("A girl in Ecruteak City wants you to show her a fully-evolved Ghost Pokémon."), "BW014", _INTL("Ecruteak City"), HotelQuestColor),
#Kin Island
"kin_1" => Quest.new("kin_1", _INTL("Banana Slamma!"), _INTL("Collect 30 bananas"), "BW059", _INTL("Kin Island"), HotelQuestColor),
"kin_2" => Quest.new("kin_2", _INTL("Fallen Meteor"), _INTL("Investigate a crater near Bond Bridge."), "BW009", _INTL("Kin Island"), HotelQuestColor),
"kin_field_1" => Quest.new("kin_field_1", _INTL("The rarest fish"), _INTL("A fisherman wants you to show him a Feebas. Apparently they can be fished around the Sevii Islands when it rains."), "BW056", _INTL("Kin Island"), FieldQuestColor),
"legendary_deoxys_1" => Quest.new("legendary_deoxys_1", _INTL("First Contact"), _INTL("Find the missing pieces of a fallen alien spaceship"), "BW (92)", _INTL("Bond Bridge"), LegendaryQuestColor),
"legendary_deoxys_2" => Quest.new("legendary_deoxys_2", _INTL("First Contact (Part 2)"), _INTL("Ask the sailor at Cinnabar Island's harbour to take you to the uncharted island where the spaceship might be located"), "BW (92)", _INTL("Bond Bridge"), LegendaryQuestColor),
#Necrozma quest
"legendary_necrozma_1" => Quest.new("legendary_necrozma_1", _INTL("Mysterious prisms"), _INTL("You found a pedestal with a mysterious prism on it. There seems to be room for more prisms."), "BW_Sabrina", _INTL("Pokémon Tower"), LegendaryQuestColor),
"legendary_necrozma_2" => Quest.new("legendary_necrozma_2", _INTL("The long night (Part 1)"), _INTL("A mysterious darkness has shrouded some of the region. Meet Sabrina outside of Saffron City's western gate to investigate."), "BW_Sabrina", _INTL("Lavender Town"), LegendaryQuestColor),
"legendary_necrozma_3" => Quest.new("legendary_necrozma_1", _INTL("The long night (Part 2)"), _INTL("The mysterious darkness has expended. Meet Sabrina on top of Celadon City's Dept. Store to figure out the source of the darkness."), "BW_Sabrina", _INTL("Route 7"), LegendaryQuestColor),
"legendary_necrozma_4" => Quest.new("legendary_necrozma_4", _INTL("The long night (Part 3)"), _INTL("Fuchsia City appears to be unaffected by the darkness. Go investigate to see if you can find out more information."), "BW_Sabrina", _INTL("Celadon City"), LegendaryQuestColor),
"legendary_necrozma_5" => Quest.new("legendary_necrozma_5", _INTL("The long night (Part 4)"), _INTL("The mysterious darkness has expended yet again and strange plants have appeared. Follow the plants to see where they lead."), "BW_koga", _INTL("Fuchsia City"), LegendaryQuestColor),
"legendary_necrozma_6" => Quest.new("legendary_necrozma_6", _INTL("The long night (Part 5)"), _INTL("You found a strange fruit that appears to be related to the mysterious darkness. Go see professor Oak to have it analyzed."), "BW029", _INTL("Safari Zone"), LegendaryQuestColor),
"legendary_necrozma_7" => Quest.new("legendary_necrozma_7", _INTL("The long night (Part 6)"), _INTL("The strange plant you found appears to glow in the mysterious darkness that now covers the entire region. Try to follow the glow to find out the source of the disturbance."), "BW-oak", _INTL("Pallet Town"), LegendaryQuestColor),
"legendary_meloetta_1" => Quest.new("legendary_meloetta_1", _INTL("A legendary band (Part 1)"), _INTL("The singer of a band in Saffron City wants you to help them recruit a drummer. They think they've heard some drumming around Crimson City..."), "BW107", _INTL("Saffron City"), LegendaryQuestColor),
"legendary_meloetta_2" => Quest.new("legendary_meloetta_2", _INTL("A legendary band (Part 2)"), _INTL("The drummer from a legendary Pokéband wants you to find its former bandmates. The band manager talked about two former guitarists..."), "band_drummer", _INTL("Saffron City"), LegendaryQuestColor),
"legendary_meloetta_3" => Quest.new("legendary_meloetta_3", _INTL("A legendary band (Part 3)"), _INTL("The drummer from a legendary Pokéband wants you to find its former bandmates. There are rumors about strange music that was heard around the region."), "band_drummer", _INTL("Saffron City"), LegendaryQuestColor),
"legendary_meloetta_4" => Quest.new("legendary_meloetta_4", _INTL("A legendary band (Part 4)"), _INTL("You assembled the full band! Come watch the show on Saturday night."), "BW117", _INTL("Saffron City"), LegendaryQuestColor),
"legendary_cresselia_1" => Quest.new(61, _INTL("Mysterious Lunar feathers"), _INTL("A mysterious entity asked you to collect Lunar Feathers for them. It said that they will come at night to tell you where to look. Whoever that may be..."), "lunarFeather", _INTL("Lavender Town"), LegendaryQuestColor),
#removed
#11 => Quest.new(11, "Powering the Lighthouse", "Catch some Voltorb to power up the lighthouse", QuestBranchHotels, "BW (43)", "Vermillion City", HotelQuestColor),
}
###################
# HOENN QUESTS ##
# ################
#route 102
define_quest("route_102_rematch",:FIELD_QUEST,_INTL("Trainer Rematches"), _INTL("A lass you battled wants to switch up her team and rematch you!"),_INTL("Route 102"),"NPC_Hoenn_Lass")
#Route 116
define_quest("route116_glasses",:FIELD_QUEST,_INTL("Lost glasses"), _INTL("A trainer has lost their glasses, help him find them!"),_INTL("Route 116"),"NPC_Hoenn_BugManiac")
#Route 104 (South)
define_quest("route104_rivalWeather",:FIELD_QUEST,_INTL("Weather Watch"), _INTL("Help your rival with fieldwork and find a Pokémon that only appears when it's windy!"),_INTL("Route 104"),"rival")
#Petalburg woods
define_quest("petalburgwoods_spores",:FIELD_QUEST,_INTL("Spores Harvest"), _INTL("A scientist has tasked you to collect 4 spore samples from the large mushrooms that can be found in the woods!"),_INTL("Petalburg Woods"),"NPC_Hoenn_Scientist")
#Route 104 (North)
define_quest("route104_oricorio",:FIELD_QUEST,_INTL("Special Flowery Grass"), _INTL("Find an Oricorio in the flowery grass behind the flower shop."),_INTL("Route 104"),"NPC_Hoenn_AromaLady")
define_quest("route104_oricorio_forms",:FIELD_QUEST,_INTL("Nectar Flowers"), _INTL("Find all 4 types of nectar flowers to transform Oricorio."),_INTL("Route 104"),"NPC_Hoenn_AromaLady")
#Route 115
define_quest("route115_secretBase",:FIELD_QUEST,_INTL("Your Very Own Secret Base!"), _INTL("Talk to Aarune near his secret base to learn how to make your own."),_INTL("Route 115"),"NPC_Hoenn_AromaLady")
#Rustboro
define_quest("rustboro_whismur",:FIELD_QUEST,_INTL("Volume Booster!"), _INTL("Find a Wingull to fuse with a Whismur to make it louder."),_INTL("Rustboro City"),"NPC_schoolgirl")

View File

@@ -0,0 +1,101 @@
def validate_regirock_ice_puzzle(solution)
for boulder_position in solution
x = boulder_position[0]
y = boulder_position[1]
# echoln ""
# echoln x.to_s + ", " + y.to_s
# echoln $game_map.event_at_position(x,y)
return false if !$game_map.event_at_position(x, y)
end
echoln "all boulders in place"
return true
end
def unpress_all_regirock_steel_switches()
switch_ids = [75, 77, 76, 67, 74, 68, 73, 72, 70, 69]
regi_map = 813
switch_ids.each do |event_id|
pbSetSelfSwitch(event_id, "A", false, regi_map)
end
end
def validate_regirock_steel_puzzle()
expected_pressed_switches = [75, 77, 74, 68, 73, 69]
expected_unpressed_switches = [76, 67, 72, 70]
switch_ids = [75, 77, 76, 67,
74, 68,
73, 72, 70, 69]
pressed_switches = []
unpressed_switches = []
switch_ids.each do |switch_id|
is_pressed = pbGetSelfSwitch(switch_id, "A")
if is_pressed
pressed_switches << switch_id
else
unpressed_switches << switch_id
end
end
for event_id in switch_ids
is_pressed = pbGetSelfSwitch(event_id, "A")
return false if !is_pressed && expected_pressed_switches.include?(event_id)
return false if is_pressed && expected_unpressed_switches.include?(event_id)
end
return true
end
def registeel_ice_press_switch(letter)
order = pbGet(VAR_REGI_PUZZLE_SWITCH_PRESSED)
solution = "ssBSBGG" # GGSBBss"
registeel_ice_reset_switches() if !order.is_a?(String)
order << letter
pbSet(VAR_REGI_PUZZLE_SWITCH_PRESSED, order)
if order == solution
echoln "OK"
pbSEPlay("Evolution start", nil, 130)
elsif order.length >= solution.length
registeel_ice_reset_switches()
end
echoln order
end
def registeel_ice_reset_switches()
switches_events = [66, 78, 84, 85, 86, 87, 88]
switches_events.each do |switch_id|
pbSetSelfSwitch(switch_id, "A", false)
echoln "reset" + switch_id.to_s
end
pbSet(VAR_REGI_PUZZLE_SWITCH_PRESSED, "")
end
def regirock_steel_move_boulder()
switches_position = [
[16, 21], [18, 21], [20, 21], [22, 21],
[16, 23], [22, 23],
[16, 25], [18, 25], [20, 25], [22, 25]
]
boulder_event = get_self
old_x = boulder_event.x
old_y = boulder_event.y
stepped_off_switch = switches_position.find { |position| position[0] == old_x && position[1] == old_y }
pbPushThisBoulder()
boulder_event = get_self
if stepped_off_switch
switch_event = $game_map.get_event_at_position(old_x, old_y, [boulder_event.id])
echoln switch_event.id if switch_event
pbSEPlay("Entering Door", nil, 80)
pbSetSelfSwitch(switch_event.id, "A", false) if switch_event
end
stepped_on_switch = switches_position.find { |position| position[0] == boulder_event.x && position[1] == boulder_event.y }
if stepped_on_switch
switch_event = $game_map.get_event_at_position(boulder_event.x, boulder_event.y, [boulder_event.id])
echoln switch_event.id if switch_event
pbSEPlay("Entering Door")
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
end
end

View File

@@ -60,7 +60,7 @@ def showNewTRMissionMessage(title, description, show_description)
pbMEPlay("rocketQuest", 80, 110)
pbCallBub(3)
Kernel.pbMessage("\\C[#{titleColor}]NEW MISSION: " + title)
Kernel.pbMessage(_INTL("\\C[{1}]NEW MISSION: ",titleColor) + title)
if show_description
pbCallBub(3)
Kernel.pbMessage("\\C[#{textColor}]" + description)
@@ -82,17 +82,17 @@ def finishTRQuest(id, status, silent = false)
end
TR_QUESTS = {
"tr_cerulean_1" => Quest.new("tr_cerulean_1", "Creepy Crawlies", "The Team Rocket Captain has tasked you with clearing the bug infestation in the temporary Rocket HQ in Cerulean City", "rocket_petrel", "Cerulean City", TRQuestColor),
"tr_cerulean_2" => Quest.new("tr_cerulean_2", "No Fishing Zone", "Intimidate the fishermen at Nugget Bridge until they leave the area.", "rocket_petrel", "Cerulean City", TRQuestColor),
"tr_cerulean_3" => Quest.new("tr_cerulean_3", "Disobedient Pokémon", "Bring back the Pokémon given by the Team Rocket Captain fainted to teach it a lesson.", "rocket_petrel", "Cerulean City", TRQuestColor),
"tr_cerulean_4" => Quest.new("tr_cerulean_4", "Gran Theft Pokémon!", "Follow Petrel and go steal a rare Pokémon from a young girl.", "rocket_petrel", "Cerulean City", TRQuestColor),
"tr_cerulean_1" => Quest.new("tr_cerulean_1", _INTL("Creepy Crawlies"), _INTL("The Team Rocket Captain has tasked you with clearing the bug infestation in the temporary Rocket HQ in Cerulean City"), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
"tr_cerulean_2" => Quest.new("tr_cerulean_2", _INTL("No Fishing Zone"), _INTL("Intimidate the fishermen at Nugget Bridge until they leave the area."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
"tr_cerulean_3" => Quest.new("tr_cerulean_3", _INTL("Disobedient Pokémon"), _INTL("Bring back the Pokémon given by the Team Rocket Captain fainted to teach it a lesson."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
"tr_cerulean_4" => Quest.new("tr_cerulean_4", _INTL("Gran Theft Pokémon!"), _INTL("Follow Petrel and go steal a rare Pokémon from a young girl."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
"tr_celadon_1" => Quest.new("tr_celadon_1", "Supplying the new grunts", "Catch 4 Pokémon with Rocket Balls in the outskirts of Celadon City.", "rocket_archer", "Celadon City", TRQuestColor),
"tr_celadon_2" => Quest.new("tr_celadon_2", "Interception!", "Intercept the TMs shipment to the Celadon Store and pose as the delivery person to deliver fake TMs.", "rocket_archer", "Celadon City", TRQuestColor),
"tr_celadon_3" => Quest.new( "tr_celadon_3", "Pokémon Collector", "Go meet a Pokémon collector on Route 22, near Viridian City and get his rare Pokémon.", "rocket_archer", "Celadon City", TRQuestColor),
"tr_celadon_4" => Quest.new("tr_celadon_4", "Operation Shutdown", "The Team Rocket HQ is being raided! Regroup with the rest of the grunts in Goldenrod Tunnel!", "rocket_archer", "Goldenrod City", TRQuestColor),
"tr_celadon_1" => Quest.new("tr_celadon_1", _INTL("Supplying the new grunts"), _INTL("Catch 4 Pokémon with Rocket Balls in the outskirts of Celadon City."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
"tr_celadon_2" => Quest.new("tr_celadon_2", _INTL("Interception!"), _INTL("Intercept the TMs shipment to the Celadon Store and pose as the delivery person to deliver fake TMs."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
"tr_celadon_3" => Quest.new( "tr_celadon_3", _INTL("Pokémon Collector"), _INTL("Go meet a Pokémon collector on Route 22, near Viridian City and get his rare Pokémon."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
"tr_celadon_4" => Quest.new("tr_celadon_4", _INTL("Operation Shutdown"), _INTL("The Team Rocket HQ is being raided! Regroup with the rest of the grunts in Goldenrod Tunnel!"), "rocket_archer", _INTL("Goldenrod City"), TRQuestColor),
"tr_pinkan" => Quest.new("tr_pinkan", "Pinkan Island!", "Help Team Rocket with a heist on a Pokémon nature preserve!", "rocket_archer", "Goldenrod City", TRQuestColor),
"tr_pinkan" => Quest.new("tr_pinkan", _INTL("Pinkan Island!"), _INTL("Help Team Rocket with a heist on a Pokémon nature preserve!"), "rocket_archer", _INTL("Goldenrod City"), TRQuestColor),
}
@@ -141,64 +141,64 @@ def legendaryQuestioning()
#question 1
pbCallBub(2, @event_id)
pbMessage("First off what does the legendary Pokémon look like?")
bodyTypes = { :BIRD => "A flying creature", :BEAST => "A large beast", :FISH => "An aquatic creature", :UNKNOWN => "I don't know..." }
pbMessage(_INTL("First off what does the legendary Pokémon look like?"))
bodyTypes = { :BIRD => _INTL("A flying creature"), :BEAST => _INTL("A large beast"), :FISH => _INTL("An aquatic creature"), :UNKNOWN => _INTL("I don't know...") }
chosen_bodyType = optionsMenu(bodyTypes.values)
answers_so_far << bodyTypes.keys[chosen_bodyType]
if chosen_bodyType == bodyTypes.length - 1
pbCallBub(2, @event_id)
pbMessage("You don't know? Have you even seen that Pokémon?")
pbMessage(_INTL("You don't know? Have you even seen that Pokémon?"))
pbCallBub(2, @event_id)
pbMessage("Hmm... You better have some more information.")
pbMessage(_INTL("Hmm... You better have some more information."))
uncertain_answers += 1
else
pbCallBub(2, @event_id)
pbMessage("#{bodyTypes.values[chosen_bodyType]} that's also a legendary Pokémon? That sounds incredible! You have my attention.")
pbMessage(_INTL("{1} that's also a legendary Pokémon? That sounds incredible! You have my attention.",bodyTypes.values[chosen_bodyType]))
end
#question 2
pbCallBub(2, @event_id)
pbMessage("Okay... What about its type?")
types = { :ELECTRIC => "Electric-type", :FIRE => "Fire-type", :WATER => "Water-Type", :ICE => "Ice-type", :UNKNOWN => "I don't know..." }
pbMessage(_INTL("Okay... What about its type?"))
types = { :ELECTRIC => _INTL("Electric-type"), :FIRE => _INTL("Fire-type"), :WATER => _INTL("Water-Type"), :ICE => _INTL("Ice-type"), :UNKNOWN => _INTL("I don't know...") }
chosen_type = optionsMenu(types.values)
answers_so_far << types.keys[chosen_type]
if chosen_type == types.length - 1
pbCallBub(2, @event_id)
pbMessage("So you don't know its type... Hmm...")
pbMessage(_INTL("So you don't know its type... Hmm..."))
uncertain_answers += 1
else
if chosen_bodyType == bodyTypes.length - 1
pbCallBub(2, @event_id)
pbMessage("Hmm... So it's an unknown creature that's #{types.values[chosen_type]}...")
pbMessage(_INTL("Hmm... So it's an unknown creature that's {1}...",types.values[chosen_type]))
else
pbCallBub(2, @event_id)
pbMessage("Hmm... #{bodyTypes.values[chosen_bodyType]} that's #{types.values[chosen_type]}.")
pbMessage(_INTL("Hmm... {1} that's {2}.",bodyTypes.values[chosen_bodyType],types.values[chosen_type]))
end
susMeter = calculateSuspicionLevel(answers_so_far, uncertain_answers)
if susMeter == 0
pbCallBub(2, @event_id)
pbMessage("That sounds pretty exciting!")
pbMessage(_INTL("That sounds pretty exciting!"))
else
pbCallBub(2, @event_id)
pbMessage("I've never heard of such a creature, but keep going.")
pbMessage(_INTL("I've never heard of such a creature, but keep going."))
end
end
#question 3
pbCallBub(2, @event_id)
pbMessage("So... Where was this legendary Pokémon sighted?")
locations = { :VIRIDIAN => "Near Viridian City", :LAVENDER => "Near Lavender Town", :CERULEAN => "Near Cerulean City", :CINNABAR => "Near Cinnabar Island", :UNKNOWN => "I don't know" }
pbMessage(_INTL("So... Where was this legendary Pokémon sighted?"))
locations = { :VIRIDIAN => _INTL("Near Viridian City"), :LAVENDER => _INTL("Near Lavender Town"), :CERULEAN => _INTL("Near Cerulean City"), :CINNABAR => _INTL("Near Cinnabar Island"), :UNKNOWN => _INTL("I don't know") }
chosen_location = optionsMenu(locations.values)
if chosen_location == locations.length - 1
uncertain_answers += 1
if uncertain_answers == 3
pbCallBub(2, @event_id)
pbMessage("Do you even know anything? This has been such a waste of time!")
pbMessage(_INTL("Do you even know anything? This has been such a waste of time!"))
return 100
else
pbCallBub(2, @event_id)
pbMessage("How can you not know where it was sighted? Do you know how unhelpful this is to me?")
pbMessage(_INTL("How can you not know where it was sighted? Do you know how unhelpful this is to me?"))
uncertain_answers += 1
end
else
@@ -206,21 +206,21 @@ def legendaryQuestioning()
susMeter = calculateSuspicionLevel(answers_so_far, uncertain_answers)
if susMeter == 0
pbCallBub(2, @event_id)
pbMessage("#{locations.values[chosen_location]}, huh? Ah yes, that would make a lot of sense... How did I not think of this before?")
pbMessage(_INTL("{1}, huh? Ah yes, that would make a lot of sense... How did I not think of this before?",locations.values[chosen_location]))
else
pbCallBub(2, @event_id)
pbMessage("Hmmm... #{locations.values[chosen_location]}, really? That sounds pretty surprising to me.")
pbMessage(_INTL("Hmmm... {1}, really? That sounds pretty surprising to me.",locations.values[chosen_location]))
end
end
#question 4
locations_formatted = { :VIRIDIAN => "Viridian City", :LAVENDER => "Lavender Town", :CERULEAN => "Cerulean City", :CINNABAR => "Cinnabar Island", :UNKNOWN => "that unknown location" }
locations_formatted = { :VIRIDIAN => _INTL("Viridian City"), :LAVENDER => _INTL("Lavender Town"), :CERULEAN => _INTL("Cerulean City"), :CINNABAR => _INTL("Cinnabar Island"), :UNKNOWN => _INTL("that unknown location") }
pbCallBub(2, @event_id)
pbMessage("And at what time of the day was that legendary Pokémon seen near #{locations_formatted.values[chosen_location]} exactly?")
time_of_day = { :DAWN => "At dawn", :NOON => "At noon", :AFTERNOON => "In the afternoon", :SUNSET => "At sunset", :NIGHT => "At night" }
pbMessage(_INTL("And at what time of the day was that legendary Pokémon seen near {1} exactly?",locations_formatted.values[chosen_location]))
time_of_day = { :DAWN => _INTL("At dawn"), :NOON => _INTL("At noon"), :AFTERNOON => _INTL("In the afternoon"), :SUNSET => _INTL("At sunset"), :NIGHT => _INTL("At night") }
chosen_time = optionsMenu(time_of_day.values)
pbCallBub(2, @event_id)
pbMessage("So it was seen near #{locations_formatted.values[chosen_location]} #{time_of_day.values[chosen_time].downcase}...")
pbMessage(_INTL("So it was seen near {1} {2}...",locations_formatted.values[chosen_location],time_of_day.values[chosen_time].downcase))
answers_so_far << time_of_day.keys[chosen_time]
return calculateSuspicionLevel(answers_so_far, uncertain_answers)
end
@@ -228,7 +228,7 @@ end
def sellPokemon(event_id)
if $Trainer.party.length <= 1
pbCallBub(2, event_id)
pbMessage("... Wait, I can't take your only Pokémon!")
pbMessage(_INTL("... Wait, I can't take your only Pokémon!"))
return false
end
pbChoosePokemon(1, 2,
@@ -241,37 +241,37 @@ def sellPokemon(event_id)
exotic_pokemon_id = pbGet(VAR_EXOTIC_POKEMON_ID)
if chosenPokemon.personalID == exotic_pokemon_id
pbCallBub(2, event_id)
pbMessage("Oh, this is the Pokémon you got from the collector, right?")
pbMessage(_INTL("Oh, this is the Pokémon you got from the collector, right?"))
pbCallBub(2, event_id)
pbMessage("Yeah, I can't take that one. The collector blabbed to the police so it's too risky.")
pbMessage(_INTL("Yeah, I can't take that one. The collector blabbed to the police so it's too risky."))
return false
end
speciesName = GameData::Species.get(chosenPokemon.species).real_name
pbCallBub(2, event_id)
if pbConfirmMessageSerious("You wanna sell me this #{speciesName}, is that right?")
if pbConfirmMessageSerious(_INTL("You wanna sell me this {1}, is that right?",speciesName))
pbCallBub(2, event_id)
pbMessage("Hmm... Let's see...")
pbMessage(_INTL("Hmm... Let's see..."))
pbWait(10)
value = calculate_pokemon_value(chosenPokemon)
pbCallBub(2, event_id)
if pbConfirmMessageSerious("\\GI could give you $#{value.to_s} for it. Do we have a deal?")
if pbConfirmMessageSerious(_INTL("\\GI could give you ${1} for it. Do we have a deal?",value.to_s))
payout = (value * 0.7).to_i
pbCallBub(2, event_id)
pbMessage("\\GExcellent. And of course, 30% goes to Team Rocket. So you get $#{payout}.")
pbMessage(_INTL("\\GExcellent. And of course, 30% goes to Team Rocket. So you get ${1}.",payout))
$Trainer.money += payout
$Trainer.remove_pokemon_at_index(pbGet(1))
pbSEPlay("Mart buy item")
pbCallBub(2, event_id)
pbMessage("\\GPleasure doing business with you.")
pbMessage(_INTL("\\GPleasure doing business with you."))
return true
else
pbCallBub(2, event_id)
pbMessage("Stop wasting my time!")
pbMessage(_INTL("Stop wasting my time!"))
end
else
pbCallBub(2, event_id)
pbMessage("Stop wasting my time!")
pbMessage(_INTL("Stop wasting my time!"))
end
return false
end

View File

@@ -0,0 +1,65 @@
def generateEggGroupTeam(eggGroup)
teamComplete = false
generatedTeam = []
while !teamComplete
species = rand(PBSpecies.maxValue)
if getPokemonEggGroups(species).include?(eggGroup)
generatedTeam << species
end
teamComplete = generatedTeam.length == 3
end
return generatedTeam
end
def generateSimpleTrainerParty(teamSpecies, level)
team = []
for species in teamSpecies
poke = Pokemon.new(species, level)
team << poke
end
return team
end
def Kernel.getRoamingMap(roamingArrayPos)
curmap = $PokemonGlobal.roamPosition[roamingArrayPos]
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
text = mapinfos[curmap].name #,(curmap==$game_map.map_id) ? _INTL("(this map)") : "")
return text
end
def Kernel.getItemNamesAsString(list)
strList = ""
for i in 0..list.length - 1
id = list[i]
name = PBItems.getName(id)
strList += name
if i != list.length - 1 && list.length > 1
strList += ","
end
end
return strList
end
def getCurrentLevelCap()
current_max_level = Settings::LEVEL_CAPS[$Trainer.badge_count]
current_max_level *= Settings::HARD_MODE_LEVEL_MODIFIER if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return current_max_level
end
def pokemonExceedsLevelCap(pokemon)
return false if $Trainer.badge_count >= Settings::NB_BADGES
current_max_level = getCurrentLevelCap()
return pokemon.level >= current_max_level
end
def get_spritecharacter_for_event(event_id)
for sprite in $scene.spriteset.character_sprites
if sprite.character.id == event_id
return sprite
end
end
end
def setForcedAltSprites(forcedSprites_map)
$PokemonTemp.forced_alt_sprites = forcedSprites_map
end

View File

@@ -0,0 +1,37 @@
def reverseFusionSpecies(species)
dexId = getDexNumberForSpecies(species)
return species if dexId <= NB_POKEMON
return species if dexId > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
body = getBasePokemonID(dexId, true)
head = getBasePokemonID(dexId, false)
newspecies = (head) * NB_POKEMON + body
return getPokemon(newspecies)
end
def replaceFusionSpecies(pokemon, speciesToChange, newSpecies)
currentBody = pokemon.species_data.get_body_species_symbol()
currentHead = pokemon.species_data.get_head_species_symbol()
should_update_body = currentBody == speciesToChange
should_update_head = currentHead == speciesToChange
echoln speciesToChange
echoln currentBody
echoln currentHead
return if !should_update_body && !should_update_head
newSpeciesBody = should_update_body ? newSpecies : currentBody
newSpeciesHead = should_update_head ? newSpecies : currentHead
newSpecies = getFusionSpecies(newSpeciesBody, newSpeciesHead)
echoln newSpecies.id_number
pokemon.species = newSpecies
end
def npc_fuse_screen(species_head,species_body)
head_pokemon = Pokemon.new(species_head,1)
body_pokemon = Pokemon.new(species_body,1)
return if head_pokemon.isFusion? || body_pokemon.isFusion?
npcTrainerFusionScreenPokemon(head_pokemon,body_pokemon)
end

View File

@@ -0,0 +1,79 @@
def pbPokemonIconFile(pokemon)
bitmapFileName = pbCheckPokemonIconFiles(pokemon.species, pokemon.isEgg?)
return bitmapFileName
end
def pbCheckPokemonIconFiles(speciesID, egg = false, dna = false)
if egg
bitmapFileName = sprintf("Graphics/Icons/iconEgg")
return pbResolveBitmap(bitmapFileName)
else
bitmapFileName = "Graphics/Pokemon/Icons/#{speciesID}"
ret = pbResolveBitmap(bitmapFileName)
return ret if ret
end
ret = pbResolveBitmap("Graphics/Icons/iconDNA.png")
return ret if ret
return pbResolveBitmap("Graphics/Icons/iconDNA.png")
end
def addShinyStarsToGraphicsArray(imageArray, xPos, yPos, shinyBody, shinyHead, debugShiny, srcx = nil, srcy = nil, width = nil, height = nil,
showSecondStarUnder = false, showSecondStarAbove = false)
color = debugShiny ? Color.new(0, 0, 0, 255) : nil
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
if shinyBody && shinyHead
if showSecondStarUnder
yPos += 15
elsif showSecondStarAbove
yPos -= 15
else
xPos -= 15
end
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
end
# if onlyOutline
# imageArray.push(["Graphics/Pictures/shiny_black",xPos,yPos,srcx,srcy,width,height,color])
# end
end
def pbBitmap(path)
if !pbResolveBitmap(path).nil?
bmp = RPG::Cache.load_bitmap_path(path)
bmp.storedPath = path
else
p "Image located at '#{path}' was not found!" if $DEBUG
bmp = Bitmap.new(1, 1)
end
return bmp
end
# if need to play animation from event route
def playAnimation(animationId, x = nil, y = nil)
return if !$scene.is_a?(Scene_Map)
x = @event.x unless x
y = @event.y unless y
$scene.spriteset.addUserAnimation(animationId, x, y, true)
end
#Shows a picture, centered in the middle of the screen in a new viewport
# Returns the viewport. Use viewport.dispose to get rid of the picture
def showPicture(path,x,y,viewport_x=(Graphics.width / 4), viewport_y=0)
begin
echoln path
viewport = Viewport.new(viewport_x, viewport_y, Graphics.width, Graphics.height)
sprite = Sprite.new(viewport)
bitmap = AnimatedBitmap.new(path) if pbResolveBitmap(path)
sprite.bitmap = bitmap.bitmap
sprite.x = x
sprite.y = y
viewport.z = 99999
return viewport
rescue
end
end

View File

@@ -0,0 +1,84 @@
def Kernel.getPlateType(item)
return :FIGHTING if item == PBItems::FISTPLATE
return :FLYING if item == PBItems::SKYPLATE
return :POISON if item == PBItems::TOXICPLATE
return :GROUND if item == PBItems::EARTHPLATE
return :ROCK if item == PBItems::STONEPLATE
return :BUG if item == PBItems::INSECTPLATE
return :GHOST if item == PBItems::SPOOKYPLATE
return :STEEL if item == PBItems::IRONPLATE
return :FIRE if item == PBItems::FLAMEPLATE
return :WATER if item == PBItems::SPLASHPLATE
return :GRASS if item == PBItems::MEADOWPLATE
return :ELECTRIC if item == PBItems::ZAPPLATE
return :PSYCHIC if item == PBItems::MINDPLATE
return :ICE if item == PBItems::ICICLEPLATE
return :DRAGON if item == PBItems::DRACOPLATE
return :DARK if item == PBItems::DREADPLATE
return :FAIRY if item == PBItems::PIXIEPLATE
return -1
end
def Kernel.listPlatesInBag()
list = []
list << PBItems::FISTPLATE if $PokemonBag.pbQuantity(:FISTPLATE) >= 1
list << PBItems::SKYPLATE if $PokemonBag.pbQuantity(:SKYPLATE) >= 1
list << PBItems::TOXICPLATE if $PokemonBag.pbQuantity(:TOXICPLATE) >= 1
list << PBItems::EARTHPLATE if $PokemonBag.pbQuantity(:EARTHPLATE) >= 1
list << PBItems::STONEPLATE if $PokemonBag.pbQuantity(:STONEPLATE) >= 1
list << PBItems::INSECTPLATE if $PokemonBag.pbQuantity(:INSECTPLATE) >= 1
list << PBItems::SPOOKYPLATE if $PokemonBag.pbQuantity(:SPOOKYPLATE) >= 1
list << PBItems::IRONPLATE if $PokemonBag.pbQuantity(:IRONPLATE) >= 1
list << PBItems::FLAMEPLATE if $PokemonBag.pbQuantity(:FLAMEPLATE) >= 1
list << PBItems::SPLASHPLATE if $PokemonBag.pbQuantity(:SPLASHPLATE) >= 1
list << PBItems::MEADOWPLATE if $PokemonBag.pbQuantity(:MEADOWPLATE) >= 1
list << PBItems::ZAPPLATE if $PokemonBag.pbQuantity(:ZAPPLATE) >= 1
list << PBItems::MINDPLATE if $PokemonBag.pbQuantity(:MINDPLATE) >= 1
list << PBItems::ICICLEPLATE if $PokemonBag.pbQuantity(:ICICLEPLATE) >= 1
list << PBItems::DRACOPLATE if $PokemonBag.pbQuantity(:DRACOPLATE) >= 1
list << PBItems::DREADPLATE if $PokemonBag.pbQuantity(:DREADPLATE) >= 1
list << PBItems::PIXIEPLATE if $PokemonBag.pbQuantity(:PIXIEPLATE) >= 1
return list
end
def getArceusPlateType(heldItem)
return :NORMAL if heldItem == nil
case heldItem
when :FISTPLATE
return :FIGHTING
when :SKYPLATE
return :FLYING
when :TOXICPLATE
return :POISON
when :EARTHPLATE
return :GROUND
when :STONEPLATE
return :ROCK
when :INSECTPLATE
return :BUG
when :SPOOKYPLATE
return :GHOST
when :IRONPLATE
return :STEEL
when :FLAMEPLATE
return :FIRE
when :SPLASHPLATE
return :WATER
when :MEADOWPLATE
return :GRASS
when :ZAPPLATE
return :ELECTRIC
when :MINDPLATE
return :PSYCHIC
when :ICICLEPLATE
return :ICE
when :DRACOPLATE
return :DRAGON
when :DREADPLATE
return :DARK
when :PIXIEPLATE
return :FAIRY
else
return :NORMAL
end
end

View File

@@ -0,0 +1,91 @@
def obtainBadgeMessage(badgeName)
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
end
def promptCaughtPokemonAction(pokemon)
pickedOption = false
return pbStorePokemon(pokemon) if !$Trainer.party_full?
return promptKeepOrRelease(pokemon) if isOnPinkanIsland() && !$game_switches[SWITCH_PINKAN_FINISHED]
while !pickedOption
command = pbMessage(_INTL("\\ts[]Your team is full!"),
[_INTL("Add to your party"), _INTL("Store to PC"),], 2)
echoln ("command " + command.to_s)
case command
when 0 # SWAP
if swapCaughtPokemon(pokemon)
echoln pickedOption
pickedOption = true
end
else
# STORE
pbStorePokemon(pokemon)
echoln pickedOption
pickedOption = true
end
end
end
def promptKeepOrRelease(pokemon)
pickedOption = false
while !pickedOption
command = pbMessage(_INTL("\\ts[]Your team is full!"),
[_INTL("Release a party member"), _INTL("Release this #{pokemon.name}"),], 2)
echoln ("command " + command.to_s)
case command
when 0 # SWAP
if swapReleaseCaughtPokemon(pokemon)
pickedOption = true
end
else
pickedOption = true
end
end
end
# def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
def swapCaughtPokemon(caughtPokemon)
pbChoosePokemon(1, 2,
proc { |poke|
!poke.egg? &&
!(poke.isShadow? rescue false)
})
index = pbGet(1)
return false if index == -1
$PokemonStorage.pbStoreCaught($Trainer.party[index])
pbRemovePokemonAt(index)
pbStorePokemon(caughtPokemon)
tmp = $Trainer.party[index]
$Trainer.party[index] = $Trainer.party[-1]
$Trainer.party[-1] = tmp
return true
end
def swapReleaseCaughtPokemon(caughtPokemon)
pbChoosePokemon(1, 2,
proc { |poke|
!poke.egg? &&
!(poke.isShadow? rescue false)
})
index = pbGet(1)
return false if index == -1
releasedPokemon = $Trainer.party[index]
pbMessage(_INTL("{1} was released.",releasedPokemon.name))
pbRemovePokemonAt(index)
pbStorePokemon(caughtPokemon)
tmp = $Trainer.party[index]
$Trainer.party[index] = $Trainer.party[-1]
$Trainer.party[-1] = tmp
return true
end
def select_any_pokemon()
commands = []
for dex_num in 1..NB_POKEMON
species = getPokemon(dex_num)
commands.push([dex_num - 1, species.real_name, species.id])
end
return pbChooseList(commands, 0, nil, 1)
end

View File

@@ -0,0 +1,164 @@
def unlock_easter_egg_hats()
if $Trainer.name.downcase == "ash"
$Trainer.hat = HAT_ASH
$Trainer.unlock_hat(HAT_ASH)
end
if $Trainer.name.downcase == "frogman"
$Trainer.hat = HAT_FROG
$Trainer.unlock_hat(HAT_FROG)
end
end
def getPlayerDefaultName(gender)
if gender == GENDER_MALE
return Settings::GAME_ID == :IF_HOENN ? "Brendan" : "Red"
else
return Settings::GAME_ID == :IF_HOENN ? "May" : "Green"
end
end
def getDefaultClothes(gender)
if gender == GENDER_MALE
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_BRENDAN : DEFAULT_OUTFIT_MALE
else
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_MAY : DEFAULT_OUTFIT_FEMALE
end
end
def getDefaultHat(gender)
if gender == GENDER_MALE
return Settings::GAME_ID == :IF_HOENN ? HAT_BRENDAN : DEFAULT_OUTFIT_MALE
else
return Settings::GAME_ID == :IF_HOENN ? HAT_MAY : DEFAULT_OUTFIT_FEMALE
end
end
def getDefaultHair(gender)
if gender == GENDER_MALE
return Settings::GAME_ID == :IF_HOENN ? HAIR_BRENDAN : DEFAULT_OUTFIT_MALE
else
return Settings::GAME_ID == :IF_HOENN ? HAIR_MAY : DEFAULT_OUTFIT_FEMALE
end
end
def setupStartingOutfit()
default_clothes_male = getDefaultClothes(GENDER_MALE)
default_clothes_female = getDefaultClothes(GENDER_FEMALE)
default_hat_male = getDefaultHat(GENDER_MALE)
default_hat_female = getDefaultHat(GENDER_FEMALE)
default_hair_male = getDefaultHair(GENDER_MALE)
default_hair_female = getDefaultHair(GENDER_FEMALE)
$Trainer.hat = nil
$Trainer.clothes = STARTING_OUTFIT
unlock_easter_egg_hats()
gender = pbGet(VAR_TRAINER_GENDER)
if gender == GENDER_FEMALE
$Trainer.unlock_clothes(default_clothes_female, true)
$Trainer.unlock_hat(default_hat_female, true)
$Trainer.hair = "3_" + default_hair_female if !$Trainer.hair # when migrating old savefiles
elsif gender == GENDER_MALE
$Trainer.unlock_clothes(default_clothes_male, true)
$Trainer.unlock_hat(default_hat_male, true)
echoln $Trainer.hair
$Trainer.hair = ("3_" + default_hair_male) if !$Trainer.hair # when migrating old savefiles
echoln $Trainer.hair
end
$Trainer.unlock_hair(default_hair_male, true)
$Trainer.unlock_hair(default_hair_female, true)
$Trainer.unlock_clothes(STARTING_OUTFIT, true)
end
def give_date_specific_hats()
current_date = Time.new
# Christmas
if (current_date.day == 24 || current_date.day == 25) && current_date.month == 12
if !$Trainer.unlocked_hats.include?(HAT_SANTA)
pbCallBub(2, @event_id, true)
pbMessage(_INTL("Hi! We're giving out a special hat today for the holidays season. Enjoy!"))
obtainHat(HAT_SANTA)
end
end
# April's fool
if (current_date.day == 1 && current_date.month == 4)
if !$Trainer.unlocked_hats.include?(HAT_CLOWN)
pbCallBub(2, @event_id, true)
pbMessage(_INTL("Hi! We're giving out this fun accessory for this special day. Enjoy!"))
obtainHat(HAT_CLOWN)
end
end
end
def qmarkMaskCheck()
if $Trainer.seen_qmarks_sprite
unless hasHat?(HAT_QMARKS)
obtainHat(HAT_QMARKS)
obtainClothes(CLOTHES_GLITCH)
end
end
end
def purchaseDyeKitMenu(hats_kit_price = 0, clothes_kit_price = 0)
commands = []
command_hats = _INTL("Hats Dye Kit (${1})",hats_kit_price)
command_clothes = _INTL("Clothes Dye Kit (${1})",clothes_kit_price)
command_cancel = _INTL("Cancel")
commands << command_hats if !$PokemonBag.pbHasItem?(:HATSDYEKIT)
commands << command_clothes if !$PokemonBag.pbHasItem?(:CLOTHESDYEKIT)
commands << command_cancel
if commands.length <= 1
pbCallBub(2, @event_id)
pbMessage(_INTL("\\C[1]Dye Kits\\C[0] can be used to dye clothes all sorts of colours!"))
pbCallBub(2, @event_id)
pbMessage(_INTL("You can use them at any time when you change clothes."))
return
end
pbCallBub(2, @event_id)
pbMessage(_INTL("\\GWelcome! Are you interested in dyeing your outfits different colours?"))
pbCallBub(2, @event_id)
pbMessage(_INTL("I make handy \\C[1]Dye Kits\\C[0] from my Smeargle's paint that can be used to dye your outfits any color you want!"))
pbCallBub(2, @event_id)
pbMessage(_INTL("\\GWhat's more is that it's reusable so you can go completely wild with it if you want! Are you interested?"))
choice = optionsMenu(commands, commands.length)
case commands[choice]
when command_hats
if $Trainer.money < hats_kit_price
pbCallBub(2, @event_id)
pbMessage(_INTL("Oh, you don't have enough money..."))
return
end
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
$Trainer.money -= hats_kit_price
pbSEPlay("SlotsCoin")
Kernel.pbReceiveItem(:HATSDYEKIT)
pbCallBub(2, @event_id)
pbMessage(_INTL("\\GHere you go! Have fun dyeing your hats!"))
when command_clothes
if $Trainer.money < clothes_kit_price
pbCallBub(2, @event_id)
pbMessage(_INTL("Oh, you don't have enough money..."))
return
end
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
$Trainer.money -= clothes_kit_price
pbSEPlay("SlotsCoin")
Kernel.pbReceiveItem(:CLOTHESDYEKIT)
pbCallBub(2, @event_id)
pbMessage(_INTL("\\GHere you go! Have fun dyeing your clothes!"))
end
pbCallBub(2, @event_id)
pbMessage(_INTL("You can use \\C[1]Dye Kits\\C[0] at any time when you change clothes."))
end

View File

@@ -0,0 +1,383 @@
def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = false)
return false if !pokemon_id
skip_randomize = true if $game_switches[SWITCH_CHOOSING_STARTER] # when choosing starters
if pbBoxesFull?
pbMessage(_INTL("There's no more room for Pokémon!\1"))
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return false
end
if pokemon_id.is_a?(Integer) && level.is_a?(Integer)
pokemon = Pokemon.new(pokemon_id, level)
species_name = pokemon.speciesName
end
# random species if randomized gift pokemon & wild poke
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !skip_randomize
tryRandomizeGiftPokemon(pokemon, skip_randomize)
end
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
pbNicknameAndStore(pokemon)
$Trainer.pokedex.register(pokemon) if see_form
return true
end
def pbHasSpecies?(species)
if species.is_a?(String) || species.is_a?(Symbol)
id = getID(PBSpecies, species)
elsif species.is_a?(Pokemon)
id = species.dexNum
end
for pokemon in $Trainer.party
next if pokemon.isEgg?
return true if pokemon.dexNum == id
end
return false
end
def getID(pbspecies_unused, species)
if species.is_a?(String)
return nil
elsif species.is_a?(Symbol)
return GameData::Species.get(species).id_number
elsif species.is_a?(Pokemon)
id = species.dexNum
end
end
# Check if the Pokemon can learn a TM
def CanLearnMove(pokemon, move)
species = getID(PBSpecies, pokemon)
return false if species <= 0
data = load_data("Data/tm.dat")
return false if !data[move]
return data[move].any? { |item| item == species }
end
def getPokemon(dexNum)
if dexNum.is_a?(Integer)
if dexNum > NB_POKEMON
body_id = getBodyID(dexNum)
head_id = getHeadID(dexNum, body_id)
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
else
pokemon_id = dexNum
end
else
pokemon_id = dexNum
end
return GameData::Species.get(pokemon_id)
end
def getSpecies(dexnum)
return getPokemon(dexnum.species) if dexnum.is_a?(Pokemon)
return getPokemon(dexnum)
end
def getAbilityIndexFromID(abilityID, fusedPokemon)
abilityList = fusedPokemon.getAbilityList
for abilityArray in abilityList #ex: [:CHLOROPHYLL, 0]
ability = abilityArray[0]
index = abilityArray[1]
return index if ability == abilityID
end
return 0
end
def getPokemonEggGroups(species)
return GameData::Species.get(species).egg_groups
end
def getAllNonLegendaryPokemon()
list = []
for i in 1..143
list.push(i)
end
for i in 147..149
list.push(i)
end
for i in 152..242
list.push(i)
end
list.push(246)
list.push(247)
list.push(248)
for i in 252..314
list.push(i)
end
for i in 316..339
list.push(i)
end
for i in 352..377
list.push(i)
end
for i in 382..420
list.push(i)
end
return list
end
def isInKantoGeneration(dexNumber)
return dexNumber <= 151
end
def isKantoPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
return isInKantoGeneration(dexNum) || isInKantoGeneration(head_dex) || isInKantoGeneration(body_dex)
end
def isInJohtoGeneration(dexNumber)
return dexNumber > 151 && dexNumber <= 251
end
def isJohtoPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
return isInJohtoGeneration(dexNum) || isInJohtoGeneration(head_dex) || isInJohtoGeneration(body_dex)
end
def isAlolaPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list = [
370, 373, 430, 431, 432, 433, 450, 451, 452,
453, 454, 455, 459, 460, 463, 464, 465, 469, 470,
471, 472, 473, 474, 475, 476, 477, 498, 499,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isKalosPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[327, 328, 329, 339, 371, 372, 417, 418,
425, 426, 438, 439, 440, 441, 444, 445, 446,
456, 461, 462, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
489, 490, 491, 492, 500,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isUnovaPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[
330, 331, 337, 338, 348, 349, 350, 351, 359, 360, 361,
362, 363, 364, 365, 366, 367, 368, 369, 374, 375, 376, 377,
397, 398, 399, 406, 407, 408, 409, 410, 411, 412, 413, 414,
415, 416, 419, 420,
422, 423, 424, 434, 345,
466, 467, 494, 493,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isSinnohPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 288, 294,
295, 296, 297, 298, 299, 305, 306, 307, 308, 315, 316, 317,
318, 319, 320, 321, 322, 323, 324, 326, 332, 343, 344, 345,
346, 347, 352, 353, 354, 358, 383, 384, 388, 389, 400, 402,
403, 429, 468]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isHoennPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list = [252, 253, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 289, 290, 291, 292, 293, 300, 301, 302, 303,
304, 309, 310, 311, 312, 313, 314, 325, 333, 334, 335, 336, 340,
341, 342, 355, 356, 357, 378, 379, 380, 381, 382, 385, 386,
387, 390, 391, 392, 393, 394, 395, 396, 401, 404, 405, 421,
427, 428, 436, 437, 442, 443, 447, 448, 449, 457, 458, 488,
495, 496, 497, 501, 502, 503, 504, 505, 506, 507, 508, 509,
510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521,
522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533,
534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def get_default_moves_at_level(species, level)
moveset = GameData::Species.get(species).moves
knowable_moves = []
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= level }
# Remove duplicates (retaining the latest copy of each move)
knowable_moves = knowable_moves.reverse
knowable_moves |= []
knowable_moves = knowable_moves.reverse
# Add all moves
moves = []
first_move_index = knowable_moves.length - MAX_MOVES
first_move_index = 0 if first_move_index < 0
for i in first_move_index...knowable_moves.length
#moves.push(Pokemon::Move.new(knowable_moves[i]))
moves << knowable_moves[i]
end
return moves
end
def listPokemonIDs()
for id in 0..NB_POKEMON
pokemon = GameData::Species.get(id).species
echoln id.to_s + ": " + "\"" + pokemon.to_s + "\"" + ", "
end
end
#IMPORTANT
#La méthode def pbCheckEvolution(pokemon,item=0)
#dans PokemonFusion (class PokemonFusionScene)
#a été modifiée et pour une raison ou une autre ca marche
#pas quand on la copie ici.
#Donc NE PAS OUBLIER DE LE COPIER AVEC
def isPartPokemon(src, target)
return Kernel.isPartPokemon(src, target)
end
#in: pokemon number
def Kernel.isPartPokemon(src, target)
src = getDexNumberForSpecies(src)
target = getDexNumberForSpecies(target)
return true if src == target
return false if src <= NB_POKEMON
bod = getBasePokemonID(src, true)
head = getBasePokemonID(src, false)
return bod == target || head == target
end
##EDITED HERE
#Retourne le pokemon de base
#param1 = int
#param2 = true pour body, false pour head
#return int du pokemon de base
def getBasePokemonID(pokemon, body = true)
if pokemon.is_a?(Symbol)
dex_number = GameData::Species.get(pokemon).id_number
pokemon = dex_number
end
return nil if pokemon <= 0
return nil if pokemon >= Settings::ZAPMOLCUNO_NB
# cname = getConstantName(PBSpecies, pokemon) rescue nil
cname = GameData::Species.get(pokemon).id.to_s
return pokemon if pokemon <= NB_POKEMON
return pokemon if cname == nil
arr = cname.split(/[B,H]/)
bod = arr[1]
head = arr[2]
return bod.to_i if body
return head.to_i
end
def getGenericPokemonCryText(pokemonSpecies)
case pokemonSpecies
when 25
return "Pika!"
when 16, 17, 18, 21, 22, 144, 145, 146, 227, 417, 418, 372 # birds
return "Squawk!"
when 163, 164
return "Hoot!" # owl
else
return "Guaugh!"
end
end
def setPokemonMoves(pokemon, move_ids = [])
moves = []
move_ids.each { |move_id|
moves << Pokemon::Move.new(move_id)
}
pokemon.moves = moves
end
def changeSpeciesSpecific(pokemon, newSpecies)
pokemon.species = newSpecies
$Trainer.pokedex.set_seen(newSpecies)
$Trainer.pokedex.set_owned(newSpecies)
end
def calculate_pokemon_weight(pokemon, nerf = 0)
base_weight = pokemon.weight
ivs = []
pokemon.iv.each { |iv|
ivs << iv[1]
}
level = pokemon.level
# Ensure IVs is an array of 6 values and level is between 1 and 100
raise "IVs array must have 6 values" if ivs.length != 6
raise "Level must be between 1 and 100" unless (1..100).include?(level)
# Calculate the IV Factor
iv_sum = ivs.sum
iv_factor = (iv_sum.to_f / 186) * 30 * 10
# Calculate the Level Factor
level_factor = (level.to_f / 100) * 5 * 10
# Calculate the weight
weight = base_weight * (1 + (iv_factor / 100) + (level_factor / 100))
weight -= base_weight
# Enforce the weight variation limits
max_weight = base_weight * 4.00 # 400% increase
min_weight = base_weight * 0.5 # 50% decrease
# Cap the weight between min and max values
weight = [[weight, min_weight].max, max_weight].min
weight -= nerf if weight - nerf > min_weight
return weight.round(2) # Round to 2 decimal places
end
def playCry(pokemonSpeciesSymbol)
species = GameData::Species.get(pokemonSpeciesSymbol).species
GameData::Species.play_cry_from_species(species)
end
def getHiddenPowerName(pokemon)
hiddenpower = pbHiddenPower(pokemon)
hiddenPowerType = hiddenpower[0]
echoln hiddenPowerType
if Settings::TRIPLE_TYPES.include?(hiddenPowerType)
return _INTL("Neutral")
end
return PBTypes.getName(hiddenPowerType)
end
def has_species_or_fusion?(species, form = -1)
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
end

View File

@@ -0,0 +1,231 @@
###################
## CONVERTER #
###################
def convertAllPokemon()
Kernel.pbMessage(_INTL("The game has detected that your previous savefile was from an earlier build of the game."))
Kernel.pbMessage(_INTL("In order to play this version, your Pokémon need to be converted to their new Pokédex numbers. "))
Kernel.pbMessage(_INTL("If you were playing Randomized mode, the trainers and wild Pokémon will also need to be reshuffled."))
if (Kernel.pbConfirmMessage(_INTL("Convert your Pokémon?")))
#get previous version
msgwindow = Kernel.pbCreateMessageWindow(nil)
msgwindow.text = _INTL("What is the last version of the game you played?")
choice = Kernel.pbShowCommands(msgwindow, [
_INTL("4.7 (September 2020)"),
_INTL("4.5-4.6.2 (2019-2020)"),
_INTL("4.2-4.4 (2019)"),
_INTL("4.0-4.1 (2018-2019)"),
_INTL("3.x or earlier (2015-2018)")], -1)
case choice
when 0
prev_total = 381
when 1
prev_total = 351
when 2
prev_total = 315
when 3
prev_total = 275
when 4
prev_total = 151
else
prev_total = 381
end
Kernel.pbDisposeMessageWindow(msgwindow)
pbEachPokemon { |poke, box|
if poke.species >= NB_POKEMON
pf = poke.species
pBody = (pf / prev_total).round
pHead = pf - (prev_total * pBody)
# Kernel.pbMessage("pbod {1} pHead {2}, species: {3})",pBody,pHead,pf)
prev_max_value = (prev_total * prev_total) + prev_total
if pf >= prev_max_value
newSpecies = convertTripleFusion(pf, prev_max_value)
if newSpecies == nil
boxname = box == -1 ? "Party" : box
Kernel.pbMessage(_INTL("Invalid Pokémon detected in box {1}:\n num. {2}, {3} (lv. {4})", boxname, pf, poke.name, poke.level))
if (Kernel.pbConfirmMessage(_INTL("Delete Pokémon and continue?")))
poke = nil
next
else
Kernel.pbMessage(_INTL("Conversion cancelled. Please restart the game."))
Graphics.freeze
end
end
end
newSpecies = pBody * NB_POKEMON + pHead
poke.species = newSpecies
end
}
Kernel.initRandomTypeArray()
if $game_switches[SWITCH_RANDOM_TRAINERS] #randomized trainers
Kernel.pbShuffleTrainers()
end
if $game_switches[956] #randomized pokemon
range = pbGet(197) == nil ? 25 : pbGet(197)
Kernel.pbShuffleDex(range, 1)
end
end
end
def convertTripleFusion(species, prev_max_value)
if prev_max_value == (351 * 351) + 351
case species
when 123553
return 145543
when 123554
return 145544
when 123555
return 145545
when 123556
return 145546
when 123557
return 145547
when 123558
return 145548
else
return nil
end
end
return nil
end
def convertTrainers()
if ($game_switches[SWITCH_RANDOM_TRAINERS])
Kernel.pbShuffleTrainers()
end
end
def convertAllPokemonManually()
if (Kernel.pbConfirmMessage(_INTL("When you last played the game, where there any gen 2 Pokémon?")))
#4.0
prev_total = 315
else
#3.0
prev_total = 151
end
convertPokemon(prev_total)
end
def convertPokemon(prev_total = 275)
pbEachPokemon { |poke, box|
if poke.species >= NB_POKEMON
pf = poke.species
pBody = (pf / prev_total).round
pHead = pf - (prev_total * pBody)
newSpecies = pBody * NB_POKEMON + pHead
poke.species = newSpecies
end
}
end
def fixMissedHMs()
# Flash
if $PokemonBag.pbQuantity(:HM08) < 1 && $PokemonGlobal.questRewardsObtained.include?(:HM08)
pbReceiveItem(:HM08)
end
# Cut
if $PokemonBag.pbQuantity(:HM01) < 1 && $game_switches[SWITCH_SS_ANNE_DEPARTED]
pbReceiveItem(:HM01)
end
# Strength
if $PokemonBag.pbQuantity(:HM04) < 1 && $game_switches[SWITCH_SNORLAX_GONE_ROUTE_12]
pbReceiveItem(:HM04)
end
# Surf
if $PokemonBag.pbQuantity(:HM03) < 1 && $game_self_switches[[107, 1, "A"]]
pbReceiveItem(:HM03)
end
# Teleport
if $PokemonBag.pbQuantity(:HM07) < 1 && $game_switches[SWITCH_TELEPORT_NPC]
pbReceiveItem(:HM07)
end
# Fly
if $PokemonBag.pbQuantity(:HM02) < 1 && $game_self_switches[[439, 1, "B"]]
pbReceiveItem(:HM02)
end
# Waterfall
if $PokemonBag.pbQuantity(:HM05) < 1 && $game_switches[SWITCH_GOT_WATERFALL]
pbReceiveItem(:HM05)
end
# Dive
if $PokemonBag.pbQuantity(:HM06) < 1 && $game_switches[SWITCH_GOT_DIVE]
pbReceiveItem(:HM06)
end
# Rock Climb
if $PokemonBag.pbQuantity(:HM10) < 1 && $game_switches[SWITCH_GOT_ROCK_CLIMB]
pbReceiveItem(:HM10)
end
end
def fixFinishedRocketQuests()
fix_broken_TR_quests()
var_tr_missions_cerulean = 288
switch_tr_mission_cerulean_4 = 1116
switch_tr_mission_celadon_1 = 1084
switch_tr_mission_celadon_2 = 1086
switch_tr_mission_celadon_3 = 1088
switch_tr_mission_celadon_4 = 1110
switch_pinkan_done = 1119
nb_cerulean_missions = pbGet(var_tr_missions_cerulean)
finishTRQuest("tr_cerulean_1", :SUCCESS, true) if nb_cerulean_missions >= 1 && !pbCompletedQuest?("tr_cerulean_1")
echoln pbCompletedQuest?("tr_cerulean_1")
finishTRQuest("tr_cerulean_2", :SUCCESS, true) if nb_cerulean_missions >= 2 && !pbCompletedQuest?("tr_cerulean_2")
finishTRQuest("tr_cerulean_3", :SUCCESS, true) if nb_cerulean_missions >= 3 && !pbCompletedQuest?("tr_cerulean_3")
finishTRQuest("tr_cerulean_4", :SUCCESS, true) if $game_switches[switch_tr_mission_cerulean_4] && !pbCompletedQuest?("tr_cerulean_4")
finishTRQuest("tr_celadon_1", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_1] && !pbCompletedQuest?("tr_celadon_1")
finishTRQuest("tr_celadon_2", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_2] && !pbCompletedQuest?("tr_celadon_2")
finishTRQuest("tr_celadon_3", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_3] && !pbCompletedQuest?("tr_celadon_3")
finishTRQuest("tr_celadon_4", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_4] && !pbCompletedQuest?("tr_celadon_4")
finishTRQuest("tr_pinkan", :SUCCESS, true) if $game_switches[switch_pinkan_done] && !pbCompletedQuest?("tr_pinkan")
end
def fix_broken_TR_quests()
for trainer_quest in $Trainer.quests
if trainer_quest.id == 0 # tr quests were all set to ID 0 instead of their real ID in v 6.4.0
for rocket_quest_id in TR_QUESTS.keys
rocket_quest = TR_QUESTS[rocket_quest_id]
next if !rocket_quest
if trainer_quest.name == rocket_quest.name
trainer_quest.id = rocket_quest_id
end
end
end
end
end
def fix_missing_infinite_splicers
return unless Settings::KANTO
obtained_infinite_splicers = $game_switches[275]
obtained_upgraded_infinite_splicers = $game_self_switches[[703,4,"A"]]
if obtained_infinite_splicers && pbQuantity(:INFINITESPLICERS) <= 0 && pbQuantity(:INFINITESPLICERS2) <= 0
pbReceiveItem(:INFINITESPLICERS)
end
if obtained_upgraded_infinite_splicers && pbQuantity(:INFINITESPLICERS2) <= 0
pbReceiveItem(:INFINITESPLICERS2)
end
end

View File

@@ -0,0 +1,159 @@
def splitSpriteCredits(name, bitmap, max_width)
name_full_width = bitmap.text_size(name).width
# use original name if can fit on one line
return [ name ] if name_full_width <= max_width
temp_string = name
name_split = []
# split name by collab separator " & " nearest to max width
start_pos = temp_string.index(' & ')
temp_pos = nil
while start_pos && (bitmap.text_size(temp_string).width > max_width)
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
if substring_width > max_width
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
start_pos = temp_string.index(' & ')
temp_pos = nil
next
end
temp_pos = start_pos
start_pos = temp_string.index(' & ', start_pos + 1)
end
# append remainder of " & " split if within max width
if temp_pos != nil
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
end
# split remaining string by space
temp_pos = nil
if (bitmap.text_size(temp_string).width > max_width) && (start_pos = temp_string.index(' '))
while start_pos && (bitmap.text_size(temp_string).width > max_width)
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
if substring_width > max_width
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
start_pos = temp_string.index(' ')
temp_pos = nil
next
end
temp_pos = start_pos
start_pos = temp_string.index(' ', start_pos + 1)
end
end
# append remaining text, even if too long for screen
name_split << temp_string if temp_string != ''
return name_split
end
def pbLoadPokemonBitmapSpecies(pokemon, species, back = false, scale = POKEMONSPRITESCALE)
ret = nil
pokemon = pokemon.pokemon if pokemon.respond_to?(:pokemon)
if pokemon.isEgg?
bitmapFileName = getEggBitmapPath(pokemon)
bitmapFileName = pbResolveBitmap(bitmapFileName)
elsif pokemon.species >= ZAPMOLCUNO_NB #zapmolcuno
bitmapFileName = getSpecialSpriteName(pokemon.species) #sprintf("Graphics/Battlers/special/144.145.146")
bitmapFileName = pbResolveBitmap(bitmapFileName)
else
#edited here
isFusion = species > NB_POKEMON
if isFusion
poke1 = getBodyID(species)
poke2 = getHeadID(species, poke1)
else
poke1 = species
poke2 = species
end
bitmapFileName = GetSpritePath(poke1, poke2, isFusion)
# Alter bitmap if supported
alterBitmap = (MultipleForms.getFunction(species, "alterBitmap") rescue nil)
end
if bitmapFileName && alterBitmap
animatedBitmap = AnimatedBitmap.new(bitmapFileName)
copiedBitmap = animatedBitmap.copy
animatedBitmap.dispose
copiedBitmap.each { |bitmap| alterBitmap.call(pokemon, bitmap) }
ret = copiedBitmap
elsif bitmapFileName
ret = AnimatedBitmap.new(bitmapFileName)
end
return ret
end
def pbPokemonBitmapFile(species)
# Used by the Pokédex
# Load normal bitmap
#get body and head num
isFused = species > NB_POKEMON
if isFused
if species >= ZAPMOLCUNO_NB
path = getSpecialSpriteName(species) + ".png"
else
poke1 = getBodyID(species) #getBasePokemonID(species,true)
poke2 = getHeadID(species, poke1) #getBasePokemonID(species,false)
path = GetSpritePath(poke1, poke2, isFused)
end
else
path = GetSpritePath(species, species, false)
end
ret = sprintf(path) rescue nil
if !pbResolveBitmap(ret)
ret = "Graphics/Battlers/000.png"
end
return ret
end
def pbLoadPokemonBitmap(pokemon, species, back = false)
#species est utilisé par elitebattle mais ca sert a rien
return pbLoadPokemonBitmapSpecies(pokemon, pokemon.species, back)
end
def getEggBitmapPath(pokemon)
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.hide_custom_eggs
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%s", getConstantName(PBSpecies, pokemon.species)) rescue nil
if !pbResolveBitmap(bitmapFileName)
if pokemon.species >= NUM_ZAPMOLCUNO
bitmapFileName = "Graphics/Battlers/Eggs/egg_base"
else
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", pokemon.species)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/Eggs/000")
end
end
end
return bitmapFileName
end
def GetSpritePath(poke1, poke2, isFused)
#Check if custom exists
spritename = GetSpriteName(poke1, poke2, isFused)
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES,poke2, spritename)
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
path = pbResolveBitmap(pathCustom) && $game_variables[196] == 0 ? pathCustom : pathReg
return path
end
def GetSpritePathForced(poke1, poke2, isFused)
#Check if custom exists
spritename = GetSpriteName(poke1, poke2, isFused)
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES, poke2, spritename)
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
path = pbResolveBitmap(pathCustom) ? pathCustom : pathReg
return path
end
def GetSpriteName(poke1, poke2, isFused)
ret = isFused ? sprintf("%d.%d", poke2, poke1) : sprintf("%d", poke2) rescue nil
return ret
end

View File

@@ -0,0 +1,115 @@
def pbGetSelfSwitch(eventId, switch)
return $game_self_switches[[@map_id, eventId, switch]]
end
def find_newer_available_version
latest_Version = fetch_latest_game_version
return nil if !latest_Version
return nil if is_higher_version(Settings::GAME_VERSION_NUMBER, latest_Version)
return latest_Version
end
def is_higher_version(gameVersion, latestVersion)
gameVersion_parts = gameVersion.split('.').map(&:to_i)
latestVersion_parts = latestVersion.split('.').map(&:to_i)
# Compare each part of the version numbers from left to right
gameVersion_parts.each_with_index do |part, i|
return true if (latestVersion_parts[i].nil? || part > latestVersion_parts[i])
return false if part < latestVersion_parts[i]
end
return latestVersion_parts.length <= gameVersion_parts.length
end
def get_current_game_difficulty
return :EASY if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
return :HARD if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return :NORMAL
end
def get_difficulty_text
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
return _INTL("Easy")
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return _INTL("Hard")
else
return _INTL("Normal")
end
end
def getLatestSpritepackDate()
return Time.new(Settings::NEWEST_SPRITEPACK_YEAR, Settings::NEWEST_SPRITEPACK_MONTH)
end
def new_spritepack_was_released()
current_spritepack_date = $PokemonGlobal.current_spritepack_date
latest_spritepack_date = getLatestSpritepackDate()
if !current_spritepack_date || (current_spritepack_date < latest_spritepack_date)
$PokemonGlobal.current_spritepack_date = latest_spritepack_date
return true
end
return false
end
def clearAllSelfSwitches(mapID, switch = "A", newValue = false)
map = $MapFactory.getMap(mapID, false)
map.events.each { |event_array|
event_id = event_array[0]
pbSetSelfSwitch(event_id, switch, newValue, mapID)
}
end
def openUrlInBrowser(url = "")
begin
# Open the URL in the default web browser
system("xdg-open", url) || system("open", url) || system("start", url)
rescue
Input.clipboard = url
pbMessage(_INTL("The game could not open the link in the browser"))
pbMessage(_INTL("The link has been copied to your clipboard instead"))
end
end
# todo: implement
def getMappedKeyFor(internalKey)
keybinding_fileName = "keybindings.mkxp1"
path = System.data_directory + keybinding_fileName
parse_keybindings(path)
# echoln Keybindings.new(path).bindings
end
def formatNumberToString(number)
return number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
end
def optionsMenu(options = [], cmdIfCancel = -1, startingOption = 0)
cmdIfCancel = -1 if !cmdIfCancel
result = pbShowCommands(nil, options, cmdIfCancel, startingOption)
# echoln "menuResult :#{result}"
return result
end
def displaySpriteWindowWithMessage(pif_sprite, message = "", x = 0, y = 0, z = 0)
spriteLoader = BattleSpriteLoader.new
sprite_bitmap = spriteLoader.load_pif_sprite_directly(pif_sprite)
if sprite_bitmap
pictureWindow = PictureWindow.new(sprite_bitmap.bitmap)
else
pictureWindow = PictureWindow.new("")
end
pictureWindow.opacity = 0
pictureWindow.z = z
pictureWindow.x = x
pictureWindow.y = y
pbMessage(message)
pictureWindow.dispose
end
def numeric_string?(str)
str.match?(/\A\d+\z/)
end

View File

@@ -103,7 +103,7 @@ def pbWonderTrade(lvl, except = [], except2 = [], premiumWonderTrade = true)
#Redo loop if below BST - 200
species = 0 if bst < (chosenBST - 200)
# raise _INTL("{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst)
# raise "{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst
# species=0 if (except.include?(species) && except2.include?(species))
# use this above line instead if you wish to neither receive pokemon that YOU
@@ -165,7 +165,7 @@ def pbGRS(minBST, chosenBST, luck, rare, except2)
#Redo loop if below BST - 200
species = 0 if bst < (chosenBST - 200)
# raise _INTL("{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst)
# raise "{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst
# species=0 if (except.include?(species) && except2.include?(species))
# use this above line instead if you wish to neither receive pokemon that YOU

File diff suppressed because it is too large Load Diff

View File

@@ -1,305 +0,0 @@
#IMPORTANT
#La méthode def pbCheckEvolution(pokemon,item=0)
#dans PokemonFusion (class PokemonFusionScene)
#a été modifiée et pour une raison ou une autre ca marche
#pas quand on la copie ici.
#Donc NE PAS OUBLIER DE LE COPIER AVEC
############################
# MODIFIED CODE SECTION #
###########################
#
# require PokeBattle_Scene_edited2
# PokemonFusion
#
NB_POKEMON = Settings::NB_POKEMON#809#420 #351 #aussi CONST_NB_POKE
CONST_NB_POKE = NB_POKEMON
def pbPokemonBitmapFile(species)
# Used by the Pokédex
# Load normal bitmap
#get body and head num
isFused = species > NB_POKEMON
if isFused
if species >= ZAPMOLCUNO_NB
path = getSpecialSpriteName(species) + ".png"
else
poke1 = getBodyID(species) #getBasePokemonID(species,true)
poke2 = getHeadID(species, poke1) #getBasePokemonID(species,false)
path = GetSpritePath(poke1, poke2, isFused)
end
else
path = GetSpritePath(species, species, false)
end
ret = sprintf(path) rescue nil
if !pbResolveBitmap(ret)
ret = "Graphics/Battlers/000.png"
end
return ret
end
def pbLoadPokemonBitmap(pokemon, species, back = false)
#species est utilisé par elitebattle mais ca sert a rien
return pbLoadPokemonBitmapSpecies(pokemon, pokemon.species, back)
end
def getEggBitmapPath(pokemon)
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.use_custom_eggs
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%s", getConstantName(PBSpecies, pokemon.species)) rescue nil
if !pbResolveBitmap(bitmapFileName)
if pokemon.species >= NUM_ZAPMOLCUNO
bitmapFileName = "Graphics/Battlers/Eggs/egg_base"
else
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", pokemon.species)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/Eggs/000")
end
end
end
return bitmapFileName
end
def pbLoadPokemonBitmapSpecies(pokemon, species, back = false, scale = POKEMONSPRITESCALE)
ret = nil
pokemon = pokemon.pokemon if pokemon.respond_to?(:pokemon)
if pokemon.isEgg?
bitmapFileName = getEggBitmapPath(pokemon)
bitmapFileName = pbResolveBitmap(bitmapFileName)
elsif pokemon.species >= ZAPMOLCUNO_NB #zapmolcuno
bitmapFileName = getSpecialSpriteName(pokemon.species) #sprintf("Graphics/Battlers/special/144.145.146")
bitmapFileName = pbResolveBitmap(bitmapFileName)
else
#edited here
isFusion = species > NB_POKEMON
if isFusion
poke1 = getBodyID(species)
poke2 = getHeadID(species, poke1)
else
poke1 = species
poke2 = species
end
bitmapFileName = GetSpritePath(poke1, poke2, isFusion)
# Alter bitmap if supported
alterBitmap = (MultipleForms.getFunction(species, "alterBitmap") rescue nil)
end
if bitmapFileName && alterBitmap
animatedBitmap = AnimatedBitmap.new(bitmapFileName)
copiedBitmap = animatedBitmap.copy
animatedBitmap.dispose
copiedBitmap.each { |bitmap| alterBitmap.call(pokemon, bitmap) }
ret = copiedBitmap
elsif bitmapFileName
ret = AnimatedBitmap.new(bitmapFileName)
end
return ret
end
#######################
# NEW CODE SECTION #
#######################
DOSSIERCUSTOMSPRITES = "CustomBattlers"
BATTLERSPATH = "Battlers"
def GetSpritePath(poke1, poke2, isFused)
#Check if custom exists
spritename = GetSpriteName(poke1, poke2, isFused)
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES,poke2, spritename)
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
path = pbResolveBitmap(pathCustom) && $game_variables[196] == 0 ? pathCustom : pathReg
return path
end
def GetSpritePathForced(poke1, poke2, isFused)
#Check if custom exists
spritename = GetSpriteName(poke1, poke2, isFused)
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES, poke2, spritename)
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
path = pbResolveBitmap(pathCustom) ? pathCustom : pathReg
return path
end
def GetSpriteName(poke1, poke2, isFused)
ret = isFused ? sprintf("%d.%d", poke2, poke1) : sprintf("%d", poke2) rescue nil
return ret
end
def isPartPokemon(src, target)
return Kernel.isPartPokemon(src, target)
end
#in: pokemon number
def Kernel.isPartPokemon(src, target)
src = getDexNumberForSpecies(src)
target = getDexNumberForSpecies(target)
return true if src == target
return false if src <= NB_POKEMON
bod = getBasePokemonID(src, true)
head = getBasePokemonID(src, false)
return bod == target || head == target
end
##EDITED HERE
#Retourne le pokemon de base
#param1 = int
#param2 = true pour body, false pour head
#return int du pokemon de base
def getBasePokemonID(pokemon, body = true)
if pokemon.is_a?(Symbol)
dex_number = GameData::Species.get(pokemon).id_number
pokemon = dex_number
end
return nil if pokemon <= 0
return nil if pokemon >= Settings::ZAPMOLCUNO_NB
# cname = getConstantName(PBSpecies, pokemon) rescue nil
cname = GameData::Species.get(pokemon).id.to_s
return pokemon if pokemon <= NB_POKEMON
return pokemon if cname == nil
arr = cname.split(/[B,H]/)
bod = arr[1]
head = arr[2]
return bod.to_i if body
return head.to_i
end
###################
## CONVERTER #
###################
def convertAllPokemon()
Kernel.pbMessage(_INTL("The game has detected that your previous savefile was from an earlier build of the game."))
Kernel.pbMessage(_INTL("In order to play this version, your Pokémon need to be converted to their new Pokédex numbers. "))
Kernel.pbMessage(_INTL("If you were playing Randomized mode, the trainers and wild Pokémon will also need to be reshuffled."))
if (Kernel.pbConfirmMessage(_INTL("Convert your Pokémon?")))
#get previous version
msgwindow = Kernel.pbCreateMessageWindow(nil)
msgwindow.text = "What is the last version of the game you played?"
choice = Kernel.pbShowCommands(msgwindow, [
"4.7 (September 2020)",
"4.5-4.6.2 (2019-2020)",
"4.2-4.4 (2019)",
"4.0-4.1 (2018-2019)",
"3.x or earlier (2015-2018)"], -1)
case choice
when 0
prev_total = 381
when 1
prev_total = 351
when 2
prev_total = 315
when 3
prev_total = 275
when 4
prev_total = 151
else
prev_total = 381
end
Kernel.pbDisposeMessageWindow(msgwindow)
pbEachPokemon { |poke, box|
if poke.species >= NB_POKEMON
pf = poke.species
pBody = (pf / prev_total).round
pHead = pf - (prev_total * pBody)
# Kernel.pbMessage(_INTL("pbod {1} pHead {2}, species: {3})",pBody,pHead,pf))
prev_max_value = (prev_total * prev_total) + prev_total
if pf >= prev_max_value
newSpecies = convertTripleFusion(pf, prev_max_value)
if newSpecies == nil
boxname = box == -1 ? "Party" : box
Kernel.pbMessage(_INTL("Invalid Pokémon detected in box {1}:\n num. {2}, {3} (lv. {4})", boxname, pf, poke.name, poke.level))
if (Kernel.pbConfirmMessage(_INTL("Delete Pokémon and continue?")))
poke = nil
next
else
Kernel.pbMessage(_INTL("Conversion cancelled. Please restart the game."))
Graphics.freeze
end
end
end
newSpecies = pBody * NB_POKEMON + pHead
poke.species = newSpecies
end
}
Kernel.initRandomTypeArray()
if $game_switches[SWITCH_RANDOM_TRAINERS] #randomized trainers
Kernel.pbShuffleTrainers()
end
if $game_switches[956] #randomized pokemon
range = pbGet(197) == nil ? 25 : pbGet(197)
Kernel.pbShuffleDex(range, 1)
end
end
end
def convertTripleFusion(species, prev_max_value)
if prev_max_value == (351 * 351) + 351
case species
when 123553
return 145543
when 123554
return 145544
when 123555
return 145545
when 123556
return 145546
when 123557
return 145547
when 123558
return 145548
else
return nil
end
end
return nil
end
def convertTrainers()
if ($game_switches[SWITCH_RANDOM_TRAINERS])
Kernel.pbShuffleTrainers()
end
end
def convertAllPokemonManually()
if (Kernel.pbConfirmMessage(_INTL("When you last played the game, where there any gen 2 Pokémon?")))
#4.0
prev_total = 315
else
#3.0
prev_total = 151
end
convertPokemon(prev_total)
end
def convertPokemon(prev_total = 275)
pbEachPokemon { |poke, box|
if poke.species >= NB_POKEMON
pf = poke.species
pBody = (pf / prev_total).round
pHead = pf - (prev_total * pBody)
newSpecies = pBody * NB_POKEMON + pHead
poke.species = newSpecies
end
}
end

View File

@@ -1,587 +0,0 @@
def pbAddPokemonID(pokemon, level = nil, seeform = true, dontRandomize = false)
return if !pokemon || !$Trainer
dontRandomize = true if $game_switches[SWITCH_CHOOSING_STARTER] #when choosing starters
if pbBoxesFull?
Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return false
end
if pokemon.is_a?(Integer) && level.is_a?(Integer)
pokemon = Pokemon.new(pokemon, level, $Trainer)
end
#random species if randomized gift pokemon & wild poke
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !dontRandomize
tryRandomizeGiftPokemon(pokemon, dontRandomize)
end
speciesname = PBSpecies.getName(pokemon.species)
Kernel.pbMessage(_INTL("{1} obtained {2}!\\se[itemlevel]\1", $Trainer.name, speciesname))
pbNicknameAndStore(pokemon)
pbSeenForm(pokemon) if seeform
return true
end
def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = false)
return false if !pokemon_id
skip_randomize = true if $game_switches[SWITCH_CHOOSING_STARTER] #when choosing starters
if pbBoxesFull?
pbMessage(_INTL("There's no more room for Pokémon!\1"))
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return false
end
if pokemon_id.is_a?(Integer) && level.is_a?(Integer)
pokemon = Pokemon.new(pokemon_id, level)
species_name = pokemon.speciesName
end
#random species if randomized gift pokemon & wild poke
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !skip_randomize
tryRandomizeGiftPokemon(pokemon, skip_randomize)
end
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
pbNicknameAndStore(pokemon)
$Trainer.pokedex.register(pokemon) if see_form
return true
end
def pbHasSpecies?(species)
if species.is_a?(String) || species.is_a?(Symbol)
id = getID(PBSpecies, species)
elsif species.is_a?(Pokemon)
id = species.dexNum
end
for pokemon in $Trainer.party
next if pokemon.isEgg?
return true if pokemon.dexNum == id
end
return false
end
#ancienne methode qui est encore callée un peu partout dans les vieux scripts
def getID(pbspecies_unused, species)
if species.is_a?(String)
return nil
elsif species.is_a?(Symbol)
return GameData::Species.get(species).id_number
elsif species.is_a?(Pokemon)
id = species.dexNum
end
end
#Check if the Pokemon can learn a TM
def CanLearnMove(pokemon, move)
species = getID(PBSpecies, pokemon)
return false if species <= 0
data = load_data("Data/tm.dat")
return false if !data[move]
return data[move].any? { |item| item == species }
end
def pbPokemonIconFile(pokemon)
bitmapFileName = pbCheckPokemonIconFiles(pokemon.species, pokemon.isEgg?)
return bitmapFileName
end
def pbCheckPokemonIconFiles(speciesID, egg = false, dna = false)
if egg
bitmapFileName = sprintf("Graphics/Icons/iconEgg")
return pbResolveBitmap(bitmapFileName)
else
bitmapFileName = _INTL("Graphics/Pokemon/Icons/{1}", speciesID)
ret = pbResolveBitmap(bitmapFileName)
return ret if ret
end
ret = pbResolveBitmap("Graphics/Icons/iconDNA.png")
return ret if ret
return pbResolveBitmap("Graphics/Icons/iconDNA.png")
end
def getPokemon(dexNum)
if dexNum.is_a?(Integer)
if dexNum > NB_POKEMON
body_id = getBodyID(dexNum)
head_id = getHeadID(dexNum, body_id)
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
else
pokemon_id = dexNum
end
else
pokemon_id = dexNum
end
return GameData::Species.get(pokemon_id)
end
def getSpecies(dexnum)
return getPokemon(dexnum.species) if dexnum.is_a?(Pokemon)
return getPokemon(dexnum)
end
def getAbilityIndexFromID(abilityID, fusedPokemon)
abilityList = fusedPokemon.getAbilityList
for abilityArray in abilityList #ex: [:CHLOROPHYLL, 0]
ability = abilityArray[0]
index = abilityArray[1]
return index if ability == abilityID
end
return 0
end
# dir_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED
# indexFolders = Dir.entries(dir_path).select do |entry|
# entry_number = entry.to_i
# File.directory?(File.join(dir_path, entry)) && entry_number.between?(1, NB_POKEMON)
# end
# return nil if indexFolders.empty?
# # Loop until a non-empty folder is found
# selectedIndex = nil
# spritesList = []
# until selectedIndex && !spritesList.empty?
# selectedIndex = indexFolders.sample
# spritesList = Dir.entries(File.join(dir_path, selectedIndex)).select do |file|
# File.file?(File.join(dir_path, selectedIndex, file))
# end
# end
# selectedSprite = spritesList.sample
# return getPokemonSpeciesFromSprite(selectedSprite)
#end
def addShinyStarsToGraphicsArray(imageArray, xPos, yPos, shinyBody, shinyHead, debugShiny, srcx = nil, srcy = nil, width = nil, height = nil,
showSecondStarUnder = false, showSecondStarAbove = false)
color = debugShiny ? Color.new(0, 0, 0, 255) : nil
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
if shinyBody && shinyHead
if showSecondStarUnder
yPos += 15
elsif showSecondStarAbove
yPos -= 15
else
xPos -= 15
end
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
end
# if onlyOutline
# imageArray.push(["Graphics/Pictures/shiny_black",xPos,yPos,srcx,srcy,width,height,color])
# end
end
# def getRandomCustomFusion(returnRandomPokemonIfNoneFound = true, customPokeList = [], maxPoke = -1, recursionLimit = 3, maxBST = 300)
# if customPokeList.length == 0
# customPokeList = getCustomSpeciesList()
# end
# randPoke = []
# if customPokeList.length >= 5000
# chosen = false
# i = 0 #loop pas plus que 3 fois pour pas lag
# while chosen == false
# fusedPoke = customPokeList[rand(customPokeList.length)]
# if (i >= recursionLimit) || maxPoke == -1
# return fusedPoke
# end
# end
# else
# if returnRandomPokemonIfNoneFound
# return rand(maxPoke) + 1
# end
# end
#
# return randPoke
# end
def getAllNonLegendaryPokemon()
list = []
for i in 1..143
list.push(i)
end
for i in 147..149
list.push(i)
end
for i in 152..242
list.push(i)
end
list.push(246)
list.push(247)
list.push(248)
for i in 252..314
list.push(i)
end
for i in 316..339
list.push(i)
end
for i in 352..377
list.push(i)
end
for i in 382..420
list.push(i)
end
return list
end
def getPokemonEggGroups(species)
return GameData::Species.get(species).egg_groups
end
def generateEggGroupTeam(eggGroup)
teamComplete = false
generatedTeam = []
while !teamComplete
species = rand(PBSpecies.maxValue)
if getPokemonEggGroups(species).include?(eggGroup)
generatedTeam << species
end
teamComplete = generatedTeam.length == 3
end
return generatedTeam
end
def pbGetSelfSwitch(eventId, switch)
return $game_self_switches[[@map_id, eventId, switch]]
end
def getAllNonLegendaryPokemon()
list = []
for i in 1..143
list.push(i)
end
for i in 147..149
list.push(i)
end
for i in 152..242
list.push(i)
end
list.push(246)
list.push(247)
list.push(248)
for i in 252..314
list.push(i)
end
for i in 316..339
list.push(i)
end
for i in 352..377
list.push(i)
end
for i in 382..420
list.push(i)
end
return list
end
def generateSimpleTrainerParty(teamSpecies, level)
team = []
for species in teamSpecies
poke = Pokemon.new(species, level)
team << poke
end
return team
end
def isInKantoGeneration(dexNumber)
return dexNumber <= 151
end
def isKantoPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
return isInKantoGeneration(dexNum) || isInKantoGeneration(head_dex) || isInKantoGeneration(body_dex)
end
def isInJohtoGeneration(dexNumber)
return dexNumber > 151 && dexNumber <= 251
end
def isJohtoPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
return isInJohtoGeneration(dexNum) || isInJohtoGeneration(head_dex) || isInJohtoGeneration(body_dex)
end
def isAlolaPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list = [
370, 373, 430, 431, 432, 433, 450, 451, 452,
453, 454, 455, 459, 460, 463, 464, 465, 469, 470,
471, 472, 473, 474, 475, 476, 477, 498, 499,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isKalosPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[327, 328, 329, 339, 371, 372, 417, 418,
425, 426, 438, 439, 440, 441, 444, 445, 446,
456, 461, 462, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
489, 490, 491, 492, 500,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isUnovaPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[
330, 331, 337, 338, 348, 349, 350, 351, 359, 360, 361,
362, 363, 364, 365, 366, 367, 368, 369, 374, 375, 376, 377,
397, 398, 399, 406, 407, 408, 409, 410, 411, 412, 413, 414,
415, 416, 419, 420,
422, 423, 424, 434, 345,
466, 467, 494, 493,
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isSinnohPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list =
[254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 288, 294,
295, 296, 297, 298, 299, 305, 306, 307, 308, 315, 316, 317,
318, 319, 320, 321, 322, 323, 324, 326, 332, 343, 344, 345,
346, 347, 352, 353, 354, 358, 383, 384, 388, 389, 400, 402,
403, 429, 468]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def isHoennPokemon(species)
dexNum = getDexNumberForSpecies(species)
poke = getPokemon(species)
head_dex = getDexNumberForSpecies(poke.get_head_species())
body_dex = getDexNumberForSpecies(poke.get_body_species())
list = [252, 253, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 289, 290, 291, 292, 293, 300, 301, 302, 303,
304, 309, 310, 311, 312, 313, 314, 325, 333, 334, 335, 336, 340,
341, 342, 355, 356, 357, 378, 379, 380, 381, 382, 385, 386,
387, 390, 391, 392, 393, 394, 395, 396, 401, 404, 405, 421,
427, 428, 436, 437, 442, 443, 447, 448, 449, 457, 458, 488,
495, 496, 497, 501, 502, 503, 504, 505, 506, 507, 508, 509,
510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521,
522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533,
534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
558, 559, 560, 561, 562, 563, 564, 565
]
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
end
def pbBitmap(path)
if !pbResolveBitmap(path).nil?
bmp = RPG::Cache.load_bitmap_path(path)
bmp.storedPath = path
else
p "Image located at '#{path}' was not found!" if $DEBUG
bmp = Bitmap.new(1, 1)
end
return bmp
end
def reverseFusionSpecies(species)
dexId = getDexNumberForSpecies(species)
return species if dexId <= NB_POKEMON
return species if dexId > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
body = getBasePokemonID(dexId, true)
head = getBasePokemonID(dexId, false)
newspecies = (head) * NB_POKEMON + body
return getPokemon(newspecies)
end
def Kernel.getRoamingMap(roamingArrayPos)
curmap = $PokemonGlobal.roamPosition[roamingArrayPos]
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
text = mapinfos[curmap].name #,(curmap==$game_map.map_id) ? _INTL("(this map)") : "")
return text
end
def Kernel.getItemNamesAsString(list)
strList = ""
for i in 0..list.length - 1
id = list[i]
name = PBItems.getName(id)
strList += name
if i != list.length - 1 && list.length > 1
strList += ","
end
end
return strList
end
def get_default_moves_at_level(species, level)
moveset = GameData::Species.get(species).moves
knowable_moves = []
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= level }
# Remove duplicates (retaining the latest copy of each move)
knowable_moves = knowable_moves.reverse
knowable_moves |= []
knowable_moves = knowable_moves.reverse
# Add all moves
moves = []
first_move_index = knowable_moves.length - MAX_MOVES
first_move_index = 0 if first_move_index < 0
for i in first_move_index...knowable_moves.length
#moves.push(Pokemon::Move.new(knowable_moves[i]))
moves << knowable_moves[i]
end
return moves
end
def find_newer_available_version
latest_Version = fetch_latest_game_version
return nil if !latest_Version
return nil if is_higher_version(Settings::GAME_VERSION_NUMBER, latest_Version)
return latest_Version
end
def is_higher_version(gameVersion, latestVersion)
gameVersion_parts = gameVersion.split('.').map(&:to_i)
latestVersion_parts = latestVersion.split('.').map(&:to_i)
# Compare each part of the version numbers from left to right
gameVersion_parts.each_with_index do |part, i|
return true if (latestVersion_parts[i].nil? || part > latestVersion_parts[i])
return false if part < latestVersion_parts[i]
end
return latestVersion_parts.length <= gameVersion_parts.length
end
def get_current_game_difficulty
return :EASY if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
return :HARD if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return :NORMAL
end
def get_difficulty_text
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
return "Easy"
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return "Hard"
else
return "Normal"
end
end
def getCurrentLevelCap()
current_max_level = Settings::LEVEL_CAPS[$Trainer.badge_count]
current_max_level *= Settings::HARD_MODE_LEVEL_MODIFIER if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
return current_max_level
end
def pokemonExceedsLevelCap(pokemon)
return false if $Trainer.badge_count >= Settings::NB_BADGES
current_max_level = getCurrentLevelCap()
return pokemon.level >= current_max_level
end
def listPokemonIDs()
for id in 0..NB_POKEMON
pokemon = GameData::Species.get(id).species
echoln id.to_s + ": " + "\"" + pokemon.to_s + "\"" + ", "
end
end
def getLatestSpritepackDate()
return Time.new(Settings::NEWEST_SPRITEPACK_YEAR, Settings::NEWEST_SPRITEPACK_MONTH)
end
def new_spritepack_was_released()
current_spritepack_date = $PokemonGlobal.current_spritepack_date
latest_spritepack_date = getLatestSpritepackDate()
if !current_spritepack_date || (current_spritepack_date < latest_spritepack_date)
$PokemonGlobal.current_spritepack_date = latest_spritepack_date
return true
end
return false
end
def splitSpriteCredits(name, bitmap, max_width)
name_full_width = bitmap.text_size(name).width
# use original name if can fit on one line
return [ name ] if name_full_width <= max_width
temp_string = name
name_split = []
# split name by collab separator " & " nearest to max width
start_pos = temp_string.index(' & ')
temp_pos = nil
while start_pos && (bitmap.text_size(temp_string).width > max_width)
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
if substring_width > max_width
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
start_pos = temp_string.index(' & ')
temp_pos = nil
next
end
temp_pos = start_pos
start_pos = temp_string.index(' & ', start_pos + 1)
end
# append remainder of " & " split if within max width
if temp_pos != nil
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
end
# split remaining string by space
temp_pos = nil
if (bitmap.text_size(temp_string).width > max_width) && (start_pos = temp_string.index(' '))
while start_pos && (bitmap.text_size(temp_string).width > max_width)
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
if substring_width > max_width
name_split << temp_string[0, temp_pos].strip
temp_string = temp_string[(temp_pos + 1)..].strip
start_pos = temp_string.index(' ')
temp_pos = nil
next
end
temp_pos = start_pos
start_pos = temp_string.index(' ', start_pos + 1)
end
end
# append remaining text, even if too long for screen
name_split << temp_string if temp_string != ''
return name_split
end
def get_spritecharacter_for_event(event_id)
for sprite in $scene.spriteset.character_sprites
if sprite.character.id == event_id
return sprite
end
end
end

View File

@@ -9,9 +9,9 @@
# Fix event comment
def pbEventCommentInput(*args)
parameters = []
list = *args[0].list # Event or event page
elements = *args[1] # Number of elements
trigger = *args[2] # Trigger
list = *args[0].list # Event or event page
elements = *args[1] # Number of elements
trigger = *args[2] # Trigger
return nil if list == nil
return nil unless list.is_a?(Array)
for item in list
@@ -67,12 +67,12 @@ module FootprintVariables
viewport = $scene.spriteset.viewport1
footsprites = $scene.spriteset.footsprites
nid = self.get_new_id
rpgEvent = RPG::Event.new(position[0], position[1])
rpgEvent = RPG::Event.new(position[0], position[1])
rpgEvent.id = nid
fev = Game_Event.new($game_map.map_id, rpgEvent, $game_map)
eventsprite = Sprite_Character.new(viewport, fev)
character_sprites.push(eventsprite)
footsprites.push(Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid, character_sprites, (event==$game_player)))
footsprites.push(Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid, character_sprites, (event == $game_player)))
end
end
@@ -83,18 +83,21 @@ end
class Sprite_Character
alias old_initialize_foot initialize
def initialize(viewport, character=nil)
def initialize(viewport, character = nil)
old_initialize_foot(viewport, character)
@disposed = false
end
alias old_update_foot update
def update
return if @disposed
old_update_foot
end
alias old_dispose_foot dispose
def dispose
old_dispose_foot
@disposed = true
@@ -106,7 +109,8 @@ class Spriteset_Map
attr_accessor :footsprites
alias old_initialize initialize
def initialize(map=nil)
def initialize(map = nil)
old_initialize(map)
@footsprites = []
end
@@ -120,6 +124,7 @@ class Spriteset_Map
end
alias old_dispose dispose
def dispose
old_dispose
@footsprites.each { |sprite| sprite.dispose } if !@footsprites.nil?
@@ -127,10 +132,11 @@ class Spriteset_Map
end
alias old_update update
def update
old_update
return if @footsprites.nil?
@footsprites.each { |sprite| sprite.update }
@footsprites.each { |sprite| sprite.update }
end
end
@@ -144,19 +150,24 @@ class Game_Character
def get_last_pos
case direction
when 2 then return [@x, @y-1, direction] # Move down
when 4 then return [@x+1, @y, direction] # Move left
when 6 then return [@x-1, @y, direction] # Move right
when 8 then return [@x, @y+1, direction] # Move up
when 2 then return [@x, @y - 1, direction] # Move down
when 4 then return [@x + 1, @y, direction] # Move left
when 6 then return [@x - 1, @y, direction] # Move right
when 8 then return [@x, @y + 1, direction] # Move up
end
return false
end
def foot_prints?
return $game_map.terrain_tag(get_last_pos[0], get_last_pos[1]) == FootprintVariables::TERRAIN_FOOT && $scene.is_a?(Scene_Map) && $scene.spriteset?
begin
return $game_map.terrain_tag(get_last_pos[0], get_last_pos[1]) == FootprintVariables::TERRAIN_FOOT && $scene.is_a?(Scene_Map) && $scene.spriteset?
rescue
return false
end
end
alias leave_tile_footprints triggerLeaveTile
def triggerLeaveTile
leave_tile_footprints
$scene.spriteset.putFootprint(self, get_last_pos) if foot_prints?
@@ -165,14 +176,14 @@ class Game_Character
end
class Footsprite
def initialize(sprite,event,viewport,map,direction,nid,chardata,player)
def initialize(sprite, event, viewport, map, direction, nid, chardata, player)
@rsprite = sprite
# Sprite
@sprite = Sprite.new(viewport)
@sprite = Sprite.new(viewport)
file = player && $PokemonGlobal.bicycle ? "footsetbike.png" : "footset.png"
@sprite.bitmap = RPG::Cache.load_bitmap("Graphics/Pictures/", file)
# Set position
@realwidth = @sprite.bitmap.width/4
@realwidth = @sprite.bitmap.width / 4
@sprite.src_rect.width = @realwidth
@opacity = FootprintVariables::FOOT_OPACITY
setFootset(direction)
@@ -180,7 +191,7 @@ class Footsprite
@map = map
@event = event
@disposed = false
@eventid = nid
@eventid = nid
@viewport = viewport
@chardata = chardata
update
@@ -189,10 +200,10 @@ class Footsprite
def setFootset(direction)
@sprite.src_rect.x =
case direction
when 2 then 0 # Move down
when 2 then 0 # Move down
when 4 then @realwidth * 3 # Move left
when 6 then @realwidth * 2 # Move right
when 8 then @realwidth # Move up
when 8 then @realwidth # Move up
end
@sprite.opacity = @opacity
end
@@ -211,14 +222,14 @@ class Footsprite
return if @disposed
x = @rsprite.x - @rsprite.ox
y = @rsprite.y - @rsprite.oy
width = @rsprite.src_rect.width
width = @rsprite.src_rect.width
height = @rsprite.src_rect.height
@sprite.x = x + width / 2
@sprite.y = y + height
@sprite.x = x + width / 2
@sprite.y = y + height
@sprite.ox = @realwidth / 2
@sprite.oy = @sprite.bitmap.height
@sprite.z = @rsprite.z - 2
@opacity -= FootprintVariables::FOOT_DELAY
@sprite.z = @rsprite.z - 2
@opacity -= FootprintVariables::FOOT_DELAY
@sprite.opacity = @opacity
dispose if @sprite.opacity <= 0
end

View File

@@ -9,7 +9,7 @@
# though, so after getting the suggestion I thought it would be cool if I #
# could make something of my own that would work with v16, as well as v17. #
#==============================================================================#
# Features: #
# Gameplay: #
# - Blacklisting events from receiving shadows #
# - Whitelisting events to always receive shadows #
# - A scaling animation when an event jumps #

View File

@@ -0,0 +1,16 @@
def addWaterCausticsEffect(fog_name = "caustic1", opacity = 16)
$game_map.fog_name = fog_name
$game_map.fog_hue = 0
$game_map.fog_opacity = opacity
#$game_map.fog_blend_type = @parameters[4]
$game_map.fog_zoom = 200
$game_map.fog_sx = 2
$game_map.fog_sy = 2
$game_map.setFog2(fog_name, -3, 0, opacity,)
end
def stopWaterCausticsEffect()
$game_map.fog_opacity = 0
$game_map.eraseFog2()
end

View File

@@ -0,0 +1,84 @@
def promptEnableSpritesDownload
message = _INTL("Some sprites appear to be missing from your game. \nWould you like the game to download sprites automatically while playing? (this requires an internet connection)")
if pbConfirmMessage(message)
$PokemonSystem.download_sprites = 0
end
end
def update_spritepack_files()
updateCreditsFile()
updateOnlineCustomSpritesFile()
reset_updated_spritesheets_cache()
$updated_spritesheets = []
spritesLoader = BattleSpriteLoader.new
spritesLoader.clear_sprites_cache(:CUSTOM)
spritesLoader.clear_sprites_cache(:BASE)
pbMessage(_INTL("Data files updated. New sprites will now be downloaded as you play!"))
end
def reset_updated_spritesheets_cache()
echoln "resetting updated spritesheets list"
begin
File.open(Settings::UPDATED_SPRITESHEETS_CACHE, 'w') { |file| file.truncate(0) }
echoln "File reset successfully."
rescue => e
echoln "Failed to reset file: #{e.message}"
end
end
def preload_party(trainer)
spriteLoader = BattleSpriteLoader.new
for pokemon in trainer.party
spriteLoader.preload_sprite_from_pokemon(pokemon)
end
end
#unused - too slow, & multithreading not possible
# def preload_party_and_boxes(storage, trainer)
# echoln "Loading boxes and party into cache in the background"
# start_time = Time.now
# spriterLoader = BattleSpriteLoader.new
# for box in storage.boxes
# for pokemon in box.pokemon
# if pokemon != nil
# if !pokemon.egg?
# spriterLoader.preload_sprite_from_pokemon(pokemon)
# end
# end
# end
# end
# for pokemon in trainer.party
# spriterLoader.preload_sprite_from_pokemon(pokemon)
# end
# end_time = Time.now
# echoln "Finished in #{end_time - start_time} seconds"
# end
def checkEnableSpritesDownload
if $PokemonSystem.download_sprites && $PokemonSystem.download_sprites != 0
customSprites = getCustomSpeciesList
if !customSprites
promptEnableSpritesDownload
else
if customSprites.length < 1000
promptEnableSpritesDownload
end
end
end
end
def check_for_spritepack_update()
$updated_spritesheets = [] if !$updated_spritesheets
if new_spritepack_was_released()
pbFadeOutIn() {
return if !downloadAllowed?()
should_update = pbConfirmMessage(_INTL("A new spritepack was released. Would you like to let the game update your game's sprites automatically?"))
if should_update
update_spritepack_files
end
}
end
end

View File

@@ -129,28 +129,28 @@
# # Draw all images
# pbDrawImagePositions(overlay, imagepos)
# # Write various bits of text
# pagename = [_INTL("INFO"),
# _INTL("TRAINER MEMO"),
# _INTL("SKILLS"),
# _INTL("MOVES"),
# _INTL("MOVES")][page - 1]
# pagename = ["INFO",
# "TRAINER MEMO",
# "SKILLS",
# "MOVES",
# "MOVES"][page - 1]
# textpos = [
# [pagename, 26, 10, 0, base, shadow],
# [@pokemon.name, 46, 56, 0, base, shadow],
# [@pokemon.level.to_s, 46, 86, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# [_INTL("Item"), 66, 312, 0, base, shadow]
# ["Item", 66, 312, 0, base, shadow]
# ]
# # Write the held item's name
# if @pokemon.hasItem?
# textpos.push([@pokemon.item.name, 16, 346, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
# else
# textpos.push([_INTL("None"), 16, 346, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)])
# textpos.push(["None", 16, 346, 0, Color.new(192, 200, 208), Color.new(208, 216, 224)])
# end
# # Write the gender symbol
# if @pokemon.male?
# textpos.push([_INTL("♂"), 178, 56, 0, Color.new(24, 112, 216), Color.new(136, 168, 208)])
# textpos.push(["♂", 178, 56, 0, Color.new(24, 112, 216), Color.new(136, 168, 208)])
# elsif @pokemon.female?
# textpos.push([_INTL("♀"), 178, 56, 0, Color.new(248, 56, 32), Color.new(224, 152, 144)])
# textpos.push(["♀", 178, 56, 0, Color.new(248, 56, 32), Color.new(224, 152, 144)])
# end
# # Draw all text
# pbDrawTextPositions(overlay, textpos)

Some files were not shown because too many files have changed in this diff Show More