mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-22 17:44:19 +01:00
Fix Minimize AI and add NaN AI score safeguard (#2460)
This commit is contained in:
parent
7ae6baf9a5
commit
a14128aece
@ -3964,6 +3964,8 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
|
|||||||
return -3;
|
return -3;
|
||||||
case BattlerTagType.ENCORE:
|
case BattlerTagType.ENCORE:
|
||||||
return -2;
|
return -2;
|
||||||
|
case BattlerTagType.MINIMIZED:
|
||||||
|
return 0;
|
||||||
case BattlerTagType.INGRAIN:
|
case BattlerTagType.INGRAIN:
|
||||||
case BattlerTagType.IGNORE_ACCURACY:
|
case BattlerTagType.IGNORE_ACCURACY:
|
||||||
case BattlerTagType.AQUA_RING:
|
case BattlerTagType.AQUA_RING:
|
||||||
|
@ -3505,6 +3505,10 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
|
|
||||||
const target = this.scene.getField()[mt];
|
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);
|
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)) {
|
if ((move.name.endsWith(" (N)") || !move.applyConditions(this, target, move)) && ![Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP].includes(move.id)) {
|
||||||
targetScore = -20;
|
targetScore = -20;
|
||||||
} else if (move instanceof AttackMove) {
|
} else if (move instanceof AttackMove) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user