Versus teams, gold for allies, fallen hearts as spectators, multi-mission editor co-op

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 19:59:43 +01:00
1 parent 811c955bad
commit fc9c49d4ca
16 files changed
+1896 -49

No files matched your search

+13 -3
View File
@@ -97,14 +97,23 @@ impl Game {
if self.map.visible.len() != n {
self.map.visible = vec![false; n];
}
// a master whose heart fell watches the rest of the match: the whole map is open to him
if self.spectating() {
self.map.visible = vec![true; n];
self.map.explored.iter_mut().for_each(|e| *e = true);
return;
}
let mut vis = vec![false; n];
let (w, h) = (mw() as i32, mh() as i32);
// the ground and the eyes of the master at this computer and of his allies (co-op partners,
// team mates); fog is local, so the local master decides
let allies: Vec<Owner> = std::iter::once(self.me).chain(Owner::MASTER_SIDES.iter().filter(|&&s| s != self.me_side && self.allied(self.me_side, s)).map(|&s| Owner::of_side(s))).collect();
let (cx, cy) = self.own_core_corner();
let core_start = (cx - 3, cy - 3, cx + 5, cy + 5);
let in_core_start = |x: i32, y: i32| x >= core_start.0 && x <= core_start.2 && y >= core_start.1 && y <= core_start.3;
// own ground and the ground around it, except straight outside the core's starting room
for i in 0..n {
if self.map.t[i].owner == self.me {
if allies.contains(&self.map.t[i].owner) {
let (x, y) = xy(i);
vis[i] = true;
let in_start = in_core_start(x, y);
@@ -128,8 +137,9 @@ impl Game {
}
}
// what the creatures and towers see along open ground (walls stop the view)
let mut eyes: Vec<(usize, i32)> = self.ents.iter().filter(|e| e.alive && !e.held && !e.hero && self.is_master(e.side) && !e.chained).map(|e| (e.tile(), SIGHT)).collect();
eyes.extend(self.towers.iter().filter(|t| !t.hero).map(|t| (t.tile, t.range() as i32 + 1)));
let mut eyes: Vec<(usize, i32)> = self.ents.iter().filter(|e| e.alive && !e.held && !e.hero && (e.side == self.me_side || self.allied(self.me_side, e.side)) && !e.chained).map(|e| (e.tile(), SIGHT)).collect();
let solo = self.masters.is_empty();
eyes.extend(self.towers.iter().filter(|t| !t.hero && (solo || allies.contains(&self.map.t[t.tile].owner))).map(|t| (t.tile, t.range() as i32 + 1)));
let mut stamp = vec![0u32; n];
let mut q = VecDeque::new();
for (sid, &(start, r)) in eyes.iter().enumerate() {