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.pull/393/head
parent
6ac224ab8a
commit
ad59c0a7c4
|
@ -557,7 +557,7 @@ export class TargetHalfHpDamageAttr extends FixedDamageAttr {
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue