Fixed Rounding Error For TargetHalfHpDamageAttr

Moves that deal half of a target's HP were not able to deal damage if the target had 1 HP. Used Math.max to ensure 1 is the lowest this value ever evaluates to.
This commit is contained in:
Benjamin Odom authored and Samuel H committed 2024-05-01 19:14:18 -04:00
1 parent 6ac224ab8a
commit ad59c0a7c4
1 file changed
+1 -1
+1 -1
View File
@@ -557,7 +557,7 @@ export class TargetHalfHpDamageAttr extends FixedDamageAttr {
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
(args[0] as Utils.IntegerHolder).value = Math.floor(target.hp / 2);
(args[0] as Utils.IntegerHolder).value = Math.max(Math.floor(target.hp / 2), 1);
return true;
}