From 715ce1f0323f10f4add783fac559f53568cbda79 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 8 Mar 2026 10:15:56 -0400 Subject: [PATCH] Fix: Spirit/Ruin tile highlights, Terramorpha SP gate, selection tween - Spirit/Ruin valid tiles: channel range was read from arch (archSpirit) instead of card (the Spirit being played). Fixed to card.get("minChannelRange", 1) / card.get("maxChannelRange", 2). Also restored "Ruin" to the tile-target branch (it needs a tile target, not the no-target branch). - Terramorpha: skip entering TERRAMORPHA_SELECT if currentSp < spCost. Player can see their SP in the HUD; clicking an unaffordable card does nothing. - Hand card tween: removed mouse_entered/mouse_exited hover animation. Tween now fires only on selection state change in _refresh_hand_selection, tracking previous state via "_sel" widget metadata. 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 | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 6c478fd..fdda9e0 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -179,7 +179,7 @@ func _setup_environment() -> void: var proc := ProceduralSkyMaterial.new() proc.sky_top_color = Color(0.08, 0.10, 0.20) proc.sky_horizon_color = Color(0.28, 0.38, 0.55) - proc.ground_bottom_color = Color(0.05, 0.05, 0.08) + proc.ground_bottom_color = Color(0.373, 0.374, 0.484, 1.0) proc.ground_horizon_color = Color(0.20, 0.28, 0.38) sky.sky_material = proc env.background_mode = Environment.BG_SKY @@ -525,8 +525,9 @@ func _valid_play_tiles(card: Dictionary) -> Array: match card_type: "Spirit", "Ruin": if arch_pos.is_empty(): return results - var ax : int = arch_pos.get("x", 0) - var ay : int = arch_pos.get("y", 0) + var ax : int = arch_pos.get("x", 0) + var ay : int = arch_pos.get("y", 0) + # Channel range comes from the card being played, not the ArchSpirit. var min_r : int = card.get("minChannelRange", 1) var max_r : int = card.get("maxChannelRange", 2) for tx in range(bw): @@ -1017,6 +1018,7 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void: if not Game.is_my_turn(): return var card := _find_hand_card(iid) + #print(card.get("name", "name failed")) if card.is_empty(): return # ArchSpirit in hand → Ascend or Transition. @@ -1029,13 +1031,14 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void: _confirm_transition(card) return - # Terramorpha → multi-tile flow. + # Terramorpha → multi-tile flow (only if player can afford it). if card.get("cardType", "") == "Terramorpha": + if Game.get_my_player().get("currentSp", 0) < card.get("spCost", 0): + return _sel_card_id = iid _terra_targets = [] _terra_count = _terra_count_for_card(card) _set_mode(Mode.TERRAMORPHA_SELECT) - # Highlight all board tiles for first selection. _clear_highlights() _highlight_tiles(_valid_play_tiles(card), HI_GREEN) return @@ -1080,19 +1083,6 @@ func _make_hand_card(card: Dictionary) -> Control: if stats_grid is CanvasItem: (stats_grid as CanvasItem).visible = false - # Hover: scale up and rise. - widget.mouse_entered.connect(func() -> void: - widget.pivot_offset = widget.size * 0.5 - var tw := create_tween() - tw.tween_property(widget, "scale", Vector2(1.10, 1.10), 0.12) - tw.parallel().tween_property(widget, "position:y", widget.position.y - 20.0, 0.12) - widget.z_index = 20) - widget.mouse_exited.connect(func() -> void: - var tw := create_tween() - tw.tween_property(widget, "scale", Vector2(1.0, 1.0), 0.10) - tw.parallel().tween_property(widget, "position:y", 0.0, 0.10) - widget.z_index = 0) - # CardWidget emits card_pressed(definition_id); forward as hand-card click. widget.card_pressed.connect(func(_def_id: String) -> void: _on_hand_card_clicked(iid, widget)) @@ -1103,12 +1093,24 @@ func _make_hand_card(card: Dictionary) -> Control: func _refresh_hand_selection() -> void: for widget in _hand_cards.get_children(): if not widget.has_meta("card_instance_id"): continue - var iid : String = str(widget.get_meta("card_instance_id")) - var sel : bool = ((_mode == Mode.CARD_FROM_HAND - or _mode == Mode.TERRAMORPHA_SELECT) - and _sel_card_id == iid) + var iid : String = str(widget.get_meta("card_instance_id")) + var sel : bool = ((_mode == Mode.CARD_FROM_HAND + or _mode == Mode.TERRAMORPHA_SELECT) + and _sel_card_id == iid) + var prev_sel : bool = widget.get_meta("_sel", false) if widget.has_method("set_selected"): widget.set_selected(sel) + # Tween scale on selection change. + if sel != prev_sel: + widget.set_meta("_sel", sel) + widget.pivot_offset = widget.size * 0.5 + var tw := create_tween() + if sel: + tw.tween_property(widget, "scale", Vector2(1.12, 1.12), 0.14) + widget.z_index = 20 + else: + tw.tween_property(widget, "scale", Vector2(1.0, 1.0), 0.10) + widget.z_index = 0 func _find_hand_card(iid: String) -> Dictionary: