Manual AI seats for matches: host toggles empty seats, co-op allies fight heroes

This commit is contained in:
Richard Zink committed 2026-11-05 06:38:38 +01:00
1 parent 3492eacd59
commit ee7b76fa6a
10 files changed
+308 -43

No files matched your search

+17 -7
View File
@@ -196,16 +196,26 @@ impl Game {
// attack: about two thirds of the creatures march on an enemy
if self.rivals[k].attack_t <= 0.0 {
self.rivals[k].attack_t = p.attack * (0.8 + self.rng.f() * 0.4);
let mut targets: Vec<(u8, u32)> = vec![(0, 3)];
for o in &self.rivals {
if o.alive && o.side != side {
targets.push((o.side, 1));
let mut targets: Vec<(u8, u32)> = Vec::new();
if self.coop {
if self.gate_on || self.ents.iter().any(|e| e.alive && e.hero) {
targets.push((1, 3));
}
} else {
targets.push((0, 3));
for o in &self.rivals {
if o.alive && o.side != side && !self.is_coop_ally_side(o.side) {
targets.push((o.side, 1));
}
}
if self.has_gate() && self.gate_hp > 0.0 {
targets.push((1, 1));
}
}
if self.has_gate() && self.gate_hp > 0.0 {
targets.push((1, 1));
}
let total: u32 = targets.iter().map(|t| t.1).sum();
if total == 0 {
continue;
}
let mut r = self.rng.next() % total;
let mut target = 0;
for (s, w) in targets {