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:
@@ -48,6 +48,13 @@ export function loadEncounter(): Encounter | null {
|
||||
typeof entry.initiative === "number" ? entry.initiative : undefined,
|
||||
};
|
||||
|
||||
// Validate AC field
|
||||
const ac = entry.ac;
|
||||
const validAc =
|
||||
typeof ac === "number" && Number.isInteger(ac) && ac >= 0
|
||||
? ac
|
||||
: undefined;
|
||||
|
||||
// Validate and attach HP fields if valid
|
||||
const maxHp = entry.maxHp;
|
||||
const currentHp = entry.currentHp;
|
||||
@@ -59,12 +66,13 @@ export function loadEncounter(): Encounter | null {
|
||||
currentHp <= maxHp;
|
||||
return {
|
||||
...base,
|
||||
ac: validAc,
|
||||
maxHp,
|
||||
currentHp: validCurrentHp ? currentHp : maxHp,
|
||||
};
|
||||
}
|
||||
|
||||
return base;
|
||||
return { ...base, ac: validAc };
|
||||
});
|
||||
|
||||
const result = createEncounter(
|
||||
|
||||
Reference in New Issue
Block a user