diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 6c181249bb9..a1cef4844cc 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3487,17 +3487,36 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { // Sqrt the weight of any damaging moves with overlapping types. This is about a 0.05 - 0.1 multiplier. // Other damaging moves 2x weight if 0-1 damaging moves, 0.5x if 2, 0.125x if 3. These weights get 20x if STAB. // Status moves remain unchanged on weight, this encourages 1-2 - movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId)).map((m) => { - let ret: number; - if (this.moveset.some(mo => mo.getMove().category !== MoveCategory.STATUS && mo.getMove().type === allMoves[m[0]].type)) { - ret = Math.ceil(Math.sqrt(m[1])); - } 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) ? 2 : 1)); - } else { - ret = m[1]; - } - return [ m[0], ret ]; - }); + movePool = baseWeights + .filter(m => !this.moveset.some(mo => m[0] === mo.moveId)) + .map(m => { + let ret: number; + if ( + this.moveset.some( + mo => + mo.getMove().category !== MoveCategory.STATUS && + mo.getMove().type === allMoves[m[0]].type, + ) + ) { + ret = Math.ceil(Math.sqrt(m[1])); + } 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) ? 20 : 1), + ); + } else { + ret = m[1]; + } + return [m[0], ret]; + }); } else { // Non-trainer pokemon just use normal weights movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId));