summaryrefslogtreecommitdiff
path: root/src/systems/fight.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-03-03 18:06:02 +0100
committertroido <troido@protonmail.com>2020-03-03 18:06:02 +0100
commit986c82723cf9a4adada02287309999f4ebbf94e3 (patch)
treeacc26dfd3cb604c959d16f4291db2f6f21d242f9 /src/systems/fight.rs
parent9954b5cbaab27aaffcafa8723dcd5d1c99fa811f (diff)
randomise attack damage
Diffstat (limited to 'src/systems/fight.rs')
-rw-r--r--src/systems/fight.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/systems/fight.rs b/src/systems/fight.rs
index 88305e2..00aeb3e 100644
--- a/src/systems/fight.rs
+++ b/src/systems/fight.rs
@@ -13,6 +13,7 @@ use crate::components::{
Controller,
Position,
AttackInbox,
+ AttackMessage,
Fighter,
Health,
ControlCooldown,
@@ -63,9 +64,7 @@ impl <'a> System<'a> for Fight {
_ => {}
}
if let Some(ent) = target {
- let mut attack = fighter.attack.clone();
- attack.attacker = Some(entity);
- AttackInbox::add_message(&mut attacked, ent, attack);
+ AttackInbox::add_message(&mut attacked, ent, AttackMessage{typ: fighter.attack.clone(), attacker: Some(entity)});
cooldowns.insert(entity, ControlCooldown{amount: fighter.cooldown}).unwrap();
if let Some(autofighter) = autofighters.get_mut(entity){
autofighter.target = Some(ent);