From 885d0bf2c02fc69fc890765d65067c01741ce47b Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sun, 17 Mar 2024 13:37:58 +0100 Subject: chore: refactor abilities --- src/shared/champion.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/shared/champion.rs') diff --git a/src/shared/champion.rs b/src/shared/champion.rs index ec27c62..8de12a5 100644 --- a/src/shared/champion.rs +++ b/src/shared/champion.rs @@ -1,3 +1,4 @@ +use crate::shared::ability::*; use crate::shared::*; use std::str::FromStr; @@ -37,3 +38,18 @@ impl Stats { } } } + +impl Champion { + pub fn to_ability(self, attack_key: AttackKey) -> Ability { + match self { + Champion::Meele => match attack_key { + AttackKey::Q => Ability::Directional(DirectionalAbility::Spear), + _ => Ability::Targeted(TargetedAbility::MeeleAttack), + }, + Champion::Ranged => match attack_key { + AttackKey::Q => Ability::Directional(DirectionalAbility::Spear), + _ => Ability::Targeted(TargetedAbility::RangedAttack), + }, + } + } +} -- cgit v1.2.3