Adds debug function to change a pokemon's species from head and body pokedex numbers

This commit is contained in:
chardub
2025-02-06 19:47:11 -05:00
parent 1809d246b6
commit 44f114b5e0
4 changed files with 28 additions and 7 deletions

Binary file not shown.

View File

@@ -115,14 +115,16 @@ end
# selected (or nil if the selection was canceled). "default", if specified, is # selected (or nil if the selection was canceled). "default", if specified, is
# the ID of the species to initially select. Pressing Input::ACTION will toggle # the ID of the species to initially select. Pressing Input::ACTION will toggle
# the list sorting between numerical and alphabetical. # the list sorting between numerical and alphabetical.
def pbChooseSpeciesList(default = nil) def pbChooseSpeciesList(default = nil,max=nil)
# commands = [] # commands = []
# GameData::Species.each { |s| commands.push([s.id_number, s.real_name, s.id]) if s.form == 0 } # GameData::Species.each { |s| commands.push([s.id_number, s.real_name, s.id]) if s.form == 0 }
# return pbChooseList(commands, default, nil, -1) # return pbChooseList(commands, default, nil, -1)
# #
defaultNumber = default == nil ? 1 : getDexNumberForSpecies(default) defaultNumber = default == nil ? 1 : getDexNumberForSpecies(default)
params = ChooseNumberParams.new params = ChooseNumberParams.new
params.setRange(1,PBSpecies.maxValue)
max = max ? max : PBSpecies.maxValue
params.setRange(1,max)
params.setInitialValue(defaultNumber) params.setInitialValue(defaultNumber)
dexNum = pbMessageChooseNumber("dex number?",params) dexNum = pbMessageChooseNumber("dex number?",params)
return GameData::Species.get(dexNum) return GameData::Species.get(dexNum)

View File

@@ -858,8 +858,7 @@ PokemonDebugMenuCommands.register("speciesform", {
_INTL("Species {1}, form {2} (forced).", pkmn.speciesName, pkmn.form)][(pkmn.forced_form.nil?) ? 0 : 1] _INTL("Species {1}, form {2} (forced).", pkmn.speciesName, pkmn.form)][(pkmn.forced_form.nil?) ? 0 : 1]
cmd = screen.pbShowCommands(msg, [ cmd = screen.pbShowCommands(msg, [
_INTL("Set species"), _INTL("Set species"),
_INTL("Set form"), _INTL("Set fusion species")], cmd)
_INTL("Remove form override")], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Set species when 0 # Set species
@@ -874,6 +873,26 @@ PokemonDebugMenuCommands.register("speciesform", {
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
when 1 # Set form when 1 # Set form
old_head_dex = get_head_number_from_symbol(pkmn.species)
old_body_dex = get_body_number_from_symbol(pkmn.species)
pbMessage('Head species?')
head_species = pbChooseSpeciesList(old_head_dex,NB_POKEMON)
pbMessage('Body species?')
body_species = pbChooseSpeciesList(old_body_dex,NB_POKEMON)
fused_species_dex = getFusionSpecies(head_species.species, body_species.species)
species = GameData::Species.get(fused_species_dex)
if species && species != pkmn.species
pkmn.species = species
if pkmn.shiny?
pkmn.debug_shiny=true
end
pkmn.calc_stats
$Trainer.pokedex.register(pkmn) if !settingUpBattle
screen.pbRefreshSingle(pkmnid)
end
# cmd2 = 0 # cmd2 = 0
# formcmds = [[], []] # formcmds = [[], []]
# GameData::Species.each do |sp| # GameData::Species.each do |sp|
@@ -901,9 +920,9 @@ PokemonDebugMenuCommands.register("speciesform", {
# screen.pbRefreshSingle(pkmnid) # screen.pbRefreshSingle(pkmnid)
# end # end
# end # end
when 2 # Remove form override # when 2 # Remove form override
pkmn.forced_form = nil # pkmn.forced_form = nil
screen.pbRefreshSingle(pkmnid) # screen.pbRefreshSingle(pkmnid)
end end
end end
next false next false

Binary file not shown.