Convert to inline anonymous function

This commit is contained in:
NightKev 2024-10-08 03:41:33 -07:00
parent 2a47c32e88
commit 8887afa079

View File

@ -2175,7 +2175,7 @@ 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 double if STAB.
// Status moves remain unchanged on weight, this encourages 1-2
const movesetFilter = (m: [Moves, number]) => {
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]));
@ -2184,9 +2184,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} else {
ret = m[1];
}
return ret;
};
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo?.moveId)).map(m => [ m[0], movesetFilter(m) ]);
return [ m[0], ret ];
});
} else {
// Non-trainer pokemon just use normal weights
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo?.moveId));