Co-op campaign matches and command markers: mission relay, allied masters, temporary flags
This commit is contained in:
1 parent
dc22e27184
commit
5928acf7f6
12 files changed
+433
-27
No files matched your search
+2
-2
@@ -14,8 +14,8 @@ fn ready(e: &Ent) -> bool {
|
||||
impl Game {
|
||||
// attack: the enemy (unit, or tower) at (wx, wy)
|
||||
pub fn order_attack(&mut self, picked: Option<usize>, wx: f32, wy: f32) {
|
||||
let unit = picked.filter(|&j| j < self.ents.len() && self.ents[j].alive && self.ents[j].side() != 0 && self.ents[j].captive == 0).or_else(|| {
|
||||
self.ents.iter().position(|e| e.alive && !e.held && e.side() != 0 && e.captive == 0 && !e.chained && (e.x - wx).powi(2) + (e.y - wy).powi(2) < 1.5 * 1.5)
|
||||
let unit = picked.filter(|&j| j < self.ents.len() && self.is_hostile(&self.ents[j])).or_else(|| {
|
||||
self.ents.iter().position(|e| self.is_hostile(e) && (e.x - wx).powi(2) + (e.y - wy).powi(2) < 1.5 * 1.5)
|
||||
});
|
||||
let tower = if unit.is_none() {
|
||||
self.towers.iter().find(|t| t.hero && (t.pos().0 - wx).powi(2) + (t.pos().1 - wy).powi(2) < 1.2 * 1.2).map(|t| (t.id, t.pos()))
|
||||
|
||||
Reference in new issue
Block a user