diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 30689de66c..1541f56eb4 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -689,6 +689,7 @@ impl From<(&CharacterAbility, AbilityKey)> for CharacterState { stage_section: StageSection::Buildup, was_wielded: false, // false by default. utils might set it to true was_sneak: false, + was_combo: None, }), CharacterAbility::ComboMelee { stage_data, diff --git a/common/src/states/combo_melee.rs b/common/src/states/combo_melee.rs index ec3c25e822..78084b5eee 100644 --- a/common/src/states/combo_melee.rs +++ b/common/src/states/combo_melee.rs @@ -118,6 +118,12 @@ impl CharacterBehavior for Data { && !ability_key_is_pressed(data, self.static_data.ability_key) { handle_interrupt(data, &mut update); + if ability_key_is_pressed(data, AbilityKey::Dodge) { + handle_dodge_input(data, &mut update); + if let CharacterState::Roll(roll) = &mut update.character { + roll.was_combo = Some((self.stage, self.combo)); + } + } match update.character { CharacterState::ComboMelee(_) => {}, _ => { diff --git a/common/src/states/roll.rs b/common/src/states/roll.rs index 45decbb376..199db493e1 100644 --- a/common/src/states/roll.rs +++ b/common/src/states/roll.rs @@ -32,6 +32,8 @@ pub struct Data { pub was_wielded: bool, /// Was sneaking pub was_sneak: bool, + /// Was combo, .0 is stage, .1 is combo counter + pub was_combo: Option<(u32, u32)>, } impl CharacterBehavior for Data { @@ -105,6 +107,11 @@ impl CharacterBehavior for Data { // Done if self.was_wielded { update.character = CharacterState::Wielding; + let combo_data = self.was_combo; + + if let Some(combo_data) = combo_data { + continue_combo(data, &mut update, combo_data); + } } else if self.was_sneak { update.character = CharacterState::Sneak; } else { @@ -116,6 +123,11 @@ impl CharacterBehavior for Data { // If it somehow ends up in an incorrect stage section if self.was_wielded { update.character = CharacterState::Wielding; + let combo_data = self.was_combo; + + if let Some(combo_data) = combo_data { + continue_combo(data, &mut update, combo_data); + } } else if self.was_sneak { update.character = CharacterState::Sneak; } else { diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index e784f05e7d..3074f339d6 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -436,6 +436,14 @@ pub fn ability_key_is_pressed(data: &JoinData, ability_key: AbilityKey) -> bool } } +pub fn continue_combo(data: &JoinData, update: &mut StateUpdate, combo_data: (u32, u32)) { + handle_ability1_input(data, update); + if let CharacterState::ComboMelee(data) = &mut update.character { + data.stage = combo_data.0; + data.combo = combo_data.1; + } +} + /// Determines what portion a state is in. Used in all attacks (eventually). Is /// used to control aspects of animation code, as well as logic within the /// character states.