Update documentation on arena-tag.ts

This commit is contained in:
Bertie690 2025-07-11 20:33:16 +02:00 committed by GitHub
parent 99dfc1d973
commit 8b808868a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -917,7 +917,7 @@ export class DelayedAttackTag extends ArenaTag {
super(ArenaTagType.DELAYED_ATTACK, 0);
}
loadTag(source: ArenaTag | any): void {
override loadTag(source: ArenaTag | any): void {
super.loadTag(source);
this.delayedAttacks = source.delayedAttacks;
}
@ -962,6 +962,24 @@ export class DelayedAttackTag extends ArenaTag {
continue;
}
this.triggerAttack(attack);
}
return this.removeDoneAttacks();
}
/**
* Remove all finished attacks from the current queue.
* @returns Whether at least 1 attack has not finished triggering.
*/
private removeDoneAttacks(): boolean {
this.delayedAttacks = this.delayedAttacks.filter(a => a.turnCount > 0);
return this.delayedAttacks.length > 0;
}
/** Trigger a delayed attack. */
protected triggerAttack(attack: DelayedAttack): void {
const target = globalScene.getField()[attack.targetIndex];
// Queue attack message and then unshift a new MoveEffectPhase for this move's attack phase.
globalScene.phaseManager.queueMessage(
i18next.t("moveTriggers:tookMoveAttack", {
@ -979,18 +997,6 @@ export class DelayedAttackTag extends ArenaTag {
);
}
return this.removeDoneAttacks();
}
/**
* Remove all finished attacks from the current queue.
* @returns Whether at least 1 attack has not finished triggering.
*/
removeDoneAttacks(): boolean {
this.delayedAttacks = this.delayedAttacks.filter(a => a.turnCount > 0);
return this.delayedAttacks.length > 0;
}
/** Override on remove func to do nothing. */
override onRemove(_arena: Arena): void {}
}