From ad59c0a7c4ae8543aba02e9ed39052545207ceac Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Wed, 1 May 2024 18:05:34 -0500 Subject: [PATCH] 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. --- src/data/move.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/move.ts b/src/data/move.ts index d6367794a..ad1ae31c0 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -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; }