diff options
Diffstat (limited to 'src/server.rs')
-rw-r--r-- | src/server.rs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/server.rs b/src/server.rs index 0f34a12..8507244 100644 --- a/src/server.rs +++ b/src/server.rs @@ -301,21 +301,19 @@ fn imperative_attack_attack( *imperative = Imperative::Idle; continue; }; - let Ok(position) = positions.get_mut(*entity) else { - *imperative = Imperative::Idle; - continue; - }; - let Ok(mut cooldown) = cooldowns.get_mut(*entity) else { - *imperative = Imperative::Idle; - continue; - }; - let base_cooldown = BaseCooldown::from_champion(*champion); - if cooldown.0[ability_slot].is_zero() { - cooldown.0[ability_slot] = base_cooldown.0[ability_slot]; - commands.spawn(ProjectileBundle::new( - ability.to_projectile(*id, position.0, direction), - )); - *imperative = Imperative::Idle; + match ability.activate() { + DirectionalAbilityActivation(run) => { + let Ok(mut cooldown) = cooldowns.get_mut(*entity) else { + *imperative = Imperative::Idle; + continue; + }; + let base_cooldown = BaseCooldown::from_champion(*champion); + if cooldown.0[ability_slot].is_zero() { + cooldown.0[ability_slot] = base_cooldown.0[ability_slot]; + run(&mut commands, *id, direction); + } + *imperative = Imperative::Idle; + } } } _ => {} |