Use the .max function in Substitute's code (#167)

This commit is contained in:
Keyacom
2022-01-29 19:24:42 +01:00
committed by GitHub
parent f9e34b8157
commit af60c4df66

View File

@@ -528,8 +528,7 @@ class Battle::Move::UserMakeSubstitute < Battle::Move
@battle.pbDisplay(_INTL("{1} already has a substitute!", user.pbThis)) @battle.pbDisplay(_INTL("{1} already has a substitute!", user.pbThis))
return true return true
end end
@subLife = user.totalhp / 4 @subLife = [user.totalhp / 4, 1].max
@subLife = 1 if @subLife < 1
if user.hp <= @subLife if user.hp <= @subLife
@battle.pbDisplay(_INTL("But it does not have enough HP left to make a substitute!")) @battle.pbDisplay(_INTL("But it does not have enough HP left to make a substitute!"))
return true return true