summaryrefslogtreecommitdiff
path: root/src/systems/fight.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/systems/fight.rs')
-rw-r--r--src/systems/fight.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/systems/fight.rs b/src/systems/fight.rs
index 703ea4a..88305e2 100644
--- a/src/systems/fight.rs
+++ b/src/systems/fight.rs
@@ -54,9 +54,6 @@ impl <'a> System<'a> for Fight {
}
Control::AttackTarget(t) => {
if *t == entity { // don't knock yourself out
- if let Some(autofighter) = autofighters.get_mut(entity){
- autofighter.target = None;
- }
} else if let Some(target_position) = positions.get(*t){
if position.pos.distance_to(target_position.pos) <= fighter.range {
target = Some(*t);
@@ -66,7 +63,9 @@ impl <'a> System<'a> for Fight {
_ => {}
}
if let Some(ent) = target {
- AttackInbox::add_message(&mut attacked, ent, fighter.attack.clone());
+ let mut attack = fighter.attack.clone();
+ attack.attacker = Some(entity);
+ AttackInbox::add_message(&mut attacked, ent, attack);
cooldowns.insert(entity, ControlCooldown{amount: fighter.cooldown}).unwrap();
if let Some(autofighter) = autofighters.get_mut(entity){
autofighter.target = Some(ent);