mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
Removed the additional indents
This commit is contained in:
parent
f0c2e62883
commit
4269c27b9c
@ -2476,41 +2476,41 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
// Check if the move category is not STATUS or if the switch out condition is not met
|
// 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)) {
|
if (move.category !== MoveCategory.STATUS && !this.getSwitchOutCondition()(user, target, move)) {
|
||||||
// Apply effects that need to be executed before switch out
|
//Apply effects that need to be executed before switch out
|
||||||
// For example, applying poison or any other status condition
|
//For example, applying poison or any other status condition
|
||||||
this.applyEffectsBeforeSwitchOut(user, target, move);
|
this.applyEffectsBeforeSwitchOut(user, target, move);
|
||||||
// Resolve the Promise after the switch out is complete
|
//Resolve the Promise after the switch out is complete
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the switch out logic inside the conditional block
|
// Move the switch out logic inside the conditional block
|
||||||
// This ensures that the switch out only happens when the conditions are met
|
// This ensures that the switch out only happens when the conditions are met
|
||||||
const switchOutTarget = this.user ? user : target;
|
const switchOutTarget = this.user ? user : target;
|
||||||
if (switchOutTarget instanceof PlayerPokemon) {
|
if (switchOutTarget instanceof PlayerPokemon) {
|
||||||
// Switch out logic for PlayerPokemon
|
// Switch out logic for PlayerPokemon
|
||||||
// This includes applying any necessary effects before switching out
|
// This includes applying any necessary effects before switching out
|
||||||
if (switchOutTarget.hp) {
|
if (switchOutTarget.hp) {
|
||||||
applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget);
|
applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, switchOutTarget);
|
||||||
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true));
|
(switchOutTarget as PlayerPokemon).switchOut(this.batonPass, true).then(() => resolve(true));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (user.scene.currentBattle.battleType) {
|
else if (user.scene.currentBattle.battleType) {
|
||||||
// Switch out logic for the battle type
|
// Switch out logic for the battle type
|
||||||
switchOutTarget.resetTurnData();
|
switchOutTarget.resetTurnData();
|
||||||
switchOutTarget.resetSummonData();
|
switchOutTarget.resetSummonData();
|
||||||
switchOutTarget.hideInfo();
|
switchOutTarget.hideInfo();
|
||||||
switchOutTarget.setVisible(false);
|
switchOutTarget.setVisible(false);
|
||||||
switchOutTarget.scene.field.remove(switchOutTarget);
|
switchOutTarget.scene.field.remove(switchOutTarget);
|
||||||
user.scene.triggerPokemonFormChange(switchOutTarget, SpeciesFormChangeActiveTrigger, true);
|
user.scene.triggerPokemonFormChange(switchOutTarget, SpeciesFormChangeActiveTrigger, true);
|
||||||
|
|
||||||
if (switchOutTarget.hp)
|
if (switchOutTarget.hp)
|
||||||
user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot), false, this.batonPass, false));
|
user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot), false, this.batonPass, false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Switch out logic for everything else
|
// Switch out logic for everything else
|
||||||
switchOutTarget.setVisible(false);
|
switchOutTarget.setVisible(false);
|
||||||
@ -2522,12 +2522,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!switchOutTarget.getAlly()?.isActive(true)) {
|
if (!switchOutTarget.getAlly()?.isActive(true)) {
|
||||||
user.scene.clearEnemyHeldItemModifiers();
|
user.scene.clearEnemyHeldItemModifiers();
|
||||||
|
|
||||||
if (switchOutTarget.hp) {
|
if (switchOutTarget.hp) {
|
||||||
user.scene.pushPhase(new BattleEndPhase(user.scene));
|
user.scene.pushPhase(new BattleEndPhase(user.scene));
|
||||||
user.scene.pushPhase(new NewBattlePhase(user.scene));
|
user.scene.pushPhase(new NewBattlePhase(user.scene));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user