mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'knarkzel/persist-combo-roll' into 'master'
added persistent combo after roll when rolling mid-combo, Closes #826 Closes #826 See merge request veloren/veloren!1524
This commit is contained in:
commit
c83fd48e13
@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Autoselecting the newly created character
|
||||
- Deselecting when the selected character is deleted
|
||||
- Upscaling support
|
||||
- Added "Persist Combo from Combo Melee State" when rolling mid-combo
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -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.
|
||||
|
@ -163,6 +163,7 @@ fn maps_roll() {
|
||||
stage_section: states::utils::StageSection::Buildup,
|
||||
was_wielded: true,
|
||||
was_sneak: false,
|
||||
was_combo: None,
|
||||
}),
|
||||
&PhysicsState {
|
||||
on_ground: true,
|
||||
|
Loading…
Reference in New Issue
Block a user