diff --git a/Data/Scripts/004_Game classes/009_Game_Player.rb b/Data/Scripts/004_Game classes/009_Game_Player.rb index b0d69ba16..aa0276784 100644 --- a/Data/Scripts/004_Game classes/009_Game_Player.rb +++ b/Data/Scripts/004_Game classes/009_Game_Player.rb @@ -384,9 +384,9 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false) trainer = $Trainer if !trainer outfit = (trainer) ? trainer.outfit : 0 if $game_player && $game_player.charsetData && !force - return nil if $game_player.charsetData[0]==$Trainer.character_ID && - $game_player.charsetData[1]==charset && - $game_player.charsetData[2]==outfit + return nil if $game_player.charsetData[0] == $Trainer.character_ID && + $game_player.charsetData[1] == charset && + $game_player.charsetData[2] == outfit end $game_player.charsetData = [$Trainer.character_ID,charset,outfit] if $game_player ret = meta[charset] diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb index b2260631c..e5945aca6 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/001_Overworld_BattleStarting.rb @@ -368,11 +368,11 @@ def pbTrainerBattleCore(*args) foePartyStarts = [] for arg in args if arg.is_a?(NPCTrainer) - foeTrainers.push(arg[0]) + foeTrainers.push(arg) foePartyStarts.push(foeParty.length) - arg[0].party.each { |pkmn| foeParty.push(pkmn) } - foeEndSpeeches.push(arg[0].lose_text) - foeItems.push(arg[0].items) + arg.party.each { |pkmn| foeParty.push(pkmn) } + foeEndSpeeches.push(arg.lose_text) + foeItems.push(arg.items) elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)] trainer = pbLoadTrainer(arg[0],arg[1],arg[2]) pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer diff --git a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb index 4efca12ef..5b7c05700 100644 --- a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb @@ -834,7 +834,7 @@ def pbSweetScent end viewport.dispose enctype = $PokemonEncounters.encounter_type - if enctype < 0 || !$PokemonEncounters.encounter_possible_here? || + if enctype || !$PokemonEncounters.encounter_possible_here? || !pbEncounter(enctype) pbMessage(_INTL("There appears to be nothing here...")) end diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb index ca38b9e85..6b2d3a0e2 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb @@ -233,7 +233,7 @@ MultipleForms.register(:ROTOM,{ move_name = pkmn.moves[move_index].name pkmn.forget_move_at_index(move_index) pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name)) - pkmn.learn_move(:THUNDERSHOCK) if pkmn.numMoves == 0 + pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0 end else # Turned into an alternate form; try learning that form's unique move @@ -250,7 +250,7 @@ MultipleForms.register(:ROTOM,{ else pkmn.forget_move_at_index(move_index) pbMessage(_INTL("{1} forgot {2}...", pkmn.name, old_move_name)) - pkmn.learn_move(:THUNDERSHOCK) if pkmn.numMoves == 0 + pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0 end else # Just try to learn this form's unique move @@ -578,7 +578,7 @@ MultipleForms.register(:NECROZMA,{ move_name = pkmn.moves[move_index].name pkmn.forget_move_at_index(move_index) pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name)) - pkmn.learn_move(:CONFUSION) if pkmn.numMoves == 0 + pbLearnMove(:CONFUSION) if pkmn.numMoves == 0 end else # Turned into an alternate form; try learning that form's unique move diff --git a/Data/Scripts/019_Utilities/001_Utilities.rb b/Data/Scripts/019_Utilities/001_Utilities.rb index 14483f1d8..71ccc0176 100644 --- a/Data/Scripts/019_Utilities/001_Utilities.rb +++ b/Data/Scripts/019_Utilities/001_Utilities.rb @@ -456,7 +456,7 @@ def pbMoveTutorChoose(move,movelist=nil,bymachine=false,oneusemachine=false) pbMessage(_INTL("{1} can't learn {2}.",pokemon.name,movename)) { screen.pbUpdate } else if pbLearnMove(pokemon,move,false,bymachine) { screen.pbUpdate } - pkmn.add_first_move(move) if oneusemachine + pokemon.add_first_move(move) if oneusemachine ret = true break end diff --git a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb index 23d57571e..105472235 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/001_EditorScreens.rb @@ -386,14 +386,14 @@ def pbTrainerTypeEditor type_hash = { :id_number => t_data.id_number, :id => t_data.id, - :name => line[1], - :base_money => line[2], - :battle_BGM => line[3], - :victory_ME => line[4], - :intro_ME => line[5], - :gender => line[6], - :skill_level => line[7], - :skill_code => line[8] + :name => data[1], + :base_money => data[2], + :battle_BGM => data[3], + :victory_ME => data[4], + :intro_ME => data[5], + :gender => data[6], + :skill_level => data[7], + :skill_code => data[8] } # Add trainer type's data to records GameData::TrainerType.register(type_hash) diff --git a/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb b/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb index 1d193a3c5..9fa55029f 100644 --- a/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb +++ b/Data/Scripts/020_Debug/001_Editor screens/004_EditorScreens_SpritePositioning.rb @@ -166,6 +166,11 @@ class SpritePositioner pbChangeSpecies(@species) refresh species_data = GameData::Species.get(@species) + if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, species_data.form)) || + pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species)) + pbMessage("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited.") + return false + end oldval = species_data.shadow_size cmdvals = [0] commands = [_INTL("None")] @@ -173,7 +178,7 @@ class SpritePositioner i = 0 loop do i += 1 - fn = sprintf("Graphics/Pictures/Battle/battler_shadow_%d", i) + fn = sprintf("Graphics/Pokemon/Shadow/%d", i) break if !pbResolveBitmap(fn) cmdvals.push(i) commands.push(i.to_s) diff --git a/Data/Scripts/020_Debug/003_Debug menus/004_Debug_MenuSpriteRenamer.rb b/Data/Scripts/020_Debug/003_Debug menus/004_Debug_MenuSpriteRenamer.rb index ead2663f2..28bb48f7f 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/004_Debug_MenuSpriteRenamer.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/004_Debug_MenuSpriteRenamer.rb @@ -231,6 +231,25 @@ module SpriteRenamer end end + def convert_player_metadata_charsets + changed = false + for i in 0...8 + metadata = GameData::Metadata.get_player(i) + next if !metadata + if metadata[1][/^trchar(\d{3})$/] + tr_type_number = $~[1].to_i + tr_type_data = GameData::TrainerType.try_get(tr_type_number) + raise _INTL("Trainer type {1} is not defined (trying to rename player metadata filename {2}).", tr_type_number, metadata[1]) if !tr_type_data + metadata[1] = "trainer_" + tr_type_data.id.to_s + changed = true + end + end + return if !changed + # Save changes to metadata and rewrite PBS file + GameData::Metadata.save + Compiler.write_metadata + end + def convert_files return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?") any_changed = false @@ -255,6 +274,8 @@ module SpriteRenamer pbSetWindowText(nil) if pbConfirmMessage("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly.") convert_trainer_sprites("Graphics/Characters/") + convert_player_metadata_charsets + pbSetWindowText(nil) # Edit all maps to replace used charsets mapData = Compiler::MapData.new t = Time.now.to_i diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 853663cf0..af53d0d31 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -1277,7 +1277,7 @@ module Compiler line_data = [line_data] if !line_data.is_a?(Array) trainer_hash[:name] = line_data[0] trainer_hash[:version] = line_data[1] if line_data[1] - trainer_names[trainer_hash[:id]] = line_data[0] + trainer_names[trainer_hash[:id_number]] = line_data[0] when 3 # Number of Pokémon, items line_data = pbGetCsvRecord(line, line_no, [0, "vEEEEEEEE", nil, :Item, :Item, :Item, :Item, :Item, :Item, :Item, :Item])