Unlock summoning and spawn starting imps for every match master, with side-correct worker counting

This commit is contained in:
Richard Zink committed 2026-11-04 15:10:01 +01:00
1 parent eb11cca8cb
commit 7ed630c6f2
3 files changed
+35 -2

No files matched your search

+9 -1
View File
@@ -138,6 +138,7 @@ pub struct St {
}
pub const RUNE_TOOL: usize = 20; // index of the rune forge tower in ui::TOOLS
pub const SUMMON_TOOL: usize = 11; // index of summoning in ui::TOOLS
pub fn st(k: EK) -> St {
let s = |name, hp, atk, range, speed, interval, wage, bounty| St { name, hp, atk, range, speed, interval, wage, bounty };
@@ -1123,7 +1124,7 @@ impl Game {
self.ents.iter().filter(|e| e.alive && e.creature()).count()
}
pub fn worker_count(&self) -> usize {
self.ents.iter().filter(|e| e.alive && !e.hero && e.kind == EK::Worker).count()
self.ents.iter().filter(|e| e.alive && !e.hero && e.kind == EK::Worker && e.side == self.me_side && !e.chained).count()
}
pub fn summon_cost(&self) -> f32 {
80.0 + 20.0 * (self.worker_count() as f32 - 4.0).max(0.0)
@@ -1137,6 +1138,7 @@ impl Game {
e.id = id;
e.kind = kind;
e.hero = hero;
e.side = self.me_side;
e.x = x;
e.y = y;
e.disp_x = x;
@@ -1377,6 +1379,12 @@ impl Game {
}
self.carve_master_area(*side, cores[k]);
self.add_master(*side, cores[k]);
self.switch_to(*side);
let (cx, cy) = cores[k];
// a new master needs the same starting crew side 0 already has
for j in 0..4 {
self.spawn(EK::Worker, false, cx as f32 - 0.5, cy as f32 + j as f32 * 0.7 + 0.3, 1);
}
}
self.local_side = local;
self.switch_to(local);