[Bug] Moody Can't Lower Stats at +6 (#6481)

This commit is contained in:
Anthony 2025-09-05 23:46:13 -07:00 committed by GitHub
parent ddc04a7a87
commit ad61a28e88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 1 deletions

View File

@ -4813,7 +4813,7 @@ export class MoodyAbAttr extends PostTurnAbAttr {
if (!simulated) {
if (canRaise.length > 0) {
const raisedStat = canRaise[pokemon.randBattleSeedInt(canRaise.length)];
canLower = canRaise.filter(s => s !== raisedStat);
canLower = canLower.filter(s => s !== raisedStat);
globalScene.phaseManager.unshiftNew("StatStageChangePhase", pokemon.getBattlerIndex(), true, [raisedStat], 2);
}
if (canLower.length > 0) {

View File

@ -84,4 +84,40 @@ describe("Abilities - Moody", () => {
expect(decreasedStat).toBeTruthy();
expect(decreasedStat.length).toBe(1);
});
it("should only try to increase a stat stage by 1 if the stat stage is not at 6", async () => {
await game.classicMode.startBattle();
const playerPokemon = game.field.getPlayerPokemon();
// Set all stat stages to 6
vi.spyOn(playerPokemon.summonData, "statStages", "get").mockReturnValue(new Array(BATTLE_STATS.length).fill(6));
// Set one of the stat stages to -6
const raisedStat = EFFECTIVE_STATS[playerPokemon.randBattleSeedInt(EFFECTIVE_STATS.length)];
playerPokemon.setStatStage(raisedStat, -6);
game.move.select(MoveId.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(raisedStat), "should increase only the stat that is not at stage 6").toBe(-4);
});
it("should only try to decrease a stat stage by 1 if the stat stage is not at -6", async () => {
await game.classicMode.startBattle();
const playerPokemon = game.field.getPlayerPokemon();
// Set all stat stages to -6
vi.spyOn(playerPokemon.summonData, "statStages", "get").mockReturnValue(new Array(BATTLE_STATS.length).fill(-6));
// Set one of the stat stages to 6
const raisedStat = EFFECTIVE_STATS[playerPokemon.randBattleSeedInt(EFFECTIVE_STATS.length)];
playerPokemon.setStatStage(raisedStat, 6);
game.move.select(MoveId.SPLASH);
await game.toNextTurn();
expect(playerPokemon.getStatStage(raisedStat), "should decrease only the stat that is not at stage -6").toBe(5);
});
});