Hero waves break in where the warning shows: they round the realm to the marked entry; the entry tile glows red

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 16:08:28 +01:00
1 parent dab31579df
commit bd3f42b8b8
3 files changed
+73 -4

No files matched your search

+38
View File
@@ -209,3 +209,41 @@ fn balance_waves() {
}
}
}
// where the heroes of a wave really break in, against the marked entry points
#[test]
#[ignore]
fn balance_entry_points() {
use crate::map::*;
println!("\n== planned entry vs. where the heroes step onto the master's ground ==");
for seed in seeds() {
let mut g = Game::new(seed, 96, 96);
pilot(&mut g, 1, None);
let mut planned: Vec<(i32, i32)> = Vec::new();
let mut first_in: Option<(i32, i32)> = None;
let mut wave = 0;
for _ in 0..((20.0 * 60.0 / STEP) as usize) {
g.update(STEP);
if g.state != 0 {
break;
}
if !g.planned_entries.is_empty() {
planned = g.planned_entries.clone();
}
if g.wave != wave {
wave = g.wave;
first_in = None;
}
if first_in.is_none() {
if let Some(e) = g.ents.iter().find(|e| e.alive && e.active_hero() && g.map.get(e.x as i32, e.y as i32).map_or(false, |t| t.owner == Owner::Player)) {
first_in = Some((e.x as i32, e.y as i32));
let d = planned.iter().map(|&(px, py)| (((px - e.x as i32).pow(2) + (py - e.y as i32).pow(2)) as f32).sqrt()).fold(f32::MAX, f32::min);
let wp = g.ents.iter().filter(|e| e.alive && e.active_hero()).filter(|e| e.waypoint.is_some()).count();
let heroes = g.ents.iter().filter(|e| e.alive && e.active_hero()).count();
let job = format!("{:?}", e.job);
println!("seed {} wave {}: planned {:?} first in at {:?} -> {:.1} tiles off; heroes with waypoint {}/{}; its job {}", seed, wave, planned, first_in.unwrap(), d, wp, heroes, job);
}
}
}
}
}