Add Biosphere and twenty-workforce achievements for revision 2

This commit is contained in:
coyotte508 2026-11-14 01:34:36 +00:00
commit 55ed7be307
4 changed files with 157 additions and 27 deletions

View file

@ -1,6 +1,6 @@
# Outpost achievements
Revision 1 exposes 16 game-local achievements through the optional `achievementDefinitions()`
Revision 2 exposes 18 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
@ -8,24 +8,26 @@ use generic artwork; there are no third-party assets or viewer-bundle URLs.
## Catalog
| ID | Name | Final-state condition |
| ------------------------ | ----------------------- | ----------------------------------------------------- |
| `colony-victor` | Colony Victor | Sole first place |
| `head-to-head` | Head to Head | Sole first place with two original seats |
| `crowded-frontier` | Crowded Frontier | Sole first place with at least five original seats |
| `kicker-victor` | Kicker Victor | Sole first place with `options.kicker === true` |
| `sealed-bid-victor` | Sealed Bid Victor | Sole first place with `options.fastBid === true` |
| `seventy-five-points` | Victory Point Milestone | At least 75 VP, the normal victory target |
| `water-megaplex` | Water Megaplex | At least four manned water factories |
| `titanium-megaplex` | Titanium Megaplex | At least four manned titanium factories |
| `chemical-megaplex` | Chemical Megaplex | At least four manned new chemicals factories |
| `diversified-industry` | Diversified Industry | At least one manned factory of each of the five types |
| `research-campus` | Research Campus | Scientists, Laboratory, and a manned research factory |
| `automated-colony` | Automated Colony | Robots upgrade and at least one robot |
| `established-outpost` | Established Outpost | Outpost upgrade |
| `orbital-network` | Orbital Network | Space Station, Planetary Cruiser, and Moon Base |
| `lunar-colony` | Lunar Colony | Moon Base |
| `self-sustaining-colony` | Self-Sustaining Colony | Ecoplants and Nodule |
| ID | Name | Final-state condition |
| ------------------------ | ----------------------- | --------------------------------------------------------------------- |
| `colony-victor` | Colony Victor | Sole first place |
| `head-to-head` | Head to Head | Sole first place with two original seats |
| `crowded-frontier` | Crowded Frontier | Sole first place with at least five original seats |
| `kicker-victor` | Kicker Victor | Sole first place with `options.kicker === true` |
| `sealed-bid-victor` | Sealed Bid Victor | Sole first place with `options.fastBid === true` |
| `seventy-five-points` | Victory Point Milestone | At least 75 VP, the normal victory target |
| `water-megaplex` | Water Megaplex | At least four manned water factories |
| `titanium-megaplex` | Titanium Megaplex | At least four manned titanium factories |
| `chemical-megaplex` | Chemical Megaplex | At least four manned new chemicals factories |
| `diversified-industry` | Diversified Industry | At least one manned factory of each of the five types |
| `research-campus` | Research Campus | Scientists, Laboratory, and a manned research factory |
| `automated-colony` | Automated Colony | Robots upgrade and at least one robot |
| `established-outpost` | Established Outpost | Outpost upgrade |
| `orbital-network` | Orbital Network | Space Station, Planetary Cruiser, and Moon Base |
| `lunar-colony` | Lunar Colony | Moon Base |
| `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 |
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
@ -33,6 +35,22 @@ 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
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
advance beyond their operating limit. Tests reach 20 through an actual paid robot purchase
in a game played from initialization to completion; a separate completed Kicker game buys
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.
## Authority and eligibility
The hook accepts the server's JSON-serializable engine state, not a JSON string or a
@ -66,7 +84,8 @@ Constructed final positions are boundary tests, not claims that their logs repro
Run the complete `pnpm check` before committing or releasing.
Revision 1 was approved and released in engine 0.10.31; see
[the release receipt](RELEASE-0.10.31.md). For subsequent releases:
[the release receipt](RELEASE-0.10.31.md). Revision 2 is staged in engine 0.10.32 for review;
it has not been published. Before releasing revision 2:
1. Obtain independent coordinator review, including the platform's human/account and
authoritative-completion eligibility gates.
@ -74,7 +93,7 @@ Revision 1 was approved and released in engine 0.10.31; see
choose an unused engine patch version and rerun `pnpm check`.
3. Follow `AGENTS.md` publishing: pack the engine, upload to existing game version doc 1,
and verify `engine.package.version`. This is engine-only; no viewer upload is needed.
4. Verify platform ingestion of manifest revision 1 and eligible completed-game awards.
4. Verify platform ingestion of manifest revision 2 and eligible completed-game awards.
5. Commit and push the released sources/version to the canonical release branch under
the repository's delivery workflow, and verify its remote head.

View file

@ -1,6 +1,6 @@
{
"name": "outpost-engine",
"version": "0.10.31",
"version": "0.10.32",
"description": "Unofficial Outpost rules engine for boardgamers.space",
"license": "AGPL-3.0",
"files": [

View file

@ -3,7 +3,8 @@ import { test } from "node:test";
import type { Engine } from "@boardgamers/protocol/engine";
import * as wrapper from "../wrapper.js";
import { moveAI } from "./ai.js";
import { initGame } from "./moves.js";
import { applyMove, initGame } from "./moves.js";
import { bestPayment, operators, populationMax, robotMax } from "./state.js";
import { rankings } from "./rankings.js";
import { FACTORY_TYPES, UPGRADES, type GameState, type PlayerState } from "./types.js";
@ -29,6 +30,7 @@ function boundaryState(): GameState {
const state = structuredClone(completed);
for (const player of state.players) {
player.factories = [];
player.population = 3;
player.robots = 0;
for (const upgrade of UPGRADES) {
player.upgrades[upgrade] = 0;
@ -50,9 +52,9 @@ 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, 1);
assert.equal(manifest.achievements.length, 16);
assert.equal(new Set(manifest.achievements.map((entry) => entry.id)).size, 16);
assert.equal(manifest.revision, 2);
assert.equal(manifest.achievements.length, 18);
assert.equal(new Set(manifest.achievements.map((entry) => entry.id)).size, 18);
for (const entry of manifest.achievements) {
assert.match(entry.id, /^[a-z0-9]+(?:-[a-z0-9]+)*$/);
assert.ok(entry.id.length <= 64);
@ -174,6 +176,103 @@ test("compound upgrade feats require every component", () => {
}
});
test("Biosphere is a final-owned, non-winning feat, not an expansion flag", () => {
const state = boundaryState();
state.options.kicker = true;
assert.equal(earned(state, "biosphere-colony"), false);
state.players[0]!.kickers.biosphere = 1;
assert.equal(wrapper.achievements(state)[0]!.outcome, "loss");
assert.equal(earned(state, "biosphere-colony"), true);
state.players[0]!.kickers.biosphere = 0;
assert.equal(earned(state, "biosphere-colony"), false);
});
test("Biosphere is attainable in a real completed Kicker game", () => {
const state = complete(5, { kicker: true, fastBid: true }, "biosphere-achievement-0");
const seat = state.players.findIndex((player) => player.kickers.biosphere > 0);
assert.notEqual(seat, -1);
assert.ok(
state.log.some((entry) => entry.type === "move" && entry.player === seat && entry.info?.kicker === "biosphere")
);
assert.ok(
wrapper
.achievements(state)
.find((result) => result.seat === seat)!
.earned.includes("biosphere-colony")
);
});
test("workforce counts owned colonists and robots at 19/20/21, including idle and excess robots", () => {
for (const population of [3, 10, 19]) {
for (const total of [19, 20, 21]) {
const state = boundaryState();
state.players.push(structuredClone(state.players[1]!), structuredClone(state.players[1]!));
const player = state.players[0]!;
player.population = population;
player.robots = total - population;
player.upgrades.outpost = 3;
player.upgrades.nodule = 1;
player.upgrades.robots = 1;
assert.ok(player.population <= populationMax(player));
assert.equal(player.factories.length, 0);
assert.equal(wrapper.achievements(state)[0]!.outcome, "loss");
assert.equal(earned(state, "twenty-workforce"), total >= 20, `${population} colonists + ${player.robots} robots`);
if (population === 3) {
assert.ok(player.robots > robotMax(player));
assert.ok(operators(player) < 20);
}
}
}
});
test("twenty workforce is reached through legal purchases and retained at real game completion", () => {
const state = initGame(5, { kicker: true, fastBid: true }, "workforce-achievement-0");
let recruitedSeat: number | undefined;
for (let moves = 0; !state.ended && moves < 100000; moves++) {
const current = wrapper.currentPlayer(state);
const seat = (Array.isArray(current) ? current[0] : current)!;
const player = state.players[seat]!;
const count = 20 - player.population - player.robots;
const cards = count > 0 ? bestPayment(player, count * 10) : null;
if (
recruitedSeat === undefined &&
state.phase === "actions" &&
player.upgrades.robots > 0 &&
player.population >= 10 &&
cards
) {
const available = player.population + Math.min(player.robots + count, robotMax(player));
applyMove(
state,
{
action: "endTurn",
buys: [{ buy: "robots", count, cards }],
manned: player.factories.map((_, index) => index).slice(0, available),
},
seat
);
recruitedSeat = seat;
assert.equal(player.population + player.robots, 20);
assert.ok(player.population <= populationMax(player));
assert.ok(player.robots <= robotMax(player));
} else {
moveAI(state, seat);
}
}
assert.notEqual(recruitedSeat, undefined);
assert.equal(state.ended, true);
assert.equal(wrapper.cancelled(state), false);
const saved = JSON.parse(JSON.stringify(state)) as GameState;
const before = JSON.stringify(saved);
assert.ok(
wrapper
.achievements(saved)
.find((result) => result.seat === recruitedSeat)!
.earned.includes("twenty-workforce")
);
assert.equal(JSON.stringify(saved), before);
});
const cases: [string, (player: PlayerState) => void, (player: PlayerState) => void][] = [
[
"seventy-five-points",

View file

@ -106,10 +106,22 @@ const catalog: { id: string; name: string; description: string; qualifies: (cont
description: "Finish owning Ecoplants and a Nodule.",
qualifies: ({ player }) => player.upgrades.ecoplants > 0 && player.upgrades.nodule > 0,
},
{
id: "biosphere-colony",
name: "Biosphere Colony",
description: "Finish owning a Biosphere Kicker card.",
qualifies: ({ player }) => player.kickers.biosphere > 0,
},
{
id: "twenty-workforce",
name: "Twenty Strong",
description: "Finish owning at least 20 colonists and robots combined, including idle workers.",
qualifies: ({ player }) => player.population + player.robots >= 20,
},
];
export function achievementDefinitions(): AchievementManifest {
return { revision: 1, achievements: catalog.map(({ id, name, description }) => ({ id, name, description })) };
return { revision: 2, achievements: catalog.map(({ id, name, description }) => ({ id, name, description })) };
}
export function achievements(state: GameState): SeatAchievements[] {