82 lines
1.9 KiB
TypeScript
82 lines
1.9 KiB
TypeScript
import type { CombatantId } from "./types.js";
|
|
|
|
export interface TurnAdvanced {
|
|
readonly type: "TurnAdvanced";
|
|
readonly previousCombatantId: CombatantId;
|
|
readonly newCombatantId: CombatantId;
|
|
readonly roundNumber: number;
|
|
}
|
|
|
|
export interface RoundAdvanced {
|
|
readonly type: "RoundAdvanced";
|
|
readonly newRoundNumber: number;
|
|
}
|
|
|
|
export interface CombatantAdded {
|
|
readonly type: "CombatantAdded";
|
|
readonly combatantId: CombatantId;
|
|
readonly name: string;
|
|
readonly position: number;
|
|
}
|
|
|
|
export interface CombatantRemoved {
|
|
readonly type: "CombatantRemoved";
|
|
readonly combatantId: CombatantId;
|
|
readonly name: string;
|
|
}
|
|
|
|
export interface CombatantUpdated {
|
|
readonly type: "CombatantUpdated";
|
|
readonly combatantId: CombatantId;
|
|
readonly oldName: string;
|
|
readonly newName: string;
|
|
}
|
|
|
|
export interface InitiativeSet {
|
|
readonly type: "InitiativeSet";
|
|
readonly combatantId: CombatantId;
|
|
readonly previousValue: number | undefined;
|
|
readonly newValue: number | undefined;
|
|
}
|
|
|
|
export interface MaxHpSet {
|
|
readonly type: "MaxHpSet";
|
|
readonly combatantId: CombatantId;
|
|
readonly previousMaxHp: number | undefined;
|
|
readonly newMaxHp: number | undefined;
|
|
readonly previousCurrentHp: number | undefined;
|
|
readonly newCurrentHp: number | undefined;
|
|
}
|
|
|
|
export interface CurrentHpAdjusted {
|
|
readonly type: "CurrentHpAdjusted";
|
|
readonly combatantId: CombatantId;
|
|
readonly previousHp: number;
|
|
readonly newHp: number;
|
|
readonly delta: number;
|
|
}
|
|
|
|
export interface TurnRetreated {
|
|
readonly type: "TurnRetreated";
|
|
readonly previousCombatantId: CombatantId;
|
|
readonly newCombatantId: CombatantId;
|
|
readonly roundNumber: number;
|
|
}
|
|
|
|
export interface RoundRetreated {
|
|
readonly type: "RoundRetreated";
|
|
readonly newRoundNumber: number;
|
|
}
|
|
|
|
export type DomainEvent =
|
|
| TurnAdvanced
|
|
| RoundAdvanced
|
|
| CombatantAdded
|
|
| CombatantRemoved
|
|
| CombatantUpdated
|
|
| InitiativeSet
|
|
| MaxHpSet
|
|
| CurrentHpAdjusted
|
|
| TurnRetreated
|
|
| RoundRetreated;
|