diff --git a/CHANGELOG.md b/CHANGELOG.md index b624a58167..e3e97a72e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a crash caused by certain audio devices on OSX - Bow animations now show held arrows - Fixed a bug where walk/run sfx played while a character rolled/dodged +- Energy regen resets on last ability use instead of on wield +- Fixed unable to use ability; Secondary and ability3 (fire rod) will now automatically wield ### Removed diff --git a/common/src/states/dance.rs b/common/src/states/dance.rs index 2cefa225fe..67070edf9c 100644 --- a/common/src/states/dance.rs +++ b/common/src/states/dance.rs @@ -11,7 +11,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_primary_wield(data, &mut update); + handle_wield(data, &mut update); // Try to Fall/Stand up/Move if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 { diff --git a/common/src/states/idle.rs b/common/src/states/idle.rs index f55707df3a..4e7797bb51 100644 --- a/common/src/states/idle.rs +++ b/common/src/states/idle.rs @@ -12,7 +12,7 @@ impl CharacterBehavior for Data { handle_move(data, &mut update, 1.0); handle_jump(data, &mut update); - handle_primary_wield(data, &mut update); + handle_wield(data, &mut update); handle_climb(data, &mut update); handle_glide(data, &mut update); handle_dodge_input(data, &mut update); diff --git a/common/src/states/sit.rs b/common/src/states/sit.rs index 54f5658d19..8d372c6ccf 100644 --- a/common/src/states/sit.rs +++ b/common/src/states/sit.rs @@ -11,7 +11,7 @@ impl CharacterBehavior for Data { fn behavior(&self, data: &JoinData) -> StateUpdate { let mut update = StateUpdate::from(data); - handle_primary_wield(data, &mut update); + handle_wield(data, &mut update); // Try to Fall/Stand up/Move if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 { diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 740c59c0ad..952d648468 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -96,10 +96,13 @@ fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { } } -/// First checks whether `primary` input is pressed, then -/// attempts to go into Equipping state, otherwise Idle -pub fn handle_primary_wield(data: &JoinData, update: &mut StateUpdate) { - if data.inputs.primary.is_pressed() { +/// First checks whether `primary`, `secondary` or `ability3` input is pressed, +/// then attempts to go into Equipping state, otherwise Idle +pub fn handle_wield(data: &JoinData, update: &mut StateUpdate) { + if data.inputs.primary.is_pressed() + || data.inputs.secondary.is_pressed() + || data.inputs.ability3.is_pressed() + { attempt_wield(data, update); } } diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index 266bda8158..e594ef2667 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -75,9 +75,15 @@ impl<'a> System<'a> for Sys { .set_to(stat.health.maximum(), HealthSource::LevelUp); } - // Accelerate recharging energy if not wielding. match character_state { - CharacterState::Idle { .. } | CharacterState::Sit { .. } => { + // Accelerate recharging energy. + CharacterState::Idle { .. } + | CharacterState::Sit { .. } + | CharacterState::Dance { .. } + | CharacterState::Glide { .. } + | CharacterState::Wielding { .. } + | CharacterState::Equipping { .. } + | CharacterState::Boost { .. } => { let res = { let energy = energy.get_unchecked(); energy.current() < energy.maximum() @@ -95,13 +101,19 @@ impl<'a> System<'a> for Sys { (energy.regen_rate + ENERGY_REGEN_ACCEL * dt.0).min(100.0); } }, - // Wield does not regen and sets the rate back to zero. - CharacterState::Wielding { .. } => { + // Ability use does not regen and sets the rate back to zero. + CharacterState::BasicMelee { .. } + | CharacterState::DashMelee { .. } + | CharacterState::TripleStrike { .. } + | CharacterState::BasicRanged { .. } + | CharacterState::BasicBlock { .. } => { if energy.get_unchecked().regen_rate != 0.0 { energy.get_mut_unchecked().regen_rate = 0.0 } }, - _ => {}, + // Non-combat abilities that consume energy; + // temporarily stall energy gain, but preserve regen_rate. + CharacterState::Roll { .. } | CharacterState::Climb { .. } => {}, } } }