From bfef09ecb3a2f2f7184db01dbfcdcdda071995a8 Mon Sep 17 00:00:00 2001 From: Christopher Schmidt Date: Sat, 7 Sep 2024 11:58:36 -0400 Subject: [PATCH] Further fixes for TurnMove refactor --- src/phases/move-phase.ts | 4 ++-- src/test/moves/spit_up.test.ts | 6 +++--- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 0ccf19a462f..0fd08c3147d 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -164,7 +164,7 @@ export class MovePhase extends BattlePhase { } // Record a failed move so Abilities like Truant don't trigger next turn and soft-lock - this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL }); + this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL, targets: this.targets }); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); // Remove any tags from moves like Fly/Dive/etc. moveQueue.shift(); // Remove the second turn of charge moves @@ -183,7 +183,7 @@ export class MovePhase extends BattlePhase { this.cancel(); // Record a failed move so Abilities like Truant don't trigger next turn and soft-lock - this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL }); + this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL, targets: [] }); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); // Remove any tags from moves like Fly/Dive/etc. diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index f88791efb74..e3eab886753 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -125,7 +125,7 @@ describe("Moves - Spit Up", () => { game.move.select(Moves.SPIT_UP); await game.phaseInterceptor.to(TurnInitPhase); - expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.FAIL }); + expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.FAIL, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(spitUp.calculateBattlePower).not.toHaveBeenCalled(); }); @@ -148,7 +148,7 @@ describe("Moves - Spit Up", () => { await game.phaseInterceptor.to(TurnInitPhase); - expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS }); + expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce(); @@ -176,7 +176,7 @@ describe("Moves - Spit Up", () => { game.move.select(Moves.SPIT_UP); await game.phaseInterceptor.to(TurnInitPhase); - expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS }); + expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce(); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index d57768d0ffd..74ff83a8be7 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -72,7 +72,7 @@ describe("Moves - Stockpile", () => { expect(user.getStatStage(Stat.SPDEF)).toBe(3); expect(stockpilingTag).toBeDefined(); expect(stockpilingTag.stockpiledCount).toBe(3); - expect(user.getMoveHistory().at(-1)).toMatchObject({ result: MoveResult.FAIL, move: Moves.STOCKPILE }); + expect(user.getMoveHistory().at(-1)).toMatchObject({ result: MoveResult.FAIL, move: Moves.STOCKPILE, targets: [ user.getBattlerIndex() ] }); } } }); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 719ac09ce06..3e486408a9b 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -183,7 +183,7 @@ describe("Moves - Swallow", () => { await game.phaseInterceptor.to(TurnInitPhase); - expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SWALLOW, result: MoveResult.SUCCESS }); + expect(pokemon.getMoveHistory().at(-1)).toMatchObject({ move: Moves.SWALLOW, result: MoveResult.SUCCESS, targets: [ pokemon.getBattlerIndex() ] }); expect(pokemon.getStatStage(Stat.DEF)).toBe(1); expect(pokemon.getStatStage(Stat.SPDEF)).toBe(-2);