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 'aj-main' of https://github.com/ajhyperbit/pokerogue int…
…o aj-main
- Loading branch information
Showing
26 changed files
with
678 additions
and
424 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
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,58 @@ | ||
import { BattleStat } from "#app/data/battle-stat"; | ||
import { Abilities } from "#enums/abilities"; | ||
import { Moves } from "#enums/moves"; | ||
import { Species } from "#enums/species"; | ||
import GameManager from "#test/utils/gameManager"; | ||
import { getMovePosition } from "#test/utils/gameManagerUtils"; | ||
import { SPLASH_ONLY } from "#test/utils/testUtils"; | ||
import Phaser from "phaser"; | ||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; | ||
|
||
describe("Abilities - Hyper Cutter", () => { | ||
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") | ||
.moveset([Moves.SAND_ATTACK, Moves.NOBLE_ROAR, Moves.DEFOG, Moves.OCTOLOCK]) | ||
.ability(Abilities.BALL_FETCH) | ||
.enemySpecies(Species.SHUCKLE) | ||
.enemyAbility(Abilities.HYPER_CUTTER) | ||
.enemyMoveset(SPLASH_ONLY); | ||
}); | ||
|
||
// Reference Link: https://bulbapedia.bulbagarden.net/wiki/Hyper_Cutter_(Ability) | ||
|
||
it("only prevents ATK drops", async () => { | ||
await game.startBattle(); | ||
|
||
const enemy = game.scene.getEnemyPokemon()!; | ||
|
||
game.doAttack(getMovePosition(game.scene, 0, Moves.OCTOLOCK)); | ||
await game.toNextTurn(); | ||
game.doAttack(getMovePosition(game.scene, 0, Moves.DEFOG)); | ||
await game.toNextTurn(); | ||
game.doAttack(getMovePosition(game.scene, 0, Moves.NOBLE_ROAR)); | ||
await game.toNextTurn(); | ||
game.doAttack(getMovePosition(game.scene, 0, Moves.SAND_ATTACK)); | ||
await game.toNextTurn(); | ||
game.override.moveset([Moves.STRING_SHOT]); | ||
game.doAttack(getMovePosition(game.scene, 0, Moves.STRING_SHOT)); | ||
await game.toNextTurn(); | ||
|
||
expect(enemy.summonData.battleStats[BattleStat.ATK]).toEqual(0); | ||
[BattleStat.ACC, BattleStat.DEF, BattleStat.EVA, BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD].forEach((stat: number) => expect(enemy.summonData.battleStats[stat]).toBeLessThan(0)); | ||
}); | ||
}); |
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
Oops, something went wrong.