Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
geeilhan 2025-01-18 12:14:29 +01:00 committed by GitHub
parent bb88fd6d11
commit fb7925061c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 23 deletions

View File

@ -14,7 +14,7 @@ export class CustomPokemonData {
public passive: Abilities | -1; public passive: Abilities | -1;
public nature: Nature | -1; public nature: Nature | -1;
public types: Type[]; 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; public hitsRecCount: number;
constructor(data?: CustomPokemonData | Partial<CustomPokemonData>) { constructor(data?: CustomPokemonData | Partial<CustomPokemonData>) {

View File

@ -5281,11 +5281,9 @@ export class PokemonSummonData {
} }
export class PokemonBattleData { export class PokemonBattleData {
//counts the hits the pokemon recived /** counts the hits the pokemon received */
public hitCount: number = 0; public hitCount: number = 0;
/** /** used for {@linkcode Moves.RAGE_FIST} in order to save hit Counts received before Rage Fist is applied */
* used for {@linkcode Moves.RAGE_FIST} in order to save hit Counts recived before Rage Fist is applied
*/
public prevHitCount: number = 0; public prevHitCount: number = 0;
public endured: boolean = false; public endured: boolean = false;
public berriesEaten: BerryType[] = []; public berriesEaten: BerryType[] = [];

View File

@ -10,6 +10,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
describe("Moves - Rage Fist", () => { describe("Moves - Rage Fist", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
let game: GameManager; let game: GameManager;
const move = allMoves[Moves.RAGE_FIST];
beforeAll(() => { beforeAll(() => {
phaserGame = new Phaser.Game({ phaserGame = new Phaser.Game({
@ -30,6 +31,8 @@ describe("Moves - Rage Fist", () => {
.enemyLevel(1) .enemyLevel(1)
.enemyAbility(Abilities.BALL_FETCH) .enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.DOUBLE_KICK); .enemyMoveset(Moves.DOUBLE_KICK);
vi.spyOn(move, "calculateBattlePower");
}); });
it("should have 100 more power if hit twice before calling Rage Fist", async () => { 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 ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.RAGE_FIST); game.move.select(Moves.RAGE_FIST);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");
@ -55,9 +55,6 @@ describe("Moves - Rage Fist", () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.RAGE_FIST); game.move.select(Moves.RAGE_FIST);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.toNextWave(); await game.toNextWave();
@ -76,9 +73,6 @@ describe("Moves - Rage Fist", () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.RAGE_FIST); game.move.select(Moves.RAGE_FIST);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.toNextWave(); await game.toNextWave();
@ -97,9 +91,6 @@ describe("Moves - Rage Fist", () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.SUBSTITUTE); game.move.select(Moves.SUBSTITUTE);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to("MoveEffectPhase"); await game.phaseInterceptor.to("MoveEffectPhase");
@ -115,9 +106,6 @@ describe("Moves - Rage Fist", () => {
await game.classicMode.startBattle([ Species.MAGIKARP ]); await game.classicMode.startBattle([ Species.MAGIKARP ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.RAGE_FIST); game.move.select(Moves.RAGE_FIST);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.toNextWave(); await game.toNextWave();
@ -137,9 +125,6 @@ describe("Moves - Rage Fist", () => {
await game.classicMode.startBattle([ Species.CHARIZARD, Species.BLASTOISE ]); await game.classicMode.startBattle([ Species.CHARIZARD, Species.BLASTOISE ]);
const move = allMoves[Moves.RAGE_FIST];
vi.spyOn(move, "calculateBattlePower");
game.move.select(Moves.RAGE_FIST); game.move.select(Moves.RAGE_FIST);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
game.doSelectPartyPokemon(1); game.doSelectPartyPokemon(1);