Implement the 017-combat-conditions feature that adds D&D 5e status conditions to combatants with icon tags, color coding, and a compact toggle picker in the encounter tracker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-06 11:29:39 +01:00
parent 78c6591973
commit febe892e15
22 changed files with 1301 additions and 62 deletions

View File

@@ -8,3 +8,4 @@ export { retreatTurnUseCase } from "./retreat-turn-use-case.js";
export { setAcUseCase } from "./set-ac-use-case.js";
export { setHpUseCase } from "./set-hp-use-case.js";
export { setInitiativeUseCase } from "./set-initiative-use-case.js";
export { toggleConditionUseCase } from "./toggle-condition-use-case.js";

View File

@@ -0,0 +1,25 @@
import {
type CombatantId,
type ConditionId,
type DomainError,
type DomainEvent,
isDomainError,
toggleCondition,
} from "@initiative/domain";
import type { EncounterStore } from "./ports.js";
export function toggleConditionUseCase(
store: EncounterStore,
combatantId: CombatantId,
conditionId: ConditionId,
): DomainEvent[] | DomainError {
const encounter = store.get();
const result = toggleCondition(encounter, combatantId, conditionId);
if (isDomainError(result)) {
return result;
}
store.save(result.encounter);
return result.events;
}