Convert apply attribute functions to promises

pull/14/head
Flashfyre 2023-12-22 21:42:47 -05:00
parent dd89db29fd
commit 6391e05508
2 changed files with 627 additions and 289 deletions

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, Utils.executeIf(!isProtected && !chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.HIT,
user, target, this.move.getMove()).then(() => { user, target, this.move.getMove()).then(() => {
if (!target.isFainted()) { return Utils.executeIf(!target.isFainted(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult).then(() => {
applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult);
if (!user.isPlayer() && this.move instanceof AttackMove) if (!user.isPlayer() && this.move instanceof AttackMove)
user.scene.applyModifiers(EnemyAttackStatusEffectChanceModifier, false, target); user.scene.applyModifiers(EnemyAttackStatusEffectChanceModifier, false, target);
} })).then(() => {
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult); applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move, hitResult).then(() => {
if (this.move instanceof AttackMove) if (this.move instanceof AttackMove)
this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target.getFieldIndex()); this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target.getFieldIndex());
resolve();
});
});
}) })
).then(() => resolve()); ).then(() => resolve());
}); });
@ -1894,6 +1896,8 @@ export class ShowAbilityPhase extends PokemonPhase {
} }
start() { start() {
super.start();
this.scene.abilityBar.showAbility(this.getPokemon()); this.scene.abilityBar.showAbility(this.getPokemon());
this.end(); this.end();

File diff suppressed because it is too large Load Diff