mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
refactor wonderguard check in its own method
This commit is contained in:
@@ -1148,6 +1148,9 @@ class Pokemon
|
|||||||
return this_level
|
return this_level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def adjustHPForWonderGuard(stats)
|
||||||
|
return self.ability == :WONDERGUARD ? 1 : stats[:HP]
|
||||||
|
end
|
||||||
|
|
||||||
# Recalculates this Pokémon's stats.
|
# Recalculates this Pokémon's stats.
|
||||||
def calc_stats
|
def calc_stats
|
||||||
@@ -1177,7 +1180,7 @@ class Pokemon
|
|||||||
end
|
end
|
||||||
hpDiff = @totalhp - @hp
|
hpDiff = @totalhp - @hp
|
||||||
#@totalhp = stats[:HP]
|
#@totalhp = stats[:HP]
|
||||||
@totalhp = self.ability == :WONDERGUARD ? 1 : stats[:HP]
|
@totalhp = adjustHPForWonderGuard(stats)
|
||||||
calculated_hp = @totalhp - hpDiff
|
calculated_hp = @totalhp - hpDiff
|
||||||
@hp = calculated_hp > 0 ? calculated_hp : 0
|
@hp = calculated_hp > 0 ? calculated_hp : 0
|
||||||
@attack = stats[:ATTACK]
|
@attack = stats[:ATTACK]
|
||||||
|
|||||||
Reference in New Issue
Block a user