Convert apply attribute functions to promises

This commit is contained in:
Flashfyre committed 2023-12-22 21:42:47 -05:00
1 parent dd89db29fd
commit 6391e05508
2 files changed
+627 -289

No files matched your search

+10 -6
View File
@@ -1739,14 +1739,16 @@ export class MoveEffectPhase extends PokemonPhase {
}
Utils.executeIf(!isProtected && !chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.HIT,
user, target, this.move.getMove()).then(() => {
if (!target.isFainted()) {
applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult);
return Utils.executeIf(!target.isFainted(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult).then(() => {
if (!user.isPlayer() && this.move instanceof AttackMove)
user.scene.applyModifiers(EnemyAttackStatusEffectChanceModifier, false, target);
}
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult);
if (this.move instanceof AttackMove)
this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target.getFieldIndex());
})).then(() => {
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult).then(() => {
if (this.move instanceof AttackMove)
this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target.getFieldIndex());
resolve();
});
});
})
).then(() => resolve());
});
@@ -1894,6 +1896,8 @@ export class ShowAbilityPhase extends PokemonPhase {
}
start() {
super.start();
this.scene.abilityBar.showAbility(this.getPokemon());
this.end();
+617 -283
View File
File diff suppressed because it is too large. Load diff