Allow Huns to move settlers without their shared city
This commit is contained in:
parent
f05c1c2366
commit
bc5bfec9f0
6 changed files with 86 additions and 6 deletions
|
|
@ -91,12 +91,15 @@ Viewer 0.1.45 uses the printed English Monumental Edition names for Objectives,
|
|||
Viewer 0.1.46 and engine 0.4.51 add an Effects indicator with a count and a rules dialog for active public effects, including Trojan Horse, Great Diplomat agreements, Negotiations and public wonders. Scopes distinguish shared effects, affected players and the current player's temporary action effects. Great Seer assignments remain private. Public-wonder draw choices display the wonder's effect, construction cost, required advance and points; Great Mausoleum discard previews include event rules and both uses of action cards. Trojan Horse now requires another human player's defended city, as stated on printed E42, and is no longer offered against barbarians. Existing saved activation prompts remain valid: decline an already-pending barbarian activation to continue without paying. Publish the matching viewer and engine together; historical battle outcomes are preserved. Cultural influence warns before rolling when another eligible city has a lower range cost, offers a source switch with the culture saving, and requires an explicit second click to retain the more expensive source. Automatic movement-group selection and switching seats during movement now select the whole compatible group instead of only its first unit.
|
||||
|
||||
Viewer 0.1.47 and engine 0.4.52 label active effects with their source event or action card. Source names use the same quiet link style as advance references and open the full source rules without changing the game. Event sources include their printed E number; action-card sources use the played copy from public history, ignoring undone actions. Older effects without a recoverable copy show the common action rules without inventing a battle use. Each effect has its own padded block with spacing between blocks. Saved effect data and game outcomes are unchanged.
|
||||
|
||||
# Viewer 0.1.48
|
||||
|
||||
Component styles are bundled into the viewer script because BGS does not load a separate stylesheet. This restores active-effect spacing and source-label layout, as well as the cultural-influence warning styles, in the published game.
|
||||
|
||||
# Viewer 0.1.49 / engine 0.4.53
|
||||
|
||||
Fanaticism's free infantry now requires losing a battle fought in a city with a Temple. The engine records the Temple condition before capture, so it still applies when that city changes hands. The destination may be any eligible city you own. The advance text now says “If you lose that battle” to make the shared condition explicit. Source: official Monumental Edition rulebook, page 31.
|
||||
|
||||
# Viewer 0.1.50
|
||||
|
||||
Replay keeps the action toolbar and Journal/Chat controls visible. Research, city management, collection, movement, happiness and available abilities can be opened for inspection; submitting actions, undoing and ending the turn remain disabled. Replay transport and the journal have separate space above the bottom controls on desktop and mobile.
|
||||
|
|
@ -126,3 +129,7 @@ Clicking a movement destination submits immediately, including attacks, embarkin
|
|||
# Viewer 0.1.56 / engine 0.4.56
|
||||
|
||||
Ordinary actions predict locally from the first recorded move, using a stable public playback identity published by the engine. Construction, recruitment, happiness, research, abilities, movement, collection, payments, turn changes and available Undo can continue while earlier deterministic moves await confirmation. Slow confirmations retain the predicted position and queued moves instead of rolling them back after eight seconds. The last round only waits at the actual end-of-age objective boundary. Dice rolls, hidden draws and Spy hand reveals require server results; random-number use and shrinking hidden decks are checked explicitly before accepting a prediction. Server rejection or a different authoritative result still corrects the position and cancels unsent moves.
|
||||
|
||||
# Viewer 0.1.57
|
||||
|
||||
Huns movement defaults to movable units when a settler shares the focused city. The Move city control can be toggled off without deselecting accompanying units, so a settler can leave while the city stays in place. Changing the selection recomputes legal destinations without submitting a move. City-only and combined Nomads movement remain available. Engine 0.4.56 is unchanged.
|
||||
|
|
|
|||
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.56",
|
||||
"version": "0.1.57",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.56",
|
||||
"version": "0.1.57",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.56",
|
||||
"version": "0.1.57",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
aria-pressed={$session.movingCity === position}
|
||||
onmouseenter={() => onHighlight(position)}
|
||||
onmouseleave={() => onHighlight(null)}
|
||||
onclick={() => controller.openNomadCity(position)}
|
||||
onclick={() => controller.toggleNomadCity(position)}
|
||||
><Landmark size={15} />Move city {position}</button
|
||||
>{/each}
|
||||
</div>{/if}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,11 @@ test('clicking another movable group switches selection, while legal destination
|
|||
c.selectTile('B2');
|
||||
assert.deepEqual(app.session().selectedUnits, [4]);
|
||||
c.selectTile('C2', { kind: 'units', player: 0 });
|
||||
assert.equal(app.session().view!.units!.find(u => u.id === 4)!.position, 'C2', 'The legal destination moves the original group immediately');
|
||||
assert.equal(
|
||||
app.session().view!.units!.find((u) => u.id === 4)!.position,
|
||||
'C2',
|
||||
'The legal destination moves the original group immediately',
|
||||
);
|
||||
assert.equal(app.sent.length, 1, 'clicking a legal destination submits the move immediately');
|
||||
} finally {
|
||||
app.close();
|
||||
|
|
@ -1694,6 +1698,62 @@ test('Huns can start city-only movement and select other Nomad cities directly o
|
|||
}
|
||||
});
|
||||
|
||||
test('Huns can move a settler from a city without moving the city, including after deselecting Nomads', async () => {
|
||||
const app = paymentController(),
|
||||
c = app.controller;
|
||||
try {
|
||||
let raw = await engine.init(2, [], { civilization: 'ChooseCivilization' }, 'nomads-exploration', {});
|
||||
for (const civilization of ['Huns', 'Rome']) {
|
||||
raw = engine.tryMove(
|
||||
raw,
|
||||
JSON.stringify({ ChooseCivilization: civilization }),
|
||||
engine.currentPlayer(raw),
|
||||
);
|
||||
}
|
||||
const g = JSON.parse(raw);
|
||||
const city = g.players[0].cities[0].position;
|
||||
g.players[0].civilization = 'Huns';
|
||||
g.players[0].advances.push('Storage');
|
||||
g.players[0].units = [{ id: 7, position: city, unit_type: 'Settler' }];
|
||||
g.actions_left = 2;
|
||||
raw = JSON.stringify(g);
|
||||
c.setPlayer(0);
|
||||
await c.load(engine.stripSecret(raw, 0));
|
||||
c.inspectTile(city);
|
||||
c.openSettlers();
|
||||
assert.equal(app.session().movingCity, null, 'Move defaults to units on the focused city');
|
||||
assert.deepEqual(app.session().selectedUnits, [7]);
|
||||
c.openNomadCity(city);
|
||||
c.selectUnits([7]);
|
||||
assert.equal(app.session().movingCity, city);
|
||||
const sharedDestination = app.session().moveDestinations.find((d) => d.terrain !== 'Unexplored')!;
|
||||
assert.ok(sharedDestination);
|
||||
c.patch({ moveTarget: sharedDestination.position });
|
||||
c.toggleNomadCity(city);
|
||||
assert.equal(app.session().movingCity, null);
|
||||
assert.deepEqual(app.session().selectedUnits, [7], 'deselecting the city keeps its settler selected');
|
||||
assert.equal(app.session().moveTarget, sharedDestination.position);
|
||||
assert.equal(app.sent.length, 0, 'changing the selection must not submit a move');
|
||||
const destination = app.session().moveDestinations.find((d) => d.terrain !== 'Unexplored')!;
|
||||
assert.ok(destination);
|
||||
c.selectTile(destination.position);
|
||||
const after = JSON.parse(engine.tryMove(raw, app.sent.at(-1)!, 0));
|
||||
assert.equal(after.players[0].cities[0].position, city);
|
||||
assert.equal(
|
||||
after.players[0].units.find((u: { id: number }) => u.id === 7).position,
|
||||
destination.position,
|
||||
);
|
||||
await c.load(engine.stripSecret(raw, 0));
|
||||
c.openNomadCity(city);
|
||||
c.toggleNomadCity(city);
|
||||
assert.equal(app.session().movingCity, null);
|
||||
assert.deepEqual(app.session().selectedUnits, []);
|
||||
assert.deepEqual(app.session().moveDestinations, []);
|
||||
} finally {
|
||||
app.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('Redo restores an undone collection, remains private to the active seat, and clears on a different move', async () => {
|
||||
const app = paymentController(),
|
||||
c = app.controller;
|
||||
|
|
|
|||
|
|
@ -1430,7 +1430,10 @@ export class Controller {
|
|||
const cities = s.view?.nomadCities ?? [];
|
||||
const positions = [...new Set(s.view?.units?.map((u) => u.position) ?? [])];
|
||||
const movable = positions.filter((p) => this.movementDestinations(this.defaultMovementGroup(p)).length);
|
||||
if ((s.focus && cities.includes(s.focus)) || (!movable.length && cities.length)) {
|
||||
if (
|
||||
(s.focus && cities.includes(s.focus) && !movable.includes(s.focus)) ||
|
||||
(!movable.length && cities.length)
|
||||
) {
|
||||
this.openNomadCity(s.focus && cities.includes(s.focus) ? s.focus : cities[0]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1452,6 +1455,16 @@ export class Controller {
|
|||
this.patch({ movingCity: position, focus: position });
|
||||
this.selectUnits([]);
|
||||
}
|
||||
toggleNomadCity(position: string) {
|
||||
const s = get(this.session);
|
||||
if (s.pending || s.playback || !canMoveOnMap(s.view, s.game)) return;
|
||||
if (s.movingCity !== position) {
|
||||
this.openNomadCity(position);
|
||||
return;
|
||||
}
|
||||
this.patch({ movingCity: null });
|
||||
this.selectUnits(s.selectedUnits, s.moveTarget);
|
||||
}
|
||||
selectUnits(selectedUnits: number[], target: string | null = null) {
|
||||
const s = get(this.session);
|
||||
const city =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue