mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 14:59:26 +02:00
Convert to inline anonymous function
This commit is contained in:
parent
2a47c32e88
commit
8887afa079
@ -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.
|
// 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.
|
// 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
|
// 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;
|
let ret: number;
|
||||||
if (this.moveset.some(mo => mo?.getMove().category !== MoveCategory.STATUS && mo?.getMove().type === allMoves[m[0]].type)) {
|
if (this.moveset.some(mo => mo?.getMove().category !== MoveCategory.STATUS && mo?.getMove().type === allMoves[m[0]].type)) {
|
||||||
ret = Math.ceil(Math.sqrt(m[1]));
|
ret = Math.ceil(Math.sqrt(m[1]));
|
||||||
@ -2184,9 +2184,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
} else {
|
} else {
|
||||||
ret = m[1];
|
ret = m[1];
|
||||||
}
|
}
|
||||||
return ret;
|
return [ m[0], ret ];
|
||||||
};
|
});
|
||||||
movePool = baseWeights.filter(m => !this.moveset.some(mo => m[0] === mo?.moveId)).map(m => [ m[0], movesetFilter(m) ]);
|
|
||||||
} 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));
|
||||||
|
Loading…
Reference in New Issue
Block a user