Fixed typos in def pbCalcTypeModPokemon, fixed party screen navigation errors when there are no Pokémon, advanced battle Debug functions now trigger modifiers, can now always change a Pokémon's form to 0

This commit is contained in:
Maruno17
2022-09-10 16:33:11 +01:00
parent 18ffd4fb94
commit dcba641a86
4 changed files with 16 additions and 6 deletions

View File

@@ -83,12 +83,12 @@ class Battle::AI
# For switching. Determines the effectiveness of a potential switch-in against
# an opposing battler.
def pbCalcTypeModPokemon(battlerThis, _battlerOther)
mod1 = Effectiveness.calculate(battlerThis.types[0], target.types[0], target.types[1])
def pbCalcTypeModPokemon(battlerThis, battlerOther)
mod1 = Effectiveness.calculate(battlerThis.types[0], battlerOther.types[0], battlerOther.types[1])
mod2 = Effectiveness::NORMAL_EFFECTIVE
if battlerThis.types.length > 1
mod2 = Effectiveness.calculate(battlerThis.types[1], target.types[0], target.types[1])
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
mod2 = Effectiveness.calculate(battlerThis.types[1], battlerOther.types[0], battlerOther.types[1])
mod2 = mod2.to_f / Effectiveness::NORMAL_EFFECTIVE
end
return mod1 * mod2
end

View File

@@ -811,6 +811,7 @@ class PokemonParty_Scene
currentsel = Settings::MAX_PARTY_SIZE
elsif currentsel == numsprites
currentsel = 0
currentsel = numsprites - 1 if currentsel >= @party.length
end
when Input::UP
if currentsel >= Settings::MAX_PARTY_SIZE
@@ -818,6 +819,7 @@ class PokemonParty_Scene
while currentsel > 0 && currentsel < Settings::MAX_PARTY_SIZE && !@party[currentsel]
currentsel -= 1
end
currentsel = numsprites - 1 if currentsel >= @party.length
else
loop do
currentsel -= 2
@@ -839,6 +841,7 @@ class PokemonParty_Scene
currentsel = Settings::MAX_PARTY_SIZE
elsif currentsel >= numsprites
currentsel = 0
currentsel = numsprites - 1 if currentsel >= @party.length
end
end
return currentsel
@@ -853,7 +856,7 @@ class PokemonParty_Scene
@sprites["pokemon#{i}"].dispose
end
lastselected = @party.length - 1 if lastselected >= @party.length
lastselected = 0 if lastselected < 0
lastselected = Settings::MAX_PARTY_SIZE if lastselected < 0
Settings::MAX_PARTY_SIZE.times do |i|
if @party[i]
@sprites["pokemon#{i}"] = PokemonPartyPanel.new(@party[i], i, @viewport)

View File

@@ -233,7 +233,7 @@ MenuHandlers.add(:debug_menu, :test_wild_battle_advanced, {
params.setCancelValue(0)
level = pbMessageChooseNumber(_INTL("Set the wild {1}'s level.",
GameData::Species.get(species).name), params)
pkmn.push(Pokemon.new(species, level)) if level > 0
pkmn.push(pbGenerateWildPokemon(species, level)) if level > 0
end
else # Edit a Pokémon
if pbConfirmMessage(_INTL("Change this Pokémon?"))
@@ -336,6 +336,7 @@ MenuHandlers.add(:debug_menu, :test_trainer_battle_advanced, {
trainerdata = pbListScreen(_INTL("CHOOSE A TRAINER"), TrainerBattleLister.new(0, false))
if trainerdata
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2])
EventHandlers.trigger(:on_trainer_load, tr)
trainers.push([0, tr])
end
else # Edit a trainer
@@ -344,6 +345,7 @@ MenuHandlers.add(:debug_menu, :test_trainer_battle_advanced, {
TrainerBattleLister.new(trainers[trainerCmd][0], false))
if trainerdata
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2])
EventHandlers.trigger(:on_trainer_load, tr)
trainers[trainerCmd] = [0, tr]
end
elsif pbConfirmMessage(_INTL("Delete this trainer?"))

View File

@@ -773,6 +773,11 @@ MenuHandlers.add(:pokemon_debug_menu, :species_and_form, {
end
if formcmds[0].length <= 1
screen.pbDisplay(_INTL("Species {1} only has one form.", pkmn.speciesName))
if pkmn.form != 0 && screen.pbConfirm(_INTL("Do you want to reset the form to 0?"))
pkmn.form = 0
$player.pokedex.register(pkmn) if !settingUpBattle && !pkmn.egg?
screen.pbRefreshSingle(pkmnid)
end
else
cmd2 = screen.pbShowCommands(_INTL("Set the Pokémon's form."), formcmds[1], cmd2)
next if cmd2 < 0