Fixed Xerneas/Zacian/Zamazenta not being their alternate form throughout battle

This commit is contained in:
Maruno17
2022-05-29 18:13:08 +01:00
parent 9ecbee910d
commit 6a046ff755
3 changed files with 24 additions and 26 deletions

View File

@@ -258,6 +258,8 @@ class Battle
logMsg += "#{@opponent.length} trainer(s))" if trainerBattle? logMsg += "#{@opponent.length} trainer(s))" if trainerBattle?
PBDebug.log(logMsg) PBDebug.log(logMsg)
pbEnsureParticipants pbEnsureParticipants
pbParty(0).each { |pkmn| @peer.pbOnStartingBattle(self, pkmn, wildBattle?) if pkmn }
pbParty(1).each { |pkmn| @peer.pbOnStartingBattle(self, pkmn, wildBattle?) if pkmn }
begin begin
pbStartBattleCore pbStartBattleCore
rescue BattleAbortedException rescue BattleAbortedException

View File

@@ -36,6 +36,12 @@ class Battle::Peer
return (box < 0) ? "" : $PokemonStorage[box].name return (box < 0) ? "" : $PokemonStorage[box].name
end end
def pbOnStartingBattle(battle, pkmn, wild = false)
f = MultipleForms.call("getFormOnStartingBattle", pkmn, wild)
pkmn.form = f if f
MultipleForms.call("changePokemonOnStartingBattle", pkmn, battle)
end
def pbOnEnteringBattle(battle, battler, pkmn, wild = false) def pbOnEnteringBattle(battle, battler, pkmn, wild = false)
f = MultipleForms.call("getFormOnEnteringBattle", pkmn, wild) f = MultipleForms.call("getFormOnEnteringBattle", pkmn, wild)
pkmn.form = f if f pkmn.form = f if f

View File

@@ -454,11 +454,11 @@ MultipleForms.register(:PUMPKABOO, {
MultipleForms.copy(:PUMPKABOO, :GOURGEIST) MultipleForms.copy(:PUMPKABOO, :GOURGEIST)
MultipleForms.register(:XERNEAS, { MultipleForms.register(:XERNEAS, {
"getFormOnEnteringBattle" => proc { |pkmn, wild| "getFormOnStartingBattle" => proc { |pkmn, wild|
next 1 next 1
}, },
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
next 0 next 0 if endBattle
} }
}) })
@@ -647,52 +647,42 @@ MultipleForms.register(:MORPEKO, {
}) })
MultipleForms.register(:ZACIAN, { MultipleForms.register(:ZACIAN, {
"getFormOnEnteringBattle" => proc { |pkmn, wild| "getFormOnStartingBattle" => proc { |pkmn, wild|
next 1 if pkmn.hasItem?(:RUSTEDSWORD) next 1 if pkmn.hasItem?(:RUSTEDSWORD)
next 0 next 0
}, },
"changePokemonOnEnteringBattle" => proc { |battler, pkmn, battle| "changePokemonOnStartingBattle" => proc { |pkmn, battle|
if GameData::Move.exists?(:BEHEMOTHBLADE) && pkmn.hasItem?(:RUSTEDSWORD) if GameData::Move.exists?(:BEHEMOTHBLADE) && pkmn.hasItem?(:RUSTEDSWORD)
pkmn.moves.each do |move| pkmn.moves.each { |move| move.id = :BEHEMOTHBLADE if move.id == :IRONHEAD }
next if move.id != :IRONHEAD
move.id = :BEHEMOTHBLADE
battler.moves.each_with_index do |b_move, i|
next if b_move.id != :IRONHEAD
battler.moves[i] = Battle::Move.from_pokemon_move(battle, move)
end
end
end end
}, },
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
next 0 next 0 if endBattle
}, },
"changePokemonOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| "changePokemonOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
pkmn.moves.each { |move| move.id = :IRONHEAD if move.id == :BEHEMOTHBLADE } if endBattle
pkmn.moves.each { |move| move.id = :IRONHEAD if move.id == :BEHEMOTHBLADE }
end
} }
}) })
MultipleForms.register(:ZAMAZENTA, { MultipleForms.register(:ZAMAZENTA, {
"getFormOnEnteringBattle" => proc { |pkmn, wild| "getFormOnStartingBattle" => proc { |pkmn, wild|
next 1 if pkmn.hasItem?(:RUSTEDSHIELD) next 1 if pkmn.hasItem?(:RUSTEDSHIELD)
next 0 next 0
}, },
"changePokemonOnEnteringBattle" => proc { |battler, pkmn, battle| "changePokemonOnStartingBattle" => proc { |pkmn, battle|
if GameData::Move.exists?(:BEHEMOTHBASH) && pkmn.hasItem?(:RUSTEDSHIELD) if GameData::Move.exists?(:BEHEMOTHBASH) && pkmn.hasItem?(:RUSTEDSHIELD)
pkmn.moves.each do |move| pkmn.moves.each { |move| move.id = :BEHEMOTHBASH if move.id == :IRONHEAD }
next if move.id != :IRONHEAD
move.id = :BEHEMOTHBASH
battler.moves.each_with_index do |b_move, i|
next if b_move.id != :IRONHEAD
battler.moves[i] = Battle::Move.from_pokemon_move(battle, move)
end
end
end end
}, },
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
next 0 next 0 if endBattle
}, },
"changePokemonOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| "changePokemonOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
pkmn.moves.each { |move| move.id = :IRONHEAD if move.id == :BEHEMOTHBASH } if endBattle
pkmn.moves.each { |move| move.id = :IRONHEAD if move.id == :BEHEMOTHBASH }
end
} }
}) })