Removed the additional indents

This commit is contained in:
EmoUsedHM01 2024-04-11 19:52:03 +01:00 committed by GitHub
parent f0c2e62883
commit 4269c27b9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
} }
else if (user.scene.currentBattle.battleType) { return;
// Switch out logic for the battle type }
switchOutTarget.resetTurnData(); else if (user.scene.currentBattle.battleType) {
switchOutTarget.resetSummonData(); // Switch out logic for the battle type
switchOutTarget.hideInfo(); switchOutTarget.resetTurnData();
switchOutTarget.setVisible(false); switchOutTarget.resetSummonData();
switchOutTarget.scene.field.remove(switchOutTarget); switchOutTarget.hideInfo();
user.scene.triggerPokemonFormChange(switchOutTarget, SpeciesFormChangeActiveTrigger, true); switchOutTarget.setVisible(false);
switchOutTarget.scene.field.remove(switchOutTarget);
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));
} }
} }
} }