mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-09 12:36:41 -05:00
Properly fix Emergency Exit and related effects
This commit is contained in:
parent
8213dd3974
commit
e1c43d4bb4
|
|
@ -848,18 +848,10 @@ exports.BattleAbilities = {
|
|||
if (!source || source === target || !target.hp || !move.totalDamage) return;
|
||||
if (target.hp <= target.maxhp / 2 && target.hp + move.totalDamage > target.maxhp / 2) {
|
||||
if (!this.canSwitch(target.side) || target.forceSwitchFlag || target.switchFlag) return;
|
||||
target.addVolatile('emergencyexit');
|
||||
}
|
||||
},
|
||||
effect: {
|
||||
onUpdatePriority: -10,
|
||||
onUpdate: function (target) {
|
||||
target.removeVolatile('emergencyexit');
|
||||
if (target.hp > target.maxhp / 2) return;
|
||||
target.switchFlag = true;
|
||||
this.effectData.source.switchFlag = false;
|
||||
source.switchFlag = false;
|
||||
this.add('-activate', target, 'ability: Emergency Exit');
|
||||
},
|
||||
}
|
||||
},
|
||||
id: "emergencyexit",
|
||||
name: "Emergency Exit",
|
||||
|
|
|
|||
|
|
@ -460,6 +460,8 @@ exports.BattleScripts = {
|
|||
|
||||
if (!damage && damage !== 0) return damage;
|
||||
|
||||
this.eachEvent('Update');
|
||||
|
||||
if (target && !move.negateSecondary && !(pokemon.hasAbility('sheerforce') && pokemon.volatiles['sheerforce'])) {
|
||||
this.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
|
||||
this.runEvent('AfterMoveSecondary', target, pokemon, move);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user