mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-11-04 10:21:20 +01:00 
			
		
		
		
	* move test folder * Update vitest files * rename test/utils to test/testUtils * Remove stray utils/gameManager Got put back from a rebase
		
			
				
	
	
		
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { Abilities } from "#enums/abilities";
 | 
						|
import { Moves } from "#enums/moves";
 | 
						|
import { Species } from "#enums/species";
 | 
						|
import GameManager from "#test/testUtils/gameManager";
 | 
						|
import Phaser from "phaser";
 | 
						|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
 | 
						|
import { Type } from "#enums/type";
 | 
						|
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
 | 
						|
import { modifierTypes } from "#app/modifier/modifier-type";
 | 
						|
 | 
						|
describe("Form Change Phase", () => {
 | 
						|
  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
 | 
						|
      .moveset([ Moves.SPLASH ])
 | 
						|
      .ability(Abilities.BALL_FETCH)
 | 
						|
      .battleType("single")
 | 
						|
      .disableCrits()
 | 
						|
      .enemySpecies(Species.MAGIKARP)
 | 
						|
      .enemyAbility(Abilities.BALL_FETCH)
 | 
						|
      .enemyMoveset(Moves.SPLASH);
 | 
						|
  });
 | 
						|
 | 
						|
  it("Zacian should successfully change into Crowned form", async () => {
 | 
						|
    await game.classicMode.startBattle([ Species.ZACIAN ]);
 | 
						|
 | 
						|
    // Before the form change: Should be Hero form
 | 
						|
    const zacian = game.scene.getPlayerParty()[0];
 | 
						|
    expect(zacian.getFormKey()).toBe("hero-of-many-battles");
 | 
						|
    expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY ]);
 | 
						|
    expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 120, 115, 80, 115, 138 ]);
 | 
						|
 | 
						|
    // Give Zacian a Rusted Sword
 | 
						|
    const rustedSwordType = generateModifierType( modifierTypes.RARE_FORM_CHANGE_ITEM)!;
 | 
						|
    const rustedSword = rustedSwordType.newModifier(zacian);
 | 
						|
    await game.scene.addModifier(rustedSword);
 | 
						|
 | 
						|
    game.move.select(Moves.SPLASH);
 | 
						|
    await game.toNextTurn();
 | 
						|
 | 
						|
    // After the form change: Should be Crowned form
 | 
						|
    expect(game.phaseInterceptor.log.includes("FormChangePhase")).toBe(true);
 | 
						|
    expect(zacian.getFormKey()).toBe("crowned");
 | 
						|
    expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY, Type.STEEL ]);
 | 
						|
    expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 150, 115, 80, 115, 148 ]);
 | 
						|
  });
 | 
						|
});
 |