From 4b4aae00db642d2da9e91dfad61eb7d99b9b43df Mon Sep 17 00:00:00 2001 From: infinitefusion Date: Mon, 22 May 2023 09:57:53 -0400 Subject: [PATCH] refactor wonderguard check in its own method --- Data/Scripts/014_Pokemon/001_Pokemon.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index fed766d36..e675ad6d0 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -1148,6 +1148,9 @@ class Pokemon return this_level end + def adjustHPForWonderGuard(stats) + return self.ability == :WONDERGUARD ? 1 : stats[:HP] + end # Recalculates this Pokémon's stats. def calc_stats @@ -1177,7 +1180,7 @@ class Pokemon end hpDiff = @totalhp - @hp #@totalhp = stats[:HP] - @totalhp = self.ability == :WONDERGUARD ? 1 : stats[:HP] + @totalhp = adjustHPForWonderGuard(stats) calculated_hp = @totalhp - hpDiff @hp = calculated_hp > 0 ? calculated_hp : 0 @attack = stats[:ATTACK]