Add tactic cast motion effects
This commit is contained in:
@@ -52,6 +52,7 @@ const UNIT_CAVALRY_ATTACK_DURATION := 0.42
|
||||
const UNIT_ARROW_ATTACK_DURATION := 0.36
|
||||
const UNIT_COMMAND_ATTACK_DURATION := 0.38
|
||||
const UNIT_HEAVY_ATTACK_DURATION := 0.34
|
||||
const UNIT_TACTIC_CAST_DURATION := 0.42
|
||||
const DIALOGUE_PANEL_POSITION := Vector2(96, 448)
|
||||
const DIALOGUE_PANEL_SIZE := Vector2(1040, 210)
|
||||
const DIALOGUE_PORTRAIT_SIZE := Vector2(164, 186)
|
||||
@@ -2051,6 +2052,12 @@ func _draw_action_effect(profile: String, start: Vector2, end: Vector2, progress
|
||||
_draw_command_attack_effect(start, end, progress, peak, team_color)
|
||||
elif profile == "heavy_strike":
|
||||
_draw_heavy_attack_effect(end, peak, team_color)
|
||||
elif profile == "tactic_damage":
|
||||
_draw_tactic_damage_effect(start, end, progress, peak, team_color)
|
||||
elif profile == "tactic_heal":
|
||||
_draw_tactic_heal_effect(start, end, progress, peak, team_color)
|
||||
elif profile == "tactic_support":
|
||||
_draw_tactic_support_effect(start, end, progress, peak, team_color)
|
||||
else:
|
||||
_draw_slash_attack_effect(end, peak, team_color)
|
||||
|
||||
@@ -2119,6 +2126,47 @@ func _draw_heavy_attack_effect(end: Vector2, peak: float, team_color: Color) ->
|
||||
draw_arc(end, 10.0 + 18.0 * peak, 0.0, TAU, 48, Color(1.0, 0.68, 0.24, 0.26 * peak), 3.0)
|
||||
|
||||
|
||||
func _draw_tactic_damage_effect(start: Vector2, end: Vector2, progress: float, peak: float, team_color: Color) -> void:
|
||||
var caster_color := team_color.lightened(0.58)
|
||||
caster_color.a = 0.34 * peak
|
||||
var fire_color := Color(1.0, 0.38, 0.18, 0.52 * peak)
|
||||
draw_arc(start, 12.0 + 7.0 * peak, progress * TAU, progress * TAU + PI * 1.55, 36, caster_color, 2.0)
|
||||
draw_line(start, end, Color(1.0, 0.62, 0.28, 0.30 * peak), 2.0)
|
||||
for index in range(3):
|
||||
var angle := progress * TAU + float(index) * TAU / 3.0
|
||||
var spark := Vector2(cos(angle), sin(angle))
|
||||
draw_line(end - spark * (5.0 + 4.0 * peak), end + spark * (12.0 + 6.0 * peak), fire_color, 2.0)
|
||||
draw_circle(end, 6.0 + 10.0 * peak, Color(1.0, 0.50, 0.18, 0.18 * peak))
|
||||
|
||||
|
||||
func _draw_tactic_heal_effect(start: Vector2, end: Vector2, progress: float, peak: float, team_color: Color) -> void:
|
||||
var line_color := Color(0.48, 1.0, 0.60, 0.24 * peak)
|
||||
if start.distance_to(end) > 0.01:
|
||||
draw_line(start, end, line_color, 2.0)
|
||||
var ring_color := Color(0.42, 1.0, 0.54, 0.42 * peak)
|
||||
draw_arc(end, 9.0 + 12.0 * peak, -progress * TAU, -progress * TAU + PI * 1.70, 44, ring_color, 2.0)
|
||||
draw_arc(end, 19.0 - 5.0 * peak, progress * TAU, progress * TAU + PI * 1.25, 40, Color(0.88, 1.0, 0.72, 0.32 * peak), 2.0)
|
||||
draw_line(end + Vector2(-7, 0), end + Vector2(7, 0), Color(0.80, 1.0, 0.78, 0.54 * peak), 2.5)
|
||||
draw_line(end + Vector2(0, -7), end + Vector2(0, 7), Color(0.80, 1.0, 0.78, 0.54 * peak), 2.5)
|
||||
var caster_glow := team_color.lightened(0.62)
|
||||
caster_glow.a = 0.20 * peak
|
||||
draw_circle(start, 6.0 + 4.0 * peak, caster_glow)
|
||||
|
||||
|
||||
func _draw_tactic_support_effect(start: Vector2, end: Vector2, progress: float, peak: float, team_color: Color) -> void:
|
||||
var banner := team_color.lightened(0.48)
|
||||
banner.a = 0.46 * peak
|
||||
if start.distance_to(end) > 0.01:
|
||||
draw_line(start, end, Color(1.0, 0.86, 0.30, 0.20 * peak), 1.5)
|
||||
draw_line(end + Vector2(-10, -16), end + Vector2(-10, 12), banner, 2.5)
|
||||
draw_rect(Rect2(end + Vector2(-8, -15), Vector2(20, 12)), Color(1.0, 0.82, 0.22, 0.28 * peak))
|
||||
draw_arc(end, 12.0 + 8.0 * peak, progress * TAU, progress * TAU + PI * 1.45, 36, Color(1.0, 0.92, 0.38, 0.36 * peak), 2.0)
|
||||
for index in range(3):
|
||||
var angle := -PI * 0.5 + float(index - 1) * 0.52
|
||||
var ray := Vector2(cos(angle), sin(angle))
|
||||
draw_line(end + ray * 7.0, end + ray * (18.0 + 5.0 * peak), Color(1.0, 0.96, 0.62, 0.25 * peak), 1.5)
|
||||
|
||||
|
||||
func _draw_slash_attack_effect(end: Vector2, peak: float, team_color: Color) -> void:
|
||||
var flash := team_color.lightened(0.45)
|
||||
flash.a = 0.55 * peak
|
||||
@@ -2164,6 +2212,15 @@ func _draw_action_impact_cue(cue: String, start: Vector2, end: Vector2, progress
|
||||
var angle := float(index) * PI * 0.5 + progress * PI * 0.25
|
||||
var crack := Vector2(cos(angle), sin(angle))
|
||||
draw_line(end + crack * radius * 0.16, end + crack * radius * (0.54 + 0.16 * peak), Color(0.96, 0.82, 0.42, 0.34 * peak), 2.0)
|
||||
elif cue == "tactic_damage":
|
||||
draw_arc(end, radius * (0.35 + peak * 0.38), 0.0, TAU, 44, Color(1.0, 0.34, 0.18, 0.28 * peak), 3.0)
|
||||
draw_arc(end, radius * 0.62, progress * TAU, progress * TAU + PI * 1.20, 36, Color(1.0, 0.82, 0.32, 0.34 * peak), 2.0)
|
||||
elif cue == "tactic_heal":
|
||||
draw_arc(end, radius * (0.40 + peak * 0.24), 0.0, TAU, 48, Color(0.48, 1.0, 0.54, 0.30 * peak), 2.5)
|
||||
draw_circle(end, radius * 0.14 + radius * 0.10 * peak, Color(0.78, 1.0, 0.74, 0.22 * peak))
|
||||
elif cue == "tactic_support":
|
||||
draw_arc(end, radius * (0.48 + peak * 0.18), -PI * 0.10, PI * 1.10, 40, Color(1.0, 0.88, 0.28, 0.30 * peak), 2.5)
|
||||
draw_line(end + Vector2(-radius * 0.38, radius * 0.26), end + Vector2(radius * 0.38, radius * 0.26), Color(1.0, 0.94, 0.50, 0.30 * peak), 2.0)
|
||||
else:
|
||||
draw_line(end - side * radius * 0.48, end + side * radius * 0.48, hot, 2.0)
|
||||
draw_circle(end, radius * 0.32 + radius * 0.18 * peak, Color(1.0, 0.82, 0.34, 0.18 * peak))
|
||||
@@ -3219,10 +3276,12 @@ func _on_unit_motion_requested(unit_id: String, from_cell: Vector2i, to_cell: Ve
|
||||
|
||||
|
||||
func _on_unit_action_motion_requested(unit_id: String, from_cell: Vector2i, to_cell: Vector2i, action_kind: String) -> void:
|
||||
if unit_id.is_empty() or from_cell == to_cell:
|
||||
if unit_id.is_empty():
|
||||
return
|
||||
var unit := state.get_unit(unit_id)
|
||||
var profile := _unit_action_motion_profile(unit, from_cell, to_cell, action_kind)
|
||||
if from_cell == to_cell and not _action_motion_allows_same_cell(profile):
|
||||
return
|
||||
unit_action_motion_by_unit[unit_id] = {
|
||||
"from": from_cell,
|
||||
"to": to_cell,
|
||||
@@ -3242,6 +3301,12 @@ func _on_unit_action_motion_requested(unit_id: String, from_cell: Vector2i, to_c
|
||||
|
||||
|
||||
func _unit_action_motion_profile(unit: Dictionary, from_cell: Vector2i, to_cell: Vector2i, _action_kind: String) -> String:
|
||||
if _action_kind == "skill_heal":
|
||||
return "tactic_heal"
|
||||
if _action_kind == "skill_support":
|
||||
return "tactic_support"
|
||||
if _action_kind.begins_with("skill_"):
|
||||
return "tactic_damage"
|
||||
var class_id := str(unit.get("class_id", ""))
|
||||
var distance := absi(from_cell.x - to_cell.x) + absi(from_cell.y - to_cell.y)
|
||||
if class_id.contains("archer") or class_id.contains("marksman") or (int(unit.get("range", 1)) > 1 and distance > 1):
|
||||
@@ -3260,6 +3325,8 @@ func _unit_action_motion_profile(unit: Dictionary, from_cell: Vector2i, to_cell:
|
||||
func _action_motion_style(profile: String) -> String:
|
||||
if profile == "arrow":
|
||||
return "ranged"
|
||||
if profile.begins_with("tactic_"):
|
||||
return "tactic"
|
||||
return "melee"
|
||||
|
||||
|
||||
@@ -3274,6 +3341,8 @@ func _action_motion_duration(profile: String) -> float:
|
||||
return UNIT_COMMAND_ATTACK_DURATION
|
||||
if profile == "heavy_strike":
|
||||
return UNIT_HEAVY_ATTACK_DURATION
|
||||
if profile.begins_with("tactic_"):
|
||||
return UNIT_TACTIC_CAST_DURATION
|
||||
return UNIT_ATTACK_ANIMATION_DURATION
|
||||
|
||||
|
||||
@@ -3288,9 +3357,15 @@ func _action_motion_lunge_scale(profile: String) -> float:
|
||||
return 0.20
|
||||
if profile == "heavy_strike":
|
||||
return 1.15
|
||||
if profile.begins_with("tactic_"):
|
||||
return 0.12
|
||||
return 1.0
|
||||
|
||||
|
||||
func _action_motion_allows_same_cell(profile: String) -> bool:
|
||||
return profile.begins_with("tactic_")
|
||||
|
||||
|
||||
func _action_motion_vfx_signature(profile: String) -> String:
|
||||
if profile == "arrow":
|
||||
return "piercing_trace"
|
||||
@@ -3302,6 +3377,12 @@ func _action_motion_vfx_signature(profile: String) -> String:
|
||||
return "command_ring"
|
||||
if profile == "heavy_strike":
|
||||
return "shock_crack"
|
||||
if profile == "tactic_damage":
|
||||
return "tactic_flare"
|
||||
if profile == "tactic_heal":
|
||||
return "healing_sigil"
|
||||
if profile == "tactic_support":
|
||||
return "order_banner"
|
||||
return "slash_flash"
|
||||
|
||||
|
||||
@@ -3316,6 +3397,12 @@ func _action_motion_impact_cue(profile: String) -> String:
|
||||
return "command"
|
||||
if profile == "heavy_strike":
|
||||
return "crush"
|
||||
if profile == "tactic_damage":
|
||||
return "tactic_damage"
|
||||
if profile == "tactic_heal":
|
||||
return "tactic_heal"
|
||||
if profile == "tactic_support":
|
||||
return "tactic_support"
|
||||
return "slash"
|
||||
|
||||
|
||||
@@ -3330,6 +3417,12 @@ func _action_motion_impact_radius(profile: String) -> float:
|
||||
return 24.0
|
||||
if profile == "heavy_strike":
|
||||
return 28.0
|
||||
if profile == "tactic_damage":
|
||||
return 26.0
|
||||
if profile == "tactic_heal":
|
||||
return 23.0
|
||||
if profile == "tactic_support":
|
||||
return 24.0
|
||||
return 16.0
|
||||
|
||||
|
||||
@@ -3344,6 +3437,8 @@ func _action_motion_sfx(profile: String) -> String:
|
||||
return "skill_cast"
|
||||
if profile == "heavy_strike":
|
||||
return "slash"
|
||||
if profile.begins_with("tactic_"):
|
||||
return "skill_cast"
|
||||
return "slash"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user