Fix broken call in force switch out
parent
fba98ffa0c
commit
d2ebb499d8
|
@ -2511,10 +2511,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
return new Promise(resolve => {
|
||||
// Check if the move category is not STATUS or if the switch out condition is not met
|
||||
if (move.category !== MoveCategory.STATUS && !this.getSwitchOutCondition()(user, target, move)) {
|
||||
//Apply effects that need to be executed before switch out
|
||||
//For example, applying poison or any other status condition
|
||||
applyPostDefendAbAttrs(PostDefendContactApplyStatusEffectAbAttr, target, user, move);
|
||||
//Resolve the Promise after the switch out is complete
|
||||
//Apply effects before switch out i.e. poison point, flame body, etc
|
||||
applyPostDefendAbAttrs(PostDefendContactApplyStatusEffectAbAttr, target, user, new PokemonMove(move.id), null);
|
||||
return resolve(false);
|
||||
}
|
||||
|
||||
|
@ -2522,8 +2520,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
// This ensures that the switch out only happens when the conditions are met
|
||||
const switchOutTarget = this.user ? user : target;
|
||||
if (switchOutTarget instanceof PlayerPokemon) {
|
||||
// Switch out logic for PlayerPokemon
|
||||
// This includes applying any necessary effects before switching out
|
||||
if (switchOutTarget.hp) {
|
||||
applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget);
|
||||
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true));
|
||||
|
|
Loading…
Reference in New Issue