mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Added test + change to valid move finding conditional.
This commit is contained in:
parent
42d22365b5
commit
ba0265bfb6
@ -6748,7 +6748,7 @@ export class SketchAttr extends MoveEffectAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
const targetMove = target.getLastXMoves()
|
||||
const targetMove = target.getLastXMoves(target.battleSummonData.turnCount)
|
||||
.find(m => m.move !== Moves.NONE && m.move !== Moves.STRUGGLE && !m.virtual);
|
||||
if (!targetMove) {
|
||||
return false;
|
||||
|
@ -5,6 +5,8 @@ import { MoveResult } from "#app/field/pokemon";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { StatusEffect } from "#app/enums/status-effect";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
|
||||
describe("Moves - Sketch", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -50,4 +52,28 @@ describe("Moves - Sketch", () => {
|
||||
expect(playerPokemon?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
// Can't verify if the player Pokemon's moveset was successfully changed because of overrides.
|
||||
});
|
||||
|
||||
it("Sketch should retrieve the most recent valid move from its target history", async () => {
|
||||
game.override
|
||||
.moveset([ Moves.SKETCH, Moves.GROWL ])
|
||||
.enemyStatusEffect(StatusEffect.PARALYSIS);
|
||||
|
||||
await game.classicMode.startBattle([ Species.REGIELEKI ]);
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
|
||||
game.move.select(Moves.GROWL);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.move.forceStatusActivation(false);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(enemyPokemon?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
|
||||
await game.toNextTurn();
|
||||
game.move.select(Moves.SKETCH);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||
await game.move.forceStatusActivation(true);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(playerPokemon?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
// Can't verify if the player Pokemon's moveset was successfully changed because of overrides.
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user