mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
added persist combo counter on roll when mid-combo
This commit is contained in:
parent
4872d285c3
commit
917ae5a0b5
@ -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,
|
||||
|
@ -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(_) => {},
|
||||
_ => {
|
||||
|
@ -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 {
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user