diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index c652a50..f80ed84 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -1219,7 +1219,24 @@ func _play_damage_animations(state: Dictionary) -> bool: if not seen_iids.has(iid): dying_iids[iid] = true + # Consume tracked target before any early return so it never bleeds into + # the next state update (e.g. a fully-blocked hit with 0 HP change). + var tracked_target : String = _last_attack_target_iid + _last_attack_target_iid = "" + if damaged_iids.is_empty() and dying_iids.is_empty(): + # Fully-blocked attack: attacker is mid-swing but the defender's defense + # absorbed all damage → no HP change, but play the blocked SFX. + if attacker_iid != "" and not tracked_target.is_empty() \ + and tracked_target != attacker_iid: + var blocked_iid := tracked_target + if attack_remaining > 0.0: + var tb := create_tween() + tb.tween_callback(func() -> void: + SFX.play(_sfx_for_unit(blocked_iid, "blockedSoundUrl")) + ).set_delay(attack_remaining) + else: + SFX.play(_sfx_for_unit(blocked_iid, "blockedSoundUrl")) return false # ── Detect counterattack: attacker took damage while mid-attack ───────── @@ -1227,8 +1244,6 @@ func _play_damage_animations(state: Dictionary) -> bool: # rely on them being in damaged_iids. Use the tracked target from the last # send_attack() call as the primary source, and fall back to any other # damaged unit if the tracked target isn't available. - var tracked_target : String = _last_attack_target_iid - _last_attack_target_iid = "" # consume; don't bleed into the next update var is_counterattack : bool = false var defender_iid : String = "" if attacker_iid != "" and damaged_iids.has(attacker_iid):