Files
2D6-Dungeon/src/types/rules.ts
T
2026-03-20 17:06:45 -05:00

86 lines
1.5 KiB
TypeScript

export type DiceKind = "d3" | "d6" | "2d6" | "d66";
export type ContentReferenceType =
| "table"
| "weapon"
| "manoeuvre"
| "armour"
| "item"
| "potion"
| "scroll"
| "creature"
| "room"
| "service";
export type ContentReference = {
type: ContentReferenceType;
id: string;
quantity?: number;
};
export type RuleEffectType =
| "gain-xp"
| "gain-gold"
| "gain-silver"
| "heal"
| "take-damage"
| "modify-shift"
| "modify-discipline"
| "modify-precision"
| "apply-status"
| "remove-status"
| "add-item"
| "remove-item"
| "start-combat"
| "reveal-exit"
| "move-level"
| "log-only";
export type RuleEffectTarget = "self" | "enemy" | "room" | "campaign";
export type RuleEffect = {
type: RuleEffectType;
amount?: number;
diceKind?: DiceKind;
rollCount?: number;
statusId?: string;
target?: RuleEffectTarget;
referenceId?: string;
notes?: string;
};
export type RollResult = {
diceKind: DiceKind;
rolls: number[];
primary?: number;
secondary?: number;
total?: number;
modifier?: number;
modifiedTotal?: number;
clamped?: boolean;
};
export type LogEntryType =
| "system"
| "roll"
| "combat"
| "loot"
| "room"
| "town"
| "progression";
export type LogEntry = {
id: string;
at: string;
type: LogEntryType;
text: string;
relatedIds?: string[];
};
export type ActionResolution = {
success: boolean;
effects: RuleEffect[];
logEntries: LogEntry[];
warnings?: string[];
};