Removes unnecessary check, makes DamageResult default to EFFECTIVE, updates remaining damageAndUpdate calls to use INDIRECT

This commit is contained in:
Christopher Schmidt 2025-02-27 22:17:46 -05:00
parent 306a39b35b
commit b5bf9766aa
3 changed files with 8 additions and 15 deletions

View File

@ -1148,7 +1148,7 @@ class FireGrassPledgeTag extends ArenaTag {
globalScene.queueMessage(i18next.t("arenaTag:fireGrassPledgeLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
// TODO: Replace this with a proper animation
globalScene.unshiftPhase(new CommonAnimPhase(pokemon.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.MAGMA_STORM));
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8));
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8), HitResult.INDIRECT);
});
return super.lapse(arena);

View File

@ -841,7 +841,7 @@ export class SeedTag extends BattlerTag {
if (!cancelled.value) {
globalScene.unshiftPhase(new CommonAnimPhase(source.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.LEECH_SEED));
const damage = pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8));
const damage = pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8), HitResult.INDIRECT);
const reverseDrain = pokemon.hasAbilityWithAttr(ReverseDrainAbAttr, false);
globalScene.unshiftPhase(new PokemonHealPhase(source.getBattlerIndex(),
!reverseDrain ? damage : damage * -1,
@ -940,7 +940,7 @@ export class NightmareTag extends BattlerTag {
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
if (!cancelled.value) {
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 4));
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 4), HitResult.INDIRECT);
}
}
@ -1268,7 +1268,7 @@ export abstract class DamagingTrapTag extends TrappedTag {
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
if (!cancelled.value) {
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8));
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8), HitResult.INDIRECT);
}
}
@ -1981,7 +1981,7 @@ export class SaltCuredTag extends BattlerTag {
if (!cancelled.value) {
const pokemonSteelOrWater = pokemon.isOfType(Type.STEEL) || pokemon.isOfType(Type.WATER);
pokemon.damageAndUpdate(toDmgValue(pokemonSteelOrWater ? pokemon.getMaxHp() / 4 : pokemon.getMaxHp() / 8));
pokemon.damageAndUpdate(toDmgValue(pokemonSteelOrWater ? pokemon.getMaxHp() / 4 : pokemon.getMaxHp() / 8), HitResult.INDIRECT);
globalScene.queueMessage(
i18next.t("battlerTags:saltCuredLapse", {
@ -2027,7 +2027,7 @@ export class CursedTag extends BattlerTag {
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
if (!cancelled.value) {
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 4));
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 4), HitResult.INDIRECT);
globalScene.queueMessage(i18next.t("battlerTags:cursedLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
}
}

View File

@ -3168,15 +3168,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
* @param ignoreFaintPhase boolean to ignore adding a FaintPhase, passsed to damage()
* @returns integer of damage done
*/
damageAndUpdate(damage: number, result?: DamageResult, critical: boolean = false, ignoreSegments: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon): number {
let isIndirectDamage: boolean = true;
if (result !== undefined) {
if (result === HitResult.INDIRECT || result === HitResult.INDIRECT_KO) {
isIndirectDamage = true;
} else {
isIndirectDamage = false;
}
}
damageAndUpdate(damage: number, result: DamageResult = HitResult.EFFECTIVE, critical: boolean = false, ignoreSegments: boolean = false, ignoreFaintPhase: boolean = false, source?: Pokemon): number {
const isIndirectDamage = [ HitResult.INDIRECT, HitResult.INDIRECT_KO ].includes(result);
const damagePhase = new DamageAnimPhase(this.getBattlerIndex(), damage, result as DamageResult, critical);
globalScene.unshiftPhase(damagePhase);
if (this.switchOutStatus && source) {