From 0c120ff1ae9e6d2c1bff6df4cfe01fdb5682fb25 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 16 Mar 2026 17:24:49 -0400 Subject: [PATCH] Fix: hand cards use ContentCache def for full art + stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-Authored-By: Happy --- .../origin-client/scenes/game/game_screen.gd | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index c1dff2c..5ee1d99 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -2280,26 +2280,24 @@ func _rebuild_hand(hand: Array) -> void: 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() 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 - # stats grid (HP/ATK/DEF/MP/range). Name, SP/ST cost, genus, and type - # remain visible; long-press context popup shows full unit stats. - var art_area := widget.get_node_or_null("Margin/VBox/ArtArea") - if art_area is Control: - (art_area as Control).custom_minimum_size = Vector2(0, 80) - var stats_grid := widget.get_node_or_null("Margin/VBox/StatsGrid") - if stats_grid is CanvasItem: - (stats_grid as CanvasItem).visible = false + # Use the full CardDefinitionDto from ContentCache so CardWidget gets the + # assets array (Art2D cdnUrl) and can load card art. Fall back to the + # instance data if the definition hasn't been synced yet. + var def := ContentCache.get_definition(def_id) + if def.is_empty(): + def = card.duplicate() + + # CardWidget._load_stats reads "movementPoints"; the CardInstanceDto calls + # 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. widget.card_pressed.connect(func(_def_id: String) -> void: