From 87f5a3345d0e901b996410ed9a495f52385759cb Mon Sep 17 00:00:00 2001
From: James Melkonian <jemelkonian@mailbox.org>
Date: Tue, 7 Feb 2023 16:57:22 +0000
Subject: [PATCH] Fix sword sfx

---
 CHANGELOG.md                 |  1 +
 assets/voxygen/audio/sfx.ron | 46 ++++++++++++++++++++++++++++++++----
 common/src/comp/ability.rs   | 19 ++++++++++-----
 3 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a8ed6d0e5a..72b3084000c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Stat diff now displays correctly for armor
 - Lamps, embers and campfires use glowing indices
 - Non-potion drinks no longer heal as much as potions.
+- Added SFX to the new sword abilities
 
 ## [0.14.0] - 2023-01-07
 
diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron
index b1a7b0b9c71..b48df9bebc7 100644
--- a/assets/voxygen/audio/sfx.ron
+++ b/assets/voxygen/audio/sfx.ron
@@ -306,21 +306,39 @@
             ],
             threshold: 0.5,
         ),
-        Attack(ComboMelee(Action, 1), Sword): (
+        Attack(ComboMelee2(Action), Sword): (
             files: [
                 "voxygen.audio.sfx.abilities.swing_sword",
             ],
             threshold: 0.7,
         ),
-        Attack(ComboMelee(Action, 2), Sword): (
+        Attack(FinisherMelee(Action), Sword): (
             files: [
-                "voxygen.audio.sfx.abilities.separated_second_swing",
+                "voxygen.audio.sfx.abilities.swing_sword",
             ],
             threshold: 0.7,
         ),
-        Attack(ComboMelee(Action, 3), Sword): (
+        Attack(DiveMelee(Action), Sword): (
             files: [
-                "voxygen.audio.sfx.abilities.separated_third_swing",
+                "voxygen.audio.sfx.abilities.swing_sword",
+            ],
+            threshold: 0.7,
+        ),
+        Attack(RiposteMelee(Action), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.swing_sword",
+            ],
+            threshold: 0.7,
+        ),
+        Attack(RapidMelee(Action), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.swing_sword",
+            ],
+            threshold: 0.7,
+        ),
+        Attack(ChargedMelee(Action), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.swing_sword",
             ],
             threshold: 0.7,
         ),
@@ -336,6 +354,24 @@
             ],
             threshold: 0.7,
         ),
+        Attack(ComboMelee(Action, 1), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.swing_sword",
+            ],
+            threshold: 0.7,
+        ),
+        Attack(ComboMelee(Action, 2), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.separated_second_swing",
+            ],
+            threshold: 0.7,
+        ),
+        Attack(ComboMelee(Action, 3), Sword): (
+            files: [
+                "voxygen.audio.sfx.abilities.separated_third_swing",
+            ],
+            threshold: 0.7,
+        ),
         Inventory(CollectedTool(Sword)): (
             files: [
                 "voxygen.audio.sfx.inventory.pickup_sword",
diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs
index fe51ea06fc4..17ec38a8d04 100644
--- a/common/src/comp/ability.rs
+++ b/common/src/comp/ability.rs
@@ -399,6 +399,11 @@ pub enum CharacterAbilityType {
     DashMelee(StageSection),
     BasicBlock,
     ComboMelee(StageSection, u32),
+    ComboMelee2(StageSection),
+    FinisherMelee(StageSection),
+    DiveMelee(StageSection),
+    RiposteMelee(StageSection),
+    RapidMelee(StageSection),
     LeapMelee(StageSection),
     SpinMelee(StageSection),
     Music(StageSection),
@@ -420,6 +425,13 @@ impl From<&CharacterState> for CharacterAbilityType {
             CharacterState::BasicBlock(_) => Self::BasicBlock,
             CharacterState::LeapMelee(data) => Self::LeapMelee(data.stage_section),
             CharacterState::ComboMelee(data) => Self::ComboMelee(data.stage_section, data.stage),
+            CharacterState::ComboMelee2(data) => {
+                data.stage_section.map_or(Self::Other, Self::ComboMelee2)
+            },
+            CharacterState::FinisherMelee(data) => Self::FinisherMelee(data.stage_section),
+            CharacterState::DiveMelee(data) => Self::DiveMelee(data.stage_section),
+            CharacterState::RiposteMelee(data) => Self::RiposteMelee(data.stage_section),
+            CharacterState::RapidMelee(data) => Self::RapidMelee(data.stage_section),
             CharacterState::SpinMelee(data) => Self::SpinMelee(data.stage_section),
             CharacterState::ChargedMelee(data) => Self::ChargedMelee(data.stage_section),
             CharacterState::ChargedRanged(_) => Self::ChargedRanged,
@@ -446,12 +458,7 @@ impl From<&CharacterState> for CharacterAbilityType {
             | CharacterState::UseItem(_)
             | CharacterState::SpriteInteract(_)
             | CharacterState::Skate(_)
-            | CharacterState::Wallrun(_)
-            | CharacterState::ComboMelee2(_)
-            | CharacterState::FinisherMelee(_)
-            | CharacterState::DiveMelee(_)
-            | CharacterState::RiposteMelee(_)
-            | CharacterState::RapidMelee(_) => Self::Other,
+            | CharacterState::Wallrun(_) => Self::Other,
         }
     }
 }
-- 
GitLab