mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 15:03:24 +02:00
[Bug] Fix oversight where mons aren't guaranteed damaging moves if none are STAB (#6406)
This commit is contained in:
parent
c8a66b2e59
commit
4aac5472a9
@ -3243,6 +3243,18 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
rand -= stabMovePool[index++][1];
|
rand -= stabMovePool[index++][1];
|
||||||
}
|
}
|
||||||
this.moveset.push(new PokemonMove(stabMovePool[index][0]));
|
this.moveset.push(new PokemonMove(stabMovePool[index][0]));
|
||||||
|
} else {
|
||||||
|
// If there are no damaging STAB moves, just force a random damaging move
|
||||||
|
const attackMovePool = baseWeights.filter(m => allMoves[m[0]].category !== MoveCategory.STATUS);
|
||||||
|
if (attackMovePool.length) {
|
||||||
|
const totalWeight = attackMovePool.reduce((v, m) => v + m[1], 0);
|
||||||
|
let rand = randSeedInt(totalWeight);
|
||||||
|
let index = 0;
|
||||||
|
while (rand > attackMovePool[index][1]) {
|
||||||
|
rand -= attackMovePool[index++][1];
|
||||||
|
}
|
||||||
|
this.moveset.push(new PokemonMove(attackMovePool[index][0], 0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (baseWeights.length > this.moveset.length && this.moveset.length < 4) {
|
while (baseWeights.length > this.moveset.length && this.moveset.length < 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user