Add Repentance placeholder VFX — server broadcast + client effect
Server: - Add RepentancePlaceholderVisualPush DTO to GameMessages.cs - Add BroadcastToAllViewersAsync helper on GameHandlerBase - GamePlayCardHandler emits game.visual.repentance_placeholder to all players and spectators after a Repentance card resolves; sets hasCustomAnimation based on ability Animation.AssetUrl presence Client: - Add repentance_placeholder_visual signal and push-router case in Game.gd - New RepentancePlaceholderFx component: resolves source/target world positions, picks affinity + player team colors, tweens a glowing orb projectile to target and plays a torus ring + burst-mote impact - Wire component in game_screen.gd (_ready, _exit_tree, signal handler) 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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user