feat: Mighty Deed table prompt on attack cards (#319)#748
Merged
Conversation
When a deed die comes up 3+, the attack chat card now offers a prompt to look the deed die result up on a Mighty Deed roll table. Tables are gathered like disapproval tables: world RollTables with 'Deed' in the name register automatically, and modules or the new mightyDeedsCompendium setting can register a compendium pack via the new dcc.registerMightyDeedsPack hook. Closes #319 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
--use-angle=metal (macOS) makes headless Chromium report a real GPU renderer instead of SwiftShader, so Foundry never posts the permanent hardware-acceleration banner that intercepted clicks and flaked tests. Side effect: the full suite drops from ~7 min to ~2.6 min. Also harden mighty-deeds.spec.js against other registered deed tables (e.g. the dcc-core-book pack): assert containment instead of exact list equality and select the test table explicitly before rolling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4 tasks
…adapter architecture + off-by-default toggle main absorbed the dcc-core-lib adapter refactor (#720), which relocated the attack flow out of the monolithic actor.js / dcc.js / dcc.scss into module/actor/rolls-weapon-mixin.mjs, module/table-loading.mjs, module/settings-table-hooks.mjs, module/chat-and-hook-wiring.mjs, and modular SCSS partials. The Mighty Deed feature (#319) was built against the pre-refactor code, so this merge ports it onto the new architecture instead of resurrecting the old monolith: - deedTables population + attack-message attach -> rolls-weapon-mixin.mjs - mightyDeedsPacks manager + isMightyDeedsTable + RollTable lifecycle handling -> table-loading.mjs - dcc.registerMightyDeedsPack hook -> settings-table-hooks.mjs - attachMightyDeedListeners wiring -> chat-and-hook-wiring.mjs - .deed-table-prompt / .deed-table-result styles -> styles/_chat.scss Adds a new off-by-default world setting `mightyDeedsEnabled` (DCC.SettingMightyDeedsEnabled, translated in all 7 languages) that gates whether the attack card surfaces the deed prompt. The table registry stays populated regardless, so the compendium picker and world-table tracking behave consistently whether or not the prompt is enabled. Tests: unit 1830 green (added deed coverage to table-loading, settings-table-hooks, and chat-and-hook-wiring specs); compare-lang clean for all 7 languages; E2E mighty-deeds.spec.js updated to enable the toggle for the prompt tests and a new disabled-by-default case added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cjCFNBa3QMgacJXUQaKpV
Generalize the standing commit/push authorization in CLAUDE.md: auto commit + push on any non-`main` branch once Vitest is green, with an explicit rule to never commit/push directly to `main` without being asked. The `refactor/dcc-core-lib-adapter` slice authorization remains as a stricter regime (push still gated on the full E2E suite). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cjCFNBa3QMgacJXUQaKpV
… hook - EXTENSION_API.md: add the public `dcc.registerMightyDeedsPack` hook row alongside its registerDisapprovalPack / registerCriticalHitsPack siblings. - user-guide/Mighty-Deeds.md: describe the optional deed-table prompt, that it is off by default, how to enable it (mightyDeedsEnabled), and how deed tables are gathered (world "Deed" tables + compendium / hook). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cjCFNBa3QMgacJXUQaKpV
Disable the Roll Deed button (and its table dropdown) once a result is posted, so repeat clicks can't post multiple deed-table results. The controls are re-enabled only if the lookup fails (table not found / out of bounds) so the user can retry. Also guards against a double-fire while the async table lookup is in flight. E2E: extend the success test to assert the button is disabled after posting and that a second (forced) click adds no further chat message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cjCFNBa3QMgacJXUQaKpV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #319: when a warrior's deed die comes up 3 or better, the attack chat card now offers a prompt — a dropdown of available Mighty Deed tables plus a Roll Deed button. Clicking it looks the already-rolled deed die value up on the chosen table and posts the result to chat as a table-draw card.
Players choose the table per attack (per RAW, a deed is declared before each attack and there are seven-plus deed categories), so this is a chat-card prompt rather than an auto-rolled pre-configured table.
How tables are gathered (mirrors the disapproval-tables pattern)
RollTables with "Deed" in the name (or the localizedDCC.Deedterm) register automatically, with live create/rename/delete handling.mightyDeedsCompendium, shown under manual compendium configuration) registers a pack via the newdcc.registerMightyDeedsPackhook — modules can also call the hook directly. A companion dcc-core-book PR adds the seven core rulebook deed tables and registers them through this hook.CONFIG.DCC.mightyDeedsTables; the sorted list is embedded in the attack card at roll time. With no tables available the card is unchanged, and no prompt appears on a failed deed.Changes
module/dcc.js,module/config.js,module/settings.js—mightyDeedsPacksTablePackManager, registry, setting, hook, world-table lifecycle hooksmodule/actor.js— attachdeedTablesto the attack message on deed successtemplates/chat-card-attack-result.html,module/chat.js— prompt UI (both normal and emote modes), click handler that resolves the table and posts the resultmodule/utilities.js— reusablegetTableFromPath()(compendiumscope.pack.Table Namepaths or world table names)styles/dcc.scss— prompt styling readable on the dark chat theme; full-width deed result textcompare-langclean)getTableFromPath; newbrowser-tests/e2e/mighty-deeds.spec.js(registry registration/unregistration, prompt + Roll Deed end-to-end against live Foundry, no-prompt-on-failed-deed)Testing
npm test: 774/774 greenOne earlier full-suite run had 2 failures (
data-modelspersistence,v14-featureseffect transfer) — both are a pre-existing flake where Foundry's permanent "hardware acceleration" notification banner lands after the specs' notification cleanup and intercepts clicks; both pass on re-run on this branch and on main.Closes #319
🤖 Generated with Claude Code