Fixes being stuck in roll when interrupting combo melee.

This commit is contained in:
Sam 2021-02-28 08:50:33 -05:00
parent cb267ac3ee
commit d818ea2f1d
2 changed files with 11 additions and 20 deletions

View File

@ -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;
},
}

View File

@ -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(),