Fixed crash when a foe trainer tries to replace a caught Shadow Pokémon, fixed Hall of Fame not remembering entries

This commit is contained in:
Maruno17
2020-12-02 21:14:13 +00:00
parent 96fbe1563d
commit 06682ba697
2 changed files with 3 additions and 1 deletions

View File

@@ -61,6 +61,7 @@ class PokeBattle_RealBattlePeer
# For switching out, including due to fainting, and for the end of battle # For switching out, including due to fainting, and for the end of battle
def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false) def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false)
return if !pkmn
f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle) f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle)
pkmn.form = f if f && pkmn.form!=f pkmn.form = f if f && pkmn.form!=f
pkmn.hp = pkmn.totalhp if pkmn.hp>pkmn.totalhp pkmn.hp = pkmn.totalhp if pkmn.hp>pkmn.totalhp

View File

@@ -486,7 +486,8 @@ class PokemonGlobalMetadata
attr_writer :hallOfFameLastNumber attr_writer :hallOfFameLastNumber
def hallOfFame def hallOfFame
return @hallOfFame || [] @hallOfFame = [] if !@hallOfFame
return @hallOfFame
end end
def hallOfFameLastNumber def hallOfFameLastNumber