From 87c35cb018609057d2638274e5b1156034584b4b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 31 Mar 2024 00:30:08 -0400 Subject: [PATCH] Fix Salt Cure causing crash --- src/data/battler-tags.ts | 5 ++--- src/data/move.ts | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 47f620d46..dd7371aeb 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -908,7 +908,7 @@ export class SaltCuredTag extends BattlerTag { private sourceIndex: integer; constructor(sourceId: integer) { - super(BattlerTagType.SALT_CURED, BattlerTagLapseType.AFTER_MOVE, 1, Moves.SALT_CURE, sourceId); + super(BattlerTagType.SALT_CURED, BattlerTagLapseType.TURN_END, 1, Moves.SALT_CURE, sourceId); } onAdd(pokemon: Pokemon): void { @@ -922,8 +922,7 @@ export class SaltCuredTag extends BattlerTag { const ret = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType); if (ret) { - const source = pokemon.getOpponents().find(o => o.getBattlerIndex() === this.sourceIndex); - pokemon.scene.unshiftPhase(new CommonAnimPhase(pokemon.scene, source.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.SALT_CURE)); + pokemon.scene.unshiftPhase(new CommonAnimPhase(pokemon.scene, pokemon.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.SALT_CURE)); const pokemonSteelOrWater = pokemon.isOfType(Type.STEEL) || pokemon.isOfType(Type.WATER); pokemon.damageAndUpdate(Math.max(Math.floor(pokemonSteelOrWater ? pokemon.getMaxHp() / 4 : pokemon.getMaxHp() / 8), 1)); diff --git a/src/data/move.ts b/src/data/move.ts index 8e9fee603..9cfdd274c 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -621,7 +621,8 @@ export class RecoilAttr extends MoveEffectAttr { if (cancelled.value) return false; - const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio), 1); + const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio), + !this.useHp && user.turnData.damageDealt ? 1 : 0); if (!recoilDamage) return false;