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> {
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
this.applyEffectsBeforeSwitchOut(user, target, move);
// Resolve the Promise after the switch out is complete
return resolve(false);
}
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
this.applyEffectsBeforeSwitchOut(user, target, move);
//Resolve the Promise after the switch out is complete
return resolve(false);
}
// Move the switch out logic inside the conditional block
// 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));
}
else {
resolve(false);
}
return;
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));
}
else {
resolve(false);
}
return;
}
else if (user.scene.currentBattle.battleType) {
// Switch out logic for the battle type
switchOutTarget.resetTurnData();
switchOutTarget.resetSummonData();
switchOutTarget.hideInfo();
switchOutTarget.setVisible(false);
switchOutTarget.scene.field.remove(switchOutTarget);
user.scene.triggerPokemonFormChange(switchOutTarget, SpeciesFormChangeActiveTrigger, true);
// Switch out logic for the battle type
switchOutTarget.resetTurnData();
switchOutTarget.resetSummonData();
switchOutTarget.hideInfo();
switchOutTarget.setVisible(false);
switchOutTarget.scene.field.remove(switchOutTarget);
user.scene.triggerPokemonFormChange(switchOutTarget, SpeciesFormChangeActiveTrigger, true);
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));
}
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));
}
else {
// Switch out logic for everything else
switchOutTarget.setVisible(false);
@ -2522,12 +2522,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
}
if (!switchOutTarget.getAlly()?.isActive(true)) {
user.scene.clearEnemyHeldItemModifiers();
user.scene.clearEnemyHeldItemModifiers();
if (switchOutTarget.hp) {
user.scene.pushPhase(new BattleEndPhase(user.scene));
user.scene.pushPhase(new NewBattlePhase(user.scene));
}
if (switchOutTarget.hp) {
user.scene.pushPhase(new BattleEndPhase(user.scene));
user.scene.pushPhase(new NewBattlePhase(user.scene));
}
}
}