Added Pokémon properties cannot_store, cannot_release and cannot_trade. Allowed Offspring species property to be edited.

This commit is contained in:
Maruno17
2021-11-08 23:21:20 +00:00
parent 15babcf835
commit 12fd500dbc
9 changed files with 179 additions and 21 deletions

View File

@@ -1026,6 +1026,7 @@ def pbPokemonEditor
[_INTL("EggGroup 2"), GameDataProperty.new(:EggGroup), _INTL("Compatibility group (egg group) for breeding purposes.")],
[_INTL("HatchSteps"), LimitProperty.new(99999), _INTL("Number of steps until an egg of this species hatches.")],
[_INTL("Incense"), ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
[_INTL("Offspring"), SpeciesPoolProperty, _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")],
[_INTL("Evolutions"), EvolutionsProperty.new, _INTL("Evolution paths of this species.")],
[_INTL("Height"), NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
[_INTL("Weight"), NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
@@ -1086,6 +1087,7 @@ def pbPokemonEditor
spec.egg_groups[1],
spec.hatch_steps,
spec.incense,
spec.offspring,
evolutions,
spec.height,
spec.weight,
@@ -1131,15 +1133,15 @@ def pbPokemonEditor
:egg_groups => egg_groups, # 26, 27
:hatch_steps => data[28],
:incense => data[29],
:offspring => spec.offspring,
:evolutions => data[30],
:height => data[31],
:weight => data[32],
:color => data[33],
:shape => data[34],
:habitat => data[35],
:generation => data[36],
:flags => data[37]
:offspring => data[30],
:evolutions => data[31],
:height => data[32],
:weight => data[33],
:color => data[34],
:shape => data[35],
:habitat => data[36],
:generation => data[37],
:flags => data[38]
}
# Add species' data to records
GameData::Species.register(species_hash)

View File

@@ -975,6 +975,108 @@ end
module SpeciesPoolProperty
def self.set(_settingname, oldsetting)
# Get all species in the pool
realcmds = []
realcmds.push([nil, "-", -1]) # Species ID, index in this list, name
for i in 0...oldsetting.length
realcmds.push([oldsetting[i], GameData::Species.get(oldsetting[i]).real_name, i])
end
# Edit species pool
cmdwin = pbListWindow([], 200)
oldsel = -1
ret = oldsetting
cmd = [0, 0]
commands = []
refreshlist = true
loop do
if refreshlist
realcmds.sort! { |a, b| a[2] <=> b[2] }
commands = []
realcmds.each_with_index do |entry, i|
commands.push((entry[0].nil?) ? _INTL("[ADD SPECIES]") : entry[1])
end
end
refreshlist = false
oldsel = -1
cmd = pbCommands3(cmdwin, commands, -1, cmd[1], true)
case cmd[0]
when 1 # Swap species up
if cmd[1] > 0 && cmd[1] < realcmds.length - 1
realcmds[cmd[1] + 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] + 1][2]
refreshlist = true
end
when 2 # Swap species down
if cmd[1] > 1
realcmds[cmd[1] - 1][2], realcmds[cmd[1]][2] = realcmds[cmd[1]][2], realcmds[cmd[1] - 1][2]
refreshlist = true
end
when 0
if cmd[1] >= 0 # Chose an entry
entry = realcmds[cmd[1]]
if entry[0].nil? # Add new species
new_species = pbChooseSpeciesList
if new_species
maxid = -1
realcmds.each { |e| maxid = [maxid, e[2]].max }
realcmds.push([new_species, GameData::Species.get(new_species).real_name, maxid + 1])
refreshlist = true
end
else # Edit existing species
case pbMessage(_INTL("\\ts[]Do what with this species?"),
[_INTL("Change species"), _INTL("Delete"), _INTL("Cancel")], 3)
when 0 # Change species
new_species = pbChooseSpeciesList(entry[0])
if new_species && new_species != entry[0]
entry[0] = new_species
entry[1] = GameData::Species.get(new_species).real_name
oldsel = entry[2]
refreshlist = true
end
when 1 # Delete
realcmds.delete_at(cmd[1])
cmd[1] = [cmd[1], realcmds.length - 1].min
refreshlist = true
end
end
else # Cancel/quit
case pbMessage(_INTL("Save changes?"),
[_INTL("Yes"), _INTL("No"), _INTL("Cancel")], 3)
when 0
realcmds.shift
for i in 0...realcmds.length
realcmds[i] = realcmds[i][0]
end
realcmds.compact!
ret = realcmds
break
when 1
break
end
end
end
end
cmdwin.dispose
return ret
end
def self.defaultValue
return []
end
def self.format(value)
ret = ""
for i in 0...value.length
ret << "," if i > 0
ret << GameData::Species.get(value[i]).real_name
end
return ret
end
end
module ItemPoolProperty
def self.set(_settingname, oldsetting)
# Get all items in the pool

View File

@@ -1030,6 +1030,36 @@ PokemonDebugMenuCommands.register("ownership", {
}
})
#===============================================================================
# Can store/release/trade
#===============================================================================
PokemonDebugMenuCommands.register("setdiscardable", {
"parent" => "main",
"name" => _INTL("Set discardable"),
"always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
cmd = 0
loop do
msg = _INTL("Click option to toggle.")
cmds = []
cmds.push((pkmn.cannot_store) ? _INTL("Cannot store") : _INTL("Can store"))
cmds.push((pkmn.cannot_release) ? _INTL("Cannot release") : _INTL("Can release"))
cmds.push((pkmn.cannot_trade) ? _INTL("Cannot trade") : _INTL("Can trade"))
cmd = screen.pbShowCommands(msg, cmds, cmd)
break if cmd < 0
case cmd
when 0 # Toggle storing
pkmn.cannot_store = !pkmn.cannot_store
when 1 # Toggle releasing
pkmn.cannot_release = !pkmn.cannot_release
when 2 # Toggle trading
pkmn.cannot_trade = !pkmn.cannot_trade
end
end
next false
}
})
#===============================================================================
# Other options
#===============================================================================