Board fleets immediately on destination click

This commit is contained in:
coyotte508 2026-10-12 18:02:24 +02:00
commit 90e58f37a1
7 changed files with 12 additions and 26 deletions

View file

@ -228,3 +228,8 @@ Selecting a land group and a friendly fleet now offers boarding against the flee
Hanno’s Navigator checks whether the ships have moved, without rejecting Hanno for earlier movement. Any eligible ships in his sea space can carry him; internal carrier IDs no longer prevent using another ship, and passenger redistribution preserves capacity. Once-per-turn and post-Navigator ship restrictions remain. Source: printed Hanno card (https://boardgamegeek.com/image/9490516); naval casualty capacity is confirmed by the official rulebook, p. 23, and remains pooled across surviving ships.
Verified with 718 frontend/engine tests, type checks, production build, and desktop/mobile browser checks against both a fixture and a local copy of Stellar-tornado-4358. No moves were submitted to the live game.
# Viewer 0.1.75 / engine unchanged (0.4.68)
Clicking a friendly fleet now immediately boards the selected land group across its available capacity. Removed the redundant Board all confirmation. Desktop/mobile browser and controller tests cover immediate boarding with and without optimistic prediction, while retaining one group-move cost.

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.74",
"version": "0.1.75",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.74",
"version": "0.1.75",
"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.74",
"version": "0.1.75",
"private": true,
"type": "module",
"scripts": {

View file

@ -47,10 +47,7 @@ try {
await page.screenshot({path:`/tmp/clash-embark-before-${width}.png`});
assert.match(await panel.innerText(), /3 selected/);
await tap('C3');
const plan=page.getByRole('group',{name:'Board fleet'});
await plan.waitFor();
await page.screenshot({path:`/tmp/clash-embark-plan-${width}.png`});
await panel.getByRole('button',{name:'Board all 3 units'}).click();
assert.equal(await panel.getByRole('button',{name:/Board all/}).count(),0);
let raw=JSON.stringify(state);
for(let i=0;i<2;i++) {
await page.waitForFunction(i=>sent.length>i,i);

View file

@ -202,14 +202,6 @@
: 'No moves available.'}
</p>
{/if}
{#if destination?.boarding}
<div class="boarding-plan" role="group" aria-label="Board fleet">
<h3><Ship size={16} />Board ships at {destination.position}</h3>
<p>{selectedUnits.length} land units · {units.filter(u => u.type === 'Ship' && u.position === destination.position).length} ships</p>
<p>Board together using the fleet’s available transport capacity. One group move.</p>
<button class="primary wide" disabled={$session.pending} onclick={() => controller.boardSelectedUnits()}>Board all {selectedUnits.length} units <ArrowRight size={16} /></button>
</div>
{/if}
{#if destination?.attack}
<div class="movement-leader-info" aria-label="Attack preview">
<h3><Swords size={16} />Attack · {destination.position}</h3>
@ -271,11 +263,3 @@
{#if !units.length && !$session.view?.nomadCities?.length}<p>Recruit units in a city to explore.</p>{/if}
{#if $session.error}<p class="inline-error" role="alert">{$session.error}</p>{/if}
</section>
<style>
.boarding-plan { display: grid; gap: .65rem; }
.boarding-plan h3 { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.boarding-plan h3 { justify-content: flex-start; font-size: 1rem; }
.boarding-plan p { font-size: .8rem; color: var(--muted); margin: 0; }
</style>

View file

@ -2590,8 +2590,7 @@ for (const predictions of [true, false]) test(`boarding across two ships spends
assert(destination?.boarding);
assert.equal(destination.boarding.length,2);
c.chooseMoveDestination('C3');
assert.equal(app.sent.length,0,'Preview must not move units');
c.boardSelectedUnits();
assert.equal(app.sent.length,1,'Clicking the fleet starts boarding immediately');
for (let i=0; i<2; i++) {
assert(app.sent[i], 'Boarding continues after server acknowledgement');
raw = engine.tryMove(raw,app.sent[i],0);

View file

@ -1182,6 +1182,7 @@ export class Controller {
if (!destination) return;
if (destination.boarding) {
this.patch({ moveTarget: destination.position, moveDestination: index });
this.boardSelectedUnits();
return;
}
const selection = this.raw + JSON.stringify(destination.action);
@ -1228,7 +1229,7 @@ export class Controller {
}
return [...destinations.filter(d => !(d.carrier != null && extra.some(e => e.position === d.position))), ...extra];
}
boardSelectedUnits() {
private boardSelectedUnits() {
const s = get(this.session), destination = s.moveDestination == null ? null : s.moveDestinations[s.moveDestination];
if (s.pending || s.playback || !destination?.boarding) return;
this.boardingQueue = destination.boarding.map(group => ({position: destination.position, group}));