Change blacklist from array to list.

This commit is contained in:
Xavion3 2025-09-06 11:20:36 +10:00 committed by Sirz Benjie
parent ab66d9f08e
commit b4e8b163f5
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -3209,7 +3209,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
Math.ceil(Math.pow(m[1], weightMultiplier) * 100), Math.ceil(Math.pow(m[1], weightMultiplier) * 100),
]); ]);
const STAB_BLACKLIST = [ const STAB_BLACKLIST: ReadonlySet<MoveId> = new Set([
MoveId.SHELL_TRAP, MoveId.SHELL_TRAP,
MoveId.FUTURE_SIGHT, MoveId.FUTURE_SIGHT,
MoveId.UPPER_HAND, MoveId.UPPER_HAND,
@ -3249,14 +3249,14 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
MoveId.EXPLOSION, MoveId.EXPLOSION,
MoveId.MISTY_EXPLOSION, MoveId.MISTY_EXPLOSION,
MoveId.SELF_DESTRUCT, MoveId.SELF_DESTRUCT,
]; ]);
// All Pokemon force a STAB move first // All Pokemon force a STAB move first
const stabMovePool = baseWeights.filter( const stabMovePool = baseWeights.filter(
m => m =>
allMoves[m[0]].category !== MoveCategory.STATUS && allMoves[m[0]].category !== MoveCategory.STATUS &&
this.isOfType(allMoves[m[0]].type) && this.isOfType(allMoves[m[0]].type) &&
!STAB_BLACKLIST.includes(m[0]), !STAB_BLACKLIST.has(m[0]),
); );
if (stabMovePool.length > 0) { if (stabMovePool.length > 0) {
@ -3270,7 +3270,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
} else { } else {
// If there are no damaging STAB moves, just force a random damaging move // If there are no damaging STAB moves, just force a random damaging move
const attackMovePool = baseWeights.filter( 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) { if (attackMovePool.length > 0) {
const totalWeight = attackMovePool.reduce((v, m) => v + m[1], 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) { } else if (allMoves[m[0]].category !== MoveCategory.STATUS) {
ret = Math.ceil( ret = Math.ceil(
(m[1] / Math.max(Math.pow(4, this.moveset.filter(mo => (mo.getMove().power ?? 0) > 1).length) / 8, 0.5)) (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 { } else {
ret = m[1]; ret = m[1];