-
Notifications
You must be signed in to change notification settings - Fork 858
Add card info tooltips with keyword explanations and related cards#9806
Add card info tooltips with keyword explanations and related cards#9806MostCromulent wants to merge 47 commits intoCard-Forge:masterfrom
Conversation
Summary
Adds Arena-style card info popups to desktop UI including selected card, related cards (tokens created, spellbooks etc), and keyword explanations. Includes menu options to enable/disable each section and scale card image size. Addresses #9705.
(I can imagine some people choosing to use this instead of default card view/card details panels).
Features
- Adds a hoverable card info popup that appears when mousing over cards during a match, showing the card image, keyword ability and keyword action explanations with reminder text, and related card images (tokens, spellbook, meld pairs) grouped by category
- Related cards supports 'creates, 'transforms into', 'other face', 'meld', 'flips into', 'specialises into', 'partner', and 'spellbook'.
- Keyword actions are defined in a new KeywordAction enum (forge-game) covering all 67 entries from MTG comprehensive rules section 701, making them reusable across modules in future
- Popup is constrained to the Forge window bounds, enforces single-instance display, and includes user preferences for image size and enable/disable toggle under Game menu
New files
- forge-game/.../keyword/KeywordAction.java -- enum of all MTG keyword actions with reminder text
- forge-gui-desktop/.../view/arcane/CardInfoPopup.java -- popup window with pill-panel styling
- forge-gui-desktop/.../match/menus/CardInfoPopupMenu.java -- Game menu submenu for popup settings
Note
Original feature request in #9705 also wanted to include flavour text for alchemy cards. This is not currently included in Forge card data so cannot be easily extracted. I have not included in this PR as I don't think significant extra diff to achieve this is worth the benefit.
Generated with Claude Code
- Spellbook/related cards extracted from Spellbook$ ability parameters
- Image size slider (100-500px) in Game > Card Info Popup menu
- Auto-download missing card images via CachedCardImage.fetcher
- Flip card images rotated 180 degrees for correct display
- Popup hidden when Forge window loses focus or is minimized
- Large groups (>5 cards) shown at half size in wrapped grid rows
Co-Authored-By: Claude Opus 4.6
Add static activePopup tracker to ensure only one popup is visible at a time.
Hide popup when owner window loses focus and skip showing when window is inactive.
Constrain related card thumbnails to fit available screen space next to hovered card.
Always show related cards including placeholder images for un-downloaded cards.
Co-Authored-By: Claude Opus 4.6
instead of stacking vertically
- Cap keyword text width to match the selected card image width
- Related card sizing: 1-2 cards at full size, 3+ scale to half with max 4 per row
- Add meld partner and partner-with as related card categories
- Group meld partner and meld result together in one row
- Stay-open behavior for popup menu checkboxes (menu no longer closes on toggle)
Co-Authored-By: Claude Opus 4.6
pill panels using dark overlay styling. Fix keyword reminder text not
appearing (double wrapping) and text clipping (use HTML View
for wrapped height calculation). Reduce card-to-popup gap.
Co-Authored-By: Claude Opus 4.6
and display them alongside keyword abilities in the popup. Keyword
actions are defined in a new KeywordAction enum in forge-game for
reuse across modules. Also top-align keyword pills, center-justify
incomplete card rows, and increase reminder text font to 12pt.
Co-Authored-By: Claude Opus 4.6
eliminate duplicate addedNames set in buildKeywords() by having the
caller pass its set directly.
Co-Authored-By: Claude Opus 4.6
|
Understand what you say about avoiding too much similarity. I'm happy to re-work this to integrate with the scroll-up card zoom view if that's the consensus, though that perhaps makes the functionality less obvious to the kind of less experienced users who the tooltips and related cards are most useful for? (Also personally I basically never use the scroll-up function, hence why I missed the conflict when zoomed in. I should at least be able to sort that out.) Will look into the other issues. The image downloader for the related cards box was at least working for me earlier today. |
|
in theory, SpellAbilityEffect represents KeywordActions for KeywordInterfaces, checkout |
and use correct image keys so related cards (spellbook, tokens, partner,
specialize) render with Forge's card renderer instead of showing blank
when card art is not downloaded.
Co-Authored-By: Claude Opus 4.6
instead of bare "Protection from " (Protection.java)
- Use CardStateView.getOracleText() instead of StaticData/CardRules lookup
- Strip card name from oracle text to avoid false positive keyword action
matches (e.g. "Boseiju, Who Endures" matching Endure)
- Sort keyword actions by oracle text position instead of enum order
- Resolve N in keyword action reminders (scry 2, mill 3) and singularize
"counters" when N=1
- Use inst.getTitle() with color-to-mana-symbol conversion for keyword names
- Filter out Enchant keyword
- Clear stale preferred size before recomputing keywords panel layout
Co-Authored-By: Claude Opus 4.6
side-by-side panel when zooming a card, with separate preference toggles
from the hover tooltip. Refactor CardInfoPopup building methods to
public static for reuse. Reorganize the Card Info Popups menu with
section headers for hover tooltip vs zoom view settings.
Co-Authored-By: Claude Opus 4.6
(e.g. Intimidate from static effects) that keywordKey parsing misses.
Unify zoom menu keyword label to "Keyword Explanations" and remove two
dead locale strings.
Co-Authored-By: Claude Opus 4.6
|
@dracontes, I'll test this more extensively tomorrow but latest commits should hopefully address many of the issues you had above including card rendering and initial implementation of seperate preference toggles to enable/disable showing related cards/keyword tips in the card zoom view. Still working on getting it to more accurately pick up granted abilities/solve a few layout problems. |
Jetz72
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we could identify KeywordActions by inspecting the card's abilities and their parameters rather than the Oracle text. But I'm not sure how well that works with everything. Something like Scry might be a straightforward spot check for a ScryEffect or a ReplaceScry, but I think there are some that are implemented purely through card script.
forge-gui-desktop/src/main/java/forge/view/arcane/CardInfoPopup.java
Outdated
Show resolved
Hide resolved
downloaded art by using ImageCache.getCardOriginalImageInfo placeholder
flag to trigger auto-download correctly
- Dynamically size zoom view side panel to match actual content width
instead of fixed 40% column, keeping scrollbar adjacent to content
- Use FScrollPane instead of JScrollPane for themed scrollbar styling
- Render spellbook cards 3 per row in zoom view for better readability
- Size pill to actual thumbnail width instead of full column width
- Scale thumbnails to fill available space up to user preference cap
Co-Authored-By: Claude Opus 4.6
forge-gui so keyword detection is available to mobile UI. Desktop
callers now apply FSkin symbol encoding at display time instead of
during keyword building.
Co-Authored-By: Claude Opus 4.6
@Jetz72, I've asked the AI to assess the feasability of this for each of the KeywordActions. Here's the response:
|
|
Well, 34 out of 50 (not counting the 17 trivial ones) isn't too bad of a start. Digging into it a bit more -
I think we could get away without a hybrid approach, but it'd still be a pretty huge overhaul to what you currently have. Each keyword would need one or more cues to check against an ability, trigger, or replacement effect, for their API, parameters, sub-abilities, and any associated costs. Instead of threading ability data to the view layer we'd probably just compute the keyword action list on the game layer. Possibly within the abilities/triggers/REs themselves before compiling them in the On second thought, if we ever wanted tooltips to work outside of a game we'd have to do it even earlier, with less tools. Possibly while as part of the ...I think it's probably fine for now. I don't think the current implementation will usually be an issue as long as the card name isn't included in the text matching. |
(y - ies conjugation fallback)
- Wrap entire zoom side panel (keywords + related cards) in a single
scroll pane instead of only the related cards section
- Add spacing between keyword boxes and related cards section
Co-Authored-By: Claude Opus 4.6
|
@dracontes thanks for feedback, this is very helpful and I will investigate. |
with numbered levels (1-4) in oracle text and current level annotation
- Fix LTR edition collector number 13 - H13 to match Scryfall download URL
- Add ChooseFromList related card entries (e.g. Garth One-Eye)
- Include UI_DISABLE_CARD_IMAGES in tooltip cache key so toggling the
preference forces tooltip rebuild instead of showing stale images
- Improve keyword display: Craft shows just mana cost, Equip shows type
qualifiers, amass includes type word, "a"/"an" parsed as numeric 1
- Capitalize "The Ring Tempts You" keyword action display name
- Fix game log tooltip positioning to use full entry bounds
Co-Authored-By: Claude Opus 4.6
|
@dracontes all of the issues above should now be fixed. Game log overlap - now renders outside of the log entirely. Garth One-Eye / Cards naming other cards The Ring Tempts You - took some slightly ugly Ring-related hard coding within the tooltip file, but have got this working. Have also got it to track your current ring level in the header and tooltip. |
Army token (Zombie, Orc, Sliver) since Amass cards don't declare
tokens via TokenScript$.
Co-Authored-By: Claude Opus 4.6
|
Devotion is a bit tricky because the gods have "Devotion for X and Y", would be best if you check for SVar X = contains Devotion like this:
|
I apologize: I somehow must have convinced myself during the testing I did for my 2026-02-21 review of that version of the PR there was a checkbox implemented to disable the zoom-in view altogether, either from the Game dropdown menu or on Preferences. Just fired up that version of this PR and I can't find it. Still, I would like that to be available for the reasons I stated. if it isn't too much trouble to implement. |
- Add master toggle prefs (UI_SHOW_HOVER_TOOLTIPS, UI_SHOW_ZOOM_TOOLTIPS)
with Ctrl+H and Ctrl+I keyboard shortcuts
- Replace individual pref checkboxes in Preferences with master toggles
that gate all tooltip display; individual options configured via in-game menu
- Rename menu from "Card Info Popups" to "Card Info Tooltips" throughout
- Merge overlay options into hover tooltip section, remove separate header
- Update defaults: all tooltip content enabled, image size 375px,
hover overlays limited to power/toughness and ability icons
- Fix NPE in KeywordInfoUtil.annotateDevotion when battlefield/graveyard null
Co-Authored-By: Claude Opus 4.6
- Rewrite annotateDevotion() to look up devotion colors from card SVars
(Count$Devotion / Count$DevotionDual) instead of parsing oracle text,
correctly handling dual-color devotion (e.g. Iroas, God of Victory)
- Use ManaCostShard.isColor() instead of getShardCount() so hybrid mana
symbols (e.g. {R/W}) count once toward dual devotion, not twice
- CTRL-H now immediately hides card info tooltips when toggled off
- CTRL-I now immediately refreshes the zoom view side panel when toggled
Co-Authored-By: Claude Opus 4.6
@Hanmac have re-worked this on latest commits, seems to be working well.
@dracontes have re-worked master enable/disable hotkeys and preferences similar to CTRL-O for overlays. |
I'm sorry, I should have been clearer: what I am asking for is a checkbox to disable the image itself showing up when you scroll up when hovering a card. Could certainly be that checkbox you set up is what's reworked to do that. Ran down the discussion, verifying relevant items. Here are some salient enough issues. The rest were addressed well enough.
|
- Fix Trample and Trample Over Planeswalkers merging into one tooltip
- Fix convert reminder text (convert and transform are interchangeable)
- Fix waterbend reminder text to match official rules (generic mana only)
- Title-case multi-word keyword action names
- Lay out single-card related groups side by side when total fits in a row
Co-Authored-By: Claude Opus 4.6
I think the CTRL-I shortcut should do what you're looking for: completely disable the tooltip functionality in zoom view. Disabling the "Enable Card Information Tooltips in Zoom View" preference will do the same thing.
These should now be fixed. |
tool4ever
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge PR, so definitely not before next release
specFaceToCollectorSuffix. Adopt same pattern in our specialize
helpers (specColorToStateName, specImageKey) to eliminate per-color
switch statements.
Co-Authored-By: Claude Opus 4.6
View-based height calculation as reminder text) so long headers
like Escape costs are no longer clipped
- Fix Craft title to show full "Craft with [types] {mana}" by
iterating all CostExile parts (the keywordKey comma delimiter
was splitting multi-type descriptions like Throne of the Grim
Captain)
- Fix Craft reminder text to list all exile types for multi-exile
cards instead of only the first
- Suppress redundant Transform keyword action when Craft is present
- Remove Craft title truncation from KeywordInfoUtil
Co-Authored-By: Claude Opus 4.6
Keywords wrap at 1 thumbnail width instead of stretching to match related
card content width. Multi-group related cards (e.g. Creates + Spellbook)
show side-by-side pills with 1 card each, paired 2 per row. Fix overflow
label truncation by setting maxWidth on the JLabel.
Co-Authored-By: Claude Opus 4.6
Keyword actions with "N" in reminder text (Support, Scry, etc.) now
require a number to follow in oracle text, rejecting generic English
uses like "life-support". Hyphenated words also rejected as word
boundaries. Manifest suppressed when Manifest Dread is present, with
Manifest Dread reminder text expanded to be self-contained.
Co-Authored-By: Claude Opus 4.6
Scavenger) via SVar API and ~58 creature-counting cards (Lhurgoyf,
Splinterfright) via oracle text. Show dynamic Delirium-style tooltips
with current count and details on hover/zoom.
Card-type detection scans SVars/static abilities/triggers for
ValidGraveyard+CardTypes markers; scope derived from .YouOwn/.OppOwn.
Creature detection matches "number of creature cards in" oracle text.
Dedup skips card-type tooltip when Delirium keyword already present.
Also: null-guard zone accesses in existing annotations, add threshold
targets (Metalcraft /3, Threshold /7, Delirium /4), show type list in
Delirium tooltip, and add "currently" wording to annotation labels.
Co-Authored-By: Claude Opus 4.6