Add Pathfinder 2e game system mode
Implements PF2e as an alternative game system alongside D&D 5e/5.5e. Settings modal "Game System" selector switches conditions, bestiary, stat block layout, and initiative calculation between systems. - Valued conditions with increment/decrement UX (Clumsy 2, Frightened 3) - 2,502 PF2e creatures from bundled search index (77 sources) - PF2e stat block: level, traits, Perception, Fort/Ref/Will, ability mods - Perception-based initiative rolling - System-scoped source cache (D&D and PF2e sources don't collide) - Backwards-compatible condition rehydration (ConditionId[] → ConditionEntry[]) - Difficulty indicator hidden in PF2e mode (excluded from MVP) Closes dostulata/initiative#19 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
calculateInitiative,
|
||||
calculatePf2eInitiative,
|
||||
formatInitiativeModifier,
|
||||
} from "../initiative.js";
|
||||
|
||||
@@ -93,6 +94,26 @@ describe("calculateInitiative", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("calculatePf2eInitiative", () => {
|
||||
it("returns perception as both modifier and passive", () => {
|
||||
const result = calculatePf2eInitiative(11);
|
||||
expect(result.modifier).toBe(11);
|
||||
expect(result.passive).toBe(11);
|
||||
});
|
||||
|
||||
it("handles zero perception", () => {
|
||||
const result = calculatePf2eInitiative(0);
|
||||
expect(result.modifier).toBe(0);
|
||||
expect(result.passive).toBe(0);
|
||||
});
|
||||
|
||||
it("handles negative perception", () => {
|
||||
const result = calculatePf2eInitiative(-2);
|
||||
expect(result.modifier).toBe(-2);
|
||||
expect(result.passive).toBe(-2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("formatInitiativeModifier", () => {
|
||||
it("formats positive modifier with plus sign", () => {
|
||||
expect(formatInitiativeModifier(7)).toBe("+7");
|
||||
|
||||
Reference in New Issue
Block a user