Count undefended city captures as battles for rewards
This commit is contained in:
parent
8a47248454
commit
6b3bf915c4
6 changed files with 54 additions and 6 deletions
|
|
@ -214,8 +214,11 @@ impl CombatStats {
|
|||
|
||||
#[must_use]
|
||||
pub fn is_battle(&self) -> bool {
|
||||
// defender can win with a fortress or great wall
|
||||
self.defender.present.amount() > 0 || self.winner() == Some(CombatRole::Defender)
|
||||
// The glossary includes undefended cities and lone Settlers: neither
|
||||
// dice nor defending Army units are required for a battle.
|
||||
self.battleground.is_city()
|
||||
|| self.defender.present.amount() > 0
|
||||
|| self.winner() == Some(CombatRole::Defender)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ fn sun_tzu() -> LeaderInfo {
|
|||
let c = s.player(player_index);
|
||||
if s.is_winner(player_index)
|
||||
&& s.round == 1
|
||||
&& s.is_battle()
|
||||
&& s.opponent(player_index).fighters(s.battleground).amount() > 0
|
||||
&& s.battleground.is_land()
|
||||
&& c.survived_leader()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -379,3 +379,5 @@ Viewer 0.1.129 names publicly completed objectives in replay and live action cap
|
|||
Viewer 0.1.130 / engine 0.4.93 preserves mixed mood/culture allocations for variable token payments such as Uprising, while ordinary costs still remove unnecessary resources.
|
||||
|
||||
Viewer 0.1.131 / engine 0.4.94 allows New Colonies to disembark into adjacent unexplored regions using land exploration, including orientation choices, terrain effects and the reveal undo boundary.
|
||||
|
||||
Viewer 0.1.132 / engine 0.4.95 treats undefended city captures as battles for Captivi, Embalming, Heroic General and battle objectives. Fast War separately requires opposing Army units; defended-city and casualty objective requirements remain intact.
|
||||
|
|
|
|||
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.131",
|
||||
"version": "0.1.132",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.131",
|
||||
"version": "0.1.132",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.131",
|
||||
"version": "0.1.132",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -204,3 +204,46 @@ test('old naval combat modifiers do not grant Steel Weapons in later rounds', ()
|
|||
assert.ok(rounds.length >= 2);
|
||||
for (const entry of rounds) assert.ok(![...entry.combat!.attacker.modifiers, ...entry.combat!.defender.modifiers].some((m: string) => /steel weapons/i.test(m)));
|
||||
});
|
||||
|
||||
|
||||
for (const target of ['empty city', 'settler', 'city with settler']) {
|
||||
for (const civ of ['Rome', 'Egypt', 'China']) {
|
||||
test(`${civ} battle rewards distinguish automatic victories from army combat: ${target}`, () => {
|
||||
const g = fixture('objective_cards/instant/conqueror'), p = g.players[0], enemy = g.players[1];
|
||||
p.civilization = civ;
|
||||
p.advances = ['Farming', 'Mining', 'Tactics', 'Bartering', 'Myths', 'Rituals'];
|
||||
p.resources = {culture_tokens: 4};
|
||||
p.action_cards = [5];
|
||||
p.objective_cards = [];
|
||||
enemy.objective_cards = [];
|
||||
enemy.action_cards = [];
|
||||
enemy.cities[0].city_pieces = {};
|
||||
enemy.units = target === 'empty city' ? [] : [{id: 0, position: 'C1', unit_type: 'Settler'}];
|
||||
if (target === 'settler') enemy.cities = [];
|
||||
if (civ === 'China') p.units[0].unit_type = {Leader: 'SunTzu'};
|
||||
let after = attack(g);
|
||||
if (view(after).stopMovement) after = move(after, {Movement: 'Stop'});
|
||||
const resources = after.players[0].resources;
|
||||
assert.equal(resources.gold ?? 0, (target === 'settler' ? 0 : 1) + (civ === 'Rome' ? 1 : 0));
|
||||
assert.equal(resources.mood_tokens ?? 0, civ === 'Rome' ? 1 : 0);
|
||||
assert.equal(resources.culture_tokens, civ === 'Egypt' ? 5 : 4);
|
||||
assert.ok(view(after).actionCards.find((c: any) => c.id === 5)?.action, 'Heroic General recognizes a won land battle');
|
||||
for (const unit of after.players[0].units.filter((u: any) => [0,1,2,3].includes(u.id)))
|
||||
assert.ok(unit.movement_restrictions.includes('Battle'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const moreWarfare of [false, true]) {
|
||||
test(`Daring checks its extra condition after an undefended capture (more enemy Warfare=${moreWarfare})`, () => {
|
||||
const g = fixture('objective_cards/instant/conqueror');
|
||||
g.players[0].objective_cards = [16];
|
||||
g.players[0].action_cards = [];
|
||||
g.players[1].objective_cards = [];
|
||||
g.players[1].units = [];
|
||||
g.players[1].cities[0].city_pieces = {};
|
||||
if (moreWarfare) g.players[1].advances.push('Draft');
|
||||
const after = attack(g);
|
||||
assert.equal(after.events?.some((e: any) => e.event_type?.SelectObjectives?.shown_objective === 'Bold') ?? false, moreWarfare);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue