mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Added battle debug option to view/edit all Pokémon, fixed some battle debug-related bugs
This commit is contained in:
@@ -1,21 +1,3 @@
|
||||
=begin
|
||||
# TODO:
|
||||
|
||||
turnCount - Is currently read-only, probably not worth being able to set
|
||||
initialItems - Array of two arrays, each with one value per party index
|
||||
recycleItems - Array of two arrays, each with one value per party index
|
||||
belch - Array of two arrays, each with one value per party index
|
||||
corrosiveGas - Array of two arrays, each with one value per party index
|
||||
first_poke_ball - both for Ball Fetch
|
||||
poke_ball_failed - both for Ball Fetch
|
||||
|
||||
View party screen for each trainer's team, be able to edit properties of Pokémon
|
||||
that aren't in battle.
|
||||
|
||||
Choose each battler's next action.
|
||||
|
||||
=end
|
||||
|
||||
#===============================================================================
|
||||
# Battler Options
|
||||
#===============================================================================
|
||||
@@ -71,6 +53,178 @@ MenuHandlers.add(:battle_debug_menu, :list_foe_battlers, {
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :speed_order, {
|
||||
"name" => _INTL("Battler Speed Order"),
|
||||
"parent" => :battlers,
|
||||
"description" => _INTL("Show all battlers in order from fastest to slowest."),
|
||||
"effect" => proc { |battle|
|
||||
battlers = battle.allBattlers.map { |b| [b, b.pbSpeed] }
|
||||
battlers.sort! { |a, b| b[1] <=> a[1] }
|
||||
commands = []
|
||||
battlers.each do |value|
|
||||
b = value[0]
|
||||
commands.push(sprintf("[%d] %s (speed: %d)", b.index, b.pbThis, value[1]))
|
||||
end
|
||||
pbMessage("\\ts[]" + _INTL("Battlers are listed from fastest to slowest. Speeds include modifiers."),
|
||||
commands, -1)
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:battle_debug_menu, :pokemon_teams, {
|
||||
"name" => _INTL("Pokémon Teams"),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Look at and edit all Pokémon in each team."),
|
||||
"effect" => proc { |battle|
|
||||
player_party_starts = battle.pbPartyStarts(0)
|
||||
foe_party_starts = battle.pbPartyStarts(1)
|
||||
cmd = 0
|
||||
loop do
|
||||
# Find all teams and how many Pokémon they have
|
||||
commands = []
|
||||
team_indices = []
|
||||
if battle.opponent
|
||||
battle.opponent.each_with_index do |trainer, i|
|
||||
first_index = foe_party_starts[i]
|
||||
last_index = (i < foe_party_starts.length - 1) ? foe_party_starts[i + 1] : battle.pbParty(1).length
|
||||
num_pkmn = last_index - first_index
|
||||
commands.push(_INTL("Opponent {1}: {2} ({3} Pokémon)", i + 1, trainer.full_name, num_pkmn))
|
||||
team_indices.push([1, i, first_index])
|
||||
end
|
||||
else
|
||||
commands.push(_INTL("Opponent: {1} wild Pokémon", battle.pbParty(1).length))
|
||||
team_indices.push([1, 0, 0])
|
||||
end
|
||||
battle.player.each_with_index do |trainer, i|
|
||||
first_index = player_party_starts[i]
|
||||
last_index = (i < player_party_starts.length - 1) ? player_party_starts[i + 1] : battle.pbParty(0).length
|
||||
num_pkmn = last_index - first_index
|
||||
if i == 0 # Player
|
||||
commands.push(_INTL("You: {1} ({2} Pokémon)", trainer.full_name, num_pkmn))
|
||||
else
|
||||
commands.push(_INTL("Ally {1}: {2} ({3} Pokémon)", i, trainer.full_name, num_pkmn))
|
||||
end
|
||||
team_indices.push([0, i, first_index])
|
||||
end
|
||||
# Choose a team
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose a team."), commands, -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
# Pick a Pokémon to look at
|
||||
pkmn_cmd = 0
|
||||
loop do
|
||||
pkmn = []
|
||||
pkmn_cmds = []
|
||||
battle.eachInTeam(team_indices[cmd][0], team_indices[cmd][1]) do |p|
|
||||
pkmn.push(p)
|
||||
pkmn_cmds.push("[#{pkmn_cmds.length + 1}] #{p.name} Lv.#{p.level} (HP: #{p.hp}/#{p.totalhp})")
|
||||
end
|
||||
pkmn_cmd = pbMessage("\\ts[]" + _INTL("Choose a Pokémon."), pkmn_cmds, -1, nil, pkmn_cmd)
|
||||
break if pkmn_cmd < 0
|
||||
battle.pbBattlePokemonDebug(pkmn[pkmn_cmd],
|
||||
battle.pbFindBattler(team_indices[cmd][2] + pkmn_cmd, team_indices[cmd][0]))
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Trainer Options
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:battle_debug_menu, :trainers, {
|
||||
"name" => _INTL("Trainer Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Variables that apply to trainers.")
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :trainer_items, {
|
||||
"name" => _INTL("NPC Trainer Items"),
|
||||
"parent" => :trainers,
|
||||
"description" => _INTL("View and change the items each NPC trainer has access to."),
|
||||
"effect" => proc { |battle|
|
||||
cmd = 0
|
||||
loop do
|
||||
# Find all NPC trainers and their items
|
||||
commands = []
|
||||
item_arrays = []
|
||||
trainer_indices = []
|
||||
if battle.opponent
|
||||
battle.opponent.each_with_index do |trainer, i|
|
||||
items = battle.items ? battle.items[i].clone : []
|
||||
commands.push(_INTL("Opponent {1}: {2} ({3} items)", i + 1, trainer.full_name, items.length))
|
||||
item_arrays.push(items)
|
||||
trainer_indices.push([1, i])
|
||||
end
|
||||
end
|
||||
if battle.player.length > 1
|
||||
battle.player.each_with_index do |trainer, i|
|
||||
next if i == 0 # Player
|
||||
items = battle.ally_items ? battle.ally_items[i].clone : []
|
||||
commands.push(_INTL("Ally {1}: {2} ({3} items)", i, trainer.full_name, items.length))
|
||||
item_arrays.push(items)
|
||||
trainer_indices.push([0, i])
|
||||
end
|
||||
end
|
||||
if commands.length == 0
|
||||
pbMessage("\\ts[]" + _INTL("There are no NPC trainers in this battle."))
|
||||
break
|
||||
end
|
||||
# Choose a trainer
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose a trainer."), commands, -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
# Get trainer's items
|
||||
items = item_arrays[cmd]
|
||||
indices = trainer_indices[cmd]
|
||||
# Edit trainer's items
|
||||
item_list_property = GameDataPoolProperty.new(:Item)
|
||||
new_items = item_list_property.set(nil, items)
|
||||
if indices[0] == 0 # Ally
|
||||
battle.ally_items = [] if !battle.ally_items
|
||||
battle.ally_items[indices[1]] = new_items
|
||||
else # Opponent
|
||||
battle.items = [] if !battle.items
|
||||
battle.items[indices[1]] = new_items
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :mega_evolution, {
|
||||
"name" => _INTL("Mega Evolution"),
|
||||
"parent" => :trainers,
|
||||
"description" => _INTL("Whether each trainer is allowed to Mega Evolve."),
|
||||
"effect" => proc { |battle|
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
cmds = []
|
||||
battle.megaEvolution.each_with_index do |side_values, side|
|
||||
trainers = (side == 0) ? battle.player : battle.opponent
|
||||
next if !trainers
|
||||
side_values.each_with_index do |value, i|
|
||||
next if !trainers[i]
|
||||
text = (side == 0) ? "Your side:" : "Foe side:"
|
||||
text += sprintf(" %d: %s", i, trainers[i].name)
|
||||
text += sprintf(" [ABLE]") if value == -1
|
||||
text += sprintf(" [UNABLE]") if value == -2
|
||||
commands.push(text)
|
||||
cmds.push([side, i])
|
||||
end
|
||||
end
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose trainer to toggle whether they can Mega Evolve."),
|
||||
commands, -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
real_cmd = cmds[cmd]
|
||||
if battle.megaEvolution[real_cmd[0]][real_cmd[1]] == -1
|
||||
battle.megaEvolution[real_cmd[0]][real_cmd[1]] = -2 # Make unable
|
||||
else
|
||||
battle.megaEvolution[real_cmd[0]][real_cmd[1]] = -1 # Make able
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Field Options
|
||||
#===============================================================================
|
||||
@@ -334,116 +488,3 @@ MenuHandlers.add(:battle_debug_menu, :position_effects, {
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Trainer Options
|
||||
#===============================================================================
|
||||
MenuHandlers.add(:battle_debug_menu, :trainers, {
|
||||
"name" => _INTL("Trainer Options..."),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Variables that apply to trainers.")
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :trainer_items, {
|
||||
"name" => _INTL("NPC Trainer Items"),
|
||||
"parent" => :trainers,
|
||||
"description" => _INTL("View and change the items each NPC trainer has access to."),
|
||||
"effect" => proc { |battle|
|
||||
cmd = 0
|
||||
loop do
|
||||
# Find all NPC trainers and their items
|
||||
commands = []
|
||||
item_arrays = []
|
||||
trainer_indices = []
|
||||
if battle.opponent
|
||||
battle.opponent.each_with_index do |trainer, i|
|
||||
items = battle.items ? battle.items[i].clone : []
|
||||
commands.push(_INTL("Opponent {1}: {2} ({3} items)", i + 1, trainer.full_name, items.length))
|
||||
item_arrays.push(items)
|
||||
trainer_indices.push([1, i])
|
||||
end
|
||||
end
|
||||
if battle.player.length > 1
|
||||
battle.player.each_with_index do |trainer, i|
|
||||
next if i == 0 # Player
|
||||
items = battle.ally_items ? battle.ally_items[i].clone : []
|
||||
commands.push(_INTL("Ally {1}: {2} ({3} items)", i, trainer.full_name, items.length))
|
||||
item_arrays.push(items)
|
||||
trainer_indices.push([0, i])
|
||||
end
|
||||
end
|
||||
if commands.length == 0
|
||||
pbMessage("\\ts[]" + _INTL("There are no NPC trainers in this battle."))
|
||||
break
|
||||
end
|
||||
# Choose a trainer
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose a trainer."), commands, -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
# Get trainer's items
|
||||
items = item_arrays[cmd]
|
||||
indices = trainer_indices[cmd]
|
||||
# Edit trainer's items
|
||||
item_list_property = GameDataPoolProperty.new(:Item)
|
||||
new_items = item_list_property.set(nil, items)
|
||||
if indices[0] == 0 # Ally
|
||||
battle.ally_items = [] if !battle.ally_items
|
||||
battle.ally_items[indices[1]] = new_items
|
||||
else # Opponent
|
||||
battle.items = [] if !battle.items
|
||||
battle.items[indices[1]] = new_items
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :mega_evolution, {
|
||||
"name" => _INTL("Mega Evolution"),
|
||||
"parent" => :trainers,
|
||||
"description" => _INTL("Whether each trainer is allowed to Mega Evolve."),
|
||||
"effect" => proc { |battle|
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
cmds = []
|
||||
battle.megaEvolution.each_with_index do |side_values, side|
|
||||
trainers = (side == 0) ? battle.player : battle.opponent
|
||||
next if !trainers
|
||||
side_values.each_with_index do |value, i|
|
||||
next if !trainers[i]
|
||||
text = (side == 0) ? "Your side:" : "Foe side:"
|
||||
text += sprintf(" %d: %s", i, trainers[i].name)
|
||||
text += sprintf(" [ABLE]") if value == -1
|
||||
text += sprintf(" [UNABLE]") if value == -2
|
||||
commands.push(text)
|
||||
cmds.push([side, i])
|
||||
end
|
||||
end
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose trainer to toggle whether they can Mega Evolve."),
|
||||
commands, -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
real_cmd = cmds[cmd]
|
||||
if battle.megaEvolution[real_cmd[0]][real_cmd[1]] == -1
|
||||
battle.megaEvolution[real_cmd[0]][real_cmd[1]] = -2 # Make unable
|
||||
else
|
||||
battle.megaEvolution[real_cmd[0]][real_cmd[1]] = -1 # Make able
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MenuHandlers.add(:battle_debug_menu, :speed_order, {
|
||||
"name" => _INTL("Battler Speed Order"),
|
||||
"parent" => :main,
|
||||
"description" => _INTL("Show all battlers in order from fastest to slowest."),
|
||||
"effect" => proc { |battle|
|
||||
battlers = battle.allBattlers.map { |b| [b, b.pbSpeed] }
|
||||
battlers.sort! { |a, b| b[1] <=> a[1] }
|
||||
commands = []
|
||||
battlers.each do |value|
|
||||
b = value[0]
|
||||
commands.push(sprintf("[%d] %s (speed: %d)", b.index, b.pbThis, value[1]))
|
||||
end
|
||||
pbMessage("\\ts[]" + _INTL("Battlers are listed from fastest to slowest. Speeds include modifiers."),
|
||||
commands, -1)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
=begin
|
||||
# TODO:
|
||||
|
||||
@turnCount
|
||||
|
||||
Stuff for Pokémon that aren't in battle:
|
||||
* Set Poké Ball
|
||||
* Set nickname
|
||||
* Make a Shadow Pokémon, set Heart Gauge (perhaps also for battlers)
|
||||
|
||||
=end
|
||||
|
||||
#===============================================================================
|
||||
# HP/Status options
|
||||
#===============================================================================
|
||||
@@ -70,7 +58,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_status, {
|
||||
msg += " " + _INTL("(turns: {1})", pkmn.statusCount)
|
||||
elsif pkmn.status == :POISON && pkmn.statusCount > 0
|
||||
if battler
|
||||
msg += " " + _INTL("(toxic, count: {1})", battler.statusCount)
|
||||
msg += " " + _INTL("(toxic, count: {1})", battler.effects[PBEffects::Toxic])
|
||||
else
|
||||
msg += " " + _INTL("(toxic)")
|
||||
end
|
||||
@@ -99,11 +87,11 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_status, {
|
||||
if pbConfirmMessage("\\ts[]" + _INTL("Make {1} badly poisoned (toxic)?", pkmn_name))
|
||||
if battler
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 15)
|
||||
params.setDefaultValue(0)
|
||||
params.setRange(0, 16)
|
||||
params.setDefaultValue(battler.effects[PBEffects::Toxic])
|
||||
params.setCancelValue(-1)
|
||||
count = pbMessageChooseNumber(
|
||||
"\\ts[]" + _INTL("Set {1}'s toxic count (0-15).", pkmn_name), params
|
||||
"\\ts[]" + _INTL("Set {1}'s toxic count (0-16).", pkmn_name), params
|
||||
)
|
||||
next if count < 0
|
||||
battler.statusCount = 1
|
||||
@@ -308,7 +296,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :hidden_values, {
|
||||
cmd = 0
|
||||
loop do
|
||||
persid = sprintf("0x%08X", pkmn.personalID)
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Personal ID is {1}.", persid),
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Choose hidden values to edit."),
|
||||
[_INTL("Set EVs"), _INTL("Set IVs")], -1, nil, cmd)
|
||||
break if cmd < 0
|
||||
case cmd
|
||||
@@ -348,7 +336,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :hidden_values, {
|
||||
end
|
||||
else # (Max) Randomise all
|
||||
evTotalTarget = Pokemon::EV_LIMIT
|
||||
if cmd2 == evcommands.length - 2 # Randomize all (not max)
|
||||
if cmd2 == ev_commands.length - 2 # Randomize all (not max)
|
||||
evTotalTarget = rand(Pokemon::EV_LIMIT)
|
||||
end
|
||||
GameData::Stat.each_main { |s| pkmn.ev[s.id] = 0 }
|
||||
@@ -378,11 +366,11 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :hidden_values, {
|
||||
iv_id.push(s.id)
|
||||
totaliv += pkmn.iv[s.id]
|
||||
end
|
||||
msg = _INTL("Change which IV?\nHidden Power:\n{1}, power {2}\nTotal: {3}/{4} ({5}%)",
|
||||
msg = _INTL("Change which IV?\nHidden Power: {1}, power {2}\nTotal: {3}/{4} ({5}%)",
|
||||
GameData::Type.get(hiddenpower[0]).name, hiddenpower[1], totaliv,
|
||||
iv_id.length * Pokemon::IV_STAT_LIMIT, 100 * totaliv / (iv_id.length * Pokemon::IV_STAT_LIMIT))
|
||||
ivcommands.push(_INTL("Randomise all"))
|
||||
cmd2 = pbMessage("\\ts[]" + msg, ivcommands, -1, nil, cmd2)
|
||||
cmd2 = pbMessage("\\ts[]\\l[3]" + msg, ivcommands, -1, nil, cmd2)
|
||||
break if cmd2 < 0
|
||||
if cmd2 < iv_id.length
|
||||
params = ChooseNumberParams.new
|
||||
@@ -788,7 +776,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_form, {
|
||||
end
|
||||
loop do
|
||||
cmd = pbMessage("\\ts[]" + _INTL("Form is {1}.", pkmn.form), formcmds[1], -1, nil, cmd)
|
||||
next if cmd < 0
|
||||
break if cmd < 0
|
||||
f = formcmds[0][cmd]
|
||||
next if f == pkmn.form
|
||||
pkmn.forced_form = nil
|
||||
|
||||
Reference in New Issue
Block a user