diff --git a/server/agent/src/attack.rs b/server/agent/src/attack.rs index d1e11832e6..37cd671b6a 100644 --- a/server/agent/src/attack.rs +++ b/server/agent/src/attack.rs @@ -4592,22 +4592,21 @@ impl<'a> AgentData<'a> { const LEAP_RANGE: f32 = 20.0; const MELEE_RANGE: f32 = 5.0; - enum ActionStateFCounters { - FCounterRocksnapperDash = 0, - FCounterRocksnapperLeap = 1, + enum ActionStateTimers { + TimerRocksnapperDash = 0, + TimerRocksnapperLeap = 1, } - agent.combat_state.counters[ActionStateFCounters::FCounterRocksnapperDash as usize] += + agent.combat_state.timers[ActionStateTimers::TimerRocksnapperDash as usize] += read_data.dt.0; - agent.combat_state.counters[ActionStateFCounters::FCounterRocksnapperLeap as usize] += + agent.combat_state.timers[ActionStateTimers::TimerRocksnapperLeap as usize] += read_data.dt.0; if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover)) { // If already charging, keep charging if not in recover controller.push_basic_input(InputKind::Primary); - } else if agent.combat_state.counters - [ActionStateFCounters::FCounterRocksnapperDash as usize] + } else if agent.combat_state.timers[ActionStateTimers::TimerRocksnapperDash as usize] > DASH_TIMER { // Use dash if timer has gone for long enough @@ -4615,11 +4614,10 @@ impl<'a> AgentData<'a> { if matches!(self.char_state, CharacterState::DashMelee(_)) { // Resets action counter when using dash - agent.combat_state.counters - [ActionStateFCounters::FCounterRocksnapperDash as usize] = 0.0; + agent.combat_state.timers[ActionStateTimers::TimerRocksnapperDash as usize] = 0.0; } } else if attack_data.dist_sqrd < LEAP_RANGE.powi(2) && attack_data.angle < 90.0 { - if agent.combat_state.counters[ActionStateFCounters::FCounterRocksnapperLeap as usize] + if agent.combat_state.timers[ActionStateTimers::TimerRocksnapperLeap as usize] > LEAP_TIMER { // Use shockwave if timer has gone for long enough @@ -4627,8 +4625,8 @@ impl<'a> AgentData<'a> { if matches!(self.char_state, CharacterState::LeapShockwave(_)) { // Resets action counter when using leap shockwave - agent.combat_state.counters - [ActionStateFCounters::FCounterRocksnapperLeap as usize] = 0.0; + agent.combat_state.timers[ActionStateTimers::TimerRocksnapperLeap as usize] = + 0.0; } } else if attack_data.dist_sqrd < MELEE_RANGE.powi(2) { // Basic attack if in melee range