Do not trigger focus band effect on status damage

pull/850/head
Griffin Zody 2024-05-13 21:35:29 -06:00
parent 4e279224c5
commit aa1c4f04eb
2 changed files with 7 additions and 3 deletions

View File

@ -1657,7 +1657,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return result; return result;
} }
damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false): integer { damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false, statusDamage: boolean = false): integer {
if (this.isFainted()) if (this.isFainted())
return 0; return 0;
const surviveDamage = new Utils.BooleanHolder(false); const surviveDamage = new Utils.BooleanHolder(false);
@ -1667,7 +1667,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING) surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING)
else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY)) else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY))
surviveDamage.value = this.lapseTag(BattlerTagType.STURDY) surviveDamage.value = this.lapseTag(BattlerTagType.STURDY)
if (!surviveDamage.value) if (!statusDamage && !surviveDamage.value)
this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage); this.scene.applyModifiers(SurviveDamageModifier, this.isPlayer(), this, surviveDamage);
if (surviveDamage.value) if (surviveDamage.value)
damage = this.hp - 1; damage = this.hp - 1;

View File

@ -2976,19 +2976,23 @@ 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 damage: integer = 0; let damage: integer = 0;
let statusDamage: boolean = false;
switch (pokemon.status.effect) { switch (pokemon.status.effect) {
case StatusEffect.POISON: case StatusEffect.POISON:
damage = Math.max(pokemon.getMaxHp() >> 3, 1); damage = Math.max(pokemon.getMaxHp() >> 3, 1);
statusDamage = true;
break; break;
case StatusEffect.TOXIC: case StatusEffect.TOXIC:
damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1); damage = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1);
statusDamage = true;
break; break;
case StatusEffect.BURN: case StatusEffect.BURN:
damage = Math.max(pokemon.getMaxHp() >> 4, 1); damage = Math.max(pokemon.getMaxHp() >> 4, 1);
statusDamage = true;
break; break;
} }
if (damage) { if (damage) {
this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage, false, false, statusDamage));
pokemon.updateInfo(); pokemon.updateInfo();
} }
new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end());