mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Update to PostTurnStatusEffectPhase to support Poison Heal
This commit is contained in:
parent
ebe1e1dc47
commit
d79a4ddf58
@ -2759,27 +2759,45 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
|||||||
|
|
||||||
if (!cancelled.value) {
|
if (!cancelled.value) {
|
||||||
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect)));
|
this.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectActivationText(pokemon.status.effect)));
|
||||||
|
|
||||||
|
let healing: integer = 0;
|
||||||
let damage: integer = 0;
|
let damage: integer = 0;
|
||||||
|
|
||||||
|
// Determine the amount of healing or damage based on the status effect
|
||||||
switch (pokemon.status.effect) {
|
switch (pokemon.status.effect) {
|
||||||
case StatusEffect.POISON:
|
case StatusEffect.POISON:
|
||||||
damage = Math.max(pokemon.getMaxHp() >> 3, 1);
|
// If the Pokémon has the ability Poison Heal, heal instead of taking damage
|
||||||
|
if (pokemon.getAbility().id === Abilities.POISON_HEAL)
|
||||||
|
healing = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||||
|
else // Otherwise, take damage as usual
|
||||||
|
damage = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||||
break;
|
break;
|
||||||
case StatusEffect.TOXIC:
|
case StatusEffect.TOXIC: // Follow same logic from Poison, but with Toxic's damage formula
|
||||||
damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1);
|
if (pokemon.getAbility().id === Abilities.POISON_HEAL)
|
||||||
|
healing = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||||
|
else
|
||||||
|
damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1);
|
||||||
break;
|
break;
|
||||||
case StatusEffect.BURN:
|
case StatusEffect.BURN: // For the burn status effect, always take damage
|
||||||
damage = Math.max(pokemon.getMaxHp() >> 4, 1);
|
damage = Math.max(pokemon.getMaxHp() >> 4, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (damage) {
|
// Apply that healing or damage to the Pokémon's HP
|
||||||
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage));
|
if (healing > 0) {
|
||||||
|
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.heal(healing), HitResult.HEAL);
|
||||||
|
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end());
|
||||||
pokemon.updateInfo();
|
pokemon.updateInfo();
|
||||||
|
} else if (damage > 0) {
|
||||||
|
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage));
|
||||||
|
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end());
|
||||||
|
pokemon.updateInfo();
|
||||||
|
} else {
|
||||||
|
// End the phase if the healing or damage is cancelled
|
||||||
|
this.end();
|
||||||
}
|
}
|
||||||
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end());
|
}
|
||||||
} else
|
|
||||||
this.end();
|
|
||||||
} else
|
} else
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user