Add tactic cast motion effects

This commit is contained in:
2026-06-18 22:34:39 +09:00
parent 3273ec33ec
commit 70a34cf262
4 changed files with 168 additions and 1 deletions

View File

@@ -754,6 +754,7 @@ func try_cast_selected_skill(skill_id: String, target_cell: Vector2i) -> bool:
if skill_kind == "support" and not _skill_has_support_effects(skill):
return false
_emit_skill_motion(caster, target_cell, skill_kind)
caster["mp"] = max(0, int(caster.get("mp", 0)) - int(skill.get("mp_cost", 0)))
if skill_kind == "heal":
var total_healed := 0
@@ -3153,6 +3154,7 @@ func _execute_ai_skill_action(caster: Dictionary, action: Dictionary) -> bool:
if skill_kind == "support" and not _skill_has_support_effects(skill):
return false
_emit_skill_motion(caster, target_cell, skill_kind)
caster["mp"] = max(0, int(caster.get("mp", 0)) - int(skill.get("mp_cost", 0)))
if skill_kind == "heal":
var total_healed := 0
@@ -3267,6 +3269,17 @@ func _resolve_skill_damage(caster: Dictionary, target: Dictionary, skill: Dictio
return false
func _emit_skill_motion(caster: Dictionary, target_cell: Vector2i, skill_kind: String) -> void:
if caster.is_empty() or not is_inside(target_cell):
return
unit_action_motion_requested.emit(
str(caster.get("id", "")),
caster.get("pos", Vector2i(-1, -1)),
target_cell,
"skill_%s" % skill_kind
)
func _handle_unit_defeated(unit: Dictionary) -> void:
if unit.is_empty():
return