Skip to content

Monster compendium - #28

Merged
egon1024 merged 11 commits into
mainfrom
monster_compendium
Mar 26, 2026
Merged

egon1024 merged 11 commits into
mainfrom
monster_compendium

Conversation

@egon1024

Copy link
Copy Markdown
Owner

Monster compendium & NPC skills

High-level summary of monster_compendium vs main: a full SRD Monster Manual–style Actor compendium, NPC skill support aligned with the generalized modifier system, compendium UX and loader work for monsters, and automated token sizing from creature size.


New content & user-facing features

Monsters (SRD) compendium

  • New thirdera_monsters pack (type: "Actor", packs/monsters/) with a dedicated sidebar banner (assets/banners/monsters-banner.webp).
  • Hundreds of NPC stat blocks as JSON source files (on the order of ~460+ entries), including broad alphabetical coverage, true dragons at all age categories, and additional creature subtype items where the SRD calls for them.
  • Monster actors embed skill and feat items (same shapes as world/compendium items) so totals can reflect ranks, misc bonuses, armor/load, and feat GMS keys; authoring conventions are documented in docs-site/compendium-guide.md (Monster / NPC compendium section).
  • SRD “hub” augmentation for applicable entries: structured data under flags.thirdera.srdHubTraits and paired HTML markers in specialAbilities for hub-derived traits (see tests under test/unit/data/srd-hub-monster-flags.test.mjs).
  • True dragon natural weapons follow a single rules module (module/logic/dragon-natural-attacks.mjs, kept in sync with scripts/refresh-dragon-natural-attacks.mjs / the import tooling).

NPC sheet & skills

  • NPC sheet Attributes → Skills subtab: list embedded skills, class-skill styling via system.npcClassSkill on skill items, modifier-only rows, and rolls consistent with PCs (module/logic/npc-skill-prep.mjs, module/sheets/actor-sheet.mjs, templates/actor/npc-sheet.hbs).
  • De-duplication of embedded skills on display and on createEmbeddedDocuments using stable identity rules (module/logic/npc-embedded-skill-identity.mjs).
  • SkillPickerDialog extensions to support NPC authoring flows (module/applications/skill-picker-dialog.mjs).

Compendium & token quality of life

  • Fuzzy search overlay for the Monsters compendium window (reuses module/utils/fuzzy.mjs from thirdera.mjs).
  • Prototype token width/height derived from system.details.size when still at Foundry’s default 1×1; updates on size change preserve manually adjusted dimensions; linked scene tokens follow on size change (GM client). Logic: module/logic/token-dimensions-from-size.mjs; Foundry wiring: module/logic/token-dimensions-from-size-hooks.mjs (registerTokenDimensionHooks).

Tooling & docs

  • Makefile test target runs node --check module/logic/compendium-loader.mjs before npm test to catch syntax issues in the large loader module early.
  • Published guidance updates in docs-site/compendium-guide.md, docs-site/development.md, and related docs-site/ pages where monster packs and NPC behavior are described.

Notes for contributors & system extenders

Compendium loader & pack wiring

  • module/logic/compendium-loader.mjs: expanded FILE_MAPPINGS for thirdera.thirdera_monsters; on import, NPC documents run resolveMonsterPackNpcKeys so authoring keys creatureTypeKey / subtypeKeys become stored details.creatureTypeUuid / details.subtypeUuids after lookup in the creature type and subtype packs (module/logic/monster-pack-keys.mjs).
  • Stable matching for create/update continues to use getStableKey (system.key, etc.); new monster JSON must define a unique system.key.
  • Adding or renaming monster source files requires updating FILE_MAPPINGS and, for generated content, the repo scripts (e.g. scripts/build-monster-pack-json.py, scripts/apply-monster-skills-feats.mjs, scripts/import_srd_missing_monsters.py) as described in the compendium guide.

Data model touchpoints

  • module/data/actor-npc.mjs, module/documents/actor.mjs, module/documents/item.mjs, module/data/item-skill.mjs: NPC skill prep hooks, defaults for npcClassSkill, and embed dedupe behavior.
  • lang/en.json and styles/thirdera.css: strings and layout for NPC skills and related UI.

Tests (Vitest)

New or expanded unit/data tests include:

  • test/unit/logic/monster-pack-keys.test.mjs
  • test/unit/logic/npc-skill-prep.test.mjs
  • test/unit/logic/npc-embedded-skill-identity.test.mjs
  • test/unit/logic/token-dimensions-from-size.test.mjs
  • test/unit/logic/token-dimensions-from-size-hooks.test.mjs
  • test/unit/logic/dragon-natural-attacks.test.mjs
  • test/unit/data/monster-embedded-skills-uniqueness.test.mjs
  • test/unit/data/srd-hub-monster-flags.test.mjs

See test/README.md for the coverage map. make test and make test-coverage should pass before merge.

Hook registration pattern

  • registerTokenDimensionHooks() is the reference register*Hooks + injected deps pattern for Foundry hooks; registered from thirdera.mjs on init.

Upgrade / migration

  • Existing worlds: compendium JSON is re-imported on the usual loader ready path; existing world actors are not batch-migrated for token dimensions (see docs-site/development.md — token footprint vs size).
  • Review release notes for any pack unlock/rebuild expectations if GMs rely on customized compendium copies.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Version Preview

Version
Current Release 0.27.0
Bump Type minor
Next Version 0.28.0

⚠️ No version tag found in PR description — defaulting to #minor. Add #major, #minor, or #patch at the start of a line in the PR body to specify.

@egon1024
egon1024 merged commit 6e8fa3e into main Mar 26, 2026
5 checks passed
@egon1024
egon1024 deleted the monster_compendium branch March 26, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant