forked from pagefaultgames/pokerogue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pagefaultgames:main' into aj-main
- Loading branch information
Showing
21 changed files
with
610 additions
and
420 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { Button } from "#app/enums/buttons.js"; | ||
import { Moves } from "#app/enums/moves"; | ||
import { Species } from "#app/enums/species"; | ||
import { CommandPhase } from "#app/phases"; | ||
import FightUiHandler from "#app/ui/fight-ui-handler.js"; | ||
import { Mode } from "#app/ui/ui.js"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import Phaser from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; | ||
import MockText from "../utils/mocks/mocksContainer/mockText"; | ||
import { SPLASH_ONLY } from "../utils/testUtils"; | ||
|
||
describe("UI - Type Hints", () => { | ||
let phaserGame: Phaser.Game; | ||
let game: GameManager; | ||
|
||
beforeAll(() => { | ||
phaserGame = new Phaser.Game({ | ||
type: Phaser.HEADLESS, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
game.phaseInterceptor.restoreOg(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
game = new GameManager(phaserGame); | ||
game.settings.typeHints(true); //activate type hints | ||
game.override.battleType("single").startingLevel(100).startingWave(1).enemyMoveset(SPLASH_ONLY); | ||
}); | ||
|
||
it("check immunity color", async () => { | ||
game.override | ||
.battleType("single") | ||
.startingLevel(100) | ||
.startingWave(1) | ||
.enemySpecies(Species.FLORGES) | ||
.enemyMoveset(SPLASH_ONLY) | ||
.moveset([Moves.DRAGON_CLAW]); | ||
game.settings.typeHints(true); //activate type hints | ||
|
||
await game.startBattle([Species.RAYQUAZA]); | ||
|
||
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { | ||
const { ui } = game.scene; | ||
const handler = ui.getHandler<FightUiHandler>(); | ||
handler.processInput(Button.ACTION); // select "Fight" | ||
game.phaseInterceptor.unlock(); | ||
}); | ||
|
||
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { | ||
const { ui } = game.scene; | ||
const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME); | ||
const dragonClawText = movesContainer | ||
.getAll<Phaser.GameObjects.Text>() | ||
.find((text) => text.text === "Dragon Claw")! as unknown as MockText; | ||
|
||
expect.soft(dragonClawText.color).toBe("#929292"); | ||
ui.getHandler().processInput(Button.ACTION); | ||
}); | ||
await game.phaseInterceptor.to(CommandPhase); | ||
}); | ||
|
||
it("check status move color", async () => { | ||
game.override.enemySpecies(Species.FLORGES).moveset([Moves.GROWL]); | ||
|
||
await game.startBattle([Species.RAYQUAZA]); | ||
|
||
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { | ||
const { ui } = game.scene; | ||
const handler = ui.getHandler<FightUiHandler>(); | ||
handler.processInput(Button.ACTION); // select "Fight" | ||
game.phaseInterceptor.unlock(); | ||
}); | ||
|
||
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => { | ||
const { ui } = game.scene; | ||
const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME); | ||
const growlText = movesContainer | ||
.getAll<Phaser.GameObjects.Text>() | ||
.find((text) => text.text === "Growl")! as unknown as MockText; | ||
|
||
expect.soft(growlText.color).toBe(undefined); | ||
ui.getHandler().processInput(Button.ACTION); | ||
}); | ||
await game.phaseInterceptor.to(CommandPhase); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { GameManagerHelper } from "./gameManagerHelper"; | ||
|
||
/** | ||
* Helper to handle settings for tests | ||
*/ | ||
export class SettingsHelper extends GameManagerHelper { | ||
|
||
/** | ||
* Disable/Enable type hints settings | ||
* @param enable true to enabled, false to disabled | ||
*/ | ||
typeHints(enable: boolean) { | ||
this.game.scene.typeHints = enable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters