diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-19 03:00:42 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-19 04:51:10 +0100 |
commit | ee2bc9dca88e52b92a49a9ff21db8832b3b66255 (patch) | |
tree | 43c3d85107eb0ac1286c50094e6d78ee913a683f /src/server.rs | |
parent | 66b4afc529e6d1c4b8f624bbfddc0195ce8d17d5 (diff) |
feat: dash ability
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; + } } } _ => {} |