- replay the shooter's combat update a second time when it launches a projectile, matching the client's own component-pass re-entry - carry the shooter's damage effect on every projectile and null a shot's target/source when either leaves the board - derive pending physical damage from the shots actually in flight instead of an incremental total, so it can never go negative - split the spawn ring's two angle registers so three- and five-unit cards land where the client puts them - attribute a combat target left at NONE to the exact site that did it, gated to report each object once - number and annotate every checksum field so a client-reported mismatch resolves straight to a name
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use logic::battle::{find_path, LogicTilemap};
|
|
fn client_path() -> Vec<i32> {
|
|
let mut path = vec![1755];
|
|
let mut node = 1720;
|
|
while node >= 1144 {
|
|
path.push(node);
|
|
node -= 36;
|
|
}
|
|
path.push(1107);
|
|
path
|
|
}
|
|
fn arena() -> LogicTilemap {
|
|
LogicTilemap::load(
|
|
std::path::Path::new("../../assets"),
|
|
"locations/goblin_arena.csv",
|
|
)
|
|
.expect("the goblin arena tilemap")
|
|
}
|
|
#[test]
|
|
fn we_reproduce_the_clients_route_node_for_node() {
|
|
let tm = arena();
|
|
let expected = client_path();
|
|
assert_eq!(expected.len(), 19);
|
|
for start in [(26, 29), (27, 29)] {
|
|
assert_eq!(
|
|
find_path(&tm, start, (27, 48), 2, false),
|
|
expected,
|
|
"start {start:?} should walk the client's route"
|
|
);
|
|
}
|
|
}
|
|
#[test]
|
|
fn the_route_bulges_because_the_lane_pinches_not_because_of_a_tie() {
|
|
let tm = arena();
|
|
assert_eq!(tm.lane_bits(27, 31), 0);
|
|
assert_eq!(tm.lane_bits(28, 31), 2);
|
|
let path = find_path(&tm, (27, 29), (27, 48), 2, false);
|
|
assert!(
|
|
!path.contains(&(31 * 36 + 27)),
|
|
"the route must not step on the off-lane tile (27,31)"
|
|
);
|
|
}
|