Sprite renamer is now in the Debug menu and doesn't run when compiling, fixed Poké Flute not working in battle, fixed Advanced Trainer Battle Debug feature not working, fixed special Mega Evolution messages not being used

This commit is contained in:
Maruno17
2021-05-11 18:44:35 +01:00
parent ab3bb12d53
commit 5005b2a7e9
8 changed files with 23 additions and 13 deletions

View File

@@ -403,6 +403,6 @@ end
# DO NOT EDIT THESE! # DO NOT EDIT THESE!
module Essentials module Essentials
VERSION = "19.1" VERSION = "19.0.dev"
ERROR_TEXT = "" ERROR_TEXT = ""
end end

View File

@@ -367,15 +367,13 @@ def pbTrainerBattleCore(*args)
foeParty = [] foeParty = []
foePartyStarts = [] foePartyStarts = []
for arg in args for arg in args
raise _INTL("Expected an array of trainer data, got {1}.",arg) if !arg.is_a?(Array) if arg.is_a?(NPCTrainer)
if arg[0].is_a?(NPCTrainer)
foeTrainers.push(arg[0]) foeTrainers.push(arg[0])
foePartyStarts.push(foeParty.length) foePartyStarts.push(foeParty.length)
arg[0].party.each { |pkmn| foeParty.push(pkmn) } arg[0].party.each { |pkmn| foeParty.push(pkmn) }
foeEndSpeeches.push(arg[0].lose_text) foeEndSpeeches.push(arg[0].lose_text)
foeItems.push(arg[0].items) foeItems.push(arg[0].items)
else elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
# [trainer type, trainer name, ID, speech (optional)]
trainer = pbLoadTrainer(arg[0],arg[1],arg[2]) trainer = pbLoadTrainer(arg[0],arg[1],arg[2])
pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
return 0 if !trainer return 0 if !trainer
@@ -385,6 +383,8 @@ def pbTrainerBattleCore(*args)
trainer.party.each { |pkmn| foeParty.push(pkmn) } trainer.party.each { |pkmn| foeParty.push(pkmn) }
foeEndSpeeches.push(arg[3] || trainer.lose_text) foeEndSpeeches.push(arg[3] || trainer.lose_text)
foeItems.push(trainer.items) foeItems.push(trainer.items)
else
raise _INTL("Expected NPCTrainer or array of trainer data, got {1}.", arg)
end end
end end
# Calculate who the player trainer(s) and their party are # Calculate who the player trainer(s) and their party are
@@ -485,7 +485,7 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
# Perform the battle # Perform the battle
if $PokemonTemp.waitingTrainer if $PokemonTemp.waitingTrainer
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer, decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
[trainerID,trainerName,trainerPartyID,endSpeech] [trainerID,trainerName,trainerPartyID,endSpeech]
) )
else else

View File

@@ -302,8 +302,7 @@ ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle|
next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF) next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF)
b.pbCureStatus(false) b.pbCureStatus(false)
end end
scene.pbRefresh battle.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
scene.pbDisplay(_INTL("All Pokémon were roused by the tune!"))
}) })
ItemHandlers::UseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls ItemHandlers::UseInBattle.addIf(proc { |item| GameData::Item.get(item).is_poke_ball? }, # Poké Balls

View File

@@ -47,7 +47,9 @@ class Pokemon
end end
def megaMessage # 0=default message, 1=Rayquaza message def megaMessage # 0=default message, 1=Rayquaza message
return species_data.mega_message megaForm = self.getMegaForm
message_number = GameData::Species.get_species_form(@species, megaForm)&.mega_message
return message_number || 0
end end
#============================================================================= #=============================================================================

View File

@@ -1144,6 +1144,16 @@ DebugMenuCommands.register("createpbs", {
} }
}) })
DebugMenuCommands.register("renamesprites", {
"parent" => "othermenu",
"name" => _INTL("Rename Old Sprites"),
"description" => _INTL("Renames and moves Pokémon/item/trainer sprites from their old places."),
"always_show" => true,
"effect" => proc {
SpriteRenamer.convert_files
}
})
DebugMenuCommands.register("invalidtiles", { DebugMenuCommands.register("invalidtiles", {
"parent" => "othermenu", "parent" => "othermenu",
"name" => _INTL("Fix Invalid Tiles"), "name" => _INTL("Fix Invalid Tiles"),

View File

@@ -28,7 +28,7 @@ end
#=============================================================================== #===============================================================================
# #
#=============================================================================== #===============================================================================
module Compiler module SpriteRenamer
module_function module_function
def readDirectoryFiles(directory, formats) def readDirectoryFiles(directory, formats)
@@ -217,7 +217,7 @@ module Compiler
end end
def convert_files def convert_files
return if !pbConfirmMessage("Check for Pokémon/item/trainer files that need renaming?") return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
# Rename and move Pokémon sprites/icons # Rename and move Pokémon sprites/icons
dest_dir = "Graphics/Pokemon/" dest_dir = "Graphics/Pokemon/"
Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir) Dir.mkdir(dest_dir) if !FileTest.directory?(dest_dir)
@@ -237,5 +237,6 @@ module Compiler
# Rename trainer sprites # Rename trainer sprites
convert_trainer_sprites("Graphics/Trainers/") convert_trainer_sprites("Graphics/Trainers/")
pbSetWindowText(nil) pbSetWindowText(nil)
pbMessage(_INTL("All found sprites and icons were renamed and moved."))
end end
end end

View File

@@ -728,8 +728,6 @@ module Compiler
yield(_INTL("Saving messages")) yield(_INTL("Saving messages"))
pbSetTextMessages pbSetTextMessages
MessageTypes.saveMessages MessageTypes.saveMessages
yield(_INTL("Renaming sprites and cries"))
convert_files
echoln "" echoln ""
echoln _INTL("*** Finished full compile ***") echoln _INTL("*** Finished full compile ***")
echoln "" echoln ""