From fb7925061cd53362ec8dedc71671184a702ed303 Mon Sep 17 00:00:00 2001 From: geeilhan <107366005+geeilhan@users.noreply.github.com> Date: Sat, 18 Jan 2025 12:14:29 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/custom-pokemon-data.ts | 2 +- src/field/pokemon.ts | 6 ++---- src/test/moves/rage_fist.test.ts | 21 +++------------------ 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/data/custom-pokemon-data.ts b/src/data/custom-pokemon-data.ts index 55b06db5179..849b9e9f237 100644 --- a/src/data/custom-pokemon-data.ts +++ b/src/data/custom-pokemon-data.ts @@ -14,7 +14,7 @@ export class CustomPokemonData { public passive: Abilities | -1; public nature: Nature | -1; public types: Type[]; - //hitsRecivedCount aka hitsRecCount saves how often the pokemon got hit until a new arena encounter (used for Rage Fist) + /** `hitsReceivedCount` aka `hitsRecCount` saves how often the pokemon got hit until a new arena encounter (used for Rage Fist) */ public hitsRecCount: number; constructor(data?: CustomPokemonData | Partial) { diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 1e377e70291..e9142df5eb0 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -5281,11 +5281,9 @@ export class PokemonSummonData { } export class PokemonBattleData { - //counts the hits the pokemon recived + /** counts the hits the pokemon received */ public hitCount: number = 0; - /** - * used for {@linkcode Moves.RAGE_FIST} in order to save hit Counts recived before Rage Fist is applied - */ + /** used for {@linkcode Moves.RAGE_FIST} in order to save hit Counts received before Rage Fist is applied */ public prevHitCount: number = 0; public endured: boolean = false; public berriesEaten: BerryType[] = []; diff --git a/src/test/moves/rage_fist.test.ts b/src/test/moves/rage_fist.test.ts index 61f612eddd4..7235b5e8ddf 100644 --- a/src/test/moves/rage_fist.test.ts +++ b/src/test/moves/rage_fist.test.ts @@ -10,6 +10,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite describe("Moves - Rage Fist", () => { let phaserGame: Phaser.Game; let game: GameManager; + const move = allMoves[Moves.RAGE_FIST]; beforeAll(() => { phaserGame = new Phaser.Game({ @@ -30,6 +31,8 @@ describe("Moves - Rage Fist", () => { .enemyLevel(1) .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.DOUBLE_KICK); + + vi.spyOn(move, "calculateBattlePower"); }); it("should have 100 more power if hit twice before calling Rage Fist", async () => { @@ -38,9 +41,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.MAGIKARP ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.RAGE_FIST); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.phaseInterceptor.to("TurnEndPhase"); @@ -55,9 +55,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.MAGIKARP ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.RAGE_FIST); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.toNextWave(); @@ -76,9 +73,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.MAGIKARP ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.RAGE_FIST); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.toNextWave(); @@ -97,9 +91,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.MAGIKARP ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.SUBSTITUTE); await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); await game.phaseInterceptor.to("MoveEffectPhase"); @@ -115,9 +106,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.MAGIKARP ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.RAGE_FIST); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.toNextWave(); @@ -137,9 +125,6 @@ describe("Moves - Rage Fist", () => { await game.classicMode.startBattle([ Species.CHARIZARD, Species.BLASTOISE ]); - const move = allMoves[Moves.RAGE_FIST]; - vi.spyOn(move, "calculateBattlePower"); - game.move.select(Moves.RAGE_FIST); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); game.doSelectPartyPokemon(1);