2024-08-22 06:49:33 -07:00
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
2024-09-01 15:23:25 -07:00
|
|
|
import { TurnStartPhase } from "#app/phases/turn-start-phase";
|
2024-09-02 22:12:34 -04:00
|
|
|
import GameManager from "#test/utils/gameManager";
|
2024-08-22 06:49:33 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
2024-09-02 22:12:34 -04:00
|
|
|
import { Stat } from "#enums/stat";
|
2024-08-13 13:25:58 -07:00
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
describe("Abilities - Mycelium Might", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
game.override.battleType("single");
|
|
|
|
game.override.disableCrits();
|
|
|
|
game.override.enemySpecies(Species.SHUCKLE);
|
|
|
|
game.override.enemyAbility(Abilities.CLEAR_BODY);
|
|
|
|
game.override.enemyMoveset([Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK]);
|
|
|
|
game.override.ability(Abilities.MYCELIUM_MIGHT);
|
|
|
|
game.override.moveset([Moves.QUICK_ATTACK, Moves.BABY_DOLL_EYES]);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2024-09-01 15:23:25 -07:00
|
|
|
* References:
|
2024-08-13 13:25:58 -07:00
|
|
|
* https://bulbapedia.bulbagarden.net/wiki/Mycelium_Might_(Ability)
|
|
|
|
* https://bulbapedia.bulbagarden.net/wiki/Priority
|
|
|
|
* https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/page-24
|
|
|
|
**/
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
it("will move last in its priority bracket and ignore protective abilities", async () => {
|
|
|
|
await game.startBattle([Species.REGIELEKI]);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon();
|
2024-09-01 15:23:25 -07:00
|
|
|
const playerIndex = game.scene.getPlayerPokemon()?.getBattlerIndex();
|
2024-08-13 13:25:58 -07:00
|
|
|
const enemyIndex = enemyPokemon?.getBattlerIndex();
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.BABY_DOLL_EYES);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
2024-09-01 15:23:25 -07:00
|
|
|
await game.phaseInterceptor.to(TurnStartPhase, false);
|
|
|
|
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
|
|
|
const speedOrder = phase.getSpeedOrder();
|
|
|
|
const commandOrder = phase.getCommandOrder();
|
2024-08-13 13:25:58 -07:00
|
|
|
// The opponent Pokemon (without Mycelium Might) goes first despite having lower speed than the player Pokemon.
|
|
|
|
// The player Pokemon (with Mycelium Might) goes last despite having higher speed than the opponent.
|
2024-09-01 15:23:25 -07:00
|
|
|
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
|
|
|
|
expect(commandOrder).toEqual([enemyIndex, playerIndex]);
|
2024-08-13 13:25:58 -07:00
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
2024-09-02 22:12:34 -04:00
|
|
|
|
|
|
|
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
|
|
|
|
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
|
2024-08-13 13:25:58 -07:00
|
|
|
}, 20000);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
it("will still go first if a status move that is in a higher priority bracket than the opponent's move is used", async () => {
|
2024-08-13 13:25:58 -07:00
|
|
|
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
2024-08-22 06:49:33 -07:00
|
|
|
await game.startBattle([Species.REGIELEKI]);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon();
|
2024-09-01 15:23:25 -07:00
|
|
|
const playerIndex = game.scene.getPlayerPokemon()?.getBattlerIndex();
|
2024-08-13 13:25:58 -07:00
|
|
|
const enemyIndex = enemyPokemon?.getBattlerIndex();
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.BABY_DOLL_EYES);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
2024-09-01 15:23:25 -07:00
|
|
|
await game.phaseInterceptor.to(TurnStartPhase, false);
|
|
|
|
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
|
|
|
const speedOrder = phase.getSpeedOrder();
|
|
|
|
const commandOrder = phase.getCommandOrder();
|
2024-08-13 13:25:58 -07:00
|
|
|
// The player Pokemon (with M.M.) goes first because its move is still within a higher priority bracket than its opponent.
|
|
|
|
// The enemy Pokemon goes second because its move is in a lower priority bracket.
|
2024-09-01 15:23:25 -07:00
|
|
|
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
|
|
|
|
expect(commandOrder).toEqual([playerIndex, enemyIndex]);
|
2024-08-13 13:25:58 -07:00
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
2024-09-02 22:12:34 -04:00
|
|
|
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
|
|
|
|
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
|
2024-08-13 13:25:58 -07:00
|
|
|
}, 20000);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
it("will not affect non-status moves", async () => {
|
|
|
|
await game.startBattle([Species.REGIELEKI]);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
2024-09-01 15:23:25 -07:00
|
|
|
const playerIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
|
2024-08-13 13:25:58 -07:00
|
|
|
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.QUICK_ATTACK);
|
2024-08-13 13:25:58 -07:00
|
|
|
|
2024-09-01 15:23:25 -07:00
|
|
|
await game.phaseInterceptor.to(TurnStartPhase, false);
|
|
|
|
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
|
|
|
const speedOrder = phase.getSpeedOrder();
|
|
|
|
const commandOrder = phase.getCommandOrder();
|
2024-08-13 13:25:58 -07:00
|
|
|
// The player Pokemon (with M.M.) goes first because it has a higher speed and did not use a status move.
|
|
|
|
// The enemy Pokemon (without M.M.) goes second because its speed is lower.
|
2024-09-01 15:23:25 -07:00
|
|
|
// This means that the commandOrder should be identical to the speedOrder
|
|
|
|
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
|
|
|
|
expect(commandOrder).toEqual([playerIndex, enemyIndex]);
|
2024-08-13 13:25:58 -07:00
|
|
|
}, 20000);
|
|
|
|
});
|