Implement the 016-combatant-ac feature that adds an optional Armor Class field to combatants with shield icon display and inline editing in the encounter tracker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-06 10:41:56 +01:00
parent 2793a66672
commit 78c6591973
20 changed files with 914 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import {
editCombatantUseCase,
removeCombatantUseCase,
retreatTurnUseCase,
setAcUseCase,
setHpUseCase,
setInitiativeUseCase,
} from "@initiative/application";
@@ -171,6 +172,19 @@ export function useEncounter() {
[makeStore],
);
const setAc = useCallback(
(id: CombatantId, value: number | undefined) => {
const result = setAcUseCase(makeStore(), id, value);
if (isDomainError(result)) {
return;
}
setEvents((prev) => [...prev, ...result]);
},
[makeStore],
);
return {
encounter,
events,
@@ -182,5 +196,6 @@ export function useEncounter() {
setInitiative,
setHp,
adjustHp,
setAc,
} as const;
}