Fourth master: dwarves get their own side so the yellow AI works; yellow colours and texts; AI cores use the player's throne and heart in their colour
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
450e55d693
commit
b29e312e6b
25 files changed
+136
-55
No files matched your search
+22
-1
@@ -206,8 +206,10 @@ impl Game {
|
||||
"msg.partner_out"
|
||||
} else if side == 2 {
|
||||
"msg.rival1_out"
|
||||
} else {
|
||||
} else if side == 3 {
|
||||
"msg.rival2_out"
|
||||
} else {
|
||||
"msg.rival3_out"
|
||||
};
|
||||
self.msg(key, vec![]);
|
||||
// its creatures scatter and vanish, its ground is free
|
||||
@@ -447,6 +449,25 @@ mod tests {
|
||||
assert!(g.torches.iter().any(|t| g.map.t[t.wall].owner == owner || g.map.t[t.wall].solid()), "torches");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_fourth_master_works_too_and_is_no_dwarf() {
|
||||
let mut g = (1..200u32).map(|s| Game::new_free(s, 96, 96, 1)).find(|g| g.rivals.len() == 1 && !g.gate_on).unwrap();
|
||||
let far = |g: &Game, (x, y): (i32, i32)| {
|
||||
let d = |(a, b): (i32, i32)| (a - x).pow(2) + (b - y).pow(2);
|
||||
d(g.map.core).min(d(g.rivals[0].core))
|
||||
};
|
||||
let spot = [(14, 14), (80, 14), (14, 80), (80, 80)].into_iter().max_by_key(|&p| far(&g, p)).unwrap();
|
||||
g.add_rival(4, spot.0, spot.1, 1);
|
||||
let owner = Owner::of_side(4);
|
||||
let ground0 = g.map.t.iter().filter(|t| t.owner == owner).count();
|
||||
for _ in 0..(6 * 60 * 20) {
|
||||
g.update(0.05);
|
||||
}
|
||||
assert!(g.ents.iter().any(|e| e.alive && e.side == 4 && e.rival() && !e.dwarf()), "its units belong to a master");
|
||||
let ground = g.map.t.iter().filter(|t| t.owner == owner).count();
|
||||
assert!(ground > ground0 + 20, "the yellow master digs and claims: {} -> {}", ground0, ground);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ai_dig_marks_carry_the_masters_side() {
|
||||
let mut g = rival_game(1);
|
||||
|
||||
Reference in new issue
Block a user