diff --git a/Client/origin-client/autoloads/Game.gd b/Client/origin-client/autoloads/Game.gd
index 0c147de..674ce72 100644
--- a/Client/origin-client/autoloads/Game.gd
+++ b/Client/origin-client/autoloads/Game.gd
@@ -83,6 +83,11 @@ signal player_pick_request(request_data: Dictionary)
## Payload keys: requestId, sourceInstanceId, effectType, revealedCardsJson, count
signal reveal_choice_pick_request(request_data: Dictionary)
+## Emitted when a Repentance card resolves with no custom animation asset.
+## Payload keys: eventId, sessionId, actorAccountId, sourceArchSpiritInstanceId,
+## cardInstanceId, cardDefinitionId, cardName, affinity, targets, hasCustomAnimation
+signal repentance_placeholder_visual(payload: Dictionary)
+
# ── State ─────────────────────────────────────────────────────────────────────
var session_id : String = ""
@@ -819,3 +824,6 @@ func _on_server_push(type: String, payload: Variant) -> void:
"game.ability.reveal_choice_pick_request":
reveal_choice_pick_request.emit(payload as Dictionary)
+
+ "game.visual.repentance_placeholder":
+ repentance_placeholder_visual.emit(payload as Dictionary)
diff --git a/Client/origin-client/scenes/game/components/effects/repentance_placeholder_fx.gd b/Client/origin-client/scenes/game/components/effects/repentance_placeholder_fx.gd
new file mode 100644
index 0000000..39398cb
--- /dev/null
+++ b/Client/origin-client/scenes/game/components/effects/repentance_placeholder_fx.gd
@@ -0,0 +1,267 @@
+class_name RepentancePlaceholderFx
+extends Node
+
+## Plays a placeholder projectile VFX when a Repentance card resolves without
+## a custom animation asset. Spawns a glowing orb that travels from the acting
+## player's ArchSpirit to the resolved target, then bursts into an impact ring.
+##
+## External refs (set by game_screen._ready):
+## pathfinder — for coord_to_world and board_distance
+## unit_bodies — Dictionary instanceId → StaticBody3D
+## units_root — Node3D that owns the 3D board unit nodes
+
+# ── External refs ─────────────────────────────────────────────────────────────
+
+var pathfinder : Pathfinder = null
+var unit_bodies : Dictionary = {} # instanceId → StaticBody3D
+var units_root : Node3D = null
+
+# ── Public API ────────────────────────────────────────────────────────────────
+
+## Called by game_screen when Game.repentance_placeholder_visual fires.
+func play(payload: Dictionary) -> void:
+ if bool(payload.get("hasCustomAnimation", false)):
+ return
+
+ var actor_id: String = str(payload.get("actorAccountId", ""))
+ var arch_id: String = str(payload.get("sourceArchSpiritInstanceId", ""))
+ var affinity: String = str(payload.get("affinity", ""))
+ var targets_raw: Variant = payload.get("targets", [])
+ var targets: Array = targets_raw as Array if targets_raw is Array else []
+
+ var src_pos: Vector3 = _resolve_arch_spirit_pos(arch_id)
+ var tgt_pos: Vector3 = _resolve_target_pos(targets, actor_id, src_pos)
+
+ var affinity_color: Color = GameConstants.AFFINITY_COLORS.get(affinity, Color(0.7, 0.55, 0.9))
+ var player_color: Color = _resolve_player_color(actor_id)
+
+ _spawn_projectile(src_pos, tgt_pos, affinity_color, player_color)
+
+
+# ── Position resolution ───────────────────────────────────────────────────────
+
+func _resolve_arch_spirit_pos(arch_instance_id: String) -> Vector3:
+ if not arch_instance_id.is_empty():
+ var body: StaticBody3D = unit_bodies.get(arch_instance_id) as StaticBody3D
+ if is_instance_valid(body):
+ return body.global_position + Vector3(0, 0.5, 0)
+
+ # Fallback: my own ArchSpirit from game state.
+ var my_arch: Dictionary = Game.get_my_player().get("archSpirit", {})
+ var pos: Dictionary = my_arch.get("position", {})
+ if not pos.is_empty() and pathfinder != null:
+ return pathfinder.coord_to_world(int(pos.get("x", 0)), int(pos.get("y", 0))) + Vector3(0, 0.8, 0)
+
+ return Vector3.ZERO
+
+
+func _resolve_target_pos(targets: Array, actor_id: String, fallback: Vector3) -> Vector3:
+ # 1. Unit instance id → current board body position.
+ for t: Variant in targets:
+ if not (t is Dictionary):
+ continue
+ var td: Dictionary = t as Dictionary
+ var inst_id: String = str(td.get("instanceId", td.get("instance_id", "")))
+ if inst_id.is_empty():
+ continue
+ var body: StaticBody3D = unit_bodies.get(inst_id) as StaticBody3D
+ if is_instance_valid(body):
+ return body.global_position + Vector3(0, 0.5, 0)
+
+ # 2. Tile coordinate.
+ for t: Variant in targets:
+ if not (t is Dictionary):
+ continue
+ var td: Dictionary = t as Dictionary
+ var coord_v: Variant = td.get("coord")
+ if coord_v is Dictionary and pathfinder != null:
+ var cd: Dictionary = coord_v as Dictionary
+ return pathfinder.coord_to_world(int(cd.get("x", 0)), int(cd.get("y", 0))) + Vector3(0, 0.6, 0)
+
+ # 3. Player ArchSpirit (target player given by instanceId = accountId in player-target actions).
+ for t: Variant in targets:
+ if not (t is Dictionary):
+ continue
+ var td: Dictionary = t as Dictionary
+ var inst_id: String = str(td.get("instanceId", td.get("instance_id", "")))
+ if inst_id.is_empty():
+ continue
+ # Try it as an account id — look for that player's arch spirit.
+ var all_players: Array = []
+ var state: Dictionary = Game.state
+ for p: Variant in state.get("players", []):
+ all_players.append(p)
+ for p: Variant in all_players:
+ if not (p is Dictionary):
+ continue
+ var pd: Dictionary = p as Dictionary
+ var acc: String = str(pd.get("accountId", ""))
+ if acc != inst_id:
+ continue
+ var arch: Dictionary = pd.get("archSpirit", {})
+ var apos: Dictionary = arch.get("position", {})
+ if not apos.is_empty() and pathfinder != null:
+ return pathfinder.coord_to_world(
+ int(apos.get("x", 0)), int(apos.get("y", 0))) + Vector3(0, 0.8, 0)
+
+ # 4. Fallback to source.
+ return fallback
+
+
+func _resolve_player_color(actor_id: String) -> Color:
+ var state: Dictionary = Game.state
+ var team_colors: Dictionary = state.get("teamColors", {})
+ # Find the actor's seat to get their team index.
+ var seat_order: Array = []
+ var so_raw: Variant = state.get("seatOrder", [])
+ if so_raw is Array:
+ seat_order = so_raw as Array
+ for i: int in seat_order.size():
+ if str(seat_order[i]) == actor_id:
+ # teamColors keys are ints (team index); seat index maps 1:1 in non-team modes.
+ var hex: String = str(team_colors.get(i, team_colors.get(str(i), "")))
+ if hex.length() >= 6:
+ return Color.html("#" + hex if not hex.begins_with("#") else hex)
+ # Fallback.
+ return Color(0.9, 0.7, 0.3)
+
+
+# ── Projectile spawning ───────────────────────────────────────────────────────
+
+func _spawn_projectile(
+ src: Vector3, tgt: Vector3,
+ affinity_color: Color, player_color: Color) -> void:
+
+ if units_root == null:
+ return
+
+ var dist: float = src.distance_to(tgt)
+ var travel_dur: float = clampf(dist * 0.18, 0.35, 0.8)
+
+ var root: Node3D = Node3D.new()
+ root.name = "RepentancePlaceholderFx"
+ root.position = src
+ units_root.add_child(root)
+
+ # Core orb (affinity color).
+ var orb: MeshInstance3D = _make_orb(affinity_color, 0.09)
+ root.add_child(orb)
+
+ # Inner spark (player color).
+ var spark: MeshInstance3D = _make_orb(player_color, 0.045)
+ root.add_child(spark)
+
+ # Trail motes orbiting the orb.
+ for i: int in range(4):
+ var angle: float = TAU * float(i) / 4.0
+ var offset: Vector3 = Vector3(cos(angle) * 0.06, 0.0, sin(angle) * 0.06)
+ var mote: MeshInstance3D = _make_orb(player_color.lerp(affinity_color, 0.4), 0.028)
+ mote.position = offset
+ root.add_child(mote)
+
+ # Travel tween.
+ var tween: Tween = create_tween()
+ tween.tween_property(root, "position", tgt, travel_dur)\
+ .set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
+ tween.tween_callback(func() -> void: _play_impact(root, tgt, affinity_color, player_color))
+
+
+func _play_impact(
+ projectile: Node3D, pos: Vector3,
+ affinity_color: Color, player_color: Color) -> void:
+
+ if is_instance_valid(projectile):
+ projectile.queue_free()
+
+ if units_root == null:
+ return
+
+ var impact_dur: float = randf_range(0.5, 0.8)
+
+ # Ring.
+ var ring: MeshInstance3D = _make_impact_ring(
+ affinity_color.lerp(player_color, 0.35), pos)
+ units_root.add_child(ring)
+
+ # Burst motes.
+ var rng: RandomNumberGenerator = RandomNumberGenerator.new()
+ rng.randomize()
+ var burst_root: Node3D = Node3D.new()
+ burst_root.name = "ImpactBurst"
+ burst_root.position = pos
+ units_root.add_child(burst_root)
+
+ for i: int in range(8):
+ var angle: float = TAU * float(i) / 8.0 + rng.randf_range(-0.2, 0.2)
+ var speed: float = rng.randf_range(0.28, 0.56)
+ var col: Color = affinity_color if i % 2 == 0 else player_color
+ var mote: MeshInstance3D = _make_orb(col, rng.randf_range(0.024, 0.055))
+ mote.position = Vector3.ZERO
+ burst_root.add_child(mote)
+ var end_pos: Vector3 = Vector3(cos(angle) * speed, rng.randf_range(0.0, 0.3), sin(angle) * speed)
+ var mt: Tween = create_tween()
+ mt.set_parallel(true)
+ mt.tween_property(mote, "position", end_pos, impact_dur)\
+ .set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_OUT)
+ mt.tween_property(mote, "scale", Vector3.ZERO, impact_dur)\
+ .set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
+
+ # Ring scale + fade.
+ var rt: Tween = create_tween()
+ rt.set_parallel(true)
+ rt.tween_property(ring, "scale", Vector3.ONE * 2.4, impact_dur)\
+ .set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_OUT)
+ var ring_mat: StandardMaterial3D = ring.material_override as StandardMaterial3D
+ if ring_mat != null:
+ rt.tween_method(func(a: float) -> void:
+ ring_mat.albedo_color.a = a, 0.75, 0.0, impact_dur)
+
+ # Cleanup.
+ var cleanup_delay: float = impact_dur + 0.4
+ get_tree().create_timer(cleanup_delay).timeout.connect(func() -> void:
+ if is_instance_valid(ring): ring.queue_free()
+ if is_instance_valid(burst_root): burst_root.queue_free())
+
+
+# ── Mesh helpers ──────────────────────────────────────────────────────────────
+
+func _make_orb(color: Color, radius: float) -> MeshInstance3D:
+ var mi: MeshInstance3D = MeshInstance3D.new()
+ var mesh: SphereMesh = SphereMesh.new()
+ mesh.radius = radius
+ mesh.height = radius * 2.0
+ mesh.radial_segments = 10
+ mesh.rings = 5
+ mi.mesh = mesh
+ var mat: StandardMaterial3D = StandardMaterial3D.new()
+ mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
+ mat.albedo_color = Color(color.r, color.g, color.b, 0.85)
+ mat.emission_enabled = true
+ mat.emission = color
+ mat.emission_energy_multiplier = 2.8
+ mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
+ mat.cull_mode = BaseMaterial3D.CULL_DISABLED
+ mi.material_override = mat
+ return mi
+
+
+func _make_impact_ring(color: Color, world_pos: Vector3) -> MeshInstance3D:
+ var mi: MeshInstance3D = MeshInstance3D.new()
+ var mesh: TorusMesh = TorusMesh.new()
+ mesh.inner_radius = 0.18
+ mesh.outer_radius = 0.22
+ mesh.rings = 16
+ mesh.ring_segments = 8
+ mi.mesh = mesh
+ mi.position = world_pos
+ mi.rotation_degrees.x = 90.0
+ var mat: StandardMaterial3D = StandardMaterial3D.new()
+ mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
+ mat.albedo_color = Color(color.r, color.g, color.b, 0.75)
+ mat.emission_enabled = true
+ mat.emission = color
+ mat.emission_energy_multiplier = 1.8
+ mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
+ mat.cull_mode = BaseMaterial3D.CULL_DISABLED
+ mi.material_override = mat
+ return mi
diff --git a/Client/origin-client/scenes/game/components/selection/ability_targeting.gd b/Client/origin-client/scenes/game/components/selection/ability_targeting.gd
index 3dad3b2..e828b69 100644
--- a/Client/origin-client/scenes/game/components/selection/ability_targeting.gd
+++ b/Client/origin-client/scenes/game/components/selection/ability_targeting.gd
@@ -150,6 +150,7 @@ func show_ability_panel(unit_id: String, unit: Dictionary) -> void:
var idx: int = ab.get("index", 0)
var ab_def: Dictionary = ab.get("def", {})
btn.pressed.connect(func() -> void:
+ hide_ability_panel()
ability_unit_id = unit_id
ability_idx = idx
ability_def = get_ability_actions(ab_def)
@@ -173,7 +174,9 @@ func show_ability_panel(unit_id: String, unit: Dictionary) -> void:
btn.text = aa.get("label", "")
btn.add_theme_font_size_override("font_size", 12)
var fn: Callable = aa.get("fn", Callable())
- btn.pressed.connect(func() -> void: fn.call())
+ btn.pressed.connect(func() -> void:
+ hide_ability_panel()
+ fn.call())
vbox.add_child(btn)
panel.add_child(vbox)
@@ -202,6 +205,16 @@ func current_target_mode() -> SelectionController.Mode:
return SelectionController.Mode.ABILITY_TARGET
+func current_board_target_type() -> String:
+ if ability_cur_action_idx < 0 or ability_cur_action_idx >= ability_def.size():
+ return "Unit"
+ if not (ability_def[ability_cur_action_idx] is Dictionary):
+ return "Unit"
+ var action: Dictionary = ability_def[ability_cur_action_idx] as Dictionary
+ var target_sel: Dictionary = action.get("target", {})
+ return str(target_sel.get("type", "Unit"))
+
+
## Advance through ability actions, entering board-target mode, player-pick, or sending.
func start_ability_targeting() -> void:
print("AbilityTargeting:: start_ability_targeting")
@@ -343,6 +356,81 @@ func highlight_ability_targets(action: Dictionary) -> void:
emit_signal("highlight_add_requested", int(pos.get("x", 0)), int(pos.get("y", 0)), "ability")
+func is_valid_board_target(coord: Vector2i, unit_id: String) -> bool:
+ if ability_cur_action_idx < 0 or ability_cur_action_idx >= ability_def.size():
+ return false
+ if not (ability_def[ability_cur_action_idx] is Dictionary):
+ return false
+
+ var action: Dictionary = ability_def[ability_cur_action_idx] as Dictionary
+ var target_sel: Dictionary = action.get("target", {})
+ var type_: String = target_sel.get("type", "Unit")
+ var ownership: String = target_sel.get("ownership", "Any")
+ var filters_v: Variant = target_sel.get("filters", [])
+ var filters: Array = filters_v as Array if filters_v is Array else []
+
+ if type_ == "Tile":
+ return coord.x >= 0 and tile_passes_filters(coord.x, coord.y, filters) \
+ and _target_coord_passes_range(coord)
+
+ if unit_id.is_empty():
+ return false
+ var unit: Dictionary = Game.get_unit_by_id(unit_id)
+ if unit.is_empty():
+ return false
+ if type_ in ["Spirit", "ArchSpirit", "SpiritToken", "Ruin"] \
+ and str(unit.get("cardType", "")).to_lower() != type_.to_lower():
+ return false
+ if not _target_unit_passes_ownership(unit_id, ownership):
+ return false
+ if not unit_passes_filters(unit, filters):
+ return false
+ return _target_unit_passes_range(unit)
+
+
+func _target_unit_passes_ownership(unit_id: String, ownership: String) -> bool:
+ match ownership:
+ "Enemy":
+ return unit_registry == null or unit_registry.enemy_unit_ids.has(unit_id)
+ "Owner", "Ally":
+ return unit_registry == null or unit_registry.friendly_unit_ids.has(unit_id)
+ "Any":
+ return true
+ _:
+ return true
+
+
+func _target_unit_passes_range(unit: Dictionary) -> bool:
+ var pos: Dictionary = unit.get("position", {})
+ if pos.is_empty():
+ return false
+ return _target_coord_passes_range(Vector2i(int(pos.get("x", 0)), int(pos.get("y", 0))))
+
+
+func _target_coord_passes_range(coord: Vector2i) -> bool:
+ var linear_only: bool = ability_range.get("linearonly", false)
+ var requires_los: bool = ability_range.get("requireslos", false)
+ if ability_range.is_empty() and not linear_only and not requires_los:
+ return true
+
+ var src: Dictionary = Game.get_unit_by_id(ability_unit_id)
+ var src_pos: Dictionary = src.get("position", {})
+ if src_pos.is_empty():
+ return false
+
+ var sx: int = int(src_pos.get("x", 0))
+ var sy: int = int(src_pos.get("y", 0))
+ if linear_only and not is_linear(sx, sy, coord.x, coord.y):
+ return false
+ if requires_los and pathfinder != null and not pathfinder.client_has_los(sx, sy, coord.x, coord.y):
+ return false
+ if not ability_range.is_empty() and pathfinder != null:
+ var dist: int = pathfinder.board_distance(coord.x, coord.y, sx, sy)
+ if dist < int(ability_range.get("min", 0)) or dist > int(ability_range.get("max", 999)):
+ return false
+ return true
+
+
func unit_passes_filters(unit: Dictionary, filters: Array) -> bool:
if filters.is_empty():
return true
diff --git a/Client/origin-client/scenes/game/components/selection/selection_controller.gd b/Client/origin-client/scenes/game/components/selection/selection_controller.gd
index bc67292..c9e05d6 100644
--- a/Client/origin-client/scenes/game/components/selection/selection_controller.gd
+++ b/Client/origin-client/scenes/game/components/selection/selection_controller.gd
@@ -306,13 +306,10 @@ func _handle_unit_selected_click(coord: Vector2i, unit_id: String) -> void:
func _handle_sacrifice_click(coord: Vector2i, unit_id: String) -> void:
var resolved: String = _resolve_occupant(coord, unit_id)
- if resolved.is_empty() or (unit_registry != null and not unit_registry.friendly_unit_ids.has(resolved)):
+ if not _is_valid_sacrifice_target(resolved):
set_mode(Mode.NONE)
return
var unit: Dictionary = Game.get_unit_by_id(resolved)
- if unit.is_empty() or unit.get("cardType", "") == "ArchSpirit":
- set_mode(Mode.NONE)
- return
_confirm_sacrifice(resolved, unit.get("name", "this spirit"))
@@ -329,11 +326,23 @@ func _handle_ability_target_click(coord: Vector2i, unit_id: String) -> void:
Game.send_tile_pick_response(rid, coord.x, coord.y)
return
+ var resolved: String = _resolve_occupant(coord, unit_id)
+ if not ability_targeting.is_valid_board_target(coord, resolved):
+ set_mode(Mode.NONE)
+ return
+
var collected: bool = false
- if not unit_id.is_empty():
+ if ability_targeting.current_board_target_type() == "Tile" and coord.x >= 0:
ability_targeting.ability_targets.append({
"actionIndex": ability_targeting.ability_cur_action_idx,
- "instanceId": unit_id
+ "coord": { "x": coord.x, "y": coord.y }
+ })
+ ability_targeting.ability_targets_this_action += 1
+ collected = true
+ elif not resolved.is_empty():
+ ability_targeting.ability_targets.append({
+ "actionIndex": ability_targeting.ability_cur_action_idx,
+ "instanceId": resolved
})
ability_targeting.ability_targets_this_action += 1
collected = true
@@ -353,6 +362,22 @@ func _handle_ability_target_click(coord: Vector2i, unit_id: String) -> void:
# ── ArchSpirit popup menu ─────────────────────────────────────────────────────
+func _is_valid_sacrifice_target(unit_id: String) -> bool:
+ if unit_id.is_empty():
+ return false
+ var unit: Dictionary = Game.get_unit_by_id(unit_id)
+ if unit.is_empty() or unit.get("cardType", "") == "ArchSpirit":
+ return false
+ if unit_registry != null and not unit_registry.friendly_unit_ids.has(unit_id):
+ return false
+ if tile_target_resolver == null:
+ return true
+ for spirit: Dictionary in tile_target_resolver.valid_sacrifice_spirits():
+ if str(spirit.get("instanceId", "")) == unit_id:
+ return true
+ return false
+
+
func show_arch_spirit_menu(unit_id: String, unit: Dictionary) -> void:
var menu: PopupMenu = PopupMenu.new()
add_child(menu)
diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd
index 1d16f5b..359716a 100644
--- a/Client/origin-client/scenes/game/game_screen.gd
+++ b/Client/origin-client/scenes/game/game_screen.gd
@@ -33,20 +33,21 @@ extends Node3D
# ── Code-only component vars ──────────────────────────────────────────────────
-var _board_ctrl : BoardController = null
-var _cam_ctrl : CameraController = null
-var _pathfinder : Pathfinder = null
-var _unit_reg : UnitRegistry = null
-var _tile_resolver : TileTargetResolver = null
-var _mesh_builder : UnitMeshBuilder = null
-var _animator : UnitAnimator = null
-var _input_handler : BoardInputHandler = null
-var _tile_drawer : TileDrawer = null
-var _skybox : SkyboxController = null
-var _inactive_dlgs : InactiveDialogs = null
-var _sel_ctrl : SelectionController = null
-var _abt : AbilityTargeting = null
-var _prompt_handler: ServerPromptHandler = null
+var _board_ctrl : BoardController = null
+var _cam_ctrl : CameraController = null
+var _pathfinder : Pathfinder = null
+var _unit_reg : UnitRegistry = null
+var _tile_resolver : TileTargetResolver = null
+var _mesh_builder : UnitMeshBuilder = null
+var _animator : UnitAnimator = null
+var _input_handler : BoardInputHandler = null
+var _tile_drawer : TileDrawer = null
+var _skybox : SkyboxController = null
+var _inactive_dlgs : InactiveDialogs = null
+var _sel_ctrl : SelectionController = null
+var _abt : AbilityTargeting = null
+var _prompt_handler: ServerPromptHandler = null
+var _repentance_fx : RepentancePlaceholderFx = null
# ── @onready node refs ────────────────────────────────────────────────────────
@@ -233,6 +234,13 @@ func _ready() -> void:
_prompt_handler.highlight_add_requested.connect(_add_highlight)
_prompt_handler.highlights_cleared.connect(_clear_highlights)
+ # RepentancePlaceholderFx
+ _repentance_fx = RepentancePlaceholderFx.new()
+ _repentance_fx.pathfinder = _pathfinder
+ _repentance_fx.unit_bodies = _mesh_builder.unit_bodies
+ _repentance_fx.units_root = _units_root
+ add_child(_repentance_fx)
+
# BoardInputHandler
_input_handler = BoardInputHandler.new()
_input_handler.hold_timer = _hold_timer
@@ -301,6 +309,7 @@ func _ready() -> void:
Game.tile_pick_request.connect(_prompt_handler.on_tile_pick_request)
Game.player_pick_request.connect(_prompt_handler.on_player_pick_request)
Game.reveal_choice_pick_request.connect(_prompt_handler.on_reveal_choice_pick_request)
+ Game.repentance_placeholder_visual.connect(_on_repentance_placeholder_visual)
# ── 6. Camera, skybox, hover, chat ───────────────────────────────────────
_cam_ctrl.sync_cam_ctrl_panel()
@@ -373,6 +382,8 @@ func _exit_tree() -> void:
Game.player_pick_request.disconnect(_prompt_handler.on_player_pick_request)
if Game.reveal_choice_pick_request.is_connected(_prompt_handler.on_reveal_choice_pick_request):
Game.reveal_choice_pick_request.disconnect(_prompt_handler.on_reveal_choice_pick_request)
+ if Game.repentance_placeholder_visual.is_connected(_on_repentance_placeholder_visual):
+ Game.repentance_placeholder_visual.disconnect(_on_repentance_placeholder_visual)
_skybox.clear_stars()
_reset_unit_hover_glow()
Chat.set_bubble_host(null)
@@ -1117,6 +1128,11 @@ func _dict_get_any(dict: Dictionary, keys: Array, fallback: Variant = null) -> V
return fallback
+func _on_repentance_placeholder_visual(payload: Dictionary) -> void:
+ if _repentance_fx != null:
+ _repentance_fx.play(payload)
+
+
func _place_highlight_quad(quad: MeshInstance3D, x: int, y: int,
col: Color, texture: Texture2D = null) -> void:
var tile_top: float = _board_ctrl.tile_visual_tops.get(
diff --git a/Server/src/SOR.Game/GameMessages.cs b/Server/src/SOR.Game/GameMessages.cs
index 8980786..4b0a48a 100644
--- a/Server/src/SOR.Game/GameMessages.cs
+++ b/Server/src/SOR.Game/GameMessages.cs
@@ -603,6 +603,25 @@ public sealed record GameUnsubscribeActivityResponse;
///
public sealed record GameActivityPush(string EventType, string SessionId);
+///
+/// Broadcast to every participant and spectator when a Repentance card resolves
+/// and the ability has no usable custom animation asset.
+/// Clients use this to play a placeholder projectile VFX from the acting player's
+/// ArchSpirit to the ability target.
+/// Clients MUST ignore this push when HasCustomAnimation is true.
+///
+public sealed record RepentancePlaceholderVisualPush(
+ string EventId,
+ string SessionId,
+ string ActorAccountId,
+ string SourceArchSpiritInstanceId,
+ string CardInstanceId,
+ string CardDefinitionId,
+ string CardName,
+ string Affinity,
+ IReadOnlyList Targets,
+ bool HasCustomAnimation);
+
// ── DTOs ─────────────────────────────────────────────────────────────────────
///
diff --git a/Server/src/SOR.Game/Handlers/GameHandlerBase.cs b/Server/src/SOR.Game/Handlers/GameHandlerBase.cs
index 8adee43..da596ea 100644
--- a/Server/src/SOR.Game/Handlers/GameHandlerBase.cs
+++ b/Server/src/SOR.Game/Handlers/GameHandlerBase.cs
@@ -113,6 +113,26 @@ internal abstract class GameHandlerBase
await Task.WhenAll(subs.Select(uid => clientPush.PushAsync(uid, push, ct)));
}
+ ///
+ /// Broadcast an arbitrary push message to all players and spectators in a session.
+ ///
+ internal static async Task BroadcastToAllViewersAsync(
+ IClientPush clientPush,
+ GameSession session,
+ ServerMessage push,
+ CancellationToken ct)
+ {
+ var allIds = GetAllPlayerIds(session);
+ var tasks = allIds.Select(pid => clientPush.PushAsync(pid, push, ct)).ToList();
+ var registry = SpectatorRegistryService.Instance;
+ if (registry != null)
+ {
+ foreach (var specId in registry.GetSpectators(session.Id))
+ tasks.Add(clientPush.PushAsync(specId.ToString(), push, ct));
+ }
+ await Task.WhenAll(tasks);
+ }
+
///
/// Push the updated game state to both players and any current spectators.
/// When is supplied a structured delta (game.state_delta)
diff --git a/Server/src/SOR.Game/Handlers/GamePlayCardHandler.cs b/Server/src/SOR.Game/Handlers/GamePlayCardHandler.cs
index 75e2f16..d54b496 100644
--- a/Server/src/SOR.Game/Handlers/GamePlayCardHandler.cs
+++ b/Server/src/SOR.Game/Handlers/GamePlayCardHandler.cs
@@ -2,6 +2,7 @@ namespace SOR.Game.Handlers;
using System.Text.Json;
using SOR.Database.Contexts;
+using SOR.Game.Abilities;
using SOR.Game.Grid;
using SOR.Networking.Abstractions.Messaging;
using SOR.Networking.Abstractions.Push;
@@ -42,6 +43,9 @@ internal sealed class GamePlayCardHandler : GameHandlerBase, IMessageHandler
var prevStateJson = session.StateJson!;
var state = GameEngine.Deserialize(prevStateJson);
+ // Capture card data before ChannelCard moves it from hand.
+ var card = state.Players[actorId].Hand.First(c => c.InstanceId == req.CardInstanceId);
+
// Build the coordinate list for the engine.
// TargetTiles (multi-tile) takes priority; fall back to TargetTile (single-tile).
IReadOnlyList? targets = null;
@@ -58,6 +62,31 @@ internal sealed class GamePlayCardHandler : GameHandlerBase, IMessageHandler
var dto = GameEngine.ToDto(newState, actorId);
await PushStateToPlayersAsync(_clientPush, session, newState, ct, prevStateJson);
+ // Visual-only push for Repentance cards (no gameplay state, transient).
+ if (card.CardType == "Repentance")
+ {
+ var archSpirit = newState.Players[actorId].ArchSpirit;
+ var abilities = AbilitySystem.ParseAbilities(card.AbilitiesJson);
+ var hasCustomAnim = abilities.Length > 0
+ && abilities[0].Animation is { } anim
+ && !string.IsNullOrEmpty(anim.AssetUrl);
+
+ var visualPush = ServerMessage.Push("game.visual.repentance_placeholder",
+ new RepentancePlaceholderVisualPush(
+ EventId: Guid.NewGuid().ToString("N")[..8],
+ SessionId: session.Id.ToString(),
+ ActorAccountId: actorId,
+ SourceArchSpiritInstanceId: archSpirit?.InstanceId ?? string.Empty,
+ CardInstanceId: card.InstanceId,
+ CardDefinitionId: card.CardDefinitionId.ToString(),
+ CardName: card.Name,
+ Affinity: card.Affinity,
+ Targets: req.Targets ?? [],
+ HasCustomAnimation: hasCustomAnim));
+
+ await BroadcastToAllViewersAsync(_clientPush, session, visualPush, ct);
+ }
+
return ServerMessage.Reply("game.play_card.ack", message.Seq, new GamePlayCardResponse(dto));
}
}