From 96fbe1563d619b60e306087f04fe83f79f4f956c Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 29 Nov 2020 16:28:12 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Fixed=20a=20Pok=C3=A9mon's=20form=20being?= =?UTF-8?q?=20reset=20upon=20evolving,=20fixed=20Pok=C3=A9mon=20not=20usin?= =?UTF-8?q?g=20Struggle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/Scripts/012_Battle/004_AI/004_AI_Move.rb | 6 ++---- Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb b/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb index c42cc49c6..4aef071a3 100644 --- a/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb +++ b/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb @@ -88,10 +88,8 @@ class PokeBattle_AI next if !@battle.pbCanChooseMove?(idxBattler,i,false) choices.push([i,100,-1]) # Move index, score, target end - if choices.length==0 # No moves are physically possible to use - user.eachMoveWithIndex do |_m,i| - choices.push([i,100,-1]) # Move index, score, target - end + if choices.length==0 # No moves are physically possible to use; use Struggle + @battle.pbAutoChooseMove(user.index) end end # Randomly choose a move from the choices and register it diff --git a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb b/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb index eeadb5e8f..550a76788 100644 --- a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb @@ -629,7 +629,8 @@ class PokeBattle_Pokemon #============================================================================= def species=(value) hasNickname = nicknamed? - @species, @form = pbGetSpeciesFromFSpecies(value) + @species, new_form = pbGetSpeciesFromFSpecies(value) + @form = new_form if @species != value @name = PBSpecies.getName(@species) unless hasNickname @level = nil # In case growth rate is different for the new species @forcedForm = nil From 06682ba697201eb25fc8bf446d4cf751b2019514 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 2 Dec 2020 21:14:13 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Fixed=20crash=20when=20a=20foe=20trainer=20?= =?UTF-8?q?tries=20to=20replace=20a=20caught=20Shadow=20Pok=C3=A9mon,=20fi?= =?UTF-8?q?xed=20Hall=20of=20Fame=20not=20remembering=20entries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb | 1 + Data/Scripts/017_UI/027_PScreen_HallOfFame.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb b/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb index cef9e2f25..4bc48a0d9 100644 --- a/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb +++ b/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb @@ -61,6 +61,7 @@ class PokeBattle_RealBattlePeer # For switching out, including due to fainting, and for the end of battle def pbOnLeavingBattle(battle,pkmn,usedInBattle,endBattle=false) + return if !pkmn f = MultipleForms.call("getFormOnLeavingBattle",pkmn,battle,usedInBattle,endBattle) pkmn.form = f if f && pkmn.form!=f pkmn.hp = pkmn.totalhp if pkmn.hp>pkmn.totalhp diff --git a/Data/Scripts/017_UI/027_PScreen_HallOfFame.rb b/Data/Scripts/017_UI/027_PScreen_HallOfFame.rb index de153a00f..0f3e57d33 100644 --- a/Data/Scripts/017_UI/027_PScreen_HallOfFame.rb +++ b/Data/Scripts/017_UI/027_PScreen_HallOfFame.rb @@ -486,7 +486,8 @@ class PokemonGlobalMetadata attr_writer :hallOfFameLastNumber def hallOfFame - return @hallOfFame || [] + @hallOfFame = [] if !@hallOfFame + return @hallOfFame end def hallOfFameLastNumber