Implement the 025-display-initiative feature that adds initiative modifier and passive initiative display to creature stat blocks, calculated as DEX modifier + (proficiency multiplier × proficiency bonus) from bestiary data, shown in MM 2024 format on the AC line
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import type { Creature } from "@initiative/domain";
|
||||
import {
|
||||
type Creature,
|
||||
calculateInitiative,
|
||||
formatInitiativeModifier,
|
||||
} from "@initiative/domain";
|
||||
|
||||
interface StatBlockProps {
|
||||
creature: Creature;
|
||||
@@ -40,6 +44,12 @@ export function StatBlock({ creature }: StatBlockProps) {
|
||||
{ label: "CHA", score: creature.abilities.cha },
|
||||
];
|
||||
|
||||
const initiative = calculateInitiative({
|
||||
dexScore: creature.abilities.dex,
|
||||
cr: creature.cr,
|
||||
initiativeProficiency: creature.initiativeProficiency,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="space-y-1 text-foreground">
|
||||
{/* Header */}
|
||||
@@ -65,6 +75,11 @@ export function StatBlock({ creature }: StatBlockProps) {
|
||||
({creature.acSource})
|
||||
</span>
|
||||
)}
|
||||
<span className="ml-3">
|
||||
<span className="font-semibold">Initiative</span>{" "}
|
||||
{formatInitiativeModifier(initiative.modifier)} (
|
||||
{initiative.passive})
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span className="font-semibold">Hit Points</span>{" "}
|
||||
|
||||
Reference in New Issue
Block a user