From f26a3fcaa0718e6dc7786036e61f83c3cfabcf59 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Sat, 14 Nov 2026 01:36:36 +0000 Subject: [PATCH] Add Trading Network Kicker achievement to revision 2 --- ACHIEVEMENTS.md | 17 ++++----- packages/engine/src/achievements.spec.ts | 44 ++++++++++++++++++++++-- packages/engine/src/achievements.ts | 7 ++++ 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/ACHIEVEMENTS.md b/ACHIEVEMENTS.md index 89a1062..9cf0267 100644 --- a/ACHIEVEMENTS.md +++ b/ACHIEVEMENTS.md @@ -1,6 +1,6 @@ # Outpost achievements -Revision 2 exposes 18 game-local achievements through the optional `achievementDefinitions()` +Revision 2 exposes 19 game-local achievements through the optional `achievementDefinitions()` and `achievements(data)` exports of `dist/wrapper.js`. Types come from the published, exact-pinned `@boardgamers/protocol@0.11.0` `/engine` entry point (type-only imports). No viewer changes or browser claims are involved. Icons are omitted so the platform can @@ -28,6 +28,7 @@ use generic artwork; there are no third-party assets or viewer-bundle URLs. | `self-sustaining-colony` | Self-Sustaining Colony | Ecoplants and Nodule | | `biosphere-colony` | Biosphere Colony | Own a Biosphere Kicker card | | `twenty-workforce` | Twenty Strong | Own at least 20 colonists and robots combined, including idle workers | +| `trading-network` | Trading Network | Own Wily Trader and Merchant House with Kicker enabled | Only the first five require victory. Factory thresholds of four correspond to the actual Mega production rule; they do not claim a Mega card was taken. All ownership and @@ -35,8 +36,8 @@ operation conditions describe the final position, not historical purchases or pr The 75-VP check uses engine scoring, including Kicker VP and only manned factory VP. IDs must never be repurposed; definition changes require a manifest revision bump. -Revision 2 adds Biosphere ownership and total-owned workforce without changing the existing -16 definitions, outcomes, or eligibility. Workforce is `population + robots`, not manned +Revision 2 adds Biosphere ownership, total-owned workforce, and Trading Network without +changing the existing 16 definitions, outcomes, or eligibility. Workforce is `population + robots`, not manned factory count or the operating-robot limit; idle and excess owned robots count. Twenty is legally attainable: base population support 5 plus one Outpost's +5 supports 10 colonists, and one Robots upgrade permits 10 operating robots. Robots can also be legally bought in @@ -45,11 +46,11 @@ in a game played from initialization to completion; a separate completed Kicker Biosphere through its auction. Boundary tests cover totals 19, 20, and 21 with mixed workers. Biosphere is checked from `kickers.biosphere`, not merely the expansion option. -A possible `trading-network` achievement remains pending coordinator input and is not in -revision 2 yet: own both Wily Trader (`wilyTrader`) and Merchant House (`merchantHouse`). -They are the two exchange Kicker cards, covering ore/water/titanium and -research/microbiotics/new chemicals respectively. No other Kicker cards are proposed as -requirements for that combo. +`trading-network` requires `options.kicker === true` and final ownership of both Wily Trader +(`wilyTrader`) and Merchant House (`merchantHouse`). They are the two exchange Kicker cards, +covering ore/water/titanium and research/microbiotics/new chemicals respectively. No other +cards or successful exchanges are required. Tests cover each missing card, disabled Kicker, +a losing owner's award, and both cards' legal auction acquisition in a completed game. ## Authority and eligibility diff --git a/packages/engine/src/achievements.spec.ts b/packages/engine/src/achievements.spec.ts index 22d5e32..bf4db03 100644 --- a/packages/engine/src/achievements.spec.ts +++ b/packages/engine/src/achievements.spec.ts @@ -53,8 +53,8 @@ function earned(state: GameState, id: string): boolean { test("manifest uses stable unique IDs, fresh literals and published hook types", async () => { const manifest = wrapper.achievementDefinitions(); assert.equal(manifest.revision, 2); - assert.equal(manifest.achievements.length, 18); - assert.equal(new Set(manifest.achievements.map((entry) => entry.id)).size, 18); + assert.equal(manifest.achievements.length, 19); + assert.equal(new Set(manifest.achievements.map((entry) => entry.id)).size, 19); for (const entry of manifest.achievements) { assert.match(entry.id, /^[a-z0-9]+(?:-[a-z0-9]+)*$/); assert.ok(entry.id.length <= 64); @@ -176,6 +176,46 @@ test("compound upgrade feats require every component", () => { } }); +test("Trading Network requires both exchange cards and enabled Kicker, but not victory", () => { + const state = boundaryState(); + state.options.kicker = true; + const player = state.players[0]!; + assert.equal(earned(state, "trading-network"), false); + player.kickers.wilyTrader = 1; + assert.equal(earned(state, "trading-network"), false); + player.kickers.wilyTrader = 0; + player.kickers.merchantHouse = 1; + assert.equal(earned(state, "trading-network"), false); + player.kickers.wilyTrader = 1; + assert.equal(wrapper.achievements(state)[0]!.outcome, "loss"); + assert.equal(earned(state, "trading-network"), true); + for (const option of [false, undefined, "true", 1]) { + state.options.kicker = option; + assert.equal(earned(state, "trading-network"), false); + } + state.options.kicker = true; + const before = JSON.stringify(state); + assert.equal(earned(state, "trading-network"), true); + assert.equal(JSON.stringify(state), before); +}); + +test("both Trading Network cards are acquired through legal auctions in a completed game", () => { + const state = complete(5, { kicker: true, fastBid: true }, "trading-achievement-1"); + const seat = state.players.findIndex((player) => player.kickers.wilyTrader > 0 && player.kickers.merchantHouse > 0); + assert.notEqual(seat, -1); + for (const kicker of ["wilyTrader", "merchantHouse"]) { + assert.ok( + state.log.some((entry) => entry.type === "move" && entry.player === seat && entry.info?.kicker === kicker) + ); + } + assert.ok( + wrapper + .achievements(state) + .find((result) => result.seat === seat)! + .earned.includes("trading-network") + ); +}); + test("Biosphere is a final-owned, non-winning feat, not an expansion flag", () => { const state = boundaryState(); state.options.kicker = true; diff --git a/packages/engine/src/achievements.ts b/packages/engine/src/achievements.ts index 48ad4f6..1553b58 100644 --- a/packages/engine/src/achievements.ts +++ b/packages/engine/src/achievements.ts @@ -118,6 +118,13 @@ const catalog: { id: string; name: string; description: string; qualifies: (cont description: "Finish owning at least 20 colonists and robots combined, including idle workers.", qualifies: ({ player }) => player.population + player.robots >= 20, }, + { + id: "trading-network", + name: "Trading Network", + description: "Finish owning both Wily Trader and Merchant House with the Kicker expansion enabled.", + qualifies: ({ player, state }) => + state.options.kicker === true && player.kickers.wilyTrader > 0 && player.kickers.merchantHouse > 0, + }, ]; export function achievementDefinitions(): AchievementManifest {