pokerogue/src/test/abilities/mycelium_might.test.ts

107 lines
4.7 KiB
TypeScript
Raw Normal View History

import { BattleStat } from "#app/data/battle-stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
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]);
});
/**
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
* References:
* 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
**/
it("will move last in its priority bracket and ignore protective abilities", async () => {
await game.startBattle([Species.REGIELEKI]);
const enemyPokemon = game.scene.getEnemyPokemon();
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
const playerIndex = game.scene.getPlayerPokemon()?.getBattlerIndex();
const enemyIndex = enemyPokemon?.getBattlerIndex();
game.move.select(Moves.BABY_DOLL_EYES);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
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();
// 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.
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
expect(commandOrder).toEqual([enemyIndex, playerIndex]);
await game.phaseInterceptor.to(TurnEndPhase);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
// Despite the opponent's ability (Clear Body), its attack stat is still reduced.
expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, 20000);
it("will still go first if a status move that is in a higher priority bracket than the opponent's move is used", async () => {
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle([Species.REGIELEKI]);
const enemyPokemon = game.scene.getEnemyPokemon();
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
const playerIndex = game.scene.getPlayerPokemon()?.getBattlerIndex();
const enemyIndex = enemyPokemon?.getBattlerIndex();
game.move.select(Moves.BABY_DOLL_EYES);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
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();
// 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.
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
expect(commandOrder).toEqual([playerIndex, enemyIndex]);
await game.phaseInterceptor.to(TurnEndPhase);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
// Despite the opponent's ability (Clear Body), its attack stat is still reduced.
expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1);
}, 20000);
it("will not affect non-status moves", async () => {
await game.startBattle([Species.REGIELEKI]);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
2024-09-01 15:23:25 -07:00
const playerIndex = game.scene.getPlayerPokemon()!.getBattlerIndex();
const enemyIndex = game.scene.getEnemyPokemon()!.getBattlerIndex();
game.move.select(Moves.QUICK_ATTACK);
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
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();
// 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.
[Refactor] Improvements on getOrder() (#3547) * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Update src/phases.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Moved getOrder() into TurnStartPhase * Cleaned up bypass speed checks * Revert "Cleaned up bypass speed checks" This reverts commit 11150254f568b8575211693919c9c5deeb3d8dcd. * Added comments. * Fixed up some inconsistencies * changed isSameBracket check * changed isSameBracket check p2 * changed isSameBracket check p3 * changed isSameBracket check p3 * Fixed up conditionals + stall/M.m * Seems OK * Update battle-spec.ts * Updated tests to use new functions introduced. Less intuitive, but faster. * Removed import * i hate git * Moved getOrder() into TurnStartPhase * Seems OK * missing import * Added Snooze's review * Added test fixes and removed unwanted edit. * fixed dynamax cannon test * typedocs fixes * Updating battle-order.test.ts * merge fixes * ughhh * Update src/test/abilities/mycelium_might.test.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * tsdocs :) * Fixed tests * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * Update src/phases/turn-start-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> * innerthunder's fixes * commas * Mocked stats instead of directly changing them --------- Co-authored-by: Frutescens <info@laptop> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
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]);
}, 20000);
});