Add optional Offshore Island expansion, bank UI, bots and achievements
This commit is contained in:
parent
93194c8b2b
commit
a7064f9c53
46 changed files with 3226 additions and 89 deletions
|
|
@ -28,4 +28,6 @@ npm run serve
|
|||
|
||||
It will use the engine in its sibling folder
|
||||
|
||||
Optional expansion: see [Offshore Island rules, setup, and release notes](docs/offshore-island.md).
|
||||
|
||||
Viewer releases: see [uploading the complete viewer build](docs/viewer-publishing.md).
|
||||
|
|
|
|||
|
|
@ -2,37 +2,54 @@
|
|||
|
||||
The engine wrapper exports the optional `achievementDefinitions()` and
|
||||
`achievements(GameState)` hooks using the published `@boardgamers/protocol/engine`
|
||||
0.11.0 types. The engine 2.1.10 artwork review candidate has manifest revision **3**.
|
||||
IDs are permanent; never reuse them for another condition. All 17 definitions now
|
||||
reference stable `achievement-<id>` assets. Original SVG/PNG artwork, provenance,
|
||||
reproduction instructions and contact sheets are in [achievement-art](achievement-art/README.md).
|
||||
Revision 3 changes only icon references; the revision 2 definitions and evaluator
|
||||
are unchanged. Upload and activation remain gated on independent review approval.
|
||||
0.11.0 types. The working manifest is revision **4** with 19 achievements; no
|
||||
package version bump, publication or activation is part of this expansion work.
|
||||
IDs are permanent; never reuse them for another condition. The original 17
|
||||
definitions, conditions and stable `achievement-<id>` asset references remain
|
||||
unchanged. Original SVG/PNG artwork, provenance, reproduction instructions and
|
||||
contact sheets are in [achievement-art](achievement-art/README.md).
|
||||
The historical revision-3 artwork manifest and release receipt are preserved,
|
||||
not regenerated. Upload and activation remain gated on independent review approval.
|
||||
|
||||
Revision 4 adds **Offshore Magnate** (`offshore-win`) and **Two-Way Trade**
|
||||
(`offshore-trader`). Both require `options.offshoreIsland === true` and the same
|
||||
committed completion and human-seat eligibility checks as base achievements.
|
||||
Offshore Magnate requires a sole game victory (not a draw). Two-Way Trade requires
|
||||
both `player.offshoreStats.cashAuctionsWon >= 1` and
|
||||
`player.offshoreStats.containerAuctionsWon >= 1` in that completed game; it does
|
||||
not require winning the game. Missing/partial counters cannot prove both auctions.
|
||||
Disabled or absent expansion options never earn either new award, even if counters
|
||||
are present. The engine records counters on bank auction settlement and reproduces
|
||||
them on replay; final holdings alone are not evidence of these auction wins.
|
||||
Protocol 0.11.0 supports text badges, not emoji: the new icons use built-in `OI`
|
||||
and `BANK` badges and require no nonexistent artwork or upload.
|
||||
|
||||
## Manifest
|
||||
|
||||
All conditions require a committed, completed 3–5-player game. Non-win feats do
|
||||
not require a victory.
|
||||
|
||||
| ID | Condition |
|
||||
| ------------------ | ------------------------------------------------------------- |
|
||||
| `win` | Sole winner after final score and island-container tiebreaker |
|
||||
| `win-three-player` | Win a three-player game |
|
||||
| `win-four-player` | Win a four-player game |
|
||||
| `win-five-player` | Win a five-player game |
|
||||
| `debt-free-win` | Win with zero outstanding loans |
|
||||
| `score-100` | Final score at least 100 |
|
||||
| `score-150` | Final score at least 150 |
|
||||
| `debt-free` | Zero outstanding loans at completion |
|
||||
| `three-factories` | Own at least three factories at completion |
|
||||
| `four-factories` | Own four factories (the legal maximum) at completion |
|
||||
| `three-warehouses` | Own at least three warehouses at completion |
|
||||
| `five-warehouses` | Own five warehouses at completion |
|
||||
| `island-fifteen` | At least fifteen containers on the island at completion |
|
||||
| `island-ten` | At least ten containers on the island at completion |
|
||||
| `island-diversity` | All five container colors on the island at completion |
|
||||
| `full-ship` | Five containers aboard the ship at completion |
|
||||
| `warehouse-five` | Five containers in the warehouse store at completion |
|
||||
| ID | Condition |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------- |
|
||||
| `win` | Sole winner after final score and island-container tiebreaker |
|
||||
| `win-three-player` | Win a three-player game |
|
||||
| `win-four-player` | Win a four-player game |
|
||||
| `win-five-player` | Win a five-player game |
|
||||
| `debt-free-win` | Win with zero outstanding loans |
|
||||
| `score-100` | Final score at least 100 |
|
||||
| `score-150` | Final score at least 150 |
|
||||
| `debt-free` | Zero outstanding loans at completion |
|
||||
| `three-factories` | Own at least three factories at completion |
|
||||
| `four-factories` | Own four factories (the legal maximum) at completion |
|
||||
| `three-warehouses` | Own at least three warehouses at completion |
|
||||
| `five-warehouses` | Own five warehouses at completion |
|
||||
| `island-fifteen` | At least fifteen containers on the island at completion |
|
||||
| `island-ten` | At least ten containers on the island at completion |
|
||||
| `island-diversity` | All five container colors on the island at completion |
|
||||
| `full-ship` | Five containers aboard the ship at completion |
|
||||
| `warehouse-five` | Five containers in the warehouse store at completion |
|
||||
| `offshore-win` | Sole winner of a completed Offshore Island expansion game |
|
||||
| `offshore-trader` | Win a cash bank auction and a container bank auction in the same completed expansion game |
|
||||
|
||||
## Revision 2 change (pending coordinator approval)
|
||||
|
||||
|
|
@ -69,6 +86,12 @@ using available moves, and completes a seeded game with five warehouse container
|
|||
It checks capacities throughout and replays the serialized completed game to the
|
||||
same awards. It does not inject final holdings or alter money/supply/phase.
|
||||
|
||||
The expansion regression starts from seeded Offshore Island setup, makes legal
|
||||
bank calls from seat zero (first bidding a stored container for cash, then bidding
|
||||
cash for bank containers), and otherwise uses legal AI moves through completion.
|
||||
The serialized finished game earns Two-Way Trade and awards Offshore Magnate to
|
||||
the sole winner; replay reproduces all awards without injecting counters or state.
|
||||
|
||||
## Rules and authority
|
||||
|
||||
This is Container, not Gaia Project. The engine ends after two supply colors run
|
||||
|
|
@ -87,8 +110,9 @@ results; filtering eligibility cannot turn a loss into a win. Player count means
|
|||
original seats, including bots/drops. Singleton/unsupported games get no rows.
|
||||
|
||||
Island holdings come from auctions (including retaining one's own cargo), but do
|
||||
not prove any particular number of auction victories or deliveries. There are no
|
||||
historical shipping, auction, production or borrowing feats. In particular,
|
||||
not prove any particular number of auction victories or deliveries. Base achievements have no
|
||||
historical shipping, auction, production or borrowing feats; only the expansion
|
||||
trading feat reads the explicit bank-auction counters. In particular,
|
||||
`debt-free` does not claim the player never borrowed. No log, objective card,
|
||||
secret breakdown or extra evidence is exposed or required. Hooks do not mutate
|
||||
inputs, and each manifest call returns a fresh object graph.
|
||||
|
|
|
|||
101
docs/offshore-island.md
Normal file
101
docs/offshore-island.md
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# Offshore Island expansion
|
||||
|
||||
This optional expansion adds the **Off-Shore Bank** to Container. The platform
|
||||
expansion ID is `offshore-island`; standalone engine setup uses
|
||||
`{ offshoreIsland: true }`. The setting is persisted in game options so replay
|
||||
uses the same rules. Missing/false means the existing classic implementation.
|
||||
Existing games are not opted in automatically.
|
||||
|
||||
## Rules reference and scope
|
||||
|
||||
Reference: [Container rulebook](https://bghub.org/r/container.pdf), especially
|
||||
pages 2, 11–14, and 16–18. A second public copy is the
|
||||
[retailer-hosted v8 rulebook](https://gamers-hq.de/media/pdf/a6/62/28/Container_Rulebook_v8_compressed.pdf).
|
||||
The requested board is shown in the
|
||||
[Offshore Island discussion](https://boardgamers.space/discussions/offshore-island-expansion-avhRTKevB006WhXy).
|
||||
|
||||
This is an expansion to the existing online rules, not a wholesale migration to
|
||||
the newer edition. Existing supply counts, base-game scoring/tiebreaking, and
|
||||
classic-mode behavior are not silently replaced by the newer edition's rules.
|
||||
No physical-edition artwork is copied into the viewer.
|
||||
|
||||
### Bank economy
|
||||
|
||||
- Three cash lots start at $1/$2/$3. Three container lots start with 2/1/0
|
||||
containers drawn from three distinct colors, removed from the supply.
|
||||
- Call Bank is one action, at most once per turn. Bid cash for a container lot,
|
||||
or factory/warehouse containers for a cash lot. Bank bids are public, unlike
|
||||
delivery-auction bids.
|
||||
- Three/four players share one active bank auction. Five players may have two,
|
||||
but at most one of each type.
|
||||
- The highest bidder wins at the start of their next turn, **after** paying loan
|
||||
interest/default. Auction winnings cannot fund that turn's interest.
|
||||
- Cash committed to a bid is unavailable for other payments. Containers
|
||||
committed to a bid remain reserved against their original district's capacity.
|
||||
Outbid containers return to their original district, with owner repricing.
|
||||
- Bank payments start at lot I, cycling through the three lots and skipping
|
||||
frozen lots with active auctions. A container payer chooses the color order.
|
||||
- Interest, delivery self-buyouts, and seized containers replenish the bank.
|
||||
Building costs and loan repayments still go to the ordinary supply.
|
||||
- Won containers go into the winner's bank holding area, not directly onto their
|
||||
ship or scoring island. Sailing to the bank allows loading one's holding-area
|
||||
containers up to the ship's capacity of five.
|
||||
- No Call Bank on a turn when winning a bank auction or triggering game end.
|
||||
Pending auctions settle at game end. Bank holding-area containers score $3 each.
|
||||
|
||||
## Rules interpretations requiring playtest review
|
||||
|
||||
The implementation uses a minimum opening bank bid of **$1 or one container**.
|
||||
The reference explicitly sets a +1 minimum for raises, but does not specify a
|
||||
numeric opening minimum. This positive minimum is an interpretation, not a
|
||||
verified publisher clarification. The explicit permission for $0 delivery bids
|
||||
does not establish permission for $0 bank bids.
|
||||
|
||||
Bank pickup is available on arrival only. The reference provides no stationary
|
||||
bank-loading action, unlike the explicit ordinary purchase action at a player's
|
||||
harbor. To collect newly won cargo while already at the bank, sail to sea and
|
||||
return. A publisher clarification could warrant changing this behavior later.
|
||||
|
||||
If two bank auctions remain at game end, they resolve in their persisted auction
|
||||
order, completing each payment, collection, and cleanup before the next. Thus a
|
||||
later payment may replenish a lot whose earlier auction has already settled.
|
||||
The rulebook does not explicitly specify an ordering or simultaneous frozen-lot
|
||||
snapshot; this deterministic interpretation also needs publisher/playtest review.
|
||||
|
||||
The old 10th Anniversary Investment Bank differs from the requested newer
|
||||
Off-Shore Bank (for example its single auction and subsidy wording). It is not
|
||||
used to override the newer bank rules.
|
||||
|
||||
## Developer testing
|
||||
|
||||
Run the existing local viewer with `pnpm --dir viewer serve`, then add
|
||||
`?offshoreIsland=1` to its URL to opt into the expansion. Without that query
|
||||
parameter the demo remains classic. BGS uses the expansion ID instead of the
|
||||
local-demo query parameter.
|
||||
|
||||
The engine has focused bank rules tests, serializes between decisions to catch
|
||||
persistence bugs, and plays complete seeded expansion games with bots for all
|
||||
three player counts. Classic compatibility tests compare full serialized setup,
|
||||
completed games, and replay against hashes captured from pre-expansion commit
|
||||
`93194c8`, rather than merely checking that old games still finish.
|
||||
|
||||
New achievements are `offshore-win` (win an expansion game) and `offshore-trader`
|
||||
(win both bank-auction types in one completed expansion game). They use manifest
|
||||
revision 4; all 17 existing achievement IDs and artwork references are retained.
|
||||
|
||||
## Release boundary
|
||||
|
||||
Engine support alone does not expose a selectable expansion in BGS. A release
|
||||
must include the engine and viewer together, register `offshore-island` in the
|
||||
BGS game's expansion metadata, and verify a new expansion game through the
|
||||
platform. Fetch `GET /api/admin/gameinfo/container/3`, preserve existing expansion
|
||||
entries, and append `{ "name": "offshore-island", "label": "Offshore Island" }`
|
||||
to the version-level `expansions` array via the corresponding PUT endpoint.
|
||||
The platform filters unknown expansion IDs, so registration must follow a verified
|
||||
compatible engine/viewer deployment; the old engine ignores expansion IDs. Do not opt an existing saved game into the expansion by editing its
|
||||
options: its setup, supply, and history were created under different rules.
|
||||
|
||||
Before publication, run engine tests/build, viewer checks/unit/browser tests,
|
||||
locale checks, and full-game/replay tests with the expansion both on and off.
|
||||
Verify cash/container conservation, escrow spending and capacity, interrupted
|
||||
turns, spectators' hidden-information views, and dropped-player/bot completion.
|
||||
24
engine/OFFSHORE-CONTRACT.md
Normal file
24
engine/OFFSHORE-CONTRACT.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Offshore engine/viewer contract
|
||||
|
||||
Opt-in `GameOptions.offshoreIsland?: boolean`; wrapper expansion ID `offshore-island`.
|
||||
`G.offshoreBank` exists only when enabled. `cashLots: number[3]`, `containerLots: ContainerPiece[3][]`, `auctions: BankAuction[]`, `called`, `won`. Auction `type: 'cash' | 'containers'` describes **prize**, `lot: 0|1|2`, `bidder`, `cash` (public escrow), `containers: {container: ContainerOnStore, district: 'factory'|'warehouse'}[]` (public escrow/reserves). Money is already net of escrow. Players have optional `bankHolding: ContainerPiece[]`, `offshoreStats: {cashAuctionsWon:number;containerAuctionsWon:number}` including end-game settlements.
|
||||
|
||||
`ShipPosition.OffshoreBank = 'offshoreBank'`. Only free pickup immediately on arrival (or successive pickup); no stationary later-turn pickup.
|
||||
|
||||
Move enum names/values:
|
||||
|
||||
- `CallBank = 'callBank'`: data `{type:'cash'|'containers',lot:number}`, extraData `{cash?:number,containers?:string[]}`. For container prize send cash; for cash prize send container IDs from own factory/warehouse. Minimum opening bid 1 (explicit interpretation of ambiguous rules), raise by at least1. Available data enumerates lot choices, not combinations.
|
||||
- `ReturnBankContainer = 'returnBankContainer'`: data ContainerPiece, extraData `{price:number}`. Price 1–4 factory, 2–6 warehouse. Only returned containers reprice, owner chooses one at a time.
|
||||
- `DistributeBankContainer = 'distributeBankContainer'`: data ContainerPiece, no extraData. Chooses next container to pay into deterministic next unfrozen lot, starting I; repeated until payment exhausted.
|
||||
- `SeizeBankContainer = 'seizeBankContainer'`: data ContainerPiece, no extraData. Right-hand player chooses among highest-priority source; repeat then choose distribution.
|
||||
- `LoadBankContainer = 'loadBankContainer'`: data ContainerPiece, no extraData, free repeat until capacity5. Other normal moves end arrival pickup window.
|
||||
|
||||
`Phase.BankDecision = 'bankDecision'`, `G.currentPlayers` is sole decision owner. `offshoreBank.decision` describes `kind:'return'|'distribute'|'seize'`, `player`, `resumePlayer`, returned `containers`, ordered-to-be-chosen `payment`, distribution `cursor`, optional `debtor`, `remaining`, `settlement`, `ending`. Use availableMoves keys to display controls. Each decision commits independently; resumePlayer's interrupted regular turn resumes after final choice. All choices are logged explicit moves.
|
||||
|
||||
Score breakdown remains same length: ship line includes bankHolding at $3 each. Other base scoring unchanged.
|
||||
|
||||
## Interpretations / unresolved physical-rule detail
|
||||
|
||||
The PDF says any lot may be chosen, so empty lots are legal (positive opening bid still required). For two auctions pending at game end, p18 says to resolve each, but does not specify a simultaneous-payment snapshot or which resolves first. This implementation resolves the persisted `auctions` array in order, with each payment before collection/cleanup as p14 directs. Only currently active tokens freeze lots; a cleaned-up lot can receive later payments. This is deterministic but end-resolution ordering is an explicit rules ambiguity requiring publisher clarification, not a claimed mandated tie-break. Normal turn-start resolution follows the same pay/collect/clean sequence.
|
||||
|
||||
`initialContainerLots` is an additional public immutable setup snapshot used to reconstruct observed cash from a stripped state with an unrelated analysis seed. It contains only the publicly seeded bank pieces, never secret cash or scoring cards.
|
||||
|
|
@ -1,7 +1,16 @@
|
|||
export { availableMoves, AvailableMoves } from './src/available-moves';
|
||||
export * from './src/choice-revisions';
|
||||
export { currentPlayers, ended, move, moveAI, setup, stripSecret } from './src/engine';
|
||||
export { Phase } from './src/gamestate';
|
||||
export type { GameState, Player, PointCard } from './src/gamestate';
|
||||
export { Phase, ShipPosition } from './src/gamestate';
|
||||
export type {
|
||||
BankAuction,
|
||||
BankAuctionType,
|
||||
BankEscrowContainer,
|
||||
GameOptions,
|
||||
GameState,
|
||||
OffshoreBank,
|
||||
Player,
|
||||
PointCard,
|
||||
} from './src/gamestate';
|
||||
export { GameEventName, LogItem } from './src/log';
|
||||
export { isLoanReversal, Move, MoveName, Moves } from './src/move';
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ describe('per-game achievements', function () {
|
|||
for (const count of [3, 4, 5]) completed.push(complete(count));
|
||||
});
|
||||
|
||||
it('publishes a fresh, stable, secret-free revision-three manifest', () => {
|
||||
it('publishes a fresh, stable, secret-free revision-four manifest', () => {
|
||||
expect(hooks.achievementDefinitions).to.be.a('function');
|
||||
const manifest = wrapper.achievementDefinitions();
|
||||
expect(manifest.revision).to.equal(3);
|
||||
expect(manifest.revision).to.equal(4);
|
||||
expect(manifest.achievements.map((d) => d.id)).not.to.include('island-five');
|
||||
expect(manifest.achievements.find((d) => d.id === 'island-fifteen')).to.deep.equal({
|
||||
id: 'island-fifteen',
|
||||
|
|
@ -51,10 +51,14 @@ describe('per-game achievements', function () {
|
|||
description: 'Finish with at least fifteen containers on your island.',
|
||||
icon: { type: 'asset', key: 'achievement-island-fifteen' },
|
||||
});
|
||||
expect(manifest.achievements).to.have.length(17);
|
||||
expect(new Set(manifest.achievements.map((d) => d.id)).size).to.equal(17);
|
||||
expect(manifest.achievements).to.have.length(19);
|
||||
expect(new Set(manifest.achievements.map((d) => d.id)).size).to.equal(19);
|
||||
for (const definition of manifest.achievements) {
|
||||
expect(definition.icon).to.deep.equal({ type: 'asset', key: `achievement-${definition.id}` });
|
||||
expect(definition.icon).to.deep.equal(
|
||||
definition.id.startsWith('offshore-')
|
||||
? { type: 'text', text: definition.id === 'offshore-win' ? 'OI' : 'BANK' }
|
||||
: { type: 'asset', key: `achievement-${definition.id}` }
|
||||
);
|
||||
expect(definition.id).to.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
||||
expect(definition.id.length).to.be.at.most(64);
|
||||
expect(definition.name).not.to.equal('');
|
||||
|
|
@ -190,6 +194,103 @@ describe('per-game achievements', function () {
|
|||
expect(wrapper.achievements(G)).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it('earns both expansion awards through legal completion and serialized replay', () => {
|
||||
const random = Math.random;
|
||||
Math.random = seedrandom('offshore-achievements');
|
||||
let G = setup(3, { offshoreIsland: true }, 'offshore-achievements');
|
||||
try {
|
||||
for (let i = 0; i < 20000 && !wrapper.ended(G); i++) {
|
||||
const seat = G.currentPlayers[0];
|
||||
const p = G.players[seat];
|
||||
// Seat zero pursues both auction types while opponents use the bank too.
|
||||
// First sell stored containers, then buy bank stock with cash.
|
||||
const offer =
|
||||
seat === 0 &&
|
||||
p.availableMoves?.[MoveName.CallBank]?.find(
|
||||
(offer) => offer.type === (p.offshoreStats!.cashAuctionsWon ? 'containers' : 'cash')
|
||||
);
|
||||
if (offer && !p.offshoreStats!.containerAuctionsWon) {
|
||||
const active = G.offshoreBank!.auctions.find((a) => a.type === offer.type);
|
||||
G = move(
|
||||
G,
|
||||
{
|
||||
name: MoveName.CallBank,
|
||||
data: offer,
|
||||
extraData:
|
||||
offer.type === 'cash'
|
||||
? {
|
||||
containers: [...p.containersOnFactoryStore, ...p.containersOnWarehouseStore]
|
||||
.slice(0, (active?.containers.length || 0) + 1)
|
||||
.map((c) => c.piece.id),
|
||||
}
|
||||
: { cash: (active?.cash || 0) + 1 },
|
||||
},
|
||||
seat
|
||||
);
|
||||
} else {
|
||||
G = moveAI(G, seat);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Math.random = random;
|
||||
}
|
||||
expect(wrapper.ended(G), 'legal expansion policy finishes').to.equal(true);
|
||||
const saved: GameState = JSON.parse(JSON.stringify(G));
|
||||
const before = JSON.stringify(saved);
|
||||
const result = wrapper.achievements(freeze(saved));
|
||||
expect(result[0].earned).to.include('offshore-trader');
|
||||
expect(result.some((row) => row.earned.includes('offshore-win'))).to.equal(true);
|
||||
expect(wrapper.achievements(wrapper.replay(saved))).to.deep.equal(result);
|
||||
expect(JSON.stringify(saved)).to.equal(before);
|
||||
});
|
||||
|
||||
it('gates expansion awards on the option, both counters, completion and seat eligibility', () => {
|
||||
const G = cloneDeep(completed[0]);
|
||||
G.players.forEach((p, seat) => {
|
||||
p.money = 100 - seat;
|
||||
p.containersOnIsland = [];
|
||||
p.offshoreStats = { cashAuctionsWon: 1, containerAuctionsWon: 1 };
|
||||
});
|
||||
const earned = (seat = 0) => wrapper.achievements(G).find((row) => row.seat === seat)!.earned;
|
||||
for (const option of [undefined, false]) {
|
||||
G.options.offshoreIsland = option;
|
||||
expect(earned()).not.to.include('offshore-win');
|
||||
expect(earned()).not.to.include('offshore-trader');
|
||||
}
|
||||
G.options.offshoreIsland = true;
|
||||
expect(earned()).to.include('offshore-win');
|
||||
expect(earned()).to.include('offshore-trader');
|
||||
expect(earned(1)).not.to.include('offshore-win');
|
||||
expect(earned(1)).to.include('offshore-trader');
|
||||
for (const stats of [
|
||||
undefined,
|
||||
{},
|
||||
{ cashAuctionsWon: 1 },
|
||||
{ containerAuctionsWon: 1 },
|
||||
{ cashAuctionsWon: 0, containerAuctionsWon: 1 },
|
||||
{ cashAuctionsWon: 1, containerAuctionsWon: 0 },
|
||||
]) {
|
||||
// Partial counters model old or incomplete serialized evidence.
|
||||
G.players[0].offshoreStats = stats as GameState['players'][number]['offshoreStats'];
|
||||
expect(earned()).not.to.include('offshore-trader');
|
||||
expect(earned()).to.include('offshore-win');
|
||||
}
|
||||
G.players[0].offshoreStats = { cashAuctionsWon: 2, containerAuctionsWon: 3 };
|
||||
expect(earned()).to.include('offshore-trader');
|
||||
G.players[1].money = G.players[0].money;
|
||||
expect(earned()).not.to.include('offshore-win');
|
||||
expect(earned()).to.include('offshore-trader');
|
||||
G.players[0].isAI = true;
|
||||
G.players[1].isDropped = true;
|
||||
expect(wrapper.achievements(G).map((row) => row.seat)).to.deep.equal([2]);
|
||||
G.newTurn = false;
|
||||
expect(wrapper.achievements(G)).to.deep.equal([]);
|
||||
G.newTurn = true;
|
||||
G.phase = Phase.Move;
|
||||
expect(wrapper.achievements(G)).to.deep.equal([]);
|
||||
expect(wrapper.achievements(setup(3, { offshoreIsland: true }, 'offshore-ongoing'))).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it('checks every numeric and diversity boundary independently of winning', () => {
|
||||
const G = cloneDeep(completed[0]);
|
||||
const p = G.players[0];
|
||||
|
|
|
|||
|
|
@ -25,13 +25,28 @@ const definitions = [
|
|||
|
||||
export function achievementDefinitions(): AchievementManifest {
|
||||
return {
|
||||
revision: 3,
|
||||
achievements: definitions.map(([id, name, description]) => ({
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
icon: { type: 'asset', key: `achievement-${id}` },
|
||||
})),
|
||||
revision: 4,
|
||||
achievements: [
|
||||
...definitions.map(([id, name, description]) => ({
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
icon: { type: 'asset' as const, key: `achievement-${id}` },
|
||||
})),
|
||||
{
|
||||
id: 'offshore-win',
|
||||
name: 'Offshore Magnate',
|
||||
description: 'Win a completed game with the Offshore Island expansion.',
|
||||
icon: { type: 'text', text: 'OI' },
|
||||
},
|
||||
{
|
||||
id: 'offshore-trader',
|
||||
name: 'Two-Way Trade',
|
||||
description:
|
||||
'Win at least one cash auction and one container auction at the bank in the same completed Offshore Island game.',
|
||||
icon: { type: 'text', text: 'BANK' },
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +85,13 @@ export function achievements(G: GameState): SeatAchievements[] {
|
|||
['island-diversity', new Set(p.containersOnIsland.map((c) => c.color)).size === 5],
|
||||
['full-ship', p.ship.containers.length === 5],
|
||||
['warehouse-five', p.containersOnWarehouseStore.length === 5],
|
||||
['offshore-win', G.options.offshoreIsland === true && win],
|
||||
[
|
||||
'offshore-trader',
|
||||
G.options.offshoreIsland === true &&
|
||||
(p.offshoreStats?.cashAuctionsWon ?? 0) >= 1 &&
|
||||
(p.offshoreStats?.containerAuctionsWon ?? 0) >= 1,
|
||||
],
|
||||
] as const;
|
||||
return { seat, earned: earned.filter(([, met]) => met).map(([id]) => id), outcome };
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
import { remove } from 'lodash';
|
||||
import { ContainerColor, ContainerOnStore, ContainerPiece, GameState, Phase, Player, ShipPosition } from './gamestate';
|
||||
import { MoveName } from './move';
|
||||
import { bankMoves, bankProductionAllowed, reserved } from './offshore';
|
||||
|
||||
export interface AvailableMoves {
|
||||
[MoveName.CallBank]?: { type: 'cash' | 'containers'; lot: number }[];
|
||||
[MoveName.ReturnBankContainer]?: ContainerPiece[];
|
||||
[MoveName.DistributeBankContainer]?: ContainerPiece[];
|
||||
[MoveName.SeizeBankContainer]?: ContainerPiece[];
|
||||
[MoveName.LoadBankContainer]?: ContainerPiece[];
|
||||
[MoveName.DomesticSale]?: ContainerPiece[];
|
||||
[MoveName.BuyFromFactory]?: Array<{
|
||||
player: number;
|
||||
|
|
@ -27,6 +33,7 @@ export interface AvailableMoves {
|
|||
}
|
||||
|
||||
export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
||||
if (G.offshoreBank && G.phase === Phase.BankDecision) return bankMoves(G, player);
|
||||
switch (G.phase) {
|
||||
case Phase.Bid: {
|
||||
const moves = {
|
||||
|
|
@ -65,7 +72,10 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
|
||||
// BuyFromFactory
|
||||
if (player.actions > 0 || player.lastMove?.name === MoveName.BuyFromFactory) {
|
||||
if (player.containersOnWarehouseStore.length < player.warehouses.length) {
|
||||
if (
|
||||
player.containersOnWarehouseStore.length + reserved(G, player, 'warehouse') <
|
||||
player.warehouses.length
|
||||
) {
|
||||
const containersAvailable: {
|
||||
player: number;
|
||||
container: ContainerOnStore;
|
||||
|
|
@ -101,6 +111,7 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
player.lastMove?.name === MoveName.BuyFromWarehouse
|
||||
) {
|
||||
if (
|
||||
player.ship.shipPosition !== ShipPosition.OffshoreBank &&
|
||||
player.ship.shipPosition !== ShipPosition.Island &&
|
||||
player.ship.shipPosition !== ShipPosition.OpenSea &&
|
||||
player.ship.containers.length < 5
|
||||
|
|
@ -242,6 +253,7 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
|
||||
remove(positions, (pos) => G.players.map((p) => p.ship.shipPosition).indexOf(pos) != -1);
|
||||
|
||||
if (G.offshoreBank) positions.push(ShipPosition.OffshoreBank);
|
||||
if (player.ship.containers.length > 0) {
|
||||
positions.push(ShipPosition.Island);
|
||||
}
|
||||
|
|
@ -266,7 +278,8 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
player.lastMove?.name === MoveName.Produce
|
||||
) {
|
||||
if (
|
||||
player.containersOnFactoryStore.length < player.factories.length * 2 &&
|
||||
player.containersOnFactoryStore.length + reserved(G, player, 'factory') <
|
||||
player.factories.length * 2 &&
|
||||
player.produced.length < player.factories.length
|
||||
) {
|
||||
const canProduce: ContainerColor[] = [];
|
||||
|
|
@ -280,7 +293,7 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
).length;
|
||||
|
||||
if (totalFactories > producedContainers && containersLeft.indexOf(factory.color) !== -1)
|
||||
canProduce.push(factory.color);
|
||||
if (bankProductionAllowed(G, player, factory.color)) canProduce.push(factory.color);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -292,6 +305,8 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
|
|||
}
|
||||
}
|
||||
|
||||
if (G.offshoreBank && !(player.lastMove?.name === MoveName.Produce && moves[MoveName.Produce]))
|
||||
Object.assign(moves, bankMoves(G, player));
|
||||
return moves;
|
||||
}
|
||||
|
||||
|
|
|
|||
52
engine/src/classic-compatibility.spec.ts
Normal file
52
engine/src/classic-compatibility.spec.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { expect } from 'chai';
|
||||
import { createHash } from 'crypto';
|
||||
import seedrandom from 'seedrandom';
|
||||
import * as wrapper from '../wrapper';
|
||||
|
||||
// Captured by running unmodified commit 93194c8 in isolation, before this expansion.
|
||||
// Hash the complete serialized state, including logs and deterministic piece IDs.
|
||||
const baselines = [
|
||||
[
|
||||
3,
|
||||
102,
|
||||
'1a0a53979c32085df8942e94dce769464772f8653050920f58b8a031360ad890',
|
||||
'd6e2d9344f775d813ffd33ba3a9ed0f6e781c37aa7f7153da5912cfee89d95ed',
|
||||
],
|
||||
[
|
||||
4,
|
||||
187,
|
||||
'e958f1b8bdbe051a77a8440ae8c34384cf640ecf5c6c07ef1e398269acab6ef8',
|
||||
'bc2afe3eafcf6c38e433c5ee24abb9417b0c1bf56ac5110759c50f6ddc3451ca',
|
||||
],
|
||||
[
|
||||
5,
|
||||
293,
|
||||
'5f74b35334a567ace31e59eaf988b01c374b4a74de244a631ef4d9afae91d44c',
|
||||
'b46c3c6e18635c10b5c68f5d7af1373bebab7f0de415f0d85a0995aa02e19cc5',
|
||||
],
|
||||
] as const;
|
||||
const digest = (value: unknown) => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
||||
|
||||
describe('classic compatibility with pre-expansion release', () => {
|
||||
for (const [players, expectedTurns, initialHash, finalHash] of baselines) {
|
||||
it(`preserves the full seeded ${players}-player setup, game and replay`, async () => {
|
||||
const seed = `achievements-${players}`;
|
||||
const random = Math.random;
|
||||
Math.random = seedrandom(seed);
|
||||
try {
|
||||
let state = await wrapper.init(players, [], {}, seed);
|
||||
expect(digest(state)).to.equal(initialHash);
|
||||
let turns = 0;
|
||||
while (!wrapper.ended(state) && turns++ < 20000) {
|
||||
state = wrapper.moveAI(state, state.currentPlayers[0]);
|
||||
}
|
||||
expect(wrapper.ended(state)).to.equal(true);
|
||||
expect(turns).to.equal(expectedTurns);
|
||||
expect(digest(state)).to.equal(finalHash);
|
||||
expect(digest(wrapper.replay(JSON.parse(JSON.stringify(state))))).to.equal(finalHash);
|
||||
} finally {
|
||||
Math.random = random;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -17,11 +17,12 @@ import {
|
|||
} from './gamestate';
|
||||
import { GameEventName, LogItem, LogMove } from './log';
|
||||
import { Move, MoveName, Moves } from './move';
|
||||
import { applyBankMove, bankUpkeep, payBankCash, settleBank } from './offshore';
|
||||
import { asserts, shuffle } from './utils';
|
||||
|
||||
export const playerColors = ['dodgerblue', 'red', 'yellow', 'limegreen', 'mediumorchid'];
|
||||
|
||||
export function setup(numPlayers: number, { beginner = true }: GameOptions, seed?: string): GameState {
|
||||
export function setup(numPlayers: number, { beginner = true, offshoreIsland }: GameOptions, seed?: string): GameState {
|
||||
seed = seed ?? Math.random().toString();
|
||||
const rng = seedrandom(seed);
|
||||
|
||||
|
|
@ -104,6 +105,28 @@ export function setup(numPlayers: number, { beginner = true }: GameOptions, seed
|
|||
player.warehouses.push(G.warehousesLeft.pop()!);
|
||||
});
|
||||
|
||||
if (offshoreIsland) {
|
||||
G.options.offshoreIsland = true;
|
||||
G.offshoreBank = {
|
||||
initialContainerLots: [],
|
||||
cashLots: [1, 2, 3],
|
||||
containerLots: [[], [], []],
|
||||
auctions: [],
|
||||
called: false,
|
||||
won: false,
|
||||
};
|
||||
const bankColors = shuffle(containerColors, rng() + '');
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const index = G.containersLeft.findIndex((c) => c.color === bankColors[i]);
|
||||
G.offshoreBank.containerLots[i < 2 ? 0 : 1].push(G.containersLeft.splice(index, 1)[0]);
|
||||
}
|
||||
G.offshoreBank.initialContainerLots = G.offshoreBank.containerLots.map((lot) => lot.slice());
|
||||
G.players.forEach((p) => {
|
||||
p.bankHolding = [];
|
||||
p.offshoreStats = { cashAuctionsWon: 0, containerAuctionsWon: 0 };
|
||||
});
|
||||
}
|
||||
|
||||
G.log.push({ type: 'event', event: { name: GameEventName.GameStart } });
|
||||
|
||||
G.players[startingPlayer].actions = 2;
|
||||
|
|
@ -162,13 +185,46 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
"Can't bid more money than you have!"
|
||||
);
|
||||
|
||||
if (G.offshoreBank && move.name === MoveName.Produce) {
|
||||
assert(
|
||||
move.extraData?.piece?.color === move.data &&
|
||||
G.containersLeft.some((c) => isEqual(c, move.extraData.piece)),
|
||||
'Invalid produced container'
|
||||
);
|
||||
assert(
|
||||
Number.isInteger(move.extraData.price) && move.extraData.price >= 1 && move.extraData.price <= 4,
|
||||
'Invalid production price'
|
||||
);
|
||||
}
|
||||
G.liveUpdate = revision;
|
||||
const previousBid = revision
|
||||
? G.hiddenLog
|
||||
.map((e) => e.type === 'move' && e.player === playerNumber && e.move.name === MoveName.Bid)
|
||||
.lastIndexOf(true)
|
||||
: -1;
|
||||
const bankResult = applyBankMove(G, move, player);
|
||||
if (bankResult.handled) {
|
||||
G.log.push({
|
||||
type: 'move',
|
||||
player: playerNumber,
|
||||
move,
|
||||
simple: `${player.name} ${move.name}`,
|
||||
pretty: `${player.name} ${move.name}`,
|
||||
});
|
||||
if (bankResult.ending && !fake) {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
}
|
||||
}
|
||||
switch (move.name) {
|
||||
// These moves were executed by applyBankMove; common bookkeeping follows below.
|
||||
case MoveName.CallBank:
|
||||
case MoveName.LoadBankContainer:
|
||||
case MoveName.ReturnBankContainer:
|
||||
case MoveName.DistributeBankContainer:
|
||||
case MoveName.SeizeBankContainer:
|
||||
break;
|
||||
case MoveName.DomesticSale: {
|
||||
asserts<Moves.MoveDomesticSale>(move);
|
||||
if (player.containersOnFactoryStore.length > 0) {
|
||||
|
|
@ -551,9 +607,11 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
if ([...new Set(G.containersLeft.map((c) => c.color))].length >= 4) {
|
||||
doUpkeep(G);
|
||||
} else {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
if (!G.offshoreBank || !settleBank(G, true)) {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -579,6 +637,7 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
player.ship.containers = [];
|
||||
const bid = G.players[G.highestBidders[0]].bid + G.players[G.highestBidders[0]].additionalBid;
|
||||
player.money -= bid;
|
||||
payBankCash(G, bid);
|
||||
G.players.forEach((p) => {
|
||||
p.bid = p.additionalBid = 0;
|
||||
});
|
||||
|
|
@ -594,9 +653,11 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
if ([...new Set(G.containersLeft.map((c) => c.color))].length >= 4) {
|
||||
doUpkeep(G);
|
||||
} else {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
if (!G.offshoreBank || !settleBank(G, true)) {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -631,9 +692,11 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
if ([...new Set(G.containersLeft.map((c) => c.color))].length >= 4) {
|
||||
doUpkeep(G);
|
||||
} else {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
if (!G.offshoreBank || !settleBank(G, true)) {
|
||||
G.phase = Phase.GameEnd;
|
||||
G.currentPlayers = [];
|
||||
calculateEndScore(G);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -664,13 +727,91 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
move.name === MoveName.Accept ||
|
||||
move.name === MoveName.Decline ||
|
||||
move.name === MoveName.Bid;
|
||||
G.newTurn = turnBoundary || !(lastLog?.type === 'move' && G.currentPlayers.includes(lastLog.player));
|
||||
G.newTurn =
|
||||
(bankResult.handled && move.name !== MoveName.LoadBankContainer && move.name !== MoveName.CallBank) ||
|
||||
(bankResult.handled && G.phase === Phase.BankDecision) ||
|
||||
turnBoundary ||
|
||||
!(lastLog?.type === 'move' && G.currentPlayers.includes(lastLog.player));
|
||||
|
||||
while (G.offshoreBank && G.phase === Phase.BankDecision && G.players[G.currentPlayers[0]].isDropped) {
|
||||
G = moveAI(G, G.currentPlayers[0]);
|
||||
}
|
||||
return G;
|
||||
}
|
||||
|
||||
export function moveAI(G: GameState, playerNumber: number): GameState {
|
||||
const player = G.players[playerNumber];
|
||||
if (G.offshoreBank && G.phase === Phase.BankDecision) {
|
||||
const name = Object.keys(player.availableMoves!)[0] as MoveName;
|
||||
const data = player.availableMoves![name]![0];
|
||||
const c = G.offshoreBank.decision?.containers.find((c) => c.container.piece.id === (data as ContainerPiece).id);
|
||||
return move(
|
||||
G,
|
||||
{
|
||||
name,
|
||||
data,
|
||||
...(name === MoveName.ReturnBankContainer ? { extraData: { price: c!.container.price } } : {}),
|
||||
} as Move,
|
||||
playerNumber
|
||||
);
|
||||
}
|
||||
// Keep expansion decisions deterministic and entirely outside the classic random stream.
|
||||
if (G.offshoreBank && G.phase === Phase.Move) {
|
||||
const moves = player.availableMoves!;
|
||||
const load = moves[MoveName.LoadBankContainer];
|
||||
if (load?.length) return move(G, { name: MoveName.LoadBankContainer, data: load[0] }, playerNumber);
|
||||
|
||||
// Collect paid-for cargo before shopping for more. Do not detour a full ship.
|
||||
if (player.bankHolding!.length && player.ship.containers.length < 5) {
|
||||
const destination = moves[MoveName.Sail]?.includes(ShipPosition.OffshoreBank)
|
||||
? ShipPosition.OffshoreBank
|
||||
: player.ship.shipPosition !== ShipPosition.OpenSea &&
|
||||
player.ship.shipPosition !== ShipPosition.OffshoreBank &&
|
||||
moves[MoveName.Sail]?.includes(ShipPosition.OpenSea)
|
||||
? ShipPosition.OpenSea
|
||||
: undefined;
|
||||
if (destination) return move(G, { name: MoveName.Sail, data: destination }, playerNumber);
|
||||
}
|
||||
|
||||
let offer: Move | undefined;
|
||||
let bestProfit = 0;
|
||||
for (const data of moves[MoveName.CallBank] || []) {
|
||||
const active = G.offshoreBank.auctions.find((a) => a.type === data.type);
|
||||
if (data.type === 'containers') {
|
||||
const count = G.offshoreBank.containerLots[data.lot].length;
|
||||
const cash = (active?.cash || 0) + 1;
|
||||
// Value cargo conservatively, cap the backlog, and reserve working cash plus interest.
|
||||
const profit = count * 2 - cash;
|
||||
if (
|
||||
count &&
|
||||
count + player.bankHolding!.length <= 5 &&
|
||||
cash <= player.money - player.loans.length - 5 &&
|
||||
profit > bestProfit
|
||||
) {
|
||||
offer = { name: MoveName.CallBank, data, extraData: { cash } };
|
||||
bestProfit = profit;
|
||||
}
|
||||
} else {
|
||||
const count = (active?.containers.length || 0) + 1;
|
||||
const stock = [
|
||||
...player.containersOnFactoryStore.map((c) => ({ c, value: Math.max(2, c.price) })),
|
||||
...player.containersOnWarehouseStore.map((c) => ({ c, value: Math.max(3, c.price) })),
|
||||
].sort((a, b) => a.value - b.value);
|
||||
const payment = stock.slice(0, count);
|
||||
const profit = G.offshoreBank.cashLots[data.lot] - payment.reduce((sum, c) => sum + c.value, 0);
|
||||
// Stored cargo is productive inventory: only exchange it for a clear cash gain.
|
||||
if (payment.length === count && profit >= 2 && profit > bestProfit) {
|
||||
offer = {
|
||||
name: MoveName.CallBank,
|
||||
data,
|
||||
extraData: { containers: payment.map((c) => c.c.piece.id) },
|
||||
};
|
||||
bestProfit = profit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (offer) return move(G, offer, playerNumber);
|
||||
}
|
||||
let moveName, data;
|
||||
let retry = 0;
|
||||
do {
|
||||
|
|
@ -691,7 +832,7 @@ export function moveAI(G: GameState, playerNumber: number): GameState {
|
|||
moveName = MoveName.Sail;
|
||||
data = player.ship.shipPosition == ShipPosition.OpenSea ? ShipPosition.Island : ShipPosition.OpenSea;
|
||||
} else {
|
||||
const moves = Object.keys(player.availableMoves!);
|
||||
const moves = Object.keys(player.availableMoves!).filter((n) => n !== MoveName.CallBank);
|
||||
|
||||
if (
|
||||
player.lastMove?.name == MoveName.Sail &&
|
||||
|
|
@ -725,6 +866,8 @@ export function moveAI(G: GameState, playerNumber: number): GameState {
|
|||
} else if (moveName == MoveName.Sail) {
|
||||
if (data == ShipPosition.Island) {
|
||||
if (player.ship.containers.length == 0) moveName = null;
|
||||
} else if (G.offshoreBank && data === ShipPosition.OffshoreBank) {
|
||||
if (!player.bankHolding!.length || player.ship.containers.length === 5) moveName = null;
|
||||
} else if (data.startsWith('playerHarbor0')) {
|
||||
if (G.players[0].containersOnWarehouseStore.length == 0) moveName = null;
|
||||
} else if (data.startsWith('playerHarbor1')) {
|
||||
|
|
@ -904,8 +1047,8 @@ function calculateEndScore(G: GameState) {
|
|||
|
||||
player.finalScoreBreakdown.push('$' + player.containersOnWarehouseStore.length * 2);
|
||||
player.money += player.containersOnWarehouseStore.length * 2;
|
||||
player.finalScoreBreakdown.push('$' + player.ship.containers.length * 3);
|
||||
player.money += player.ship.containers.length * 3;
|
||||
player.finalScoreBreakdown.push('$' + (player.ship.containers.length + (player.bankHolding?.length || 0)) * 3);
|
||||
player.money += (player.ship.containers.length + (player.bankHolding?.length || 0)) * 3;
|
||||
player.finalScoreBreakdown.push('-$' + player.loans.length * 11);
|
||||
player.money += player.loans.length * -11;
|
||||
});
|
||||
|
|
@ -933,7 +1076,7 @@ function doUpkeep(G: GameState) {
|
|||
// Pass/Accept/Decline log entry), so together they pin a per-upkeep random stream.
|
||||
const rng = seedrandom(`${G.seed}:upkeep:${G.log.length}`);
|
||||
const player = G.players[G.currentPlayers[0]];
|
||||
const loanCount = player.loans.length;
|
||||
const loanCount = G.offshoreBank ? 0 : player.loans.length;
|
||||
const interest: string[] = [];
|
||||
for (let i = 0; i < loanCount; i++) {
|
||||
if (player.money > 0) {
|
||||
|
|
@ -1053,6 +1196,7 @@ function doUpkeep(G: GameState) {
|
|||
if (currentPlayer == G.startingPlayer) {
|
||||
G.round++;
|
||||
}
|
||||
if (G.offshoreBank) bankUpkeep(G);
|
||||
}
|
||||
|
||||
function remove(array, value) {
|
||||
|
|
@ -1066,6 +1210,8 @@ function removeRandom<T>(array: T[], rng: () => number): T {
|
|||
|
||||
function prettyShipPosition(G: GameState, data: ShipPosition, simple = false): string {
|
||||
switch (data) {
|
||||
case ShipPosition.OffshoreBank:
|
||||
return 'the Off-Shore Bank';
|
||||
case ShipPosition.Island:
|
||||
return 'the island harbor';
|
||||
case ShipPosition.OpenSea:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { Move } from './move';
|
|||
|
||||
export interface GameOptions {
|
||||
beginner?: boolean;
|
||||
offshoreIsland?: boolean;
|
||||
}
|
||||
|
||||
export enum ContainerColor {
|
||||
|
|
@ -33,6 +34,7 @@ export interface ContainerOnStore {
|
|||
}
|
||||
|
||||
export enum ShipPosition {
|
||||
OffshoreBank = 'offshoreBank',
|
||||
OpenSea = 'sea',
|
||||
PlayerHarbor01 = 'playerHarbor01',
|
||||
PlayerHarbor02 = 'playerHarbor02',
|
||||
|
|
@ -64,6 +66,8 @@ export interface Ship {
|
|||
}
|
||||
|
||||
export interface Player {
|
||||
bankHolding?: ContainerPiece[];
|
||||
offshoreStats?: { cashAuctionsWon: number; containerAuctionsWon: number };
|
||||
id: number;
|
||||
pointCard: PointCard | null;
|
||||
factories: FactoryPiece[];
|
||||
|
|
@ -90,6 +94,7 @@ export interface Player {
|
|||
}
|
||||
|
||||
export enum Phase {
|
||||
BankDecision = 'bankDecision',
|
||||
Move = 'move',
|
||||
Bid = 'bid',
|
||||
AcceptDecline = 'acceptDecline',
|
||||
|
|
@ -119,7 +124,40 @@ export interface ShipPiece {
|
|||
id: `S${number}`;
|
||||
}
|
||||
|
||||
export type BankAuctionType = 'cash' | 'containers';
|
||||
export interface BankEscrowContainer {
|
||||
container: ContainerOnStore;
|
||||
district: 'factory' | 'warehouse';
|
||||
}
|
||||
export interface BankAuction {
|
||||
type: BankAuctionType;
|
||||
lot: number;
|
||||
bidder: number;
|
||||
cash: number;
|
||||
containers: BankEscrowContainer[];
|
||||
}
|
||||
export interface OffshoreBank {
|
||||
initialContainerLots: ContainerPiece[][];
|
||||
cashLots: number[];
|
||||
containerLots: ContainerPiece[][];
|
||||
auctions: BankAuction[];
|
||||
called: boolean;
|
||||
won: boolean;
|
||||
decision?: {
|
||||
kind: 'return' | 'distribute' | 'seize';
|
||||
player: number;
|
||||
resumePlayer: number;
|
||||
containers: BankEscrowContainer[];
|
||||
payment: ContainerPiece[];
|
||||
cursor: number;
|
||||
debtor?: number;
|
||||
remaining?: number;
|
||||
settlement?: BankAuction;
|
||||
ending?: boolean;
|
||||
};
|
||||
}
|
||||
export interface GameState {
|
||||
offshoreBank?: OffshoreBank;
|
||||
liveUpdate?: boolean;
|
||||
analysisCash?: number[];
|
||||
pendingMessages?: string[];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
import { ContainerColor, ContainerPiece, FactoryPiece, ShipPosition, WarehousePiece } from './gamestate';
|
||||
|
||||
export declare namespace Moves {
|
||||
export interface MoveCallBank {
|
||||
name: MoveName.CallBank;
|
||||
data: { type: 'cash' | 'containers'; lot: number };
|
||||
extraData: { cash?: number; containers?: string[] };
|
||||
}
|
||||
export interface MoveBankContainer {
|
||||
name:
|
||||
| MoveName.ReturnBankContainer
|
||||
| MoveName.DistributeBankContainer
|
||||
| MoveName.SeizeBankContainer
|
||||
| MoveName.LoadBankContainer;
|
||||
data: ContainerPiece;
|
||||
extraData?: { price: number };
|
||||
}
|
||||
|
||||
export interface MoveBuyFromFactory {
|
||||
name: MoveName.BuyFromFactory;
|
||||
data: {
|
||||
|
|
@ -91,6 +106,8 @@ export declare namespace Moves {
|
|||
}
|
||||
|
||||
export type Move = (
|
||||
| Moves.MoveCallBank
|
||||
| Moves.MoveBankContainer
|
||||
| Moves.MoveBuyFromFactory
|
||||
| Moves.MoveBuyFromWarehouse
|
||||
| Moves.MoveBuyFactory
|
||||
|
|
@ -109,6 +126,11 @@ export type Move = (
|
|||
) & { revision?: string };
|
||||
|
||||
export enum MoveName {
|
||||
CallBank = 'callBank',
|
||||
ReturnBankContainer = 'returnBankContainer',
|
||||
DistributeBankContainer = 'distributeBankContainer',
|
||||
SeizeBankContainer = 'seizeBankContainer',
|
||||
LoadBankContainer = 'loadBankContainer',
|
||||
DomesticSale = 'domesticSale',
|
||||
BuyWarehouse = 'buyWarehouse',
|
||||
BuyFactory = 'buyFactory',
|
||||
|
|
|
|||
46
engine/src/offshore-ai.spec.ts
Normal file
46
engine/src/offshore-ai.spec.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { expect } from 'chai';
|
||||
import seedrandom from 'seedrandom';
|
||||
import * as wrapper from '../wrapper';
|
||||
import { MoveName } from './move';
|
||||
|
||||
const json = (value: unknown) => JSON.parse(JSON.stringify(value));
|
||||
|
||||
describe('Off-Shore Bank bots', () => {
|
||||
for (const seats of [3, 4, 5]) {
|
||||
it(`completes and replays a serialized ${seats}-seat game with bank participation`, async function () {
|
||||
this.timeout(30000);
|
||||
const random = Math.random;
|
||||
const seed = `offshore-ai-${seats}`;
|
||||
Math.random = seedrandom(seed);
|
||||
try {
|
||||
let state = await wrapper.init(seats, [], { offshoreIsland: true }, seed);
|
||||
let turns = 0;
|
||||
while (!wrapper.ended(state) && turns++ < 3000) {
|
||||
state = wrapper.moveAI(state, state.currentPlayers[0]);
|
||||
const saved = wrapper.toSave(state);
|
||||
expect(saved, 'every bot turn commits').not.equal(undefined);
|
||||
state = json(saved);
|
||||
}
|
||||
expect(wrapper.ended(state), `finished after ${turns} turns`).equal(true);
|
||||
const calls = state.log.filter((l) => l.type === 'move' && l.move.name === MoveName.CallBank);
|
||||
expect(calls.length, 'bots start and compete in auctions').greaterThan(2);
|
||||
expect(
|
||||
state.log.some((l) => l.type === 'move' && l.move.name === MoveName.LoadBankContainer),
|
||||
'collect won cargo'
|
||||
).equal(true);
|
||||
expect(state.players.reduce((sum, p) => sum + p.offshoreStats!.containerAuctionsWon, 0)).greaterThan(0);
|
||||
expect(state.players.reduce((sum, p) => sum + p.offshoreStats!.cashAuctionsWon, 0)).greaterThan(0);
|
||||
expect(
|
||||
state.log.some(
|
||||
(l) =>
|
||||
l.type === 'move' && l.move.name === MoveName.CallBank && (l.move.extraData.cash || 0) > 1
|
||||
),
|
||||
'raises a public cash bid'
|
||||
).equal(true);
|
||||
expect(json(wrapper.replay(json(state)))).deep.equal(state);
|
||||
} finally {
|
||||
Math.random = random;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
326
engine/src/offshore.spec.ts
Normal file
326
engine/src/offshore.spec.ts
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
import { expect } from 'chai';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import * as wrapper from '../wrapper';
|
||||
import { availableMoves } from './available-moves';
|
||||
import { move, setup, stripSecret } from './engine';
|
||||
import { GameState, Phase, ShipPosition } from './gamestate';
|
||||
import { Move, MoveName } from './move';
|
||||
import { bankProductionAllowed, payBankCash, reserved } from './offshore';
|
||||
|
||||
function game(n = 3) {
|
||||
const g = setup(n, { offshoreIsland: true }, 'bank-tests');
|
||||
g.players.forEach((p) => (p.name = `Player ${p.id}`));
|
||||
return g;
|
||||
}
|
||||
function act(g: GameState, m: Move) {
|
||||
return move(g, m, g.currentPlayers[0]);
|
||||
}
|
||||
function pass(g: GameState) {
|
||||
return act(g, { name: MoveName.Pass, data: true });
|
||||
}
|
||||
function refresh(g: GameState) {
|
||||
for (const p of g.players) p.availableMoves = g.currentPlayers.includes(p.id) ? availableMoves(g, p) : null;
|
||||
}
|
||||
function cashBid(g: GameState, cash = 1, lot = 0) {
|
||||
return act(g, { name: MoveName.CallBank, data: { type: 'containers', lot }, extraData: { cash } });
|
||||
}
|
||||
function containerBid(g: GameState, ids: string[], lot = 2) {
|
||||
return act(g, { name: MoveName.CallBank, data: { type: 'cash', lot }, extraData: { containers: ids } });
|
||||
}
|
||||
function decisions(g: GameState) {
|
||||
while (g.phase === Phase.BankDecision) {
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
const name = Object.keys(p.availableMoves!)[0] as MoveName;
|
||||
const data = p.availableMoves![name]![0];
|
||||
act(g, { name, data, extraData: { price: 2 } } as Move);
|
||||
}
|
||||
}
|
||||
describe('optional Off-Shore Bank', () => {
|
||||
it('does not change absent/false expansion setup or ordinary seeded player setup', () => {
|
||||
const base = setup(3, {}, 'bank-tests');
|
||||
expect(setup(3, { offshoreIsland: false }, 'bank-tests')).deep.equal(base);
|
||||
const g = game();
|
||||
expect(g.players.map((p) => p.factories)).deep.equal(base.players.map((p) => p.factories));
|
||||
expect(g.offshoreBank!.cashLots).deep.equal([1, 2, 3]);
|
||||
expect(g.offshoreBank!.containerLots.map((l) => l.length)).deep.equal([2, 1, 0]);
|
||||
const seeded = g.offshoreBank!.containerLots.reduce((a, l) => a.concat(l), [] as typeof g.containersLeft);
|
||||
expect(new Set(seeded.map((c) => c.color)).size).equal(3);
|
||||
expect(g.containersLeft.length).equal(base.containersLeft.length - 3);
|
||||
expect(game()).deep.equal(g);
|
||||
});
|
||||
it('enables via expansion ID and persists the option', async () => {
|
||||
expect((await wrapper.init(3, ['offshore-island'], {}, 'seed')).options.offshoreIsland).equal(true);
|
||||
expect((await wrapper.init(3, [], {}, 'seed')).offshoreBank).equal(undefined);
|
||||
});
|
||||
it('escrows cash, limits one call per turn, settles at next own start, and replays', () => {
|
||||
const g = game();
|
||||
const id = g.currentPlayers[0];
|
||||
cashBid(g, 4);
|
||||
expect(g.players[id].money).equal(16);
|
||||
expect(g.players[id].actions).equal(1);
|
||||
expect(g.players[id].availableMoves!.callBank).equal(undefined);
|
||||
const publicG = stripSecret(g, (id + 1) % 3);
|
||||
expect(publicG.players[id].money).equal(0);
|
||||
expect(publicG.offshoreBank!.auctions[0].cash).equal(4);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
expect(g.players[id].bankHolding!.length).equal(2);
|
||||
expect(g.players[id].offshoreStats!.containerAuctionsWon).equal(1);
|
||||
expect(g.offshoreBank!.cashLots).deep.equal([3, 3, 4]);
|
||||
expect(g.players[id].availableMoves!.callBank).equal(undefined);
|
||||
expect(wrapper.replay(g)).deep.equal(g);
|
||||
});
|
||||
it('returns outbid cash and rejects malformed or unaffordable bids without mutating escrow', () => {
|
||||
const g = game();
|
||||
const id = g.currentPlayers[0];
|
||||
cashBid(g, 2);
|
||||
pass(g);
|
||||
const before = cloneDeep(g.offshoreBank);
|
||||
expect(() => cashBid(g, 1)).throw();
|
||||
expect(() => cashBid(g, 1.5)).throw();
|
||||
expect(() => cashBid(g, 100)).throw();
|
||||
expect(g.offshoreBank).deep.equal(before);
|
||||
cashBid(g, 3);
|
||||
expect(g.players[id].money).equal(20);
|
||||
});
|
||||
it('reserves original districts and interrupts for owner-only returned-container repricing', () => {
|
||||
const g = game();
|
||||
const id = g.currentPlayers[0];
|
||||
const p = g.players[id];
|
||||
const piece = p.containersOnFactoryStore[0].piece;
|
||||
containerBid(g, [piece.id]);
|
||||
expect(p.containersOnFactoryStore.length).equal(0);
|
||||
expect(reserved(g, p, 'factory')).equal(1);
|
||||
pass(g);
|
||||
const bidder = g.players[g.currentPlayers[0]];
|
||||
bidder.containersOnFactoryStore.push({ piece: g.containersLeft.pop()!, price: 3, moved: false });
|
||||
refresh(g);
|
||||
const resume = bidder.id;
|
||||
containerBid(
|
||||
g,
|
||||
bidder.containersOnFactoryStore.map((c) => c.piece.id)
|
||||
);
|
||||
expect(g.phase).equal(Phase.BankDecision);
|
||||
expect(g.currentPlayers).deep.equal([id]);
|
||||
expect(p.availableMoves!.returnBankContainer).deep.equal([piece]);
|
||||
expect(() => act(g, { name: MoveName.ReturnBankContainer, data: piece, extraData: { price: 5 } })).throw();
|
||||
act(g, { name: MoveName.ReturnBankContainer, data: piece, extraData: { price: 1 } });
|
||||
expect(p.containersOnFactoryStore[0].price).equal(1);
|
||||
expect(g.currentPlayers).deep.equal([resume]);
|
||||
expect(g.newTurn).equal(true);
|
||||
});
|
||||
it('allows payer distribution choices and frozen-lot skipping', () => {
|
||||
const g = game(5);
|
||||
const first = g.players[g.currentPlayers[0]];
|
||||
containerBid(g, [first.containersOnFactoryStore[0].piece.id]);
|
||||
pass(g);
|
||||
cashBid(g, 2, 0);
|
||||
payBankCash(g, 3);
|
||||
expect(g.offshoreBank!.cashLots).deep.equal([3, 3, 3]);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
expect(g.phase).equal(Phase.BankDecision);
|
||||
const piece = g.offshoreBank!.decision!.payment[0];
|
||||
act(g, { name: MoveName.DistributeBankContainer, data: piece });
|
||||
expect(g.offshoreBank!.containerLots[1].some((c) => c.id === piece.id)).equal(true);
|
||||
expect(first.offshoreStats!.cashAuctionsWon).equal(1);
|
||||
expect(first.money).equal(23);
|
||||
});
|
||||
it('pays interest before bank settlement using spendable cash only; right chooses default priority', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
p.loans.push(g.loansLeft.pop()!, g.loansLeft.pop()!);
|
||||
p.ship.containers.push(g.containersLeft.pop()!);
|
||||
cashBid(g, 20);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
expect(g.phase).equal(Phase.BankDecision);
|
||||
expect(g.currentPlayers[0]).equal((p.id + 2) % 3);
|
||||
expect(g.players[g.currentPlayers[0]].availableMoves!.seizeBankContainer).deep.equal(p.ship.containers);
|
||||
expect(p.bankHolding!.length).equal(0);
|
||||
decisions(g);
|
||||
expect(p.ship.containers.length).equal(0);
|
||||
expect(p.containersOnFactoryStore.length).equal(0);
|
||||
expect(p.bankHolding!.length).equal(2);
|
||||
expect(p.loans.length).equal(2);
|
||||
});
|
||||
it('loads only on arrival for free, obeys capacity and requires leaving/reentering next turn', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
p.bankHolding!.push(...g.containersLeft.splice(0, 6));
|
||||
refresh(g);
|
||||
act(g, { name: MoveName.Sail, data: ShipPosition.OffshoreBank });
|
||||
for (let i = 0; i < 5; i++) act(g, { name: MoveName.LoadBankContainer, data: p.bankHolding![0] });
|
||||
expect(p.actions).equal(1);
|
||||
expect(p.ship.containers.length).equal(5);
|
||||
expect(p.availableMoves!.loadBankContainer).equal(undefined);
|
||||
p.ship.containers = [];
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
expect(p.availableMoves!.loadBankContainer).equal(undefined);
|
||||
});
|
||||
it('forbids a mandatory production run that would end the game after Call Bank', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
const second = g.factoriesLeft.find((f) => f.color !== p.factories[0].color)!;
|
||||
p.factories.push(second);
|
||||
const colors = p.factories.map((f) => f.color);
|
||||
g.containersLeft = g.containersLeft.filter(
|
||||
(c, i, all) => !colors.includes(c.color) || i === all.findIndex((x) => x.color === c.color)
|
||||
);
|
||||
cashBid(g);
|
||||
expect(bankProductionAllowed(g, p, colors[0])).equal(false);
|
||||
expect(p.availableMoves!.produce).equal(undefined);
|
||||
});
|
||||
it('resolves end-game pending auctions with payer decisions and scores holdings at $3', () => {
|
||||
const g = game();
|
||||
const winner = g.players[g.currentPlayers[0]];
|
||||
containerBid(g, [winner.containersOnFactoryStore[0].piece.id]);
|
||||
pass(g);
|
||||
g.containersLeft = g.containersLeft.filter((c) =>
|
||||
[g.containersLeft[0].color, g.containersLeft[15].color].includes(c.color)
|
||||
);
|
||||
refresh(g);
|
||||
pass(g);
|
||||
expect(g.phase).equal(Phase.BankDecision);
|
||||
decisions(g);
|
||||
expect(g.phase).equal(Phase.GameEnd);
|
||||
expect(winner.offshoreStats!.cashAuctionsWon).equal(1);
|
||||
expect(g.offshoreBank!.auctions.length).equal(0);
|
||||
expect(winner.finalScoreBreakdown!.length).equal(10);
|
||||
});
|
||||
it('reconstructs public analysis cash and holdings with an unrelated scenario seed', () => {
|
||||
const g = game();
|
||||
cashBid(g, 4);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
const analysis = wrapper.createAnalysisScenario(stripSecret(g, g.currentPlayers[0]), {
|
||||
player: g.currentPlayers[0],
|
||||
seed: 'different',
|
||||
});
|
||||
expect(analysis.players.map((p) => p.money)).deep.equal(g.players.map((p) => p.money));
|
||||
expect(analysis.offshoreBank).deep.equal(g.offshoreBank);
|
||||
});
|
||||
it('logs and replays a complete container-payment decision and supports dropped decision owners', async () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
containerBid(g, [p.containersOnFactoryStore[0].piece.id]);
|
||||
pass(g);
|
||||
pass(g);
|
||||
pass(g);
|
||||
expect(g.phase).equal(Phase.BankDecision);
|
||||
expect(wrapper.replay(g)).deep.equal(g);
|
||||
const copy = cloneDeep(g);
|
||||
await wrapper.dropPlayer(copy, p.id);
|
||||
expect(copy.phase).equal(Phase.Move);
|
||||
decisions(g);
|
||||
expect(wrapper.replay(g)).deep.equal(g);
|
||||
});
|
||||
it('sends delivery self-buyout cash to bank, not supply', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
p.ship.containers.push(g.containersLeft.pop()!);
|
||||
refresh(g);
|
||||
act(g, { name: MoveName.Sail, data: ShipPosition.Island });
|
||||
for (const bidder of g.currentPlayers.slice())
|
||||
move(
|
||||
g,
|
||||
{ name: MoveName.Bid, data: true, extraData: { price: bidder === g.currentPlayers[0] ? 3 : 1 } },
|
||||
bidder
|
||||
);
|
||||
while (g.phase === Phase.Bid)
|
||||
move(g, { name: MoveName.Bid, data: true, extraData: { price: 0 } }, g.currentPlayers[0]);
|
||||
const amount = g.players[g.highestBidders[0]].bid + g.players[g.highestBidders[0]].additionalBid;
|
||||
const before = g.offshoreBank!.cashLots.reduce((a, b) => a + b, 0);
|
||||
act(g, { name: MoveName.Decline, data: true });
|
||||
expect(g.offshoreBank!.cashLots.reduce((a, b) => a + b, 0)).equal(before + amount);
|
||||
});
|
||||
it('settles pending cash bids at game end and values holding containers in existing ship row', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
cashBid(g, 1);
|
||||
pass(g);
|
||||
g.containersLeft = g.containersLeft.filter((c) => c.color === g.containersLeft[0].color);
|
||||
refresh(g);
|
||||
pass(g);
|
||||
expect(g.phase).equal(Phase.GameEnd);
|
||||
expect(p.bankHolding!.length).equal(2);
|
||||
expect(p.finalScoreBreakdown![8]).equal('$6');
|
||||
expect(p.money).equal(25);
|
||||
});
|
||||
it('keeps returned-container reserve capacity unavailable to warehouse purchases and production', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
const extra = g.containersLeft.pop()!;
|
||||
p.containersOnFactoryStore.push({ piece: extra, price: 2, moved: false });
|
||||
p.containersOnWarehouseStore.push({ piece: g.containersLeft.pop()!, price: 2, moved: false });
|
||||
refresh(g);
|
||||
containerBid(g, [extra.id, p.containersOnWarehouseStore[0].piece.id]);
|
||||
expect(reserved(g, p, 'factory')).equal(1);
|
||||
expect(reserved(g, p, 'warehouse')).equal(1);
|
||||
expect(p.availableMoves!.produce).equal(undefined);
|
||||
expect(p.availableMoves!.buyFromFactory).equal(undefined);
|
||||
expect(
|
||||
g.players
|
||||
.filter((x) => x.id !== p.id)
|
||||
.every((x) => !x.containersOnFactoryStore.some((c) => c.piece.id === extra.id))
|
||||
).equal(true);
|
||||
});
|
||||
|
||||
it('settles two end-game auctions exactly once across JSON persistence at every decision', () => {
|
||||
let g = game(5);
|
||||
const first = g.players[g.currentPlayers[0]];
|
||||
first.containersOnFactoryStore.push({ piece: g.containersLeft.pop()!, price: 2, moved: false });
|
||||
refresh(g);
|
||||
containerBid(
|
||||
g,
|
||||
first.containersOnFactoryStore.map((c) => c.piece.id)
|
||||
);
|
||||
pass(g);
|
||||
const second = g.players[g.currentPlayers[0]];
|
||||
cashBid(g, 2);
|
||||
pass(g);
|
||||
g.containersLeft = g.containersLeft.filter((c) => c.color === g.containersLeft[0].color);
|
||||
refresh(g);
|
||||
pass(g);
|
||||
expect(g.offshoreBank!.auctions.length).equal(2);
|
||||
let count = 0;
|
||||
while (g.phase === Phase.BankDecision && count++ < 10) {
|
||||
g = JSON.parse(JSON.stringify(g));
|
||||
const piece = g.offshoreBank!.decision!.payment[0];
|
||||
act(g, { name: MoveName.DistributeBankContainer, data: piece });
|
||||
}
|
||||
expect(count).equal(2);
|
||||
expect(g.phase).equal(Phase.GameEnd);
|
||||
expect(g.offshoreBank!.auctions).deep.equal([]);
|
||||
expect(g.players[first.id].offshoreStats!.cashAuctionsWon).equal(1);
|
||||
expect(g.players[second.id].offshoreStats!.containerAuctionsWon).equal(1);
|
||||
expect(g.players[second.id].bankHolding!.length).equal(2);
|
||||
});
|
||||
it('optimistically completes final bank decisions without scoring secret point cards', () => {
|
||||
const g = game();
|
||||
const p = g.players[g.currentPlayers[0]];
|
||||
containerBid(g, [p.containersOnFactoryStore[0].piece.id]);
|
||||
pass(g);
|
||||
g.players[g.currentPlayers[0]].containersOnIsland.push(g.containersLeft.pop()!);
|
||||
g.containersLeft = g.containersLeft.filter((c) => c.color === g.containersLeft[0].color);
|
||||
refresh(g);
|
||||
pass(g);
|
||||
const stripped = cloneDeep(stripSecret(g, p.id));
|
||||
expect(() =>
|
||||
move(
|
||||
stripped,
|
||||
{ name: MoveName.DistributeBankContainer, data: stripped.offshoreBank!.decision!.payment[0] },
|
||||
p.id,
|
||||
true
|
||||
)
|
||||
).not.throw();
|
||||
expect(stripped.players.some((p) => p.finalScoreBreakdown !== undefined)).equal(false);
|
||||
});
|
||||
});
|
||||
286
engine/src/offshore.ts
Normal file
286
engine/src/offshore.ts
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
import assert from 'assert';
|
||||
import { AvailableMoves } from './available-moves';
|
||||
import { BankAuction, ContainerPiece, GameState, Phase, Player, ShipPosition } from './gamestate';
|
||||
import { GameEventName } from './log';
|
||||
import { Move, MoveName } from './move';
|
||||
|
||||
export function payBankCash(G: GameState, amount: number) {
|
||||
const b = G.offshoreBank;
|
||||
if (!b) return;
|
||||
const lots = [0, 1, 2].filter((i) => !b.auctions.some((a) => a.type === 'cash' && a.lot === i));
|
||||
for (let i = 0; i < amount; i++) b.cashLots[lots[i % lots.length]]++;
|
||||
}
|
||||
export function reserved(G: GameState, player: Player, district: 'factory' | 'warehouse') {
|
||||
return (
|
||||
G.offshoreBank?.auctions
|
||||
.filter((a) => a.bidder === player.id)
|
||||
.reduce((n, a) => n + a.containers.filter((c) => c.district === district).length, 0) || 0
|
||||
);
|
||||
}
|
||||
export function seizureChoices(G: GameState, player: Player): ContainerPiece[] {
|
||||
return (
|
||||
[
|
||||
player.containersOnIsland,
|
||||
player.ship.containers,
|
||||
player.bankHolding || [],
|
||||
player.containersOnWarehouseStore.map((c) => c.piece),
|
||||
player.containersOnFactoryStore.map((c) => c.piece),
|
||||
].find((a) => a.length > 0) || []
|
||||
);
|
||||
}
|
||||
export function bankMoves(G: GameState, player: Player): AvailableMoves {
|
||||
const b = G.offshoreBank!;
|
||||
const d = b.decision;
|
||||
if (d) {
|
||||
if (d.kind === 'return') return { [MoveName.ReturnBankContainer]: d.containers.map((c) => c.container.piece) };
|
||||
if (d.kind === 'seize') return { [MoveName.SeizeBankContainer]: seizureChoices(G, G.players[d.debtor!]) };
|
||||
return { [MoveName.DistributeBankContainer]: d.payment };
|
||||
}
|
||||
const moves: AvailableMoves = {};
|
||||
if (
|
||||
player.ship.shipPosition === ShipPosition.OffshoreBank &&
|
||||
player.ship.containers.length < 5 &&
|
||||
(player.lastMove?.name === MoveName.Sail || player.lastMove?.name === MoveName.LoadBankContainer) &&
|
||||
player.bankHolding!.length
|
||||
) {
|
||||
moves[MoveName.LoadBankContainer] = player.bankHolding!.slice();
|
||||
}
|
||||
if (player.actions <= 0 || b.called || b.won || new Set(G.containersLeft.map((c) => c.color)).size < 4)
|
||||
return moves;
|
||||
const offers: { type: 'cash' | 'containers'; lot: number }[] = [];
|
||||
for (const type of ['cash', 'containers'] as const) {
|
||||
const active = b.auctions.find((a) => a.type === type);
|
||||
if (active?.bidder === player.id) continue;
|
||||
if (!active && b.auctions.length >= (G.players.length === 5 ? 2 : 1)) continue;
|
||||
const canBid =
|
||||
type === 'containers'
|
||||
? player.money > (active?.cash || 0)
|
||||
: player.containersOnFactoryStore.length + player.containersOnWarehouseStore.length >
|
||||
(active?.containers.length || 0);
|
||||
if (!canBid) continue;
|
||||
for (let lot = 0; lot < 3; lot++) {
|
||||
if (!active || active.lot === lot) offers.push({ type, lot });
|
||||
}
|
||||
}
|
||||
if (offers.length) moves[MoveName.CallBank] = offers;
|
||||
return moves;
|
||||
}
|
||||
function collect(G: GameState, a: BankAuction) {
|
||||
const b = G.offshoreBank!;
|
||||
const p = G.players[a.bidder];
|
||||
if (a.type === 'cash') {
|
||||
p.money += b.cashLots[a.lot];
|
||||
b.cashLots[a.lot] = 0;
|
||||
p.offshoreStats!.cashAuctionsWon++;
|
||||
} else {
|
||||
p.bankHolding!.push(...b.containerLots[a.lot]);
|
||||
b.containerLots[a.lot] = [];
|
||||
p.offshoreStats!.containerAuctionsWon++;
|
||||
}
|
||||
G.log.push({
|
||||
type: 'event',
|
||||
event: { name: GameEventName.Upkeep, interest: `${p.name} wins bank ${a.type} lot ${a.lot + 1}` },
|
||||
});
|
||||
const index = b.auctions.findIndex(
|
||||
(active) => active.type === a.type && active.lot === a.lot && active.bidder === a.bidder
|
||||
);
|
||||
assert(index >= 0, 'Bank settlement no longer matches an active auction');
|
||||
b.auctions.splice(index, 1);
|
||||
b.won = true;
|
||||
}
|
||||
/** Returns true while a player decision is pending. */
|
||||
export function settleBank(G: GameState, ending = false): boolean {
|
||||
const b = G.offshoreBank!;
|
||||
const player = G.currentPlayers[0];
|
||||
for (const a of b.auctions.slice()) {
|
||||
if (!ending && a.bidder !== player) continue;
|
||||
if (a.type === 'containers') {
|
||||
payBankCash(G, a.cash);
|
||||
collect(G, a);
|
||||
} else {
|
||||
b.decision = {
|
||||
kind: 'distribute',
|
||||
player: a.bidder,
|
||||
resumePlayer: player,
|
||||
containers: [],
|
||||
payment: a.containers.map((c) => c.container.piece),
|
||||
cursor: 0,
|
||||
settlement: a,
|
||||
ending,
|
||||
};
|
||||
G.phase = Phase.BankDecision;
|
||||
G.currentPlayers = [a.bidder];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export function bankUpkeep(G: GameState) {
|
||||
const b = G.offshoreBank!;
|
||||
const p = G.players[G.currentPlayers[0]];
|
||||
b.called = b.won = false;
|
||||
const interest = p.loans.length;
|
||||
if (p.money < interest && p.loans.length < 2 && G.loansLeft.length) {
|
||||
p.loans.push(G.loansLeft.pop()!);
|
||||
p.money += 10;
|
||||
}
|
||||
const paid = Math.min(p.money, interest);
|
||||
p.money -= paid;
|
||||
payBankCash(G, paid);
|
||||
if (interest)
|
||||
G.log.push({
|
||||
type: 'event',
|
||||
event: { name: GameEventName.Upkeep, interest: `${p.name} pays $${paid} interest to the Off-Shore Bank` },
|
||||
});
|
||||
const remaining = interest - paid;
|
||||
if (remaining && seizureChoices(G, p).length) {
|
||||
const chooser = (p.id + G.players.length - 1) % G.players.length;
|
||||
b.decision = {
|
||||
kind: 'seize',
|
||||
player: chooser,
|
||||
resumePlayer: p.id,
|
||||
debtor: p.id,
|
||||
remaining,
|
||||
containers: [],
|
||||
payment: [],
|
||||
cursor: 0,
|
||||
};
|
||||
G.phase = Phase.BankDecision;
|
||||
G.currentPlayers = [chooser];
|
||||
} else settleBank(G);
|
||||
}
|
||||
export function applyBankMove(G: GameState, move: Move, p: Player): { handled: boolean; ending?: boolean } {
|
||||
const b = G.offshoreBank;
|
||||
if (!b) return { handled: false };
|
||||
if (move.name === MoveName.CallBank) {
|
||||
assert(
|
||||
move.extraData &&
|
||||
typeof move.extraData === 'object' &&
|
||||
Object.keys(move.extraData).every((k) => k === (move.data.type === 'cash' ? 'containers' : 'cash')),
|
||||
'Invalid bank bid fields'
|
||||
);
|
||||
const old = b.auctions.find((a) => a.type === move.data.type);
|
||||
const a: BankAuction = { ...move.data, bidder: p.id, cash: 0, containers: [] };
|
||||
if (a.type === 'containers') {
|
||||
const cash = move.extraData?.cash;
|
||||
assert(Number.isSafeInteger(cash) && cash! > (old?.cash || 0) && cash! <= p.money, 'Invalid bank cash bid');
|
||||
assert(!move.extraData.containers?.length, 'Unexpected containers');
|
||||
a.cash = cash!;
|
||||
} else {
|
||||
const ids = move.extraData?.containers;
|
||||
assert(
|
||||
Array.isArray(ids) && ids.length > (old?.containers.length || 0) && new Set(ids).size === ids.length,
|
||||
'Invalid bank container bid'
|
||||
);
|
||||
assert(!move.extraData.cash, 'Unexpected cash');
|
||||
for (const id of ids!) {
|
||||
const factory = p.containersOnFactoryStore.find((c) => c.piece.id === id);
|
||||
const container = factory || p.containersOnWarehouseStore.find((c) => c.piece.id === id);
|
||||
assert(container, 'Only stored containers can be bid');
|
||||
a.containers.push({ container: container!, district: factory ? 'factory' : 'warehouse' });
|
||||
}
|
||||
}
|
||||
p.money -= a.cash;
|
||||
for (const c of a.containers) {
|
||||
const store = c.district === 'factory' ? p.containersOnFactoryStore : p.containersOnWarehouseStore;
|
||||
store.splice(store.indexOf(c.container), 1);
|
||||
}
|
||||
if (old) {
|
||||
b.auctions.splice(b.auctions.indexOf(old), 1);
|
||||
G.players[old.bidder].money += old.cash;
|
||||
if (old.containers.length) {
|
||||
b.decision = {
|
||||
kind: 'return',
|
||||
player: old.bidder,
|
||||
resumePlayer: p.id,
|
||||
containers: old.containers,
|
||||
payment: [],
|
||||
cursor: 0,
|
||||
};
|
||||
G.phase = Phase.BankDecision;
|
||||
G.currentPlayers = [old.bidder];
|
||||
}
|
||||
}
|
||||
b.auctions.push(a);
|
||||
b.called = true;
|
||||
p.actions--;
|
||||
} else if (move.name === MoveName.LoadBankContainer) {
|
||||
const i = p.bankHolding!.findIndex((c) => c.id === move.data.id);
|
||||
p.ship.containers.push(p.bankHolding!.splice(i, 1)[0]);
|
||||
} else if (
|
||||
[MoveName.ReturnBankContainer, MoveName.DistributeBankContainer, MoveName.SeizeBankContainer].includes(
|
||||
move.name
|
||||
)
|
||||
) {
|
||||
const d = b.decision!;
|
||||
const piece = (move as { data: ContainerPiece }).data;
|
||||
if (move.name === MoveName.ReturnBankContainer) {
|
||||
const i = d.containers.findIndex((c) => c.container.piece.id === piece.id);
|
||||
const c = d.containers[i];
|
||||
assert(move.extraData && Object.keys(move.extraData).every((k) => k === 'price'), 'Invalid return fields');
|
||||
const price = (move as { extraData?: { price: number } }).extraData?.price;
|
||||
assert(
|
||||
Number.isInteger(price) &&
|
||||
price! >= (c.district === 'factory' ? 1 : 2) &&
|
||||
price! <= (c.district === 'factory' ? 4 : 6),
|
||||
'Invalid return price'
|
||||
);
|
||||
c.container.price = price!;
|
||||
(c.district === 'factory' ? p.containersOnFactoryStore : p.containersOnWarehouseStore).push(c.container);
|
||||
d.containers.splice(i, 1);
|
||||
if (d.containers.length) return { handled: true };
|
||||
} else if (move.name === MoveName.SeizeBankContainer) {
|
||||
const debtor = G.players[d.debtor!];
|
||||
for (const arr of [debtor.containersOnIsland, debtor.ship.containers, debtor.bankHolding!]) {
|
||||
const i = arr.findIndex((c) => c.id === piece.id);
|
||||
if (i >= 0) arr.splice(i, 1);
|
||||
}
|
||||
for (const arr of [debtor.containersOnFactoryStore, debtor.containersOnWarehouseStore]) {
|
||||
const i = arr.findIndex((c) => c.piece.id === piece.id);
|
||||
if (i >= 0) arr.splice(i, 1);
|
||||
}
|
||||
d.payment.push(piece);
|
||||
d.remaining!--;
|
||||
if (d.remaining! > 0 && seizureChoices(G, debtor).length) return { handled: true };
|
||||
d.kind = 'distribute';
|
||||
return { handled: true };
|
||||
} else {
|
||||
const lots = [0, 1, 2].filter((i) => !b.auctions.some((a) => a.type === 'containers' && a.lot === i));
|
||||
b.containerLots[lots[d.cursor++ % lots.length]].push(piece);
|
||||
d.payment.splice(
|
||||
d.payment.findIndex((c) => c.id === piece.id),
|
||||
1
|
||||
);
|
||||
if (d.payment.length) return { handled: true };
|
||||
if (d.settlement) collect(G, d.settlement);
|
||||
}
|
||||
delete b.decision;
|
||||
G.phase = Phase.Move;
|
||||
G.currentPlayers = [d.resumePlayer];
|
||||
if (d.kind !== 'return' && settleBank(G, d.ending)) return { handled: true };
|
||||
return { handled: true, ending: d.ending };
|
||||
} else return { handled: false };
|
||||
return { handled: true };
|
||||
}
|
||||
|
||||
/** Mandatory production must be finishable without triggering game end after Call Bank. */
|
||||
export function bankProductionAllowed(G: GameState, p: Player, first: ContainerPiece['color']): boolean {
|
||||
if (!G.offshoreBank?.called) return true;
|
||||
const colors = p.factories
|
||||
.map((f) => f.color)
|
||||
.filter((c) => !p.produced.includes(c) && G.containersLeft.some((x) => x.color === c));
|
||||
const slots = p.factories.length * 2 - p.containersOnFactoryStore.length - reserved(G, p, 'factory');
|
||||
const required = Math.min(slots, colors.length);
|
||||
for (let mask = 0; mask < 1 << colors.length; mask++) {
|
||||
const selected = colors.filter((_, i) => mask & (1 << i));
|
||||
if (selected.length !== required || !selected.includes(first)) continue;
|
||||
const remaining = G.containersLeft.slice();
|
||||
for (const color of selected)
|
||||
remaining.splice(
|
||||
remaining.findIndex((c) => c.color === color),
|
||||
1
|
||||
);
|
||||
if (new Set(remaining.map((c) => c.color)).size >= 4) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -11,7 +11,11 @@ import { isLoanReversal, Move, MoveName } from './src/move';
|
|||
import { asserts } from './src/utils';
|
||||
|
||||
export async function init(nbPlayers: number, expansions: string[], options: {}, seed?: string): Promise<GameState> {
|
||||
return engine.setup(nbPlayers, options, seed);
|
||||
return engine.setup(
|
||||
nbPlayers,
|
||||
expansions.includes('offshore-island') ? { ...options, offshoreIsland: true } : options,
|
||||
seed
|
||||
);
|
||||
}
|
||||
|
||||
export function setPlayerMetaData(G: GameState, player: number, metaData: { name: string }) {
|
||||
|
|
@ -203,6 +207,10 @@ export async function dropPlayer(G: GameState, player: number) {
|
|||
// (`nextPlayer` recursion, the `!isDropped` filters in the auction logic).
|
||||
if (G.currentPlayers.includes(player)) {
|
||||
switch (G.phase) {
|
||||
case Phase.BankDecision:
|
||||
while (G.phase === Phase.BankDecision && G.currentPlayers.includes(player))
|
||||
G = engine.moveAI(G, player);
|
||||
break;
|
||||
case Phase.Bid:
|
||||
// A dropped bidder bids nothing (also covers the additional-bid round)
|
||||
G = engine.move(G, { name: MoveName.Bid, data: true, extraData: { price: 0 } }, player);
|
||||
|
|
@ -298,6 +306,10 @@ function observedCash(G: GameState, seed: string): number[] | undefined {
|
|||
];
|
||||
const containers = [
|
||||
...replayed.containersLeft,
|
||||
...(replayed.offshoreBank?.containerLots.reduce(
|
||||
(all, lot) => all.concat(lot),
|
||||
[] as typeof replayed.containersLeft
|
||||
) || []),
|
||||
...replayed.players.reduce(
|
||||
(all, p) => all.concat(p.containersOnFactoryStore.map((c) => c.piece)),
|
||||
[] as typeof replayed.containersLeft
|
||||
|
|
@ -315,6 +327,18 @@ function observedCash(G: GameState, seed: string): number[] | undefined {
|
|||
p.containersOnFactoryStore = [{ piece: container, price: 2, moved: false }];
|
||||
p.actions = p.id === G.startingPlayer ? 2 : 0;
|
||||
}
|
||||
if (replayed.offshoreBank) {
|
||||
replayed.offshoreBank.initialContainerLots = cloneDeep(G.offshoreBank!.initialContainerLots);
|
||||
replayed.offshoreBank.containerLots = cloneDeep(G.offshoreBank!.initialContainerLots);
|
||||
for (const piece of replayed.offshoreBank.containerLots.reduce(
|
||||
(all, lot) => all.concat(lot),
|
||||
[] as typeof replayed.containersLeft
|
||||
)) {
|
||||
const i = containers.findIndex((c) => c.id === piece.id);
|
||||
if (i < 0) return undefined;
|
||||
containers.splice(i, 1);
|
||||
}
|
||||
}
|
||||
replayed.factoriesLeft = factories;
|
||||
replayed.containersLeft = containers;
|
||||
replayed.startingPlayer = G.startingPlayer;
|
||||
|
|
@ -333,10 +357,13 @@ function observedCash(G: GameState, seed: string): number[] | undefined {
|
|||
'containersOnFactoryStore',
|
||||
'containersOnWarehouseStore',
|
||||
'containersOnIsland',
|
||||
'bankHolding',
|
||||
'offshoreStats',
|
||||
] as const) {
|
||||
if (!isEqual(p[key], actual[key])) return undefined;
|
||||
}
|
||||
}
|
||||
if (G.offshoreBank && !isEqual(G.offshoreBank, replayed.offshoreBank)) return undefined;
|
||||
return replayed.players.map((p, i) => p.money + (G.players[i].loans.length - p.loans.length) * 10);
|
||||
} catch {
|
||||
return undefined;
|
||||
|
|
|
|||
|
|
@ -12,9 +12,13 @@ OUT = ROOT / 'docs/achievement-art'
|
|||
manifest = json.loads((OUT / 'manifest.json').read_text())
|
||||
source = (ROOT / 'engine/src/achievements.ts').read_text()
|
||||
baseline = subprocess.check_output(['git', 'show', manifest['baseline']+':engine/src/achievements.ts'], cwd=ROOT, text=True)
|
||||
# Entire definitions and entire evaluator byte-for-byte, not a selection of conditions.
|
||||
# Historical definitions stay byte-for-byte; strip only the two additive expansion rules
|
||||
# before comparing the full historical evaluator. Artwork provenance remains revision 3.
|
||||
assert source.split('export function achievementDefinitions')[0] == baseline.split('export function achievementDefinitions')[0]
|
||||
assert source.split('/** Money is already')[1] == baseline.split('/** Money is already')[1]
|
||||
historical_evaluator = re.sub(
|
||||
r" \['offshore-win',.*?\n \],\n",
|
||||
'', source.split('/** Money is already')[1], flags=re.S)
|
||||
assert historical_evaluator == baseline.split('/** Money is already')[1]
|
||||
ids = re.findall(r"^ \['([^']+)',", source, re.M)
|
||||
assert [a['id'] for a in manifest['assets']] == ids
|
||||
assert len(ids) == len(set(ids)) == 17
|
||||
|
|
@ -39,4 +43,4 @@ for size in (32,48,64):
|
|||
with Image.open(OUT/f'contact-sheet-{size}.png') as im:
|
||||
im.load()
|
||||
assert im.width == 880
|
||||
print('PASS: 17 IDs and full evaluator unchanged; refs, source hashes, unique decoded 256px assets, 32/48/64px sheets')
|
||||
print('PASS: 17 historical IDs and base evaluator unchanged; refs, source hashes, unique decoded 256px assets, 32/48/64px sheets')
|
||||
|
|
|
|||
|
|
@ -10,12 +10,21 @@ const { setup } = require(path.join(packed, 'dist/index.js'));
|
|||
const manifest = require(path.join(root, 'docs/achievement-art/manifest.json'));
|
||||
assert.equal(require(path.join(packed, 'package.json')).version, manifest.engineVersion);
|
||||
const definitions = hooks.achievementDefinitions();
|
||||
assert.equal(definitions.revision, manifest.revision);
|
||||
assert.equal(definitions.revision, 4);
|
||||
const historical = definitions.achievements.filter((a) => !a.id.startsWith('offshore-'));
|
||||
const expansion = definitions.achievements.filter((a) => a.id.startsWith('offshore-'));
|
||||
assert.deepEqual(
|
||||
definitions.achievements.map((a) => a.id),
|
||||
expansion.map((a) => [a.id, a.icon]),
|
||||
[
|
||||
['offshore-win', { type: 'text', text: 'OI' }],
|
||||
['offshore-trader', { type: 'text', text: 'BANK' }],
|
||||
]
|
||||
);
|
||||
assert.deepEqual(
|
||||
historical.map((a) => a.id),
|
||||
manifest.assets.map((a) => a.id)
|
||||
);
|
||||
for (const a of definitions.achievements) {
|
||||
for (const a of historical) {
|
||||
assert.deepEqual(a.icon, { type: 'asset', key: `achievement-${a.id}` });
|
||||
assert.ok(fs.existsSync(path.join(root, 'docs/achievement-art', `${a.icon.key}.png`)));
|
||||
}
|
||||
|
|
@ -42,5 +51,5 @@ for (const n of [3, 4, 5]) {
|
|||
}
|
||||
}
|
||||
console.log(
|
||||
'PASS: exact extracted 2.1.10 package, revision 3, all 17 asset refs, legal 3/4/5-player completion and replay'
|
||||
'PASS: exact extracted 2.1.10 package, revision 4, 17 historical asset refs and 2 text badges, legal 3/4/5-player completion and replay'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ From the repository root, install with `pnpm install`.
|
|||
pnpm --dir viewer serve
|
||||
```
|
||||
|
||||
Add `?offshoreIsland=1` to opt into Offshore Island in the local demo. Without that query parameter the demo remains classic. The expansion panel displays public auctions, escrow and holding areas; its bid, return-price, distribution, default and loading controls follow the engine's legal moves.
|
||||
|
||||
Add `?chapter=supply-chain` to open a tutorial. The other chapter IDs are
|
||||
`buildings`, `selling`, `bidding`, `keep-cargo` and `scoring`.
|
||||
|
||||
|
|
@ -18,6 +20,7 @@ pnpm --dir viewer check
|
|||
pnpm --dir viewer test:tutorial
|
||||
NODE_OPTIONS=--openssl-legacy-provider pnpm --dir viewer package
|
||||
pnpm --dir viewer test:browser
|
||||
pnpm --dir viewer test:offshore:browser
|
||||
pnpm --dir viewer test:tutorial:browser
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
"package": "vue-cli-service build --target lib --name container-viewer src/wrapper.ts",
|
||||
"prepublishOnly": "npm run package",
|
||||
"test:browser": "node scripts/protocol-smoke.mjs",
|
||||
"test:offshore:browser": "node scripts/offshore-smoke.mjs",
|
||||
"test:tutorial": "node --test tests/tutorial/lessons.cjs",
|
||||
"check": "tsc --noEmit",
|
||||
"test:tutorial:browser": "node scripts/tutorial-smoke.mjs",
|
||||
|
|
|
|||
182
viewer/scripts/offshore-smoke.mjs
Normal file
182
viewer/scripts/offshore-smoke.mjs
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { createServer } from 'node:http';
|
||||
import { createRequire } from 'node:module';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { chromium } from 'playwright';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const root = new URL('../../', import.meta.url);
|
||||
const engine = require(fileURLToPath(new URL('engine/dist/index.js', root)));
|
||||
const copy = (value) => JSON.parse(JSON.stringify(value));
|
||||
const files = {
|
||||
'/bundle.js': fileURLToPath(new URL('viewer/dist/container-viewer.umd.min.js', root)),
|
||||
'/bundle.css': fileURLToPath(new URL('viewer/dist/container-viewer.css', root)),
|
||||
'/vue.js': require.resolve('vue/dist/vue.min.js'),
|
||||
};
|
||||
const server = createServer(async (req, res) => {
|
||||
try {
|
||||
if (req.url === '/') {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.end(
|
||||
'<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="stylesheet" href="/bundle.css"><div id="app"></div><script src="/vue.js"></script><script src="/bundle.js"></script>'
|
||||
);
|
||||
} else {
|
||||
const locale = /^\/container-viewer\.umd\.min\.locale-[a-zA-Z-]+\.js$/.test(req.url);
|
||||
const path = files[req.url] || (locale && fileURLToPath(new URL('viewer/dist' + req.url, root)));
|
||||
if (!path) {
|
||||
res.statusCode = 404;
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
res.setHeader('Content-Type', req.url.endsWith('.css') ? 'text/css' : 'text/javascript; charset=utf-8');
|
||||
res.end(await readFile(path));
|
||||
}
|
||||
} catch (error) {
|
||||
res.statusCode = 500;
|
||||
res.end(String(error));
|
||||
}
|
||||
});
|
||||
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_EXECUTABLE });
|
||||
try {
|
||||
for (const width of [390, 1400]) {
|
||||
const page = await browser.newPage({ viewport: { width, height: 900 } });
|
||||
const errors = [];
|
||||
page.on('pageerror', (e) => errors.push(e.message));
|
||||
await page.goto(`http://127.0.0.1:${server.address().port}/`);
|
||||
let state = engine.setup(3, { offshoreIsland: true }, 'offshore-browser');
|
||||
const player = state.currentPlayers[0];
|
||||
state.players.forEach((p, i) => (p.name = ['Ada', 'Benoît', 'Cleo'][i]));
|
||||
state.newTurn = true;
|
||||
await page.evaluate(
|
||||
({ state, player }) => {
|
||||
window.host = container.launch('#app');
|
||||
window.moves = [];
|
||||
host.on('move', (value) => moves.push(value));
|
||||
host.emit('preferences', { sound: false, colorBlind: true });
|
||||
host.emit('player', { index: player });
|
||||
host.emit('state', state);
|
||||
},
|
||||
{ state: engine.stripSecret(copy(state), player), player }
|
||||
);
|
||||
const push = async () => {
|
||||
state.players[player].availableMoves = engine.availableMoves(state, state.players[player]);
|
||||
await page.evaluate((state) => {
|
||||
moves.length = 0;
|
||||
host.emit('state', state);
|
||||
}, engine.stripSecret(copy(state), player));
|
||||
};
|
||||
await page.waitForSelector('.offshore-lot', { state: 'attached' });
|
||||
if (width <= 600) {
|
||||
assert.equal(await page.locator('.bank-toggle').getAttribute('aria-expanded'), 'false');
|
||||
await page.getByRole('button', { name: 'Show bank', exact: true }).click();
|
||||
}
|
||||
assert.equal(await page.locator('.offshore-lot').count(), 6);
|
||||
await page.locator('.offshore-lot').nth(3).getByRole('button', { name: 'Call Bank', exact: true }).click();
|
||||
await page.locator('#bank-cash-bid').fill('2');
|
||||
await page.getByRole('button', { name: 'Place public bid', exact: true }).click();
|
||||
const bid = await page.evaluate(() => moves.at(-1));
|
||||
assert.equal(bid.at(-1).name, 'callBank');
|
||||
for (const action of bid) state = engine.move(state, action, player);
|
||||
await push();
|
||||
assert.match(await page.locator('.offshore-lot').nth(3).innerText(), /Cash in escrow: \$2/);
|
||||
|
||||
await page.getByRole('button', { name: 'Hide bank', exact: true }).click();
|
||||
// A returned container is a committed interruption belonging to its owner.
|
||||
const own = state.players[player];
|
||||
const returned = own.containersOnFactoryStore.pop();
|
||||
assert.ok(returned);
|
||||
state.newTurn = true;
|
||||
state.phase = 'bankDecision';
|
||||
state.currentPlayers = [player];
|
||||
state.offshoreBank.decision = {
|
||||
kind: 'return',
|
||||
player,
|
||||
resumePlayer: player,
|
||||
containers: [{ container: returned, district: 'factory' }],
|
||||
payment: [],
|
||||
cursor: 0,
|
||||
};
|
||||
await page.evaluate((state) => {
|
||||
host.emit('player', { index: undefined });
|
||||
host.emit('state', state);
|
||||
}, engine.stripSecret(copy(state)));
|
||||
await page.getByRole('button', { name: 'Show bank', exact: true }).click();
|
||||
await page.waitForFunction(() =>
|
||||
document.querySelector('.bank-decision')?.textContent.includes('Awaiting bank choice')
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator('.bank-decision .offshore-cargo-piece').count(),
|
||||
1,
|
||||
'spectator sees pending return cargo'
|
||||
);
|
||||
assert.equal(await page.locator('.bank-decision button').count(), 0, 'spectator has no decision controls');
|
||||
await page.evaluate((player) => host.emit('player', { index: player }), player);
|
||||
await push();
|
||||
await page.getByRole('button', { name: 'Return at $3', exact: true }).click();
|
||||
const repricing = await page.evaluate(() => moves.at(-1));
|
||||
assert.equal(repricing.length, 1, 'interruption is not appended to the previous bid buffer');
|
||||
state = engine.move(state, repricing[0], player);
|
||||
assert.equal(state.newTurn, true);
|
||||
await push();
|
||||
assert.equal(await page.locator('.bank-choice').count(), 0);
|
||||
assert.equal(
|
||||
state.players[player].containersOnFactoryStore.find((c) => c.piece.id === returned.piece.id).price,
|
||||
3
|
||||
);
|
||||
|
||||
// Public lots and escrow remain visible after French localization and on phones.
|
||||
await page.evaluate(() => host.emit('preferences', { locale: 'fr' }));
|
||||
await page.waitForFunction(() => document.querySelector('#offshore-title')?.textContent === 'Île offshore');
|
||||
assert.match(await page.locator('.offshore-bank').innerText(), /Lot d’argent/);
|
||||
assert.match(await page.locator('.offshore-bank').innerText(), /Argent consigné/);
|
||||
assert.match(await page.locator('.inline-game-log').innerText(), /appelle la banque/);
|
||||
assert.match(await page.locator('.inline-game-log').innerText(), /remet un conteneur/);
|
||||
const bounds = await page.locator('.offshore-bank').boundingBox();
|
||||
assert.ok(bounds.x >= 0 && bounds.x + bounds.width <= width + 1, 'panel fits viewport');
|
||||
assert.equal(await page.locator('.offshore-bank').evaluate((el) => el.scrollWidth <= el.clientWidth + 1), true);
|
||||
await page.screenshot({ path: `/tmp/container-offshore-${width}.png`, fullPage: true });
|
||||
await page.evaluate(() => host.emit('preferences', { locale: 'en' }));
|
||||
|
||||
// Final cash settlement must remain clickable with opponents' point cards stripped.
|
||||
const payment = state.players[player].containersOnFactoryStore.pop();
|
||||
const auction = {
|
||||
type: 'cash',
|
||||
lot: 0,
|
||||
bidder: player,
|
||||
cash: 0,
|
||||
containers: [{ container: payment, district: 'factory' }],
|
||||
};
|
||||
state.offshoreBank.auctions = [auction];
|
||||
state.offshoreBank.decision = {
|
||||
kind: 'distribute',
|
||||
player,
|
||||
resumePlayer: player,
|
||||
containers: [],
|
||||
payment: [payment.piece],
|
||||
cursor: 0,
|
||||
settlement: copy(auction),
|
||||
ending: true,
|
||||
};
|
||||
state.phase = 'bankDecision';
|
||||
state.newTurn = true;
|
||||
state.currentPlayers = [player];
|
||||
await push();
|
||||
await page.getByRole('button', { name: 'Distribute next', exact: true }).click();
|
||||
const distribution = await page.evaluate(() => moves.at(-1));
|
||||
assert.equal(distribution.length, 1);
|
||||
state = engine.move(state, distribution[0], player);
|
||||
assert.equal(state.phase, 'gameEnd');
|
||||
await push();
|
||||
await page.waitForFunction(() => document.querySelector('.statusBar')?.textContent.includes('Game ended'));
|
||||
assert.deepEqual(errors, []);
|
||||
await page.close();
|
||||
console.log(
|
||||
`Offshore browser smoke passed: ${width}px, stripped state, bids, interruption, final settlement, French.`
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
|
|
@ -59,6 +59,14 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<OffshoreBank
|
||||
v-if="G && G.options.offshoreIsland"
|
||||
:state="G"
|
||||
:player="player"
|
||||
:color-blind="preferences.colorBlind"
|
||||
:available-moves="canMove ? G.players[player].availableMoves : {}"
|
||||
@move="sendMove"
|
||||
/>
|
||||
<div key="board-and-journal" class="board-and-journal">
|
||||
<div ref="boardScroll" class="board-scroll" tabindex="0" aria-label="Game board">
|
||||
<svg
|
||||
|
|
@ -191,6 +199,12 @@
|
|||
:data="{ type: 'islandHarbor' }"
|
||||
/>
|
||||
|
||||
<g v-if="G && G.options.offshoreIsland" pointer-events="none">
|
||||
<rect x="675" y="430" width="90" height="220" rx="12" fill="#f6f4e9" stroke="#8ca9aa" />
|
||||
<text x="720" y="425" text-anchor="middle" fill="#315f66" font-size="9">
|
||||
Offshore bank harbor
|
||||
</text>
|
||||
</g>
|
||||
<Ship
|
||||
v-for="ship in ships"
|
||||
:key="ship.id"
|
||||
|
|
@ -701,7 +715,9 @@
|
|||
'$2 containers',
|
||||
'Discarded color',
|
||||
'Containers in Warehouses ($2 each)',
|
||||
'Containers on Ship ($3 each)',
|
||||
G.options.offshoreIsland
|
||||
? 'Containers on Ship and in Holding ($3 each)'
|
||||
: 'Containers on Ship ($3 each)',
|
||||
'Loans (-$11 each)',
|
||||
]"
|
||||
:key="'FC_' + cat"
|
||||
|
|
@ -733,12 +749,14 @@
|
|||
</template>
|
||||
<script lang="ts">
|
||||
import InlineLog from './InlineLog.vue';
|
||||
import OffshoreBank from './OffshoreBank.vue';
|
||||
import { islandValue } from '../island-value';
|
||||
import ColorBlindButton from './buttons/ColorBlindButton.vue';
|
||||
import { colorBadgeHtml } from '../color-blind';
|
||||
import { playerColors, playerTextColor, playerSymbol } from '../player-colors';
|
||||
import { journalPieces } from '../journal-pieces';
|
||||
import { journalOrder } from '../journal-order';
|
||||
import { offshoreJournal, escapeJournal } from '../offshore-journal';
|
||||
import { Vue, Component, Prop, Watch, Provide, ProvideReactive } from 'vue-property-decorator';
|
||||
import { bidRevision, MoveName, ended, isLoanReversal, move as engineMove } from 'container-engine';
|
||||
import type { GameState, Move } from 'container-engine';
|
||||
|
|
@ -761,6 +779,7 @@ import { GameEventName, LogMove } from 'container-engine/src/log';
|
|||
},
|
||||
components: {
|
||||
InlineLog,
|
||||
OffshoreBank,
|
||||
PlayerBoard,
|
||||
Container,
|
||||
Factory,
|
||||
|
|
@ -1085,6 +1104,19 @@ export default class Game extends Vue {
|
|||
this.G?.players.forEach((player, pi) => {
|
||||
const color = this.playerColors[pi];
|
||||
switch (player.ship.shipPosition) {
|
||||
case ShipPosition.OffshoreBank:
|
||||
this.ships.push({
|
||||
id: player.ship.piece.id,
|
||||
x: 700,
|
||||
y: 410 + pi * 44,
|
||||
rotate: 90,
|
||||
color,
|
||||
containers: player.ship.containers,
|
||||
owner: pi,
|
||||
position: player.ship.shipPosition,
|
||||
});
|
||||
break;
|
||||
|
||||
case ShipPosition.OpenSea:
|
||||
this.ships.push({
|
||||
id: player.ship.piece.id,
|
||||
|
|
@ -1678,6 +1710,7 @@ export default class Game extends Vue {
|
|||
if (!this.G || ended(this.G)) {
|
||||
return 'Game ended!';
|
||||
} else if (this.player !== undefined && this.G?.currentPlayers.includes(this.player)) {
|
||||
if (this.G.offshoreBank?.decision) return 'Choose your bank decision in the Offshore Island panel.';
|
||||
if (this.G.players[this.player].availableMoves![MoveName.Bid]) {
|
||||
if (this.G.highestBidders.length != 0) {
|
||||
return "It's a tie, choose your ADDITIONAL bid!";
|
||||
|
|
@ -1698,7 +1731,10 @@ export default class Game extends Vue {
|
|||
', '
|
||||
)} to play...`;
|
||||
|
||||
let log = (this.G.log[this.G.log.length - 1] as LogMove).pretty;
|
||||
const last = this.G.log[this.G.log.length - 1] as LogMove;
|
||||
const bankMessage = offshoreJournal(last, this.G);
|
||||
if (bankMessage) return bankMessage;
|
||||
let log = last.pretty;
|
||||
while (log?.indexOf('>') != -1) {
|
||||
log = log?.substr(0, log.indexOf('<')) + log.substr(log.indexOf('>') + 1);
|
||||
}
|
||||
|
|
@ -1881,7 +1917,14 @@ export default class Game extends Vue {
|
|||
logReversed.push('New event: ' + log.event.name);
|
||||
}
|
||||
} else if (log.type == 'move') {
|
||||
logReversed.push(journalPieces(log.pretty, this.preferences.colorBlind, this.playerColors));
|
||||
const bankMessage = offshoreJournal(log, this.G!);
|
||||
logReversed.push(
|
||||
journalPieces(
|
||||
bankMessage ? escapeJournal(bankMessage) : log.pretty,
|
||||
this.preferences.colorBlind,
|
||||
this.playerColors
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1904,7 +1947,9 @@ export default class Game extends Vue {
|
|||
logReversed.push('New event: ' + log.event.name);
|
||||
}
|
||||
} else if (log.type == 'move') {
|
||||
logReversed.push(log.simple.replaceAll('darkslategray', 'dark green'));
|
||||
logReversed.push(
|
||||
offshoreJournal(log, this.G!) || log.simple.replaceAll('darkslategray', 'dark green')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
531
viewer/src/components/OffshoreBank.vue
Normal file
531
viewer/src/components/OffshoreBank.vue
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
<template>
|
||||
<section v-if="state.options.offshoreIsland && bank" class="offshore-bank" aria-labelledby="offshore-title">
|
||||
<header class="offshore-header">
|
||||
<div>
|
||||
<span class="offshore-eyebrow">OPTIONAL EXPANSION</span>
|
||||
<h2 id="offshore-title">Offshore Island</h2>
|
||||
</div>
|
||||
<div class="bank-summary">
|
||||
<span
|
||||
><span>Public auctions</span>: {{ bank.auctions.length }} · <span>Your holding</span>:
|
||||
{{ ownPlayer && ownPlayer.bankHolding ? ownPlayer.bankHolding.length : 0 }}</span
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="bank-button bank-toggle"
|
||||
:aria-expanded="expanded ? 'true' : 'false'"
|
||||
aria-controls="offshore-content"
|
||||
@click="expanded = !expanded"
|
||||
>
|
||||
{{ expanded ? 'Hide bank' : 'Show bank' }}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
<div id="offshore-content" v-show="expanded">
|
||||
<div class="offshore-lots">
|
||||
<article v-for="(cash, i) in bank.cashLots" :key="'cash' + i" class="offshore-lot">
|
||||
<h3>
|
||||
<span>Cash lot</span> {{ i + 1 }} <strong>${{ cash }}</strong>
|
||||
</h3>
|
||||
<div v-if="auction('cash', i)" class="offshore-escrow">
|
||||
<span>Leading bidder</span>: <b translate="no">{{ owner(auction('cash', i).bidder) }}</b>
|
||||
<OffshoreCargo :pieces="escrow(auction('cash', i))" :color-blind="colorBlind" />
|
||||
</div>
|
||||
<p v-else class="offshore-muted">No public bid</p>
|
||||
<button v-if="offer('cash', i)" type="button" class="bank-button" @click="chooseOffer('cash', i)">
|
||||
Call Bank
|
||||
</button>
|
||||
</article>
|
||||
<article v-for="(cargo, i) in bank.containerLots" :key="'containers' + i" class="offshore-lot">
|
||||
<h3>
|
||||
<span>Container lot</span> {{ i + 1 }} <strong>{{ cargo.length }}</strong>
|
||||
</h3>
|
||||
<OffshoreCargo :pieces="cargo" :color-blind="colorBlind" />
|
||||
<p v-if="auction('containers', i)" class="offshore-escrow">
|
||||
<span>Leading bidder</span>:
|
||||
<b translate="no">{{ owner(auction('containers', i).bidder) }}</b> ·
|
||||
<span>Cash in escrow</span>: ${{ auction('containers', i).cash }}
|
||||
</p>
|
||||
<p v-else class="offshore-muted">No public bid</p>
|
||||
<button
|
||||
v-if="offer('containers', i)"
|
||||
type="button"
|
||||
class="bank-button"
|
||||
@click="chooseOffer('containers', i)"
|
||||
>
|
||||
Call Bank
|
||||
</button>
|
||||
</article>
|
||||
</div>
|
||||
<form
|
||||
v-if="selectedOffer && offer(selectedOffer.type, selectedOffer.lot)"
|
||||
class="bank-decision"
|
||||
@submit.prevent="submitBid"
|
||||
>
|
||||
<h3>
|
||||
<span>Call Bank</span> ·
|
||||
<span>{{ selectedOffer.type === 'cash' ? 'Cash lot' : 'Container lot' }}</span>
|
||||
{{ selectedOffer.lot + 1 }}
|
||||
</h3>
|
||||
<template v-if="selectedOffer.type === 'containers'">
|
||||
<label for="bank-cash-bid">Cash bid</label>
|
||||
<input
|
||||
id="bank-cash-bid"
|
||||
v-model.number="cashBid"
|
||||
type="number"
|
||||
min="1"
|
||||
step="1"
|
||||
inputmode="numeric"
|
||||
/>
|
||||
<p>Cash is placed in public escrow until outbid or collected.</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p>Select containers from your stores. Your bid must exceed the current public bid.</p>
|
||||
<h4>Factory store</h4>
|
||||
<OffshoreCargo
|
||||
:pieces="factoryCargo"
|
||||
:selectable="storeIds"
|
||||
:selected="selectedIds"
|
||||
:color-blind="colorBlind"
|
||||
@select="toggleContainer"
|
||||
/>
|
||||
<h4>Warehouse store</h4>
|
||||
<OffshoreCargo
|
||||
:pieces="warehouseCargo"
|
||||
:selectable="storeIds"
|
||||
:selected="selectedIds"
|
||||
:color-blind="colorBlind"
|
||||
@select="toggleContainer"
|
||||
/>
|
||||
<p><span>Selected containers</span>: {{ selectedIds.length }}</p>
|
||||
</template>
|
||||
<button class="bank-button primary" type="submit" :disabled="!bidIsLegal">Place public bid</button>
|
||||
<button class="bank-button" type="button" @click="selectedOffer = null">Cancel</button>
|
||||
<p v-if="!bidIsLegal" class="bank-hint">
|
||||
Choose a higher bid using your available cash or stored containers.
|
||||
</p>
|
||||
</form>
|
||||
<section v-if="bank.decision && !decisionMoves.length" class="bank-decision" aria-live="polite">
|
||||
<h3>{{ decisionTitle }}</h3>
|
||||
<p>
|
||||
<span>Awaiting bank choice</span>: <b translate="no">{{ owner(bank.decision.player) }}</b>
|
||||
</p>
|
||||
<OffshoreCargo :pieces="pendingCargo" :color-blind="colorBlind" />
|
||||
</section>
|
||||
<section v-if="decisionMoves.length" class="bank-decision" aria-live="polite">
|
||||
<h3>{{ decisionTitle }}</h3>
|
||||
<p v-if="bank.decision && bank.decision.kind === 'return'">
|
||||
Choose a new selling price for each returned container.
|
||||
</p>
|
||||
<p v-if="bank.decision && bank.decision.kind === 'distribute'">
|
||||
<span>Next container goes to lot</span> {{ distributionLot + 1 }}.
|
||||
<span>Choose the order of distribution.</span>
|
||||
</p>
|
||||
<p v-if="bank.decision && bank.decision.kind === 'seize'">
|
||||
Choose a container to cover unpaid interest.
|
||||
</p>
|
||||
<div v-for="choice in decisionMoves" :key="choice.data.id" class="bank-choice">
|
||||
<OffshoreCargo :pieces="[choice.data]" :color-blind="colorBlind" />
|
||||
<template v-if="choice.name === names.ReturnBankContainer">
|
||||
<button
|
||||
v-for="price in returnPrices(choice)"
|
||||
:key="price"
|
||||
type="button"
|
||||
class="bank-button"
|
||||
@click="emitMove({ ...choice, extraData: { price } })"
|
||||
>
|
||||
<span>Return at</span> ${{ price }}
|
||||
</button>
|
||||
</template>
|
||||
<button v-else class="bank-button" type="button" @click="emitMove(choice)">
|
||||
{{ choice.name === names.SeizeBankContainer ? 'Select for default' : 'Distribute next' }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<div class="offshore-holdings">
|
||||
<article
|
||||
v-for="(p, i) in state.players"
|
||||
:key="p.id"
|
||||
class="offshore-holding"
|
||||
:class="{ own: i === player }"
|
||||
>
|
||||
<h3>
|
||||
<span translate="no">{{ owner(i) }}</span> <span v-if="i === player">· You</span>
|
||||
</h3>
|
||||
<span class="offshore-muted">Holding area</span>
|
||||
<OffshoreCargo :pieces="p.bankHolding || []" :color-blind="colorBlind" />
|
||||
<template v-if="i === player">
|
||||
<button
|
||||
v-for="piece in availableMoves[names.LoadBankContainer] || []"
|
||||
:key="piece.id"
|
||||
type="button"
|
||||
class="bank-button"
|
||||
@click="emitMove({ name: names.LoadBankContainer, data: piece })"
|
||||
>
|
||||
<span>Load onto ship</span> <OffshoreCargo :pieces="[piece]" :color-blind="colorBlind" />
|
||||
</button>
|
||||
</template>
|
||||
<span v-if="!p.bankHolding || !p.bankHolding.length" class="offshore-muted">Empty</span>
|
||||
<p v-if="p.ship.shipPosition === 'offshoreBank'" class="offshore-docked">Ship docked at the bank</p>
|
||||
</article>
|
||||
</div>
|
||||
<div class="bank-navigation">
|
||||
<button
|
||||
v-if="canSailToBank"
|
||||
type="button"
|
||||
class="bank-button primary"
|
||||
@click="emitMove({ name: names.Sail, data: positions.OffshoreBank })"
|
||||
>
|
||||
Sail to offshore bank
|
||||
</button>
|
||||
<button
|
||||
v-if="canLeaveBank"
|
||||
type="button"
|
||||
class="bank-button"
|
||||
@click="emitMove({ name: names.Sail, data: positions.OpenSea })"
|
||||
>
|
||||
Sail to open sea
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
|
||||
import { BankAuction, BankAuctionType, GameState, ShipPosition } from 'container-engine/src/gamestate';
|
||||
import { AvailableMoves } from 'container-engine/src/available-moves';
|
||||
import { Move, MoveName, Moves } from 'container-engine/src/move';
|
||||
import { legalBankAction } from '../offshore-actions';
|
||||
import OffshoreCargo from './OffshoreCargo.vue';
|
||||
|
||||
@Component({ components: { OffshoreCargo } })
|
||||
export default class OffshoreBank extends Vue {
|
||||
@Prop({ required: true }) state!: GameState;
|
||||
@Prop() player?: number;
|
||||
@Prop({ default: false }) colorBlind!: boolean;
|
||||
@Prop({ default: () => ({}) }) availableMoves!: AvailableMoves;
|
||||
expanded = typeof window === 'undefined' || window.innerWidth > 600;
|
||||
|
||||
get attentionKey() {
|
||||
return [
|
||||
MoveName.ReturnBankContainer,
|
||||
MoveName.DistributeBankContainer,
|
||||
MoveName.SeizeBankContainer,
|
||||
MoveName.LoadBankContainer,
|
||||
]
|
||||
.flatMap((name) => (this.availableMoves[name] || []).map((piece) => name + ':' + piece.id))
|
||||
.join('|');
|
||||
}
|
||||
|
||||
@Watch('attentionKey', { immediate: true })
|
||||
revealRequiredChoice(key: string) {
|
||||
if (key) this.expanded = true;
|
||||
}
|
||||
|
||||
names = MoveName;
|
||||
positions = ShipPosition;
|
||||
selectedOffer: { type: BankAuctionType; lot: number } | null = null;
|
||||
selectedIds: string[] = [];
|
||||
cashBid = 1;
|
||||
|
||||
@Watch('state')
|
||||
resetDraft() {
|
||||
this.selectedOffer = null;
|
||||
this.selectedIds = [];
|
||||
this.cashBid = 1;
|
||||
}
|
||||
|
||||
get bank() {
|
||||
return this.state.offshoreBank;
|
||||
}
|
||||
get ownPlayer() {
|
||||
return this.player == null ? undefined : this.state.players[this.player];
|
||||
}
|
||||
get factoryCargo() {
|
||||
return (this.ownPlayer?.containersOnFactoryStore || []).map((c) => ({ ...c.piece, price: c.price }));
|
||||
}
|
||||
get warehouseCargo() {
|
||||
return (this.ownPlayer?.containersOnWarehouseStore || []).map((c) => ({ ...c.piece, price: c.price }));
|
||||
}
|
||||
get storeIds() {
|
||||
return [...this.factoryCargo, ...this.warehouseCargo].map((c) => c.id);
|
||||
}
|
||||
offer(type: BankAuctionType, lot: number) {
|
||||
return this.availableMoves[MoveName.CallBank]?.find((o) => o.type === type && o.lot === lot);
|
||||
}
|
||||
chooseOffer(type: BankAuctionType, lot: number) {
|
||||
if (!this.offer(type, lot)) return;
|
||||
this.selectedOffer = { type, lot };
|
||||
this.selectedIds = [];
|
||||
this.cashBid = (this.auction(type, lot)?.cash || 0) + 1;
|
||||
}
|
||||
toggleContainer(id: string) {
|
||||
if (!this.storeIds.some((storeId) => storeId === id)) return;
|
||||
this.selectedIds = this.selectedIds.includes(id)
|
||||
? this.selectedIds.filter((c) => c !== id)
|
||||
: [...this.selectedIds, id];
|
||||
}
|
||||
get bidMove(): Moves.MoveCallBank | null {
|
||||
return this.selectedOffer
|
||||
? {
|
||||
name: MoveName.CallBank,
|
||||
data: this.selectedOffer,
|
||||
extraData:
|
||||
this.selectedOffer.type === 'cash' ? { containers: this.selectedIds } : { cash: this.cashBid },
|
||||
}
|
||||
: null;
|
||||
}
|
||||
get bidIsLegal() {
|
||||
return !!this.bidMove && legalBankAction(this.state, this.player, this.bidMove);
|
||||
}
|
||||
submitBid() {
|
||||
if (this.bidMove && this.bidIsLegal) this.emitMove(this.bidMove);
|
||||
}
|
||||
emitMove(action: Move) {
|
||||
// Recheck against the current legal move set immediately before emitting.
|
||||
if (!this.availableMoves[action.name] || !legalBankAction(this.state, this.player, action)) return;
|
||||
this.$emit('move', action);
|
||||
this.resetDraft();
|
||||
}
|
||||
get decisionMoves(): Moves.MoveBankContainer[] {
|
||||
const names = [
|
||||
MoveName.ReturnBankContainer,
|
||||
MoveName.DistributeBankContainer,
|
||||
MoveName.SeizeBankContainer,
|
||||
] as const;
|
||||
return names.flatMap((name) => (this.availableMoves[name] || []).map((data) => ({ name, data })));
|
||||
}
|
||||
get pendingCargo() {
|
||||
const decision = this.bank?.decision;
|
||||
return decision?.kind === 'return'
|
||||
? decision.containers.map((c) => ({ ...c.container.piece, price: c.container.price }))
|
||||
: decision?.payment || [];
|
||||
}
|
||||
get decisionTitle() {
|
||||
return this.bank?.decision?.kind === 'return'
|
||||
? 'Outbid containers'
|
||||
: this.bank?.decision?.kind === 'seize'
|
||||
? 'Loan default'
|
||||
: 'Distribute bank payment';
|
||||
}
|
||||
returnPrices(choice: Moves.MoveBankContainer) {
|
||||
return [1, 2, 3, 4, 5, 6].filter((price) =>
|
||||
legalBankAction(this.state, this.player, { ...choice, extraData: { price } })
|
||||
);
|
||||
}
|
||||
get distributionLot() {
|
||||
const lots = [0, 1, 2].filter((i) => !this.bank?.auctions.some((a) => a.type === 'containers' && a.lot === i));
|
||||
return lots[(this.bank?.decision?.cursor || 0) % lots.length];
|
||||
}
|
||||
get canSailToBank() {
|
||||
return this.availableMoves[MoveName.Sail]?.includes(ShipPosition.OffshoreBank);
|
||||
}
|
||||
get canLeaveBank() {
|
||||
return (
|
||||
this.ownPlayer?.ship.shipPosition === ShipPosition.OffshoreBank &&
|
||||
this.availableMoves[MoveName.Sail]?.includes(ShipPosition.OpenSea)
|
||||
);
|
||||
}
|
||||
owner(index: number) {
|
||||
return this.state.players[index]?.name || String(index + 1);
|
||||
}
|
||||
auction(type: BankAuctionType, lot: number) {
|
||||
return this.bank?.auctions.find((a) => a.type === type && a.lot === lot);
|
||||
}
|
||||
escrow(auction: BankAuction) {
|
||||
return auction.containers.map((c) => ({ ...c.container.piece, price: c.container.price }));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.offshore-bank {
|
||||
font: 14px/1.4 system-ui, sans-serif;
|
||||
box-sizing: border-box;
|
||||
width: min(1250px, 100%);
|
||||
margin: 14px auto;
|
||||
padding: 18px;
|
||||
background: #f6f4e9;
|
||||
border: 1px solid #8ca9aa;
|
||||
border-top: 4px solid #315f66;
|
||||
border-radius: 10px;
|
||||
color: #203a45;
|
||||
box-shadow: 0 4px 14px #203a4510;
|
||||
}
|
||||
.offshore-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.bank-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
color: #526d70;
|
||||
font-size: 12px;
|
||||
}
|
||||
.bank-toggle {
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.offshore-header h2 {
|
||||
margin: 3px 0 0;
|
||||
font-size: 23px;
|
||||
}
|
||||
.offshore-header p {
|
||||
font-size: 13px;
|
||||
color: #526d70;
|
||||
}
|
||||
.offshore-eyebrow {
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 0.13em;
|
||||
color: #63786e;
|
||||
}
|
||||
.offshore-lots {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.offshore-lot {
|
||||
border: 1px solid #c4d0c8;
|
||||
border-radius: 7px;
|
||||
padding: 12px;
|
||||
background: #ffffffa8;
|
||||
min-width: 0;
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.offshore-lot h3 strong {
|
||||
float: right;
|
||||
color: #315f66;
|
||||
font-size: 18px;
|
||||
}
|
||||
.offshore-escrow {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.offshore-escrow .offshore-cargo {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.offshore-muted {
|
||||
color: #586c6b;
|
||||
font-size: 12px;
|
||||
}
|
||||
.offshore-holdings {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
.offshore-holding {
|
||||
border: 1px dashed #adbfbb;
|
||||
border-radius: 6px;
|
||||
padding: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
.offshore-holding.own {
|
||||
background: #e6eee3;
|
||||
border-style: solid;
|
||||
}
|
||||
.offshore-holding .offshore-cargo {
|
||||
margin: 5px 0;
|
||||
}
|
||||
.offshore-docked {
|
||||
margin: 8px 0 0;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #315f66;
|
||||
}
|
||||
.bank-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
margin: 7px 5px 0 0;
|
||||
padding: 8px 12px;
|
||||
min-height: 36px;
|
||||
border: 1px solid #74938e;
|
||||
border-radius: 5px;
|
||||
background: #fffdf5;
|
||||
color: #254d4b;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bank-button.primary {
|
||||
background: #315f66;
|
||||
color: white;
|
||||
}
|
||||
.bank-button:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bank-button:focus-visible,
|
||||
input:focus-visible {
|
||||
outline: 3px solid #af742c;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.bank-button:hover:not(:disabled) {
|
||||
box-shadow: inset 0 0 0 1px currentColor;
|
||||
}
|
||||
.bank-decision {
|
||||
margin-top: 12px;
|
||||
padding: 14px;
|
||||
border: 2px solid #af8a48;
|
||||
border-radius: 7px;
|
||||
background: #fffae9;
|
||||
}
|
||||
.bank-decision p {
|
||||
font-size: 13px;
|
||||
}
|
||||
.bank-decision h4 {
|
||||
margin: 10px 0 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.bank-decision input {
|
||||
width: 90px;
|
||||
margin: 0 10px;
|
||||
padding: 7px;
|
||||
border: 1px solid #74938e;
|
||||
border-radius: 4px;
|
||||
font: inherit;
|
||||
}
|
||||
.bank-choice {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin: 6px 0;
|
||||
}
|
||||
.bank-hint {
|
||||
color: #765a2c;
|
||||
}
|
||||
.bank-navigation {
|
||||
margin-top: 8px;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.offshore-bank {
|
||||
padding: 12px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
.offshore-header {
|
||||
display: block;
|
||||
}
|
||||
.offshore-header p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
.offshore-lots {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.offshore-lot {
|
||||
padding: 9px;
|
||||
}
|
||||
.offshore-holdings {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
81
viewer/src/components/OffshoreCargo.vue
Normal file
81
viewer/src/components/OffshoreCargo.vue
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<div class="offshore-cargo">
|
||||
<template v-for="piece in pieces">
|
||||
<button
|
||||
v-if="selectable.includes(piece.id)"
|
||||
:key="piece.id"
|
||||
type="button"
|
||||
class="offshore-cargo-piece"
|
||||
:class="{ selected: selected.includes(piece.id) }"
|
||||
:aria-pressed="selected.includes(piece.id) ? 'true' : 'false'"
|
||||
:data-piece-id="piece.id"
|
||||
:title="colourName(piece.color)"
|
||||
@click="$emit('select', piece.id)"
|
||||
>
|
||||
<span v-html="badge(piece.color)"></span>
|
||||
<span>{{ colourName(piece.color) }}</span>
|
||||
<small v-if="piece.price != null">${{ piece.price }}</small>
|
||||
</button>
|
||||
<span v-else :key="piece.id" class="offshore-cargo-piece" :title="colourName(piece.color)">
|
||||
<span v-html="badge(piece.color)"></span>
|
||||
<span>{{ colourName(piece.color) }}</span>
|
||||
<small v-if="piece.price != null">${{ piece.price }}</small>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { ContainerPiece } from 'container-engine/src/gamestate';
|
||||
import { colorBadgeHtml } from '../color-blind';
|
||||
|
||||
/** Cargo outside the classic board: real piece IDs are preserved for escrow and loading choices. */
|
||||
@Component
|
||||
export default class OffshoreCargo extends Vue {
|
||||
@Prop({ default: () => [] }) pieces!: Array<ContainerPiece & { price?: number }>;
|
||||
@Prop({ default: () => [] }) selectable!: string[];
|
||||
@Prop({ default: () => [] }) selected!: string[];
|
||||
@Prop({ default: false }) colorBlind!: boolean;
|
||||
|
||||
badge(color: string) {
|
||||
return colorBadgeHtml(color, this.colorBlind);
|
||||
}
|
||||
|
||||
colourName(color: string) {
|
||||
return color === 'darkslategray' ? 'dark green' : color;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.offshore-cargo {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
min-width: 0;
|
||||
}
|
||||
.offshore-cargo-piece {
|
||||
display: inline-flex;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
padding: 5px 7px;
|
||||
border: 1px solid #b7c9ca;
|
||||
border-radius: 5px;
|
||||
background: #fffdf5;
|
||||
color: #203a45;
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
}
|
||||
button.offshore-cargo-piece {
|
||||
cursor: pointer;
|
||||
min-height: 36px;
|
||||
}
|
||||
button.offshore-cargo-piece:hover,
|
||||
button.offshore-cargo-piece.selected {
|
||||
background: #dfeddf;
|
||||
border-color: #37655a;
|
||||
}
|
||||
button.offshore-cargo-piece:focus-visible {
|
||||
outline: 3px solid #af742c;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -10,4 +10,6 @@ For rich text that is split into icons and spans, call `translateText` on the co
|
|||
|
||||
Run `node scripts/check-locales.mjs viewer/src/localization` to verify catalogue coverage and placeholders. The viewer's normal build and browser tests should also cover language switching, action controls, translated tutorial progression and narrow layouts. Browser text must remain readable if a translation is missing; English is the fallback.
|
||||
|
||||
The Offshore Island expansion currently includes UI strings in English and French. Its newly added entries in other catalogues explicitly retain English as a readable fallback pending translation; they are not silently omitted. Classic translations are unchanged.
|
||||
|
||||
Persian (`fa`, including `fa-IR`) was authored with game-specific context. Scoped RTL prose leaves the SVG board, coordinates, sale slots and calculator in their original physical order. Player names and chat remain user content; technical extraction keys retain their source spelling.
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} accepterer buddet fra {p1} på ${p2} og modtager ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} afviser alle bud og køber lasten for ${p1}",
|
||||
"Change bid": "Ændr bud",
|
||||
"Undo my move": "Fortryd mit træk"
|
||||
"Undo my move": "Fortryd mit træk",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} nimmt das Gebot von {p1} über ${p2} an und erhält ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} lehnt alle Gebote ab und kauft die Ladung für ${p1}",
|
||||
"Change bid": "Gebot ändern",
|
||||
"Undo my move": "Zug zurücknehmen"
|
||||
"Undo my move": "Zug zurücknehmen",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} δέχεται την προσφορά ${p2} του παίκτη {p1} και λαμβάνει ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} απορρίπτει όλες τις προσφορές και αγοράζει το φορτίο για ${p1}",
|
||||
"Change bid": "Αλλαγή προσφοράς",
|
||||
"Undo my move": "Αναίρεση κίνησης"
|
||||
"Undo my move": "Αναίρεση κίνησης",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} accepts {p1}'s bid of ${p2} and receives ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} declines all bids and buys the cargo for ${p1}",
|
||||
"Change bid": "Change bid",
|
||||
"Undo my move": "Undo my move"
|
||||
"Undo my move": "Undo my move",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} پیشنهاد ${p2} از {p1} را میپذیرد و ${p3} دریافت میکند",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} همهٔ پیشنهادها را رد میکند و محموله را به قیمت ${p1} میخرد",
|
||||
"Change bid": "تغییر پیشنهاد",
|
||||
"Undo my move": "بازگرداندن حرکت"
|
||||
"Undo my move": "بازگرداندن حرکت",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} accepte l’enchère de {p1} de ${p2} et reçoit ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} refuse toutes les enchères et achète la cargaison pour ${p1}",
|
||||
"Change bid": "Modifier l’enchère",
|
||||
"Undo my move": "Annuler mon coup"
|
||||
"Undo my move": "Annuler mon coup",
|
||||
"Call Bank": "Appeler la banque",
|
||||
"Cash bid": "Enchère en argent",
|
||||
"Cash in escrow": "Argent consigné",
|
||||
"Cash is placed in public escrow until outbid or collected.": "L’argent est consigné publiquement jusqu’à une surenchère ou au règlement.",
|
||||
"Cash lot": "Lot d’argent",
|
||||
"Choose a container to cover unpaid interest.": "Choisissez un conteneur pour couvrir les intérêts impayés.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Proposez une enchère supérieure avec votre argent disponible ou vos conteneurs en magasin.",
|
||||
"Choose a new selling price for each returned container.": "Choisissez un nouveau prix de vente pour chaque conteneur rendu.",
|
||||
"Choose the order of distribution.": "Choisissez l’ordre de distribution.",
|
||||
"Container lot": "Lot de conteneurs",
|
||||
"Distribute bank payment": "Répartir le paiement à la banque",
|
||||
"Distribute next": "Distribuer ensuite",
|
||||
"Factory store": "Magasin d’usine",
|
||||
"Holding area": "Zone d’attente",
|
||||
"Leading bidder": "Meilleur enchérisseur",
|
||||
"Load onto ship": "Charger sur le navire",
|
||||
"Loan default": "Défaut de paiement",
|
||||
"Next container goes to lot": "Le prochain conteneur va au lot",
|
||||
"No public bid": "Aucune enchère publique",
|
||||
"OPTIONAL EXPANSION": "EXTENSION FACULTATIVE",
|
||||
"Offshore Island": "Île offshore",
|
||||
"Offshore bank harbor": "Port de la banque offshore",
|
||||
"Outbid containers": "Conteneurs d’une offre dépassée",
|
||||
"Place public bid": "Placer une enchère publique",
|
||||
"Public bank auctions · cargo held offshore": "Enchères publiques de la banque · marchandises en attente",
|
||||
"Return at": "Rendre au prix de",
|
||||
"Sail to offshore bank": "Naviguer vers la banque offshore",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Sélectionnez des conteneurs de vos magasins. Votre offre doit dépasser l’enchère publique actuelle.",
|
||||
"Select for default": "Saisir pour impayé",
|
||||
"Selected containers": "Conteneurs sélectionnés",
|
||||
"Ship docked at the bank": "Navire amarré à la banque",
|
||||
"Warehouse store": "Magasin d’entrepôt",
|
||||
"· You": "· Vous",
|
||||
"Containers on Ship and in Holding ($3 each)": "Conteneurs sur le navire et en attente (3 $ chacun)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Faites votre choix bancaire dans le panneau Île offshore.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} appelle la banque pour le lot d’argent {p1} : {p2} conteneurs consignés.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} appelle la banque pour le lot de conteneurs {p1} : {p2} $ consignés.",
|
||||
"{p0} sails to the offshore bank.": "{p0} navigue vers la banque offshore.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} remet un conteneur {p1} en vente à {p2} $.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} répartit un conteneur {p1} à la banque.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} saisit un conteneur {p1} pour les intérêts impayés.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} charge un conteneur {p1} depuis la zone d’attente.",
|
||||
"Public auctions": "Enchères publiques",
|
||||
"Your holding": "Vos conteneurs en attente",
|
||||
"Show bank": "Afficher la banque",
|
||||
"Hide bank": "Masquer la banque",
|
||||
"Awaiting bank choice": "En attente d’un choix bancaire"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0}, {p1} की ${p2} की बोली स्वीकार करता है और ${p3} प्राप्त करता है",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} सभी बोलियाँ अस्वीकार करके ${p1} में माल खरीदता है",
|
||||
"Change bid": "बोली बदलें",
|
||||
"Undo my move": "अपनी चाल वापस लें"
|
||||
"Undo my move": "अपनी चाल वापस लें",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} accetta l’offerta di ${p2} di {p1} e riceve ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} rifiuta tutte le offerte e acquista il carico per ${p1}",
|
||||
"Change bid": "Modifica offerta",
|
||||
"Undo my move": "Annulla la mossa"
|
||||
"Undo my move": "Annulla la mossa",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0}: {p1}의 ${p2} 입찰을 수락하고 ${p3}를 받습니다",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0}: 모든 입찰을 거절하고 화물을 ${p1}에 구매합니다",
|
||||
"Change bid": "입찰 변경",
|
||||
"Undo my move": "내 수 되돌리기"
|
||||
"Undo my move": "내 수 되돌리기",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} accepteert het bod van {p1} van ${p2} en ontvangt ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} wijst alle biedingen af en koopt de lading voor ${p1}",
|
||||
"Change bid": "Bod wijzigen",
|
||||
"Undo my move": "Zet ongedaan maken"
|
||||
"Undo my move": "Zet ongedaan maken",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} przyjmuje ofertę {p1} w wysokości ${p2} i otrzymuje ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} odrzuca wszystkie oferty i kupuje ładunek za ${p1}",
|
||||
"Change bid": "Zmień ofertę",
|
||||
"Undo my move": "Cofnij ruch"
|
||||
"Undo my move": "Cofnij ruch",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} aceita o lance de ${p2} de {p1} e recebe ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} recusa todos os lances e compra a carga por ${p1}",
|
||||
"Change bid": "Alterar lance",
|
||||
"Undo my move": "Desfazer jogada"
|
||||
"Undo my move": "Desfazer jogada",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} acceptă oferta de ${p2} a lui {p1} și primește ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} refuză toate ofertele și cumpără încărcătura pentru ${p1}",
|
||||
"Change bid": "Modifică oferta",
|
||||
"Undo my move": "Anulează mutarea"
|
||||
"Undo my move": "Anulează mutarea",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} принимает ставку {p1} в размере ${p2} и получает ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} отклоняет все ставки и покупает груз за ${p1}",
|
||||
"Change bid": "Изменить ставку",
|
||||
"Undo my move": "Отменить ход"
|
||||
"Undo my move": "Отменить ход",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} chấp nhận giá ${p2} của {p1} và nhận ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} từ chối mọi giá đấu và mua hàng với giá ${p1}",
|
||||
"Change bid": "Đổi giá đấu",
|
||||
"Undo my move": "Hoàn tác nước đi"
|
||||
"Undo my move": "Hoàn tác nước đi",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"Island score if the game ended now, including the discarded colour and full-set bonus.": "若此刻结束游戏的岛屿得分,已计入颜色移除和五色加成。",
|
||||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} 接受 {p1} 的 ${p2} 出价,收到 ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} 拒绝所有出价,以 ${p1} 自购货物",
|
||||
"Change bid": "更改出价"
|
||||
"Change bid": "更改出价",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -653,5 +653,52 @@
|
|||
"{p0} accepts {p1}'s bid of ${p2} and receives ${p3}": "{p0} 接受 {p1} 的 ${p2} 出價並獲得 ${p3}",
|
||||
"{p0} declines all bids and buys the cargo for ${p1}": "{p0} 拒絕所有出價並以 ${p1} 購買貨物",
|
||||
"Change bid": "更改出價",
|
||||
"Undo my move": "撤回我的行動"
|
||||
"Undo my move": "撤回我的行動",
|
||||
"Call Bank": "Call Bank",
|
||||
"Cash bid": "Cash bid",
|
||||
"Cash in escrow": "Cash in escrow",
|
||||
"Cash is placed in public escrow until outbid or collected.": "Cash is placed in public escrow until outbid or collected.",
|
||||
"Cash lot": "Cash lot",
|
||||
"Choose a container to cover unpaid interest.": "Choose a container to cover unpaid interest.",
|
||||
"Choose a higher bid using your available cash or stored containers.": "Choose a higher bid using your available cash or stored containers.",
|
||||
"Choose a new selling price for each returned container.": "Choose a new selling price for each returned container.",
|
||||
"Choose the order of distribution.": "Choose the order of distribution.",
|
||||
"Container lot": "Container lot",
|
||||
"Distribute bank payment": "Distribute bank payment",
|
||||
"Distribute next": "Distribute next",
|
||||
"Factory store": "Factory store",
|
||||
"Holding area": "Holding area",
|
||||
"Leading bidder": "Leading bidder",
|
||||
"Load onto ship": "Load onto ship",
|
||||
"Loan default": "Loan default",
|
||||
"Next container goes to lot": "Next container goes to lot",
|
||||
"No public bid": "No public bid",
|
||||
"OPTIONAL EXPANSION": "OPTIONAL EXPANSION",
|
||||
"Offshore Island": "Offshore Island",
|
||||
"Offshore bank harbor": "Offshore bank harbor",
|
||||
"Outbid containers": "Outbid containers",
|
||||
"Place public bid": "Place public bid",
|
||||
"Public bank auctions · cargo held offshore": "Public bank auctions · cargo held offshore",
|
||||
"Return at": "Return at",
|
||||
"Sail to offshore bank": "Sail to offshore bank",
|
||||
"Select containers from your stores. Your bid must exceed the current public bid.": "Select containers from your stores. Your bid must exceed the current public bid.",
|
||||
"Select for default": "Select for default",
|
||||
"Selected containers": "Selected containers",
|
||||
"Ship docked at the bank": "Ship docked at the bank",
|
||||
"Warehouse store": "Warehouse store",
|
||||
"· You": "· You",
|
||||
"Containers on Ship and in Holding ($3 each)": "Containers on Ship and in Holding ($3 each)",
|
||||
"Choose your bank decision in the Offshore Island panel.": "Choose your bank decision in the Offshore Island panel.",
|
||||
"{p0} calls bank for cash lot {p1}: {p2} containers in escrow.": "{p0} calls bank for cash lot {p1}: {p2} containers in escrow.",
|
||||
"{p0} calls bank for container lot {p1}: ${p2} in escrow.": "{p0} calls bank for container lot {p1}: ${p2} in escrow.",
|
||||
"{p0} sails to the offshore bank.": "{p0} sails to the offshore bank.",
|
||||
"{p0} returns a {p1} container at ${p2}.": "{p0} returns a {p1} container at ${p2}.",
|
||||
"{p0} distributes a {p1} container to the bank.": "{p0} distributes a {p1} container to the bank.",
|
||||
"{p0} seizes a {p1} container for unpaid interest.": "{p0} seizes a {p1} container for unpaid interest.",
|
||||
"{p0} loads a {p1} container from the holding area.": "{p0} loads a {p1} container from the holding area.",
|
||||
"Public auctions": "Public auctions",
|
||||
"Your holding": "Your holding",
|
||||
"Show bank": "Show bank",
|
||||
"Hide bank": "Hide bank",
|
||||
"Awaiting bank choice": "Awaiting bank choice"
|
||||
}
|
||||
|
|
|
|||
12
viewer/src/offshore-actions.ts
Normal file
12
viewer/src/offshore-actions.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { GameState, Move, move } from 'container-engine';
|
||||
|
||||
/** Parameterised bank bids/prices are checked by the engine, never a second viewer ruleset. */
|
||||
export function legalBankAction(state: GameState, player: number | undefined, action: Move): boolean {
|
||||
if (player == null || !state.currentPlayers.includes(player)) return false;
|
||||
try {
|
||||
move(JSON.parse(JSON.stringify(state)), action, player, true);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
40
viewer/src/offshore-journal.ts
Normal file
40
viewer/src/offshore-journal.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { GameState, ShipPosition } from 'container-engine/src/gamestate';
|
||||
import { LogMove } from 'container-engine/src/log';
|
||||
import { MoveName } from 'container-engine/src/move';
|
||||
|
||||
/** Public bank moves carry enough information for useful prose without exposing secrets. */
|
||||
export function offshoreJournal(entry: LogMove, state: GameState): string | undefined {
|
||||
const player = state.players?.[entry.player]?.name || String(entry.player + 1);
|
||||
const move = entry.move;
|
||||
if (move.name === MoveName.CallBank) {
|
||||
return move.data.type === 'cash'
|
||||
? `${player} calls bank for cash lot ${move.data.lot + 1}: ${
|
||||
move.extraData.containers?.length || 0
|
||||
} containers in escrow.`
|
||||
: `${player} calls bank for container lot ${move.data.lot + 1}: $${move.extraData.cash} in escrow.`;
|
||||
}
|
||||
if (move.name === MoveName.Sail && move.data === ShipPosition.OffshoreBank)
|
||||
return `${player} sails to the offshore bank.`;
|
||||
if (
|
||||
[
|
||||
MoveName.ReturnBankContainer,
|
||||
MoveName.DistributeBankContainer,
|
||||
MoveName.SeizeBankContainer,
|
||||
MoveName.LoadBankContainer,
|
||||
].includes(move.name)
|
||||
) {
|
||||
const action = move as import('container-engine/src/move').Moves.MoveBankContainer;
|
||||
const color = action.data.color === 'darkslategray' ? 'dark green' : action.data.color;
|
||||
if (action.name === MoveName.ReturnBankContainer)
|
||||
return `${player} returns a ${color} container at $${action.extraData?.price}.`;
|
||||
if (action.name === MoveName.DistributeBankContainer)
|
||||
return `${player} distributes a ${color} container to the bank.`;
|
||||
if (action.name === MoveName.SeizeBankContainer)
|
||||
return `${player} seizes a ${color} container for unpaid interest.`;
|
||||
return `${player} loads a ${color} container from the holding area.`;
|
||||
}
|
||||
}
|
||||
|
||||
export function escapeJournal(text: string): string {
|
||||
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
|
@ -13,7 +13,9 @@ function launchSelfContained(selector = '#app') {
|
|||
mountSoundTests(emitter);
|
||||
installLocalChat(emitter);
|
||||
|
||||
let gameState = setup(5, {});
|
||||
// Explicit local opt-in; the normal demo and published game defaults stay classic.
|
||||
const offshoreIsland = new URLSearchParams(window.location.search).get('offshoreIsland') === '1';
|
||||
let gameState = setup(5, offshoreIsland ? { offshoreIsland: true } : {});
|
||||
|
||||
for (let i = 0; i < gameState.players.length; i++) {
|
||||
gameState.players[i].name = `Player ${i + 1}`;
|
||||
|
|
|
|||
185
viewer/tests/unit/offshore-bank.spec.ts
Normal file
185
viewer/tests/unit/offshore-bank.spec.ts
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
import Game from '@/components/Game.vue';
|
||||
import OffshoreBank from '@/components/OffshoreBank.vue';
|
||||
import { legalBankAction } from '@/offshore-actions';
|
||||
import { escapeJournal, offshoreJournal } from '@/offshore-journal';
|
||||
import { mount, shallowMount } from '@vue/test-utils';
|
||||
import { expect } from 'chai';
|
||||
import { availableMoves, MoveName, setup } from 'container-engine';
|
||||
import { Phase, ShipPosition } from 'container-engine/src/gamestate';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
function fixture() {
|
||||
const state = setup(3, { offshoreIsland: true }, 'offshore-viewer');
|
||||
const player = state.currentPlayers[0];
|
||||
state.players.forEach((p, i) => (p.name = `Trader ${i + 1}`));
|
||||
const own = state.players[player];
|
||||
own.actions = 2;
|
||||
const factory = state.containersLeft.pop()!;
|
||||
const warehouse = state.containersLeft.pop()!;
|
||||
own.containersOnFactoryStore.push({ piece: factory, price: 2, moved: false });
|
||||
own.containersOnWarehouseStore.push({ piece: warehouse, price: 3, moved: false });
|
||||
const refresh = () => (own.availableMoves = availableMoves(state, own));
|
||||
refresh();
|
||||
const render = () =>
|
||||
mount(OffshoreBank, { propsData: { state, player, availableMoves: own.availableMoves, colorBlind: true } });
|
||||
return { state, player, own, factory, warehouse, refresh, render };
|
||||
}
|
||||
|
||||
describe('Offshore bank viewer', () => {
|
||||
it('formats public bank journal details and escapes user-provided player names', () => {
|
||||
const { state, player } = fixture();
|
||||
state.players[player].name = '<Ada>';
|
||||
const text = offshoreJournal(
|
||||
{
|
||||
type: 'move',
|
||||
player,
|
||||
pretty: '',
|
||||
simple: '',
|
||||
move: { name: MoveName.CallBank, data: { type: 'containers', lot: 2 }, extraData: { cash: 4 } },
|
||||
},
|
||||
state
|
||||
)!;
|
||||
expect(text).to.equal('<Ada> calls bank for container lot 3: $4 in escrow.');
|
||||
expect(escapeJournal(text)).to.contain('<Ada>');
|
||||
});
|
||||
it('keeps classic games free of the expansion panel', () => {
|
||||
const state = setup(3, {}, 'classic-viewer');
|
||||
const wrapper = shallowMount(Game, {
|
||||
propsData: {
|
||||
state,
|
||||
player: state.currentPlayers[0],
|
||||
emitter: new EventEmitter(),
|
||||
preferences: { sound: false },
|
||||
},
|
||||
});
|
||||
expect(wrapper.findComponent(OffshoreBank).exists()).to.equal(false);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('shows three lots of each kind and submits a real engine-legal cash bid', async () => {
|
||||
const { render, state, player } = fixture();
|
||||
const wrapper = render();
|
||||
expect(wrapper.findAll('.offshore-lot').length).to.equal(6);
|
||||
await wrapper.findAll('.offshore-lot').at(3).find('button').trigger('click');
|
||||
await wrapper.find('input').setValue('2');
|
||||
const before = JSON.stringify(state);
|
||||
await wrapper.find('form').trigger('submit');
|
||||
const action = wrapper.emitted('move')![0][0];
|
||||
expect(action).to.deep.equal({
|
||||
name: MoveName.CallBank,
|
||||
data: { type: 'containers', lot: 0 },
|
||||
extraData: { cash: 2 },
|
||||
});
|
||||
expect(legalBankAction(state, player, action)).to.equal(true);
|
||||
expect(JSON.stringify(state)).to.equal(before);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('selects specific factory and warehouse pieces for a cargo bid and rejects empty bids', async () => {
|
||||
const { render, factory, warehouse } = fixture();
|
||||
const wrapper = render();
|
||||
await wrapper.find('.offshore-lot button').trigger('click');
|
||||
expect(wrapper.find('button[type="submit"]').attributes('disabled')).to.equal('disabled');
|
||||
await wrapper.find(`form [data-piece-id="${factory.id}"]`).trigger('click');
|
||||
await wrapper.find(`form [data-piece-id="${warehouse.id}"]`).trigger('click');
|
||||
await wrapper.find('form').trigger('submit');
|
||||
expect(wrapper.emitted('move')![0][0].extraData.containers).to.deep.equal([factory.id, warehouse.id]);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('does not enable invalid cash bids or stale/spectator controls', async () => {
|
||||
const { render, own } = fixture();
|
||||
const wrapper = render();
|
||||
await wrapper.findAll('.offshore-lot').at(3).find('button').trigger('click');
|
||||
await wrapper.find('input').setValue(String(own.money + 1));
|
||||
await wrapper.find('form').trigger('submit');
|
||||
expect(wrapper.emitted('move')).to.equal(undefined);
|
||||
await wrapper.setProps({ availableMoves: {}, player: undefined });
|
||||
expect(wrapper.findAll('.offshore-lot button').length).to.equal(0);
|
||||
expect(wrapper.find('form').exists()).to.equal(false);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('offers only engine-valid return prices, preserving escrow and holding cargo', () => {
|
||||
const { state, player, own, factory, warehouse, refresh, render } = fixture();
|
||||
own.bankHolding!.push(state.containersLeft.pop()!);
|
||||
state.phase = Phase.BankDecision;
|
||||
state.offshoreBank!.decision = {
|
||||
kind: 'return',
|
||||
player,
|
||||
resumePlayer: player,
|
||||
containers: [
|
||||
{ container: own.containersOnFactoryStore.pop()!, district: 'factory' },
|
||||
{ container: own.containersOnWarehouseStore.pop()!, district: 'warehouse' },
|
||||
],
|
||||
payment: [],
|
||||
cursor: 0,
|
||||
};
|
||||
refresh();
|
||||
const wrapper = render();
|
||||
const vm = wrapper.vm as any;
|
||||
expect(vm.returnPrices({ name: MoveName.ReturnBankContainer, data: factory })).to.deep.equal([1, 2, 3, 4]);
|
||||
expect(vm.returnPrices({ name: MoveName.ReturnBankContainer, data: warehouse })).to.deep.equal([2, 3, 4, 5, 6]);
|
||||
expect(wrapper.findAll('.bank-choice').length).to.equal(2);
|
||||
expect(wrapper.find('.offshore-holding.own .offshore-cargo-piece').exists()).to.equal(true);
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('shows default selection and distribution only when requested by the engine', async () => {
|
||||
const { state, player, refresh, render } = fixture();
|
||||
state.phase = Phase.BankDecision;
|
||||
state.offshoreBank!.decision = {
|
||||
kind: 'seize',
|
||||
player,
|
||||
resumePlayer: player,
|
||||
debtor: player,
|
||||
remaining: 1,
|
||||
containers: [],
|
||||
payment: [],
|
||||
cursor: 0,
|
||||
};
|
||||
refresh();
|
||||
let wrapper = render();
|
||||
expect(wrapper.text()).to.contain('Loan default');
|
||||
await wrapper.find('.bank-choice button').trigger('click');
|
||||
expect(wrapper.emitted('move')![0][0].name).to.equal(MoveName.SeizeBankContainer);
|
||||
wrapper.destroy();
|
||||
state.offshoreBank!.decision = {
|
||||
kind: 'distribute',
|
||||
player,
|
||||
resumePlayer: player,
|
||||
containers: [],
|
||||
payment: [state.containersLeft.pop()!],
|
||||
cursor: 0,
|
||||
};
|
||||
refresh();
|
||||
wrapper = render();
|
||||
expect(wrapper.text()).to.contain('Next container goes to lot');
|
||||
await wrapper.find('.bank-choice button').trigger('click');
|
||||
expect(wrapper.emitted('move')![0][0].name).to.equal(MoveName.DistributeBankContainer);
|
||||
wrapper.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;
|
||||
own.lastMove = { name: MoveName.Sail, data: ShipPosition.OffshoreBank };
|
||||
own.bankHolding!.push(state.containersLeft.pop()!);
|
||||
refresh();
|
||||
const wrapper = render();
|
||||
expect(wrapper.find('.offshore-holding.own button').text()).to.contain('Load onto ship');
|
||||
await wrapper.find('.offshore-holding.own button').trigger('click');
|
||||
expect(wrapper.emitted('move')![0][0].name).to.equal(MoveName.LoadBankContainer);
|
||||
own.lastMove = null;
|
||||
refresh();
|
||||
await wrapper.setProps({ availableMoves: own.availableMoves });
|
||||
expect(wrapper.find('.offshore-holding.own button').exists()).to.equal(false);
|
||||
wrapper.destroy();
|
||||
const game = shallowMount(Game, {
|
||||
propsData: { state, player, emitter: new EventEmitter(), preferences: { sound: false } },
|
||||
});
|
||||
const ship = (game.vm as any).ships.find((s) => s.owner === player);
|
||||
expect(Number.isFinite(ship.x) && Number.isFinite(ship.y)).to.equal(true);
|
||||
game.destroy();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue