Protect unoccupied cities during Negotiations
This commit is contained in:
parent
426d95f09d
commit
cb703313d3
5 changed files with 34 additions and 4 deletions
|
|
@ -97,7 +97,10 @@ fn add_diplomatic_relations(player: &Player, game: &Game, base: &mut Vec<MoveRou
|
|||
fn add_negotiations(player: &Player, game: &Game, base: &mut Vec<MoveRoute>) {
|
||||
if let Some(partner) = negotiations_partner(game, player.index) {
|
||||
let partner = game.player(partner);
|
||||
base.retain(|r| partner.get_units(r.destination).is_empty());
|
||||
base.retain(|r| {
|
||||
partner.get_units(r.destination).is_empty()
|
||||
&& !partner.cities.iter().any(|city| city.position == r.destination)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,6 +268,26 @@ fn test_negotiations() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn negotiations_protects_cities_without_units() {
|
||||
for fortress in [false, true] {
|
||||
let mut game = JSON.load_game("negotiations");
|
||||
game.player_mut(0).units.clear();
|
||||
game.player_mut(1).advances.insert(advance::Advance::Tactics);
|
||||
game.player_mut(0).cities[0].pieces.fortress = fortress.then_some(0);
|
||||
let destination = Position::from_offset("C2");
|
||||
let can_enter = |game: &server::game::Game| {
|
||||
possible_move_routes(game.player(1), game, &[0], Position::from_offset("B1"), None)
|
||||
.iter().any(|routes| routes.iter().any(|route| route.destination == destination))
|
||||
};
|
||||
assert!(can_enter(&game), "The city is reachable before Negotiations");
|
||||
let game = server::game_api::execute(game, Action::Playing(PlayingAction::ActionCard(23)), 0);
|
||||
let game = server::game_api::execute(game, payment_response(ResourcePile::culture_tokens(1)), 0);
|
||||
let game = server::game_api::execute(game, Action::Playing(PlayingAction::EndTurn), 0);
|
||||
assert!(!can_enter(&game), "Negotiations must protect a city even without units");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_assassination() {
|
||||
JSON.test(
|
||||
|
|
|
|||
|
|
@ -600,3 +600,10 @@ Exhausted-land placement now excludes spaces containing any player's units,
|
|||
including the active player's own units. When no eligible empty space remains,
|
||||
the placement is skipped. Regression coverage includes friendly and enemy
|
||||
infantry and settlers; all 39 incident tests pass.
|
||||
|
||||
## Viewer 0.1.178 / engine 0.4.121
|
||||
|
||||
Negotiations now protects the partner's cities even when no units occupy them,
|
||||
including cities defended only by a fortress. Regression tests verify that both
|
||||
fortified and unfortified cities are reachable before Negotiations but blocked
|
||||
on the opponent's turn while the effect is active.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.177",
|
||||
"version": "0.1.178",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.177",
|
||||
"version": "0.1.178",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.177",
|
||||
"version": "0.1.178",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue