diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index fdda9e0..d3997f7 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -523,13 +523,20 @@ func _valid_play_tiles(card: Dictionary) -> Array: var arch_pos : Dictionary = arch.get("position", {}) match card_type: - "Spirit", "Ruin": + "Spirit": if arch_pos.is_empty(): return results - 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) + var ax : int = arch_pos.get("x", 0) + var ay : int = arch_pos.get("y", 0) + # Channel range is a property of the ArchSpirit. + # dict.get(key, default) only uses the default when the key is ABSENT. + # The server sends nullable ints (e.g. "minChannelRange": null), so the + # key EXISTS but its value is null — GDScript returns null, which silently + # coerces to 0 on a typed int variable, collapsing the range to nothing. + # Read as Variant first, then substitute the default explicitly. + var raw_min = arch.get("minChannelRange") + var raw_max = arch.get("maxChannelRange") + var min_r : int = 1 if raw_min == null else int(raw_min) + var max_r : int = 2 if raw_max == null else int(raw_max) for tx in range(bw): for ty in range(bh): var dist : int = abs(tx - ax) + abs(ty - ay) @@ -542,8 +549,8 @@ func _valid_play_tiles(card: Dictionary) -> Array: for ty in range(bh): results.append(Vector2i(tx, ty)) - "Repentance", "Instinct": - pass # No tile target, play directly. + "Repentance", "Instinct", "Ruin": + pass # No tile target — played directly (server handles placement). return results @@ -694,7 +701,7 @@ func _handle_board_click(mouse_pos: Vector2) -> void: if card.is_empty(): _set_mode(Mode.NONE); return var card_type : String = card.get("cardType", "") - if card_type in ["Repentance", "Instinct"]: + if card_type in ["Repentance", "Instinct", "Ruin"]: Game.send_play_card(_sel_card_id, 0, 0) _set_mode(Mode.NONE); return if coord.x < 0: @@ -1043,11 +1050,21 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void: _highlight_tiles(_valid_play_tiles(card), HI_GREEN) return - # Deselect if already selected. + # Ruin — server auto-places it; channel immediately on click. + if card.get("cardType", "") == "Ruin": + Game.send_play_card(iid, 0, 0) + return + + # Deselect if same card clicked again. if _mode == Mode.CARD_FROM_HAND and _sel_card_id == iid: _set_mode(Mode.NONE); return - # Normal Spirit/Ruin/Repentance/Instinct. + # If switching cards (or coming from TERRAMORPHA_SELECT), explicitly reset + # so the previous card's scale-up tween is released before entering the new mode. + if _mode in [Mode.CARD_FROM_HAND, Mode.TERRAMORPHA_SELECT]: + _set_mode(Mode.NONE) + + # Normal Spirit / Repentance / Instinct. _sel_card_id = iid _set_mode(Mode.CARD_FROM_HAND) _clear_highlights()