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>
27 lines
634 B
TypeScript
27 lines
634 B
TypeScript
import type { Creature } from "@initiative/domain";
|
|
import { creatureId } from "@initiative/domain";
|
|
|
|
let counter = 0;
|
|
|
|
export function buildCreature(overrides?: Partial<Creature>): Creature {
|
|
const id = ++counter;
|
|
return {
|
|
id: creatureId(`creature-${id}`),
|
|
name: `Creature ${id}`,
|
|
source: "srd",
|
|
sourceDisplayName: "SRD",
|
|
size: "Medium",
|
|
type: "humanoid",
|
|
alignment: "neutral",
|
|
ac: 13,
|
|
hp: { average: 7, formula: "2d6" },
|
|
speed: "30 ft.",
|
|
abilities: { str: 10, dex: 14, con: 10, int: 10, wis: 10, cha: 10 },
|
|
cr: "1/4",
|
|
initiativeProficiency: 0,
|
|
proficiencyBonus: 2,
|
|
passive: 10,
|
|
...overrides,
|
|
};
|
|
}
|