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 { }
|
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
|
* @param statusEffect - The {@linkcode StatusEffect} to check for
|
||||||
* @see {@linkcode apply}
|
* @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`:
|
* @param args - The args passed to the `AbAttr`:
|
||||||
* - `[0]` - The {@linkcode StatusEffect} of the Pokemon
|
* - `[0]` - The {@linkcode StatusEffect} of the Pokemon
|
||||||
* - `[1]` - The number of turns remaining until the status is healed
|
* - `[1]` - The number of turns remaining until the status is healed
|
||||||
|
@ -7,16 +7,15 @@ export { StatusEffect };
|
|||||||
export class Status {
|
export class Status {
|
||||||
constructor(
|
constructor(
|
||||||
public effect: StatusEffect,
|
public effect: StatusEffect,
|
||||||
/** Only used by the Toxic status effect */
|
/** Toxic damage is `1/16 max HP * toxicTurnCount` */
|
||||||
public turnCount: number = 0,
|
public toxicTurnCount: number = 0,
|
||||||
/** Only used by the Sleep status effect */
|
public sleepTurnsRemaining?: number
|
||||||
public turnsRemaining?: number
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
incrementTurn(): void {
|
incrementTurn(): void {
|
||||||
this.turnCount++;
|
this.toxicTurnCount++;
|
||||||
if (this.turnsRemaining) {
|
if (this.sleepTurnsRemaining) {
|
||||||
this.turnsRemaining--;
|
this.sleepTurnsRemaining--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +172,10 @@ export class MovePhase extends BattlePhase {
|
|||||||
break;
|
break;
|
||||||
case StatusEffect.SLEEP:
|
case StatusEffect.SLEEP:
|
||||||
applyMoveAttrs(BypassSleepAttr, this.pokemon, null, this.move.getMove());
|
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);
|
applyAbAttrs(ReduceStatusEffectDurationAbAttr, this.pokemon, null, false, this.pokemon.status.effect, turnsRemaining);
|
||||||
this.pokemon.status.turnsRemaining = turnsRemaining.value;
|
this.pokemon.status.sleepTurnsRemaining = turnsRemaining.value;
|
||||||
healed = this.pokemon.status.turnsRemaining <= 0;
|
healed = this.pokemon.status.sleepTurnsRemaining <= 0;
|
||||||
activated = !healed && !this.pokemon.getTag(BattlerTagType.BYPASS_SLEEP);
|
activated = !healed && !this.pokemon.getTag(BattlerTagType.BYPASS_SLEEP);
|
||||||
this.cancelled = activated;
|
this.cancelled = activated;
|
||||||
break;
|
break;
|
||||||
|
@ -26,7 +26,7 @@ export class ObtainStatusEffectPhase extends PokemonPhase {
|
|||||||
if (pokemon && !pokemon.status) {
|
if (pokemon && !pokemon.status) {
|
||||||
if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon)) {
|
if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon)) {
|
||||||
if (this.turnsRemaining) {
|
if (this.turnsRemaining) {
|
||||||
pokemon.status!.turnsRemaining = this.turnsRemaining;
|
pokemon.status!.sleepTurnsRemaining = this.turnsRemaining;
|
||||||
}
|
}
|
||||||
pokemon.updateInfo(true);
|
pokemon.updateInfo(true);
|
||||||
new CommonBattleAnim(CommonAnim.POISON + (this.statusEffect! - 1), pokemon).play(this.scene, false, () => {
|
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();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
if (pokemon.status?.effect === StatusEffect.TOXIC) {
|
||||||
pokemon.status.turnCount = 0;
|
pokemon.status.toxicTurnCount = 0;
|
||||||
}
|
}
|
||||||
this.scene.arena.applyTags(ArenaTrapTag, pokemon);
|
this.scene.arena.applyTags(ArenaTrapTag, pokemon);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
|||||||
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||||
break;
|
break;
|
||||||
case StatusEffect.TOXIC:
|
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;
|
break;
|
||||||
case StatusEffect.BURN:
|
case StatusEffect.BURN:
|
||||||
damage.value = Math.max(pokemon.getMaxHp() >> 4, 1);
|
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));
|
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) {
|
if (!forHistory) {
|
||||||
this.status = source.status
|
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;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ describe("Abilities - Magic Guard", () => {
|
|||||||
|
|
||||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
const toxicStartCounter = enemyPokemon.status!.turnCount;
|
const toxicStartCounter = enemyPokemon.status!.toxicTurnCount;
|
||||||
//should be 0
|
//should be 0
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
@ -162,7 +162,7 @@ describe("Abilities - Magic Guard", () => {
|
|||||||
* - The enemy Pokemon's hypothetical CatchRateMultiplier should be 1.5
|
* - The enemy Pokemon's hypothetical CatchRateMultiplier should be 1.5
|
||||||
*/
|
*/
|
||||||
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
|
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);
|
expect(getStatusEffectCatchRateMultiplier(enemyPokemon.status!.effect)).toBe(1.5);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user