Implement issue #21: custom combatants can now have a challenge rating assigned via a new breakdown panel, opened by tapping the difficulty indicator. Bestiary-linked combatants show read-only CR with source name; custom combatants get a CR picker with all standard 5e values. CR persists across reloads and round-trips through JSON export/import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
455 B
TypeScript
19 lines
455 B
TypeScript
import {
|
|
type CombatantId,
|
|
type DomainError,
|
|
type DomainEvent,
|
|
setCr,
|
|
} from "@initiative/domain";
|
|
import type { EncounterStore } from "./ports.js";
|
|
import { runEncounterAction } from "./run-encounter-action.js";
|
|
|
|
export function setCrUseCase(
|
|
store: EncounterStore,
|
|
combatantId: CombatantId,
|
|
value: string | undefined,
|
|
): DomainEvent[] | DomainError {
|
|
return runEncounterAction(store, (encounter) =>
|
|
setCr(encounter, combatantId, value),
|
|
);
|
|
}
|