Skip to content

feat: Mighty Deed table prompt on attack cards (#319)#748

Merged
cyface merged 8 commits into
mainfrom
feature/319-mighty-deed-table
Jun 19, 2026
Merged

feat: Mighty Deed table prompt on attack cards (#319)#748
cyface merged 8 commits into
mainfrom
feature/319-mighty-deed-table

Conversation

@cyface

@cyface cyface commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

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)

  • World RollTables with "Deed" in the name (or the localized DCC.Deed term) register automatically, with live create/rename/delete handling.
  • A new world setting Mighty Deeds Tables Compendium (mightyDeedsCompendium, shown under manual compendium configuration) registers a pack via the new dcc.registerMightyDeedsPack hook — 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.
  • Both feed 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.jsmightyDeedsPacks TablePackManager, registry, setting, hook, world-table lifecycle hooks
  • module/actor.js — attach deedTables to the attack message on deed success
  • templates/chat-card-attack-result.html, module/chat.js — prompt UI (both normal and emote modes), click handler that resolves the table and posts the result
  • module/utilities.js — reusable getTableFromPath() (compendium scope.pack.Table Name paths or world table names)
  • styles/dcc.scss — prompt styling readable on the dark chat theme; full-width deed result text
  • i18n — 7 new keys translated in all 7 languages (compare-lang clean)
  • Tests — 5 new Vitest cases for getTableFromPath; new browser-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 green
  • Full Playwright E2E suite: 35/35 green (includes the 3 new mighty-deeds tests)
  • Manually verified in live Foundry v14: world-table registration, prompt rendering in emote and non-emote modes, Roll Deed posting the correct band's result, deleted-table warning path, and the dcc-core-book compendium path with all seven core tables

One earlier full-suite run had 2 failures (data-models persistence, v14-features effect 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

cyface and others added 2 commits June 12, 2026 15:41
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>
cyface and others added 6 commits June 19, 2026 12:30
…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
@cyface cyface merged commit 994de29 into main Jun 19, 2026
5 checks passed
@cyface cyface deleted the feature/319-mighty-deed-table branch June 19, 2026 20:21
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.

Add a feature to allow automated rolling against optional Mighty Deed maneuver tables

1 participant