diff options
| author | troido <troido@protonmail.com> | 2020-03-05 12:50:25 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-03-05 12:50:25 +0100 |
| commit | 170741fe959d30ee43ce689fd5fbae725cc1dae4 (patch) | |
| tree | de337876fb9afc3ca20e5a99ef61689813f51ebe /src/components/messages.rs | |
| parent | ea99b86b89659624133a63f03600f0b57592a5f4 (diff) | |
equipent now kinda works
Diffstat (limited to 'src/components/messages.rs')
| -rw-r--r-- | src/components/messages.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/messages.rs b/src/components/messages.rs index ae615f1..8fe38e3 100644 --- a/src/components/messages.rs +++ b/src/components/messages.rs @@ -1,4 +1,5 @@ +use std::collections::HashMap; use std::any::Any; use specs::{ Component, @@ -6,6 +7,7 @@ use specs::{ Entity, WriteStorage }; +use super::equipment::Stat; @@ -46,6 +48,12 @@ impl AttackType { Self::Heal(_) => false } } + pub fn apply_bonuses(self, bonuses: &HashMap<Stat, i64>) -> AttackType { + match self { + Self::Attack(strength) => Self::Attack(strength + *bonuses.get(&Stat::Strength).unwrap_or(&0)), + Self::Heal(_) => self + } + } } #[derive(Debug, Clone)] |
