From 32037d2247a4db1c1c09d63a7849f562b6081bfe Mon Sep 17 00:00:00 2001 From: troido Date: Sun, 1 Mar 2020 22:33:54 +0100 Subject: only attack one target at a time --- src/systems/fight.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/systems/fight.rs b/src/systems/fight.rs index 42a7543..2a663e3 100644 --- a/src/systems/fight.rs +++ b/src/systems/fight.rs @@ -40,12 +40,12 @@ impl <'a> System<'a> for Fight { for (entity, controller, position, fighter) in (&entities, &controllers, &positions, &fighters).join(){ match &controller.control { Control::Attack(directions) => { - for direction in directions { + 'targets: for direction in directions { for ent in ground.cells.get(&(position.pos + direction.to_position())).unwrap_or(&HashSet::new()) { if healths.contains(*ent) && *ent != entity { AttackInbox::add_message(&mut attacked, *ent, fighter.attack.clone()); cooldowns.insert(entity, ControlCooldown{amount: fighter.cooldown}).unwrap(); - break; + break 'targets; } } } -- cgit