Fix Minimize AI and add NaN AI score safeguard (#2460)

This commit is contained in:
Xavion3 2024-06-21 09:26:32 +10:00 committed by GitHub
parent 7ae6baf9a5
commit a14128aece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -3964,6 +3964,8 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
return -3;
case BattlerTagType.ENCORE:
return -2;
case BattlerTagType.MINIMIZED:
return 0;
case BattlerTagType.INGRAIN:
case BattlerTagType.IGNORE_ACCURACY:
case BattlerTagType.AQUA_RING:

View File

@ -3505,6 +3505,10 @@ export class EnemyPokemon extends Pokemon {
const target = this.scene.getField()[mt];
let targetScore = move.getUserBenefitScore(this, target, move) + move.getTargetBenefitScore(this, target, move) * (mt < BattlerIndex.ENEMY === this.isPlayer() ? 1 : -1);
if (Number.isNaN(targetScore)) {
console.error(`Move ${move.name} returned score of NaN`);
targetScore = 0;
}
if ((move.name.endsWith(" (N)") || !move.applyConditions(this, target, move)) && ![Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP].includes(move.id)) {
targetScore = -20;
} else if (move instanceof AttackMove) {