From b4e8b163f5b888f3d72e5f9de997e01aae2fc0aa Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Sat, 6 Sep 2025 11:20:36 +1000 Subject: [PATCH] Change blacklist from array to list. --- src/field/pokemon.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index d9db30db563..178253dfae5 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3209,7 +3209,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { Math.ceil(Math.pow(m[1], weightMultiplier) * 100), ]); - const STAB_BLACKLIST = [ + const STAB_BLACKLIST: ReadonlySet = new Set([ MoveId.SHELL_TRAP, MoveId.FUTURE_SIGHT, MoveId.UPPER_HAND, @@ -3249,14 +3249,14 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { MoveId.EXPLOSION, MoveId.MISTY_EXPLOSION, MoveId.SELF_DESTRUCT, - ]; + ]); // All Pokemon force a STAB move first const stabMovePool = baseWeights.filter( m => allMoves[m[0]].category !== MoveCategory.STATUS && this.isOfType(allMoves[m[0]].type) && - !STAB_BLACKLIST.includes(m[0]), + !STAB_BLACKLIST.has(m[0]), ); if (stabMovePool.length > 0) { @@ -3270,7 +3270,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } else { // If there are no damaging STAB moves, just force a random damaging move const attackMovePool = baseWeights.filter( - m => allMoves[m[0]].category !== MoveCategory.STATUS && !STAB_BLACKLIST.includes(m[0]), + m => allMoves[m[0]].category !== MoveCategory.STATUS && !STAB_BLACKLIST.has(m[0]), ); if (attackMovePool.length > 0) { const totalWeight = attackMovePool.reduce((v, m) => v + m[1], 0); @@ -3308,7 +3308,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } else if (allMoves[m[0]].category !== MoveCategory.STATUS) { ret = Math.ceil( (m[1] / Math.max(Math.pow(4, this.moveset.filter(mo => (mo.getMove().power ?? 0) > 1).length) / 8, 0.5)) - * (this.isOfType(allMoves[m[0]].type) && !STAB_BLACKLIST.includes(m[0]) ? 20 : 1), + * (this.isOfType(allMoves[m[0]].type) && !STAB_BLACKLIST.has(m[0]) ? 20 : 1), ); } else { ret = m[1];