Atomic addCombatant with optional CombatantInit bag
addCombatant now accepts an optional init parameter for pre-filled stats (HP, AC, initiative, creatureId, color, icon, playerCharacterId), making combatant creation a single atomic operation with domain validation. This eliminates the multi-step store.save() bypass in addFromBestiary and addFromPlayerCharacter, and removes the CombatantOpts/applyCombatantOpts helpers. Also extracts shared initiative sort logic into initiative-sort.ts used by both addCombatant and setInitiative. Closes #15 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
export { type AddCombatantSuccess, addCombatant } from "./add-combatant.js";
|
||||
export {
|
||||
type AddCombatantSuccess,
|
||||
addCombatant,
|
||||
type CombatantInit,
|
||||
} from "./add-combatant.js";
|
||||
export { type AdjustHpSuccess, adjustHp } from "./adjust-hp.js";
|
||||
export { advanceTurn } from "./advance-turn.js";
|
||||
export { resolveCreatureName } from "./auto-number.js";
|
||||
|
||||
Reference in New Issue
Block a user