From 986c82723cf9a4adada02287309999f4ebbf94e3 Mon Sep 17 00:00:00 2001 From: troido Date: Tue, 3 Mar 2020 18:06:02 +0100 Subject: randomise attack damage --- src/systems/fight.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/systems/fight.rs') 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); -- cgit