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); super(ArenaTagType.DELAYED_ATTACK, 0);
} }
loadTag(source: ArenaTag | any): void { override loadTag(source: ArenaTag | any): void {
super.loadTag(source); super.loadTag(source);
this.delayedAttacks = source.delayedAttacks; this.delayedAttacks = source.delayedAttacks;
} }
@ -962,21 +962,7 @@ export class DelayedAttackTag extends ArenaTag {
continue; continue;
} }
// Queue attack message and then unshift a new MoveEffectPhase for this move's attack phase. this.triggerAttack(attack);
globalScene.phaseManager.queueMessage(
i18next.t("moveTriggers:tookMoveAttack", {
pokemonName: getPokemonNameWithAffix(target),
moveName: allMoves[attack.move].name,
}),
);
globalScene.phaseManager.unshiftNew(
"MoveEffectPhase",
attack.sourceId,
[attack.targetIndex],
allMoves[attack.move],
MoveUseMode.TRANSPARENT,
);
} }
return this.removeDoneAttacks(); return this.removeDoneAttacks();
@ -986,11 +972,31 @@ export class DelayedAttackTag extends ArenaTag {
* Remove all finished attacks from the current queue. * Remove all finished attacks from the current queue.
* @returns Whether at least 1 attack has not finished triggering. * @returns Whether at least 1 attack has not finished triggering.
*/ */
removeDoneAttacks(): boolean { private removeDoneAttacks(): boolean {
this.delayedAttacks = this.delayedAttacks.filter(a => a.turnCount > 0); this.delayedAttacks = this.delayedAttacks.filter(a => a.turnCount > 0);
return this.delayedAttacks.length > 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", {
pokemonName: getPokemonNameWithAffix(target),
moveName: allMoves[attack.move].name,
}),
);
globalScene.phaseManager.unshiftNew(
"MoveEffectPhase",
attack.sourceId,
[attack.targetIndex],
allMoves[attack.move],
MoveUseMode.TRANSPARENT,
);
}
/** Override on remove func to do nothing. */ /** Override on remove func to do nothing. */
override onRemove(_arena: Arena): void {} override onRemove(_arena: Arena): void {}
} }