From d96289a2dbbfd9f6c68fbdd0012893643ac8c3da Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 11 Oct 2024 08:25:22 -0700 Subject: [PATCH] Update tsdocs for Early Bird's `AbAttr` Rename `turnCount` to `toxicTurnCount` and `turnsRemaining` to `sleepTurnsRemaining` in `status-effect.ts` --- src/data/ability.ts | 4 ++-- src/data/status-effect.ts | 13 ++++++------- src/phases/move-phase.ts | 6 +++--- src/phases/obtain-status-effect-phase.ts | 2 +- src/phases/post-summon-phase.ts | 2 +- src/phases/post-turn-status-effect-phase.ts | 2 +- src/system/pokemon-data.ts | 2 +- src/test/abilities/magic_guard.test.ts | 4 ++-- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index a64dbe71a54..45ec5685427 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -4193,7 +4193,7 @@ export class RedirectTypeMoveAbAttr extends RedirectMoveAbAttr { export class BlockRedirectAbAttr extends AbAttr { } /** - * Used by Early Bird + * Used by Early Bird, makes the pokemon wake up faster * @param statusEffect - The {@linkcode StatusEffect} to check for * @see {@linkcode apply} */ @@ -4205,7 +4205,7 @@ export class ReduceStatusEffectDurationAbAttr extends AbAttr { } /** - * Applies the duration reduction of the `AbAttr` + * Reduces the number of sleep turns remaining by an extra 1 when applied * @param args - The args passed to the `AbAttr`: * - `[0]` - The {@linkcode StatusEffect} of the Pokemon * - `[1]` - The number of turns remaining until the status is healed diff --git a/src/data/status-effect.ts b/src/data/status-effect.ts index a2ed0c1cc38..4483d0e8bfa 100644 --- a/src/data/status-effect.ts +++ b/src/data/status-effect.ts @@ -7,16 +7,15 @@ export { StatusEffect }; export class Status { constructor( public effect: StatusEffect, - /** Only used by the Toxic status effect */ - public turnCount: number = 0, - /** Only used by the Sleep status effect */ - public turnsRemaining?: number + /** Toxic damage is `1/16 max HP * toxicTurnCount` */ + public toxicTurnCount: number = 0, + public sleepTurnsRemaining?: number ) {} incrementTurn(): void { - this.turnCount++; - if (this.turnsRemaining) { - this.turnsRemaining--; + this.toxicTurnCount++; + if (this.sleepTurnsRemaining) { + this.sleepTurnsRemaining--; } } diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index 8379b0af9af..5ace7a8b515 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -172,10 +172,10 @@ export class MovePhase extends BattlePhase { break; case StatusEffect.SLEEP: applyMoveAttrs(BypassSleepAttr, this.pokemon, null, this.move.getMove()); - const turnsRemaining = new NumberHolder(this.pokemon.status.turnsRemaining ?? 0); + const turnsRemaining = new NumberHolder(this.pokemon.status.sleepTurnsRemaining ?? 0); applyAbAttrs(ReduceStatusEffectDurationAbAttr, this.pokemon, null, false, this.pokemon.status.effect, turnsRemaining); - this.pokemon.status.turnsRemaining = turnsRemaining.value; - healed = this.pokemon.status.turnsRemaining <= 0; + this.pokemon.status.sleepTurnsRemaining = turnsRemaining.value; + healed = this.pokemon.status.sleepTurnsRemaining <= 0; activated = !healed && !this.pokemon.getTag(BattlerTagType.BYPASS_SLEEP); this.cancelled = activated; break; diff --git a/src/phases/obtain-status-effect-phase.ts b/src/phases/obtain-status-effect-phase.ts index 9f719070fa0..8f270f8587d 100644 --- a/src/phases/obtain-status-effect-phase.ts +++ b/src/phases/obtain-status-effect-phase.ts @@ -26,7 +26,7 @@ export class ObtainStatusEffectPhase extends PokemonPhase { if (pokemon && !pokemon.status) { if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon)) { if (this.turnsRemaining) { - pokemon.status!.turnsRemaining = this.turnsRemaining; + pokemon.status!.sleepTurnsRemaining = this.turnsRemaining; } pokemon.updateInfo(true); new CommonBattleAnim(CommonAnim.POISON + (this.statusEffect! - 1), pokemon).play(this.scene, false, () => { diff --git a/src/phases/post-summon-phase.ts b/src/phases/post-summon-phase.ts index b99c0b90fd8..227a784a9d8 100644 --- a/src/phases/post-summon-phase.ts +++ b/src/phases/post-summon-phase.ts @@ -18,7 +18,7 @@ export class PostSummonPhase extends PokemonPhase { const pokemon = this.getPokemon(); if (pokemon.status?.effect === StatusEffect.TOXIC) { - pokemon.status.turnCount = 0; + pokemon.status.toxicTurnCount = 0; } this.scene.arena.applyTags(ArenaTrapTag, pokemon); diff --git a/src/phases/post-turn-status-effect-phase.ts b/src/phases/post-turn-status-effect-phase.ts index 285bbddde88..5bd078d21f8 100644 --- a/src/phases/post-turn-status-effect-phase.ts +++ b/src/phases/post-turn-status-effect-phase.ts @@ -30,7 +30,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { damage.value = Math.max(pokemon.getMaxHp() >> 3, 1); break; case StatusEffect.TOXIC: - damage.value = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); + damage.value = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.toxicTurnCount), 1); break; case StatusEffect.BURN: damage.value = Math.max(pokemon.getMaxHp() >> 4, 1); diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index fc20557b61e..52b39376563 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -128,7 +128,7 @@ export default class PokemonData { this.moveset = (source.moveset || [ new PokemonMove(Moves.TACKLE), new PokemonMove(Moves.GROWL) ]).filter(m => m).map((m: any) => new PokemonMove(m.moveId, m.ppUsed, m.ppUp)); if (!forHistory) { this.status = source.status - ? new Status(source.status.effect, source.status.turnCount, source.status.turnsRemaining) + ? new Status(source.status.effect, source.status.toxicTurnCount, source.status.sleepTurnsRemaining) : null; } diff --git a/src/test/abilities/magic_guard.test.ts b/src/test/abilities/magic_guard.test.ts index 614f983e76e..8075eac66f2 100644 --- a/src/test/abilities/magic_guard.test.ts +++ b/src/test/abilities/magic_guard.test.ts @@ -150,7 +150,7 @@ describe("Abilities - Magic Guard", () => { const enemyPokemon = game.scene.getEnemyPokemon()!; - const toxicStartCounter = enemyPokemon.status!.turnCount; + const toxicStartCounter = enemyPokemon.status!.toxicTurnCount; //should be 0 await game.phaseInterceptor.to(TurnEndPhase); @@ -162,7 +162,7 @@ describe("Abilities - Magic Guard", () => { * - The enemy Pokemon's hypothetical CatchRateMultiplier should be 1.5 */ expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); - expect(enemyPokemon.status!.turnCount).toBeGreaterThan(toxicStartCounter); + expect(enemyPokemon.status!.toxicTurnCount).toBeGreaterThan(toxicStartCounter); expect(getStatusEffectCatchRateMultiplier(enemyPokemon.status!.effect)).toBe(1.5); } );