fix(client): expose targetable attachments - #6752
Conversation
📝 WalkthroughWalkthroughPermanentCard now opens the attachment chooser when attached permanents are actionable, reuses a dedicated chooser callback, and tests target selection through the attachment fan. ChangesAttachment targeting
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/src/components/board/PermanentCard.tsx`:
- Around line 692-697: Move attachment interaction determination out of the
client: replace the client-derived attachmentsActionable routing around
showAttachmentFan with engine-provided, host-scoped interaction options and
actions. Propagate these options/actions through every adapter to AttachmentFan,
and have the fan render only engine-authorized choices and dispatch their
corresponding actions, including sacrifice, mana-cost, and undo-tap states.
Remove client-side game-data derivation so the frontend remains a display layer.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d3c6690f-5b53-4156-86a2-2072b8c58348
📒 Files selected for processing (2)
client/src/components/board/PermanentCard.tsxclient/src/components/board/__tests__/PermanentCard.test.tsx
| } else if (attachmentsActionable) { | ||
| // The host is not a legal choice, but one of its attachments is. Open | ||
| // the full-card chooser rather than requiring a precise click on an | ||
| // overlapping attachment peek. The fan derives every selectable card | ||
| // from the engine's current legal-target set. | ||
| showAttachmentFan(); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Move attachment actionability and actions into the engine.
Line 692 makes a client-derived attachmentsActionable predicate control gameplay routing. It also includes sacrifice, mana-cost, and undo-tap states, but AttachmentFan only handles target selection, board choices, and activation actions—so those cases open a fan where selecting the attachment performs no action. Expose engine-authorized attachment interaction options/actions per host, wire them through every adapter, and have the fan render and dispatch that state.
As per path instructions, “The frontend is a display layer, never a logic layer” and game-data derivation must be pushed into the engine.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@client/src/components/board/PermanentCard.tsx` around lines 692 - 697, Move
attachment interaction determination out of the client: replace the
client-derived attachmentsActionable routing around showAttachmentFan with
engine-provided, host-scoped interaction options and actions. Propagate these
options/actions through every adapter to AttachmentFan, and have the fan render
only engine-authorized choices and dispatch their corresponding actions,
including sacrifice, mana-cost, and undo-tap states. Remove client-side
game-data derivation so the frontend remains a display layer.
Source: Path instructions
Summary by CodeRabbit