mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-02 22:08:36 -05:00
Fix multi-hit moves against Berserk/Emergency Exit/Wimp Out too
This commit is contained in:
parent
8fe6d89d14
commit
208c22ad72
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user