mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 14:59:26 +02:00
Update tsdocs for Early Bird's AbAttr
Rename `turnCount` to `toxicTurnCount` and `turnsRemaining` to `sleepTurnsRemaining` in `status-effect.ts`
This commit is contained in:
parent
5c791e995d
commit
d96289a2db
@ -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
|
||||
|
@ -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--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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, () => {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user