Stage 2 of the Hax's Tools split. its-achievable ships as a standalone module that subscribes to hax-hooks-lib's envelope stream and provides achievements + custom rules + rewards + achievement wall + combat HUD. ## What's new scripts/ — moved from battle-focus/scripts/, MODULE_ID retagged battle-focus → its-achievable: - achievement-rules.js (323 lines) — rule engine: OPERATORS, TRIGGER_TYPES, evaluateCondition(s), testRule, evaluateRulesFor* - achievements.js (1150 lines) — 24-entry catalog + award path, per-event evaluators, encounter-end + career-update evaluation - achievement-wall.js (333 lines) — renderAchievementWall, getAchievementWallProgress, renderAchievementPopover - custom-achievements-app.js (270 lines) — GM FormApplication for editing custom rules - hud.js (624 lines) — combat HUD (ApplicationV2 + HandlebarsApplicationMixin); removed dead import of battle-focus's encounter.js (it was unused even in the original) scripts/main.js — Foundry entry point. Registers settings at its-achievable.* namespace; exposes the public API on mod.api; registers chatBubble popover listener + HUD singleton on ready. templates/ + styles/ — moved verbatim. tests/PLAN.md — per-project test plan (sections A-F). tests/test-helpers.mjs — Foundry stub. tests/verify-achievable-v1.mjs — smoke test, 75 assertions covering rule engine, catalog, awards, hooks-lib wiring, HUD payload derivation, and wall/popover rendering. Runs in <2s. ## Architecture - **Settings namespace**: its-achievable.* (was battle-focus.*). No migration (per Kaysser's decision); users with existing worlds re-create their custom rules. Documented in README. - **HUD derives its own state from hooks-lib envelopes.** Stage 2 keeps the legacy battle-focus:hud-update broadcast subscription for now (battle-focus still emits it); Stage 3 will switch the HUD to subscribe to hooks-lib directly and remove the battle-focus broadcasts. - **Encounter singleton**: accessed via battle-focus's public api.getActiveEncounter() — no direct import of battle-focus's encounter.js. ## Dependencies - hax-hooks-lib ^0.2.0 (declared in module.json relationships). - battle-focus (soft, runtime) — provides the encounter singleton. ## Tests - 75/75 smoke assertions pass in 0.07s. - Module manifest validates: 0 errors, 1 warning (no icon — Stage 2+ work). Push: Gitea only.
22 lines
720 B
JSON
22 lines
720 B
JSON
{
|
|
"name": "its-achievable",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "Foundry VTT module: achievements, custom rules, rewards, achievement wall, and combat HUD. Depends on hax-hooks-lib (event stream) and battle-focus (encounter state).",
|
|
"main": "scripts/main.js",
|
|
"type": "module",
|
|
"scripts": {
|
|
"test": "node tests/verify-achievable-v1.mjs",
|
|
"test:verbose": "TEST_VERBOSE=1 node tests/verify-achievable-v1.mjs"
|
|
},
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"author": "kaykayyali",
|
|
"license": "UNLICENSED",
|
|
"comment": "This package.json is for test/CI tooling only — Foundry VTT modules are loaded by Foundry, not by npm.",
|
|
"dependencies": {
|
|
"hax-hooks-lib": "^0.2.0"
|
|
}
|
|
}
|