From 4f0f4ce2d5ba1fc1262dcc6234f54a5e3f0a68b5 Mon Sep 17 00:00:00 2001 From: geeilhan <107366005+geeilhan@users.noreply.github.com> Date: Sat, 18 Jan 2025 15:57:47 +0100 Subject: [PATCH] Apply suggestions from code review Added changes to documentation and cleaning up code Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/custom-pokemon-data.ts | 2 +- src/data/move.ts | 26 ++++++++++++------------- src/phases/encounter-phase.ts | 2 +- src/phases/new-biome-encounter-phase.ts | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/data/custom-pokemon-data.ts b/src/data/custom-pokemon-data.ts index 849b9e9f237..4a5eb89aeed 100644 --- a/src/data/custom-pokemon-data.ts +++ b/src/data/custom-pokemon-data.ts @@ -30,7 +30,7 @@ export class CustomPokemonData { this.hitsRecCount = this.hitsRecCount ?? 0; } - resetHitRecivedCount(): void { + resetHitReceivedCount(): void { this.hitsRecCount = 0; } } diff --git a/src/data/move.ts b/src/data/move.ts index 5482a83a26e..2bc750d55a3 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3994,32 +3994,30 @@ export class FriendshipPowerAttr extends VariablePowerAttr { } /** - * This Attribute calculates the current power of {@linkcode Moves.RAGE_FIST} + * This Attribute calculates the current power of {@linkcode Moves.RAGE_FIST}. * The counter for power calculation does not reset on every wave but on every new arena encounter */ export class RageFistPowerAttr extends VariablePowerAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - const BDHitCount = user.battleData.hitCount; - const previousHitCount = user.battleData.prevHitCount; + const { hitCount, prevHitCount } = user.battleData; + const basePower: Utils.NumberHolder = args[0]; - this.updateHitRecivedCount(user, BDHitCount, previousHitCount); + this.updateHitReceivedCount(user, hitCount, prevHitCount); - console.log(`GHNote hitsRecCount: ${user.customPokemonData.hitsRecCount}`); - - (args[0] as Utils.NumberHolder).value = 50 + (Math.min(user.customPokemonData.hitsRecCount, 6) * 50); + basePower.value = 50 + (Math.min(user.customPokemonData.hitsRecCount, 6) * 50); return true; } /** - * Updates the hitCount of recived hits during this arena encounter + * Updates the number of hits the Pokemon has taken in battle * @param user Pokemon calling Rage Fist - * @param BDHitCount The hitCount of reviced hits this battle up until the function is called - * @param previousHitCount The hitCount of reviced hits this battle the last time Rage Fist was called + * @param hitCount The number of received hits this battle + * @param previousHitCount The number of received hits this battle since last time Rage Fist was used */ - updateHitRecivedCount(user: Pokemon, BDHitCount: number, previousHitCount: number): void { - user.customPokemonData.hitsRecCount += (BDHitCount - previousHitCount); - user.battleData.prevHitCount = BDHitCount; + updateHitReceivedCount(user: Pokemon, hitCount: number, previousHitCount: number): void { + user.customPokemonData.hitsRecCount += (hitCount - previousHitCount); + user.battleData.prevHitCount = hitCount; } } @@ -11013,7 +11011,7 @@ export function initMoves() { new AttackMove(Moves.TWIN_BEAM, Type.PSYCHIC, MoveCategory.SPECIAL, 40, 100, 10, -1, 0, 9) .attr(MultiHitAttr, MultiHitType._2), new AttackMove(Moves.RAGE_FIST, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9) - .partial() // Counter resets every wave instead of on arena reset + .edgeCase() // Counter incorrectly increases on confusion self-hits .attr(RageFistPowerAttr) .punchingMove(), new AttackMove(Moves.ARMOR_CANNON, Type.FIRE, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9) diff --git a/src/phases/encounter-phase.ts b/src/phases/encounter-phase.ts index 2083f09896a..353dd6681cb 100644 --- a/src/phases/encounter-phase.ts +++ b/src/phases/encounter-phase.ts @@ -107,7 +107,7 @@ export class EncounterPhase extends BattlePhase { //resets hitRecCount during Trainer ecnounter for (const pokemon of globalScene.getPlayerParty()) { if (pokemon) { - pokemon.customPokemonData.resetHitRecivedCount(); + pokemon.customPokemonData.resetHitReceivedCount(); } } battle.enemyParty[e] = battle.trainer?.genPartyMember(e)!; // TODO:: is the bang correct here? diff --git a/src/phases/new-biome-encounter-phase.ts b/src/phases/new-biome-encounter-phase.ts index b0a7bf4d1ae..2de9a4300c5 100644 --- a/src/phases/new-biome-encounter-phase.ts +++ b/src/phases/new-biome-encounter-phase.ts @@ -14,7 +14,7 @@ export class NewBiomeEncounterPhase extends NextEncounterPhase { for (const pokemon of globalScene.getPlayerParty()) { if (pokemon) { pokemon.resetBattleData(); - pokemon.customPokemonData.resetHitRecivedCount(); + pokemon.customPokemonData.resetHitReceivedCount(); } }