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,
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();

File diff suppressed because it is too large Load Diff