diff --git a/data/abilities.js b/data/abilities.js index 1e232dec1d..40848821da 100644 --- a/data/abilities.js +++ b/data/abilities.js @@ -302,10 +302,11 @@ let BattleAbilities = { desc: "When this Pokemon has more than 1/2 its maximum HP and takes damage from an attack bringing it to 1/2 or less of its maximum HP, its Special Attack is raised by 1 stage. This effect applies after all hits from a multi-hit move; Sheer Force prevents it from activating if the move has a secondary effect.", shortDesc: "This Pokemon's Sp. Atk is raised by 1 when it reaches 1/2 or less of its max HP.", onAfterMoveSecondary(target, source, move) { - if (!source || source === target || !target.hp) return; + if (!source || source === target || !target.hp || !move.totalDamage) return; const lastAttackedBy = target.getLastAttackedBy(); if (!lastAttackedBy) return; - if (target.hp <= target.maxhp / 2 && target.hp + lastAttackedBy.damage > target.maxhp / 2) { + const damage = move.multihit ? move.totalDamage : lastAttackedBy.damage; + if (target.hp <= target.maxhp / 2 && target.hp + damage > target.maxhp / 2) { this.boost({spa: 1}); } }, @@ -853,10 +854,11 @@ let BattleAbilities = { desc: "When this Pokemon has more than 1/2 its maximum HP and takes damage bringing it to 1/2 or less of its maximum HP, it immediately switches out to a chosen ally. This effect applies after all hits from a multi-hit move; Sheer Force prevents it from activating if the move has a secondary effect. This effect applies to both direct and indirect damage, except Curse and Substitute on use, Belly Drum, Pain Split, and confusion damage.", shortDesc: "This Pokemon switches out when it reaches 1/2 or less of its maximum HP.", onAfterMoveSecondary(target, source, move) { - if (!source || source === target || !target.hp) return; + if (!source || source === target || !target.hp || !move.totalDamage) return; const lastAttackedBy = target.getLastAttackedBy(); if (!lastAttackedBy) return; - if (target.hp <= target.maxhp / 2 && target.hp + lastAttackedBy.damage > target.maxhp / 2) { + const damage = move.multihit ? move.totalDamage : lastAttackedBy.damage; + if (target.hp <= target.maxhp / 2 && target.hp + damage > target.maxhp / 2) { if (!this.canSwitch(target.side) || target.forceSwitchFlag || target.switchFlag) return; target.switchFlag = true; source.switchFlag = false; @@ -4016,10 +4018,11 @@ let BattleAbilities = { desc: "When this Pokemon has more than 1/2 its maximum HP and takes damage bringing it to 1/2 or less of its maximum HP, it immediately switches out to a chosen ally. This effect applies after all hits from a multi-hit move; Sheer Force prevents it from activating if the move has a secondary effect. This effect applies to both direct and indirect damage, except Curse and Substitute on use, Belly Drum, Pain Split, and confusion damage.", shortDesc: "This Pokemon switches out when it reaches 1/2 or less of its maximum HP.", onAfterMoveSecondary(target, source, move) { - if (!source || source === target || !target.hp) return; + if (!source || source === target || !target.hp || !move.totalDamage) return; const lastAttackedBy = target.getLastAttackedBy(); if (!lastAttackedBy) return; - if (target.hp <= target.maxhp / 2 && target.hp + lastAttackedBy.damage > target.maxhp / 2) { + const damage = move.multihit ? move.totalDamage : lastAttackedBy.damage; + if (target.hp <= target.maxhp / 2 && target.hp + damage > target.maxhp / 2) { if (!this.canSwitch(target.side) || target.forceSwitchFlag || target.switchFlag) return; target.switchFlag = true; source.switchFlag = false;