Apply suggestions from code review

Added changes to documentation and cleaning up code

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
geeilhan 2025-01-18 15:57:47 +01:00 committed by GitHub
parent eb9ac890a6
commit 4f0f4ce2d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 17 deletions

View File

@ -30,7 +30,7 @@ export class CustomPokemonData {
this.hitsRecCount = this.hitsRecCount ?? 0; this.hitsRecCount = this.hitsRecCount ?? 0;
} }
resetHitRecivedCount(): void { resetHitReceivedCount(): void {
this.hitsRecCount = 0; this.hitsRecCount = 0;
} }
} }

View File

@ -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 * The counter for power calculation does not reset on every wave but on every new arena encounter
*/ */
export class RageFistPowerAttr extends VariablePowerAttr { export class RageFistPowerAttr extends VariablePowerAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const BDHitCount = user.battleData.hitCount; const { hitCount, prevHitCount } = user.battleData;
const previousHitCount = user.battleData.prevHitCount; const basePower: Utils.NumberHolder = args[0];
this.updateHitRecivedCount(user, BDHitCount, previousHitCount); this.updateHitReceivedCount(user, hitCount, prevHitCount);
console.log(`GHNote hitsRecCount: ${user.customPokemonData.hitsRecCount}`); basePower.value = 50 + (Math.min(user.customPokemonData.hitsRecCount, 6) * 50);
(args[0] as Utils.NumberHolder).value = 50 + (Math.min(user.customPokemonData.hitsRecCount, 6) * 50);
return true; 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 user Pokemon calling Rage Fist
* @param BDHitCount The hitCount of reviced hits this battle up until the function is called * @param hitCount The number of received hits this battle
* @param previousHitCount The hitCount of reviced hits this battle the last time Rage Fist was called * @param previousHitCount The number of received hits this battle since last time Rage Fist was used
*/ */
updateHitRecivedCount(user: Pokemon, BDHitCount: number, previousHitCount: number): void { updateHitReceivedCount(user: Pokemon, hitCount: number, previousHitCount: number): void {
user.customPokemonData.hitsRecCount += (BDHitCount - previousHitCount); user.customPokemonData.hitsRecCount += (hitCount - previousHitCount);
user.battleData.prevHitCount = BDHitCount; 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) new AttackMove(Moves.TWIN_BEAM, Type.PSYCHIC, MoveCategory.SPECIAL, 40, 100, 10, -1, 0, 9)
.attr(MultiHitAttr, MultiHitType._2), .attr(MultiHitAttr, MultiHitType._2),
new AttackMove(Moves.RAGE_FIST, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9) 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) .attr(RageFistPowerAttr)
.punchingMove(), .punchingMove(),
new AttackMove(Moves.ARMOR_CANNON, Type.FIRE, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9) new AttackMove(Moves.ARMOR_CANNON, Type.FIRE, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9)

View File

@ -107,7 +107,7 @@ export class EncounterPhase extends BattlePhase {
//resets hitRecCount during Trainer ecnounter //resets hitRecCount during Trainer ecnounter
for (const pokemon of globalScene.getPlayerParty()) { for (const pokemon of globalScene.getPlayerParty()) {
if (pokemon) { if (pokemon) {
pokemon.customPokemonData.resetHitRecivedCount(); pokemon.customPokemonData.resetHitReceivedCount();
} }
} }
battle.enemyParty[e] = battle.trainer?.genPartyMember(e)!; // TODO:: is the bang correct here? battle.enemyParty[e] = battle.trainer?.genPartyMember(e)!; // TODO:: is the bang correct here?

View File

@ -14,7 +14,7 @@ export class NewBiomeEncounterPhase extends NextEncounterPhase {
for (const pokemon of globalScene.getPlayerParty()) { for (const pokemon of globalScene.getPlayerParty()) {
if (pokemon) { if (pokemon) {
pokemon.resetBattleData(); pokemon.resetBattleData();
pokemon.customPokemonData.resetHitRecivedCount(); pokemon.customPokemonData.resetHitReceivedCount();
} }
} }