mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-23 07:49:36 +02:00
test
This commit is contained in:
parent
0c63324fc1
commit
293895f86f
@ -2898,7 +2898,7 @@ export class SecretPowerAttr extends MoveEffectAttr {
|
||||
secondaryEffect = new StatStageChangeAttr([ Stat.SPD ], -1, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const biome = user.scene.arena.biomeType;
|
||||
switch (biome) {
|
||||
case Biome.TOWN:
|
||||
@ -2954,15 +2954,14 @@ export class SecretPowerAttr extends MoveEffectAttr {
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.RUINS:
|
||||
case Biome.ABYSS:
|
||||
|
||||
case Biome.TEMPLE:
|
||||
case Biome.END:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return secondaryEffect.apply(user, target, move, []);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class PostVictoryStatStageChangeAttr extends MoveAttr {
|
||||
@ -7981,7 +7980,7 @@ export function initMoves() {
|
||||
.unimplemented(),
|
||||
new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3)
|
||||
.unimplemented(),
|
||||
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3)
|
||||
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 100, 0, 3)
|
||||
.makesContact(false)
|
||||
.attr(SecretPowerAttr),
|
||||
new AttackMove(Moves.DIVE, Type.WATER, MoveCategory.PHYSICAL, 80, 100, 10, -1, 0, 3)
|
||||
|
58
src/test/moves/secret_power.test.ts
Normal file
58
src/test/moves/secret_power.test.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Biome } from "#app/enums/biome";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { Species } from "#enums/species";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { StatusEffect } from "#app/enums/status-effect";
|
||||
|
||||
describe("Moves - Secret Power", () => {
|
||||
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.SECRET_POWER ])
|
||||
.ability(Abilities.BALL_FETCH)
|
||||
.battleType("single")
|
||||
.disableCrits()
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyLevel(60)
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.MISTY_TERRAIN ]);
|
||||
vi.spyOn(allMoves[Moves.SECRET_POWER], "chance", "get").mockReturnValue(100);
|
||||
});
|
||||
|
||||
it("Secret Power checks for an active terrain first then looks at the biome for its secondary effect", async () => {
|
||||
game.override.startingBiome(Biome.METROPOLIS);
|
||||
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
||||
// No Terrain + Biome.METROPOLIS --> Paralysis
|
||||
game.move.select(Moves.SECRET_POWER);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(enemyPokemon.status?.effect).toBe(StatusEffect.PARALYSIS);
|
||||
|
||||
// Misty Terrain --> SpAtk -1
|
||||
game.move.select(Moves.SECRET_POWER);
|
||||
await game.forceEnemyMove(Moves.MISTY_TERRAIN);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-1);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user