From 170741fe959d30ee43ce689fd5fbae725cc1dae4 Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 5 Mar 2020 12:50:25 +0100 Subject: equipent now kinda works --- src/components/messages.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/components/messages.rs') 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) -> AttackType { + match self { + Self::Attack(strength) => Self::Attack(strength + *bonuses.get(&Stat::Strength).unwrap_or(&0)), + Self::Heal(_) => self + } + } } #[derive(Debug, Clone)] -- cgit