11import { MoveId } from "#enums/move-id" ;
2+ import { MoveResult } from "#enums/move-result" ;
23import { SpeciesId } from "#enums/species-id" ;
34import { GameManager } from "#test/framework/game-manager" ;
45import Phaser from "phaser" ;
56import { beforeAll , beforeEach , describe , expect , it } from "vitest" ;
67
7- describe ( "Moves - Fake Out" , ( ) => {
8+ describe . each ( [
9+ { move : MoveId . FAKE_OUT , name : "Fake Out" } ,
10+ { move : MoveId . FIRST_IMPRESSION , name : "First Impression" } ,
11+ { move : MoveId . MAT_BLOCK , name : "Mat Block" } ,
12+ ] ) ( "Move - $name" , ( { move } ) => {
813 let phaserGame : Phaser . Game ;
914 let game : GameManager ;
1015
@@ -18,64 +23,56 @@ describe("Moves - Fake Out", () => {
1823 game = new GameManager ( phaserGame ) ;
1924 game . override
2025 . battleStyle ( "single" )
21- . enemySpecies ( SpeciesId . CORVIKNIGHT )
26+ . enemySpecies ( SpeciesId . SHUCKLE )
2227 . enemyMoveset ( MoveId . SPLASH )
23- . enemyLevel ( 10 )
24- . startingLevel ( 1 ) // prevent LevelUpPhase from happening
28+ . enemyLevel ( 100 )
29+ . startingLevel ( 100 )
2530 . criticalHits ( false ) ;
2631 } ) ;
2732
2833 it ( "should only work the first turn a pokemon is sent out in a battle" , async ( ) => {
2934 await game . classicMode . startBattle ( SpeciesId . FEEBAS ) ;
3035
31- game . move . use ( MoveId . FAKE_OUT ) ;
36+ game . move . use ( move ) ;
3237 await game . toNextTurn ( ) ;
3338
34- const corv = game . field . getEnemyPokemon ( ) ;
35- expect ( corv ) . not . toHaveFullHp ( ) ;
36- corv . hp = corv . getMaxHp ( ) ;
39+ const feebas = game . field . getPlayerPokemon ( ) ;
40+ expect ( feebas ) . toHaveUsedMove ( { move, result : MoveResult . SUCCESS } ) ;
3741
38- game . move . use ( MoveId . FAKE_OUT ) ;
39- await game . toNextTurn ( ) ;
42+ game . move . use ( move ) ;
43+ await game . toEndOfTurn ( ) ;
4044
41- expect ( corv ) . toHaveFullHp ( ) ;
45+ expect ( feebas ) . toHaveUsedMove ( { move , result : MoveResult . FAIL } ) ;
4246 } ) ;
4347
44- // This is a PokeRogue buff to Fake Out
48+ // This is a PokeRogue buff to Fake Out & co.
4549 it ( "should succeed at the start of each new wave, even if user wasn't recalled" , async ( ) => {
4650 await game . classicMode . startBattle ( SpeciesId . FEEBAS ) ;
4751
48- // set hp to 1 for easy knockout
49- game . field . getEnemyPokemon ( ) . hp = 1 ;
50- game . move . use ( MoveId . FAKE_OUT ) ;
52+ game . move . use ( MoveId . SPLASH ) ;
53+ await game . doKillOpponents ( ) ;
5154 await game . toNextWave ( ) ;
5255
53- game . move . use ( MoveId . FAKE_OUT ) ;
56+ game . move . use ( move ) ;
5457 await game . toNextTurn ( ) ;
5558
56- const corv = game . field . getEnemyPokemon ( ) ;
57- expect ( corv ) . not . toHaveFullHp ( ) ;
59+ const feebas = game . field . getPlayerPokemon ( ) ;
60+ expect ( feebas ) . toHaveUsedMove ( { move , result : MoveResult . SUCCESS } ) ;
5861 } ) ;
5962
6063 it ( "should succeed if recalled and sent back out" , async ( ) => {
6164 await game . classicMode . startBattle ( SpeciesId . FEEBAS , SpeciesId . MAGIKARP ) ;
6265
63- game . move . use ( MoveId . FAKE_OUT ) ;
64- await game . toNextTurn ( ) ;
65-
66- const corv = game . field . getEnemyPokemon ( ) ;
67- expect ( corv ) . not . toHaveFullHp ( ) ;
68- corv . hp = corv . getMaxHp ( ) ;
69-
7066 game . doSwitchPokemon ( 1 ) ;
7167 await game . toNextTurn ( ) ;
7268
7369 game . doSwitchPokemon ( 1 ) ;
7470 await game . toNextTurn ( ) ;
7571
76- game . move . use ( MoveId . FAKE_OUT ) ;
72+ game . move . use ( move ) ;
7773 await game . toNextTurn ( ) ;
7874
79- expect ( corv ) . not . toHaveFullHp ( ) ;
75+ const feebas = game . field . getPlayerPokemon ( ) ;
76+ expect ( feebas ) . toHaveUsedMove ( { move, result : MoveResult . SUCCESS } ) ;
8077 } ) ;
8178} ) ;
0 commit comments