Explain exhausted settler supply in Explorers journal

This commit is contained in:
coyotte508 2026-10-23 11:39:20 +02:00
commit 68890bb1a9
5 changed files with 34 additions and 5 deletions

View file

@ -166,10 +166,11 @@ fn explorer(id: u8, tactics_card: TacticsCardFactory) -> ActionCard {
|e| &mut e.play_action_card,
0,
|game, p, _| {
let p = p.get(game);
if p.available_units().settlers == 0 {
if p.get(game).available_units().settlers == 0 {
p.log(game, "No free settler gained: none left in supply.");
return None;
}
let p = p.get(game);
Some(PositionRequest::new(
p.cities.iter().map(|c| c.position).collect(),
0..=1,

View file

@ -464,3 +464,9 @@ Human Sacrifice can now pay wonder culture costs directly with captives, includi
through the normal wonder construction button. Verified a local copy of the reported
Placid-estuary-1587 purchase, regression coverage for availability and spending,
frontend/engine tests, locales, type checking and production build. No saved data edited.
### 0.1.163 / engine 0.4.110 — Explorers supply explanation
Explorers writes “No free settler gained: none left in supply.” to the journal when
all four settlers are in play. Verified exhausted and available supply paths,
frontend/engine tests, locale checks, type checking and production build.

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.162",
"version": "0.1.163",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.162",
"version": "0.1.163",
"dependencies": {
"@boardgamers/protocol": "0.9.0",
"lucide-svelte": "^0.577.0",

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.162",
"version": "0.1.163",
"private": true,
"type": "module",
"scripts": {

View file

@ -1589,3 +1589,25 @@ test('Human Sacrifice makes wonders directly buildable and pays their culture co
assert.equal(after.players[index].resources.culture_tokens ?? 0, 0);
assert.equal(after.actions_left, g.actions_left - 1);
});
test('Explorers records when its free settler is unavailable', async () => {
for (const count of [3, 4]) {
const g = await setup('Rome'), index = seat(g), p = g.players[index];
p.action_cards = [21];
p.units = Array.from({ length: count }, (_, id) => ({ id, position: p.cities[0].position, unit_type: 'Settler' }));
p.next_unit_id = count;
let after = move(g, { Playing: { ActionCard: 21 } });
after = move(after, { Response: { Payment: [{ culture_tokens: 1 }] } });
after = move(after, { Response: { SelectPositions: [] } });
const message = 'No free settler gained: none left in supply.';
assert.equal(JSON.stringify(after.log).includes(message), count === 4);
if (count === 3) {
assert.equal(view(after).decision.description, 'Gain a free settler');
after = move(after, { Response: { SelectPositions: [p.cities[0].position] } });
assert.equal(after.players[index].units.length, 4);
} else {
assert.equal(view(after).decision, null);
assert.equal(after.players[index].units.length, 4);
}
}
});