Fix bug in moveset code (#735)

Pokemon with very limited movepools could sometimes generate with no moves
This commit is contained in:
Xavion3 2024-05-11 15:46:36 +10:00 committed by GitHub
parent 168869d322
commit d24762b5dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -1263,7 +1263,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
while (movePool.length > 1 && this.moveset.length < 4) { while (baseWeights.length > this.moveset.length && this.moveset.length < 4) {
if (this.hasTrainer()) { if (this.hasTrainer()) {
// 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.