From 4aac5472a97f09388949a12def706e03ac0cd123 Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Tue, 26 Aug 2025 02:51:35 -0400 Subject: [PATCH] [Bug] Fix oversight where mons aren't guaranteed damaging moves if none are STAB (#6406) --- src/field/pokemon.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index cc7e27caae4..dab96e4090a 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3243,6 +3243,18 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { rand -= stabMovePool[index++][1]; } 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) {