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

+25
View File
@@ -52,6 +52,15 @@ impl Game {
if !self.start_masters(sides, local) {
return false;
}
// every master has to be able to build his dungeon at once
if let Some(v) = self.known.get_mut(crate::game::SUMMON_TOOL) {
*v = true;
}
for m in self.masters.iter_mut() {
if let Some(v) = m.known.get_mut(crate::game::SUMMON_TOOL) {
*v = true;
}
}
self.netplay = Some(Netplay::default());
true
}
@@ -271,6 +280,22 @@ mod tests {
assert_eq!(a.checksum(), b.checksum());
}
#[test]
fn a_new_match_master_can_summon_at_once() {
let mut g = client(24, 2);
assert!(g.tool_allowed(crate::game::SUMMON_TOOL), "summoning is known in a match");
assert_eq!(g.worker_count(), 4, "a new master starts with his own four imps");
let (cx, cy) = core_of(&g, Owner::Rival1);
let mana = g.mana;
let cost = g.summon_cost();
g.queue(Act::Summon { x: cx as f32 - 0.5, y: cy as f32 + 0.5 });
let turn = g.take_orders();
g.receive_turn(&turn);
assert!(cost > 0.0 && g.mana < mana, "summoning costs mana");
assert!(g.ents.iter().any(|e| e.kind == crate::game::EK::Worker && e.side == 2 && e.alive), "the summoned imp belongs to the master who summoned it");
assert_eq!(g.worker_count(), 5, "the summon counts as the master's own worker");
}
#[test]
fn a_client_without_the_next_turn_stands_still_and_its_orders_wait() {
let mut g = client(22, 0);