mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
[Bug] Moody Can't Lower Stats at +6 (#6481)
This commit is contained in:
parent
ddc04a7a87
commit
ad61a28e88
@ -4813,7 +4813,7 @@ export class MoodyAbAttr extends PostTurnAbAttr {
|
|||||||
if (!simulated) {
|
if (!simulated) {
|
||||||
if (canRaise.length > 0) {
|
if (canRaise.length > 0) {
|
||||||
const raisedStat = canRaise[pokemon.randBattleSeedInt(canRaise.length)];
|
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);
|
globalScene.phaseManager.unshiftNew("StatStageChangePhase", pokemon.getBattlerIndex(), true, [raisedStat], 2);
|
||||||
}
|
}
|
||||||
if (canLower.length > 0) {
|
if (canLower.length > 0) {
|
||||||
|
@ -84,4 +84,40 @@ describe("Abilities - Moody", () => {
|
|||||||
expect(decreasedStat).toBeTruthy();
|
expect(decreasedStat).toBeTruthy();
|
||||||
expect(decreasedStat.length).toBe(1);
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user