From d818ea2f1d081bf3702a1987145fd6506b44405a Mon Sep 17 00:00:00 2001
From: Sam <samuelkeiffer@gmail.com>
Date: Sun, 28 Feb 2021 08:50:33 -0500
Subject: [PATCH] Fixes being stuck in roll when interrupting combo melee.

---
 common/src/states/roll.rs  | 21 +++++++++++----------
 common/src/states/utils.rs | 10 ----------
 2 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/common/src/states/roll.rs b/common/src/states/roll.rs
index 4f46f606de..3392219782 100644
--- a/common/src/states/roll.rs
+++ b/common/src/states/roll.rs
@@ -115,7 +115,16 @@ impl CharacterBehavior for Data {
                 } else {
                     // Done
                     if let Some((key, stage)) = self.was_combo {
-                        resume_combo(data, &mut update, key, stage);
+                        if ability_key_is_pressed(data, key) {
+                            handle_interrupt(data, &mut update, true);
+                            // If other states are introduced that progress through stages, add them
+                            // here
+                            if let CharacterState::ComboMelee(c) = &mut update.character {
+                                c.stage = stage;
+                            }
+                        } else {
+                            update.character = CharacterState::Wielding;
+                        }
                     } else if self.was_wielded {
                         update.character = CharacterState::Wielding;
                     } else if self.was_sneak {
@@ -127,15 +136,7 @@ impl CharacterBehavior for Data {
             },
             _ => {
                 // If it somehow ends up in an incorrect stage section
-                if let Some((key, stage)) = self.was_combo {
-                    resume_combo(data, &mut update, key, stage);
-                } else if self.was_wielded {
-                    update.character = CharacterState::Wielding;
-                } else if self.was_sneak {
-                    update.character = CharacterState::Sneak;
-                } else {
-                    update.character = CharacterState::Idle;
-                }
+                update.character = CharacterState::Idle;
             },
         }
 
diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs
index a39f20811e..032173629d 100644
--- a/common/src/states/utils.rs
+++ b/common/src/states/utils.rs
@@ -586,16 +586,6 @@ pub fn handle_interrupt(data: &JoinData, update: &mut StateUpdate, attacks_inter
     handle_dodge_input(data, update);
 }
 
-pub fn resume_combo(data: &JoinData, update: &mut StateUpdate, key: AbilityKey, stage: u32) {
-    if ability_key_is_pressed(data, key) {
-        handle_interrupt(data, update, true);
-    }
-    // If other states are introduced that progress through stages, add them here
-    if let CharacterState::ComboMelee(c) = &mut update.character {
-        c.stage = stage;
-    }
-}
-
 pub fn ability_key_is_pressed(data: &JoinData, ability_key: AbilityKey) -> bool {
     match ability_key {
         AbilityKey::Mouse1 => data.inputs.primary.is_pressed(),