From b563e73027da81541ae8b74063269f3a86a6e68f Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 3 May 2021 19:25:49 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20changing=20a=20Pok=C3=A9mon's=20form=20?= =?UTF-8?q?with=20an=20item=20not=20doing=20certain=20things,=20fixed=20al?= =?UTF-8?q?ternate=20forms=20not=20inheriting=20certain=20properties=20fro?= =?UTF-8?q?m=20the=20base=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/Scripts/014_Pokemon/001_Pokemon.rb | 12 ++++++++++++ Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb | 1 - Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index 8c72a3574..1e468bb56 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -139,6 +139,18 @@ class Pokemon end def form=(value) + oldForm = @form + @form = value + @ability = nil + MultipleForms.call("onSetForm", self, value, oldForm) + calc_stats + $Trainer.pokedex.register(self) + end + + # The same as def form=, but yields to a given block in the middle so that a + # message about the form changing can be shown before calling "onSetForm" + # which may have its own messages, e.g. learning a move. + def setForm(value) oldForm = @form @form = value @ability = nil diff --git a/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb b/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb index 4c1b1cc8a..83d4b42ce 100644 --- a/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb +++ b/Data/Scripts/014_Pokemon/006_Pokemon_Deprecated.rb @@ -171,7 +171,6 @@ class Pokemon deprecated_method_alias :isAble?, :able?, removal_in: 'v20' deprecated_method_alias :isFainted?, :fainted?, removal_in: 'v20' deprecated_method_alias :isShiny?, :shiny?, removal_in: 'v20' - deprecated_method_alias :setForm, :form=, removal_in: 'v20' deprecated_method_alias :setGender, :gender=, removal_in: 'v20' deprecated_method_alias :isMale?, :male?, removal_in: 'v20' deprecated_method_alias :isFemale?, :female?, removal_in: 'v20' diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index aef3efb34..62a15af40 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -662,6 +662,8 @@ module Compiler :base_stats => contents["BaseStats"] || base_data.base_stats, :evs => contents["EffortPoints"] || base_data.evs, :base_exp => contents["BaseEXP"] || base_data.base_exp, + :growth_rate => base_data.growth_rate, + :gender_ratio => base_data.gender_ratio, :catch_rate => contents["Rareness"] || base_data.catch_rate, :happiness => contents["Happiness"] || base_data.happiness, :moves => moves, @@ -674,6 +676,7 @@ module Compiler :wild_item_rare => contents["WildItemRare"] || base_data.wild_item_rare, :egg_groups => contents["Compatibility"] || base_data.egg_groups.clone, :hatch_steps => contents["StepsToHatch"] || base_data.hatch_steps, + :incense => base_data.incense, :evolutions => evolutions, :height => contents["Height"] || base_data.height, :weight => contents["Weight"] || base_data.weight,