Clarify bank lots and amounts and place harbor alongside bank

This commit is contained in:
coyotte508 2026-11-18 22:08:52 +00:00
commit d360520964
21 changed files with 178 additions and 55 deletions

View file

@ -73,7 +73,16 @@ try {
await page.waitForSelector('.offshore-bank .offshore-lot', { state: 'attached' });
assert.equal(await page.locator('.offshore-bank .offshore-lot').count(), 6);
assert.equal(await page.locator('text=OPTIONAL EXPANSION').count(), 0);
const lotBounds = await page.locator('.offshore-lot[data-type="containers"][data-lot="2"]').boundingBox();
const pierBounds = await page.locator('.bank-piers').boundingBox();
assert.ok(pierBounds.x >= lotBounds.x + lotBounds.width, 'harbor is beside the bank lots');
assert.ok(pierBounds.x - lotBounds.x - lotBounds.width < 12, 'harbor joins the bank, not a distant area');
assert.equal(await page.getByText('BANK HARBOR', { exact: true }).count(), 0);
await page.locator('.offshore-lot[data-type="containers"][data-lot="2"]').click();
assert.equal(
(await page.locator('.bank-bid-guidance').textContent()).trim(),
'Bid cash to win these containers.'
);
const calculator = page.locator('[data-tutorial="bank-bid"]');
await calculator.focus();
await calculator.press('9');
@ -89,10 +98,9 @@ try {
assert.equal(bid.at(-1).data.lot, 2);
for (const action of bid) state = engine.move(state, action, player);
await push();
assert.match(
await page.locator('.offshore-lot[data-type="containers"][data-lot="2"]').locator('..').textContent(),
/\$2/
);
assert.match(await page.locator('.bank-bid-amount').textContent(), /^2/);
assert.equal(await page.locator('.bank-bid-amount').getAttribute('font-size'), '16');
assert.ok(!(await page.locator('.bank-bid-amount').textContent()).includes('$'));
// A fresh turn fixture: calling the bank twice in one turn is illegal.
state = engine.setup(3, { offshoreIsland: true }, 'offshore-browser');

View file

@ -205,9 +205,10 @@
</g>
<DropZone
v-if="G && G.options.offshoreIsland"
transform="translate(1100 665)"
:width="140"
:height="240"
class="bank-harbor"
transform="translate(342 690)"
:width="102"
:height="210"
:enabled="true"
:accepts="'ship'"
:data="{ type: 'offshoreBank' }"
@ -372,9 +373,17 @@
</template>
</template>
<g v-if="bankDraft && canMove" class="bank-draft" transform="translate(310 680)">
<text x="0" y="-8" font-size="12">
{{ bankDraft.type === 'cash' ? 'Offer cargo' : 'Offer cash' }} · Lot {{ bankDraft.lot + 1 }}
<g v-if="bankDraft && canMove" class="bank-draft" transform="translate(470 700)">
<text x="0" y="-26" font-size="12">
{{ bankDraft.type === 'cash' ? 'Offer cargo' : 'Offer cash' }} · Lot
{{ ['I', 'II', 'III'][bankDraft.lot] }}
</text>
<text class="bank-bid-guidance" x="0" y="-9" font-size="12" fill="#45585b">
{{
bankDraft.type === 'cash'
? 'Bid containers to win this cash.'
: 'Bid cash to win these containers.'
}}
</text>
<Calculator
v-if="bankDraft.type === 'containers'"
@ -1180,8 +1189,8 @@ export default class Game extends Vue {
case ShipPosition.OffshoreBank:
this.ships.push({
id: player.ship.piece.id,
x: 1125,
y: 670 + pi * 45,
x: 373,
y: 665 + pi * 44,
rotate: 90,
color,
containers: player.ship.containers,

View file

@ -1,21 +1,28 @@
<template>
<g v-if="state.options.offshoreIsland && bank" class="offshore-bank">
<g transform="translate(20 680)" class="bank-board">
<text x="0" y="-12" font-size="10" fill="#45585b">OFFSHORE BANK</text>
<text x="0" y="-24" font-size="10" fill="#45585b">OFFSHORE BANK</text>
<g v-for="(label, i) in ['I', 'II', 'III']" :key="label" class="bank-lot-guide">
<title>Lot order: payments start at I, then cycle through II and III, skipping active auctions.</title>
<rect :x="i * 104" y="-18" width="100" height="16" fill="transparent" />
<text :x="50 + i * 104" y="-9" text-anchor="middle" font-size="10" fill="#45585b" translate="no">{{
label
}}</text>
</g>
<template v-for="(type, row) in ['cash', 'containers']">
<g
v-for="i in 3"
:key="type + i"
@click.stop="chooseOffer(type, i - 1)"
:transform="`translate(${(i - 1) * 88} ${row * 88})`"
:transform="`translate(${(i - 1) * 104} ${row * 110})`"
>
<rect
class="offshore-lot"
:class="{ legal: offer(type, i - 1) }"
:data-type="type"
:data-lot="i - 1"
width="84"
height="82"
width="100"
height="104"
fill="#e2e0d3"
stroke="#899997"
:role="offer(type, i - 1) ? 'button' : undefined"
@ -32,12 +39,17 @@
@keydown.enter.prevent.stop="chooseOffer(type, i - 1)"
@keydown.space.prevent.stop="chooseOffer(type, i - 1)"
>
<title>{{ type === 'cash' ? 'Cash' : 'Container' }} lot {{ i }}</title>
<title>
{{
type === 'cash'
? 'Bid containers to win this cash.'
: 'Bid cash to win these containers.'
}}
</title>
</rect>
<text x="77" y="12" text-anchor="end" font-size="8" pointer-events="none">{{ i }}</text>
<text v-if="type === 'cash'" x="6" y="18" font-size="14" pointer-events="none"
>${{ bank.cashLots[i - 1] }}</text
>
<text v-if="type === 'cash'" class="bank-money" x="6" y="18" font-size="16" pointer-events="none">{{
bank.cashLots[i - 1]
}}</text>
<OffshoreCargo
v-else
:pieces="bank.containerLots[i - 1]"
@ -48,25 +60,25 @@
<g v-if="auction(type, i - 1)">
<rect
x="1"
:y="type === 'cash' ? 25 : 70"
:y="type === 'cash' ? 29 : 87"
width="3"
height="11"
:fill="playerColors[auction(type, i - 1).bidder]"
/>
<title translate="no">{{ owner(auction(type, i - 1).bidder) }}</title>
<text x="6" :y="type === 'cash' ? 31 : 76" font-size="8" fill="#203a45" translate="no"
>{{ playerLabel(auction(type, i - 1).bidder)
<text x="6" :y="type === 'cash' ? 36 : 94" font-size="12" fill="#203a45" translate="no"
>{{ playerLabel(auction(type, i - 1).bidder, 6)
}}<title translate="no">{{ owner(auction(type, i - 1).bidder) }}</title></text
>
<OffshoreCargo
v-if="type === 'cash'"
:pieces="escrow(auction(type, i - 1))"
transform="translate(6 36)"
transform="translate(6 44)"
:columns="3"
:rows="2"
/>
<text v-else x="78" y="76" font-size="10" text-anchor="end"
>${{ auction(type, i - 1).cash }}</text
<text v-else class="bank-money bank-bid-amount" x="94" y="94" font-size="16" text-anchor="end"
>{{ auction(type, i - 1).cash }}<title>Cash bid</title></text
>
</g>
</g>
@ -79,16 +91,19 @@
@click="emitMove({ name: names.Sail, data: 'offshoreBank' })"
/>
</g>
<text x="1100" y="665" font-size="9" fill="#45585b">BANK HARBOR</text>
<g class="bank-piers" pointer-events="none" transform="translate(332 680)">
<rect width="10" height="230" fill="#c6c6b8" />
<rect v-for="i in 6" :key="i" x="10" :y="(i - 1) * 44" width="102" height="10" fill="#c6c6b8" />
</g>
<g
v-for="({ p, i }, index) in holdings"
:key="'holding' + i"
:transform="`translate(${600 + Math.floor(index / 3) * 240} ${680 + (index % 3) * 85})`"
:transform="`translate(${750 + Math.floor(index / 3) * 240} ${680 + (index % 3) * 85})`"
class="bank-holding"
:data-owner="i"
>
<rect x="0" y="-8" width="3" height="12" :fill="playerColors[i]" />
<text x="7" y="0" font-size="10" fill="#203a45" translate="no"
<text x="7" y="0" font-size="12" fill="#203a45" translate="no"
>{{ playerLabel(i) }}<title translate="no">{{ owner(i) }}: bank holding</title></text
>
<OffshoreCargo
@ -104,7 +119,7 @@
@select="loadContainer"
/>
</g>
<g v-if="bank.decision" class="bank-decision" transform="translate(310 680)">
<g v-if="bank.decision" class="bank-decision" transform="translate(470 680)">
<text x="0" y="0" font-size="14">{{ decisionTitle }}</text>
<template v-if="!decisionMoves.length">
<text x="0" y="20" font-size="12" fill="#203a45" translate="no"
@ -115,7 +130,7 @@
</template>
<template v-else>
<text v-if="bank.decision.kind === 'distribute'" x="0" y="20" font-size="11"
>Lot {{ distributionLot + 1 }}</text
>Lot {{ ['I', 'II', 'III'][distributionLot] }}</text
>
<g
v-for="(choice, index) in visibleDecisions"
@ -143,9 +158,9 @@
fill="#c6c6b8"
stroke="#899997"
/>
<text :x="42 + (price - 1) * 30" y="12" text-anchor="middle" font-size="11"
>${{ price }}</text
>
<text :x="42 + (price - 1) * 30" y="12" text-anchor="middle" font-size="16">{{
price
}}</text>
</g>
</template>
<g
@ -270,9 +285,9 @@ export default class OffshoreBank extends Vue {
owner(index: number) {
return this.state.players[index]?.name || String(index + 1);
}
playerLabel(index: number) {
playerLabel(index: number, limit = 18) {
const name = this.owner(index);
return name.length > 10 ? name.slice(0, 9) + '…' : name;
return name.length > limit ? name.slice(0, limit - 1) + '…' : name;
}
auction(type: BankAuctionType, lot: number) {
return this.bank?.auctions.find((a) => a.type === type && a.lot === lot);

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "Conteneur orange : {p0} $",
"tan container: ${p0}": "Conteneur beige : {p0} $",
"white container: ${p0}": "Conteneur blanc : {p0} $",
"dark green container: ${p0}": "Conteneur vert foncé : {p0} $"
"dark green container: ${p0}": "Conteneur vert foncé : {p0} $",
"Bid containers to win this cash.": "Misez des conteneurs pour cet argent.",
"Bid cash to win these containers.": "Misez de l’argent pour ces conteneurs.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Les paiements commencent au lot I, puis passent à II et III en boucle, en sautant les enchères en cours."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -721,5 +721,8 @@
"orange container: ${p0}": "orange container: ${p0}",
"tan container: ${p0}": "tan container: ${p0}",
"white container: ${p0}": "white container: ${p0}",
"dark green container: ${p0}": "dark green container: ${p0}"
"dark green container: ${p0}": "dark green container: ${p0}",
"Bid containers to win this cash.": "Bid containers to win this cash.",
"Bid cash to win these containers.": "Bid cash to win these containers.",
"Lot order: payments start at I, then cycle through II and III, skipping active auctions.": "Lot order: payments start at I, then cycle through II and III, skipping active auctions."
}

View file

@ -61,6 +61,20 @@ describe('Offshore bank viewer', () => {
wrapper.destroy();
});
it('distinguishes lot order from cash using a single guide and sale-price typography', () => {
const { render } = fixture();
const wrapper = render();
expect(wrapper.findAll('.bank-lot-guide text').wrappers.map((node) => node.text())).toEqual(['I', 'II', 'III']);
const money = wrapper.findAll('.bank-money');
expect(money.wrappers.map((node) => node.text())).toEqual(['1', '2', '3']);
expect(money.wrappers.every((node) => node.attributes('font-size') === '16')).toBe(true);
expect(wrapper.find('.bank-piers').exists()).toBe(true);
expect(wrapper.text()).not.toContain('BANK HARBOR');
expect(wrapper.findAll('.offshore-lot title').at(0).text()).toBe('Bid containers to win this cash.');
expect(wrapper.findAll('.offshore-lot title').at(3).text()).toBe('Bid cash to win these containers.');
wrapper.destroy();
});
it('selects the exact type and lot through all six SVG lots', async () => {
const { render } = fixture();
const wrapper = render();
@ -217,7 +231,7 @@ describe('Offshore bank viewer', () => {
};
refresh();
wrapper = render();
expect(wrapper.text()).toContain('Lot 1');
expect(wrapper.text()).toContain('Lot I');
await wrapper.find('.bank-choice [role="button"]').trigger('click');
expect(wrapper.emitted('move')![0][0].name).toBe(MoveName.DistributeBankContainer);
wrapper.destroy();
@ -251,6 +265,32 @@ describe('Offshore bank viewer', () => {
wrapper.destroy();
});
it('places five bank ships in separate berths beside the lots', () => {
const state = setup(5, { offshoreIsland: true }, 'bank-berths');
state.players.forEach((p) => {
p.ship.shipPosition = ShipPosition.OffshoreBank;
});
const game = shallowMount(Game, {
propsData: {
state,
player: state.currentPlayers[0],
emitter: new EventEmitter(),
preferences: { sound: false },
},
});
const ships = (game.vm as any).ships;
expect(ships).toHaveLength(5);
ships.forEach((ship, i) => {
expect(ship.rotate).toBe(90);
// A 30×80 ship rotated around (15,40) spans x-25..x+55 and y+25..y+55.
expect(ship.x - 25).toBeGreaterThanOrEqual(342);
expect(ship.x + 55).toBeLessThanOrEqual(444);
expect(ship.y + 25).toBe(690 + i * 44);
expect(ship.y + 55).toBeLessThan(724 + i * 44);
});
game.destroy();
});
it('renders bank ships at finite coordinates and permits arrival loading only', async () => {
const { state, player, own, refresh, render } = fixture();
own.ship.shipPosition = ShipPosition.OffshoreBank;