Match formatting of pokemon.ts

This commit is contained in:
NightKev 2025-03-16 17:38:55 -07:00
parent 57cbba1749
commit 7ddc23eb36

View File

@ -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. // 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. // 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 // Status moves remain unchanged on weight, this encourages 1-2
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId)).map((m) => { movePool = baseWeights
let ret: number; .filter(m => !this.moveset.some(mo => m[0] === mo.moveId))
if (this.moveset.some(mo => mo.getMove().category !== MoveCategory.STATUS && mo.getMove().type === allMoves[m[0]].type)) { .map(m => {
ret = Math.ceil(Math.sqrt(m[1])); let ret: number;
} else if (allMoves[m[0]].category !== MoveCategory.STATUS) { if (
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)); this.moveset.some(
} else { mo =>
ret = m[1]; mo.getMove().category !== MoveCategory.STATUS &&
} mo.getMove().type === allMoves[m[0]].type,
return [ m[0], ret ]; )
}); ) {
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 { } else {
// Non-trainer pokemon just use normal weights // Non-trainer pokemon just use normal weights
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId)); movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo.moveId));