summaryrefslogtreecommitdiff
path: root/src/systems/fight.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-03-01 22:33:54 +0100
committertroido <troido@protonmail.com>2020-03-01 22:33:54 +0100
commit32037d2247a4db1c1c09d63a7849f562b6081bfe (patch)
treeac038b806b22eb2ee37267e84cef59738dc79632 /src/systems/fight.rs
parent6a7a74e6878ff04e61e6ef21a922e314b9bab271 (diff)
only attack one target at a time
Diffstat (limited to 'src/systems/fight.rs')
-rw-r--r--src/systems/fight.rs4
1 files 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;
}
}
}