summaryrefslogtreecommitdiff
path: root/src/components/messages.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/messages.rs')
-rw-r--r--src/components/messages.rs8
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)]