Fix: hand cards use ContentCache def for full art + stats

CardInstanceDto lacks the `assets` array, so card art never loaded.
Look up the full CardDefinitionDto from ContentCache (which has assets,
genus, abilitiesJson, and all base stats) and pass it as the `def`
argument to widget.setup().

Also remove the old "compact" code that was hiding the stats grid and
shrinking the art area — the full CardWidget now shows as intended.

Field alias retained: maxMp → movementPoints for CardWidget._load_stats.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-16 17:24:49 -04:00
co-authored by Claude Happy
parent 568f418608
commit 0c120ff1ae
+14 -16
View File
@@ -2280,26 +2280,24 @@ func _rebuild_hand(hand: Array) -> void:
func _make_hand_card(card: Dictionary) -> Control: func _make_hand_card(card: Dictionary) -> Control:
var iid : String = card.get("instanceId", "") var iid : String = card.get("instanceId", "")
var def_id : String = str(card.get("cardDefinitionId", ""))
# Instantiate the shared CardWidget scene used by the collection UI.
# Build a def dict from the live card data. CardWidget reads "movementPoints"
# but the CardInstanceDto field is "maxMp", so alias it here.
var widget : PanelContainer = _CARD_WIDGET_SCENE.instantiate() var widget : PanelContainer = _CARD_WIDGET_SCENE.instantiate()
widget.set_meta("card_instance_id", iid) widget.set_meta("card_instance_id", iid)
var def := card.duplicate()
def["movementPoints"] = card.get("maxMp", null)
widget.setup(card, def)
# Compact the card for the hand area: shrink art and hide the detailed # Use the full CardDefinitionDto from ContentCache so CardWidget gets the
# stats grid (HP/ATK/DEF/MP/range). Name, SP/ST cost, genus, and type # assets array (Art2D cdnUrl) and can load card art. Fall back to the
# remain visible; long-press context popup shows full unit stats. # instance data if the definition hasn't been synced yet.
var art_area := widget.get_node_or_null("Margin/VBox/ArtArea") var def := ContentCache.get_definition(def_id)
if art_area is Control: if def.is_empty():
(art_area as Control).custom_minimum_size = Vector2(0, 80) def = card.duplicate()
var stats_grid := widget.get_node_or_null("Margin/VBox/StatsGrid")
if stats_grid is CanvasItem: # CardWidget._load_stats reads "movementPoints"; the CardInstanceDto calls
(stats_grid as CanvasItem).visible = false # it "maxMp", so alias it into the def dict before passing.
def["movementPoints"] = card.get("maxMp", def.get("movementPoints", null))
widget.setup(card, def)
# CardWidget emits card_pressed(definition_id); forward as hand-card click. # CardWidget emits card_pressed(definition_id); forward as hand-card click.
widget.card_pressed.connect(func(_def_id: String) -> void: widget.card_pressed.connect(func(_def_id: String) -> void: