Hotfix for NaN luck (#1840)

Makes luck default to 0 if false-y
This commit is contained in:
Xavion3 2024-06-06 05:42:15 +10:00 committed by GitHub
parent 3855b92237
commit 4b36d38acb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -1875,8 +1875,9 @@ export class ModifierTypeOption {
} }
export function getPartyLuckValue(party: Pokemon[]): integer { 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); .reduce((total: integer, value: integer) => total += value, 0), 0, 14);
return luck || 0;
} }
export function getLuckString(luckValue: integer): string { export function getLuckString(luckValue: integer): string {