From 4b36d38acbdc2d80448727b08bb77ab1b33c6207 Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Thu, 6 Jun 2024 05:42:15 +1000 Subject: [PATCH] Hotfix for NaN luck (#1840) Makes luck default to 0 if false-y --- src/modifier/modifier-type.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index ca3712f8295..e404781bc8d 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1875,8 +1875,9 @@ export class ModifierTypeOption { } export function getPartyLuckValue(party: Pokemon[]): integer { - return Phaser.Math.Clamp(party.map(p => p.isFainted() ? 0 : p.getLuck()) + const luck = Phaser.Math.Clamp(party.map(p => p.isFainted() ? 0 : p.getLuck()) .reduce((total: integer, value: integer) => total += value, 0), 0, 14); + return luck || 0; } export function getLuckString(luckValue: integer): string {