Require four formations for both federation achievements

This commit is contained in:
coyotte508 2026-11-14 01:06:00 +00:00
commit 58ff3f1cd5
6 changed files with 62 additions and 33 deletions

View file

@ -7,7 +7,7 @@ or a claim that achievements have been enabled on the hosted service.
## Hook contract
- `achievementDefinitions()` returns `{ revision: 3, achievements }`. Each definition
- `achievementDefinitions()` returns `{ revision: 4, achievements }`. Each definition
has string `id`, `name`, and `description` fields and an optional strict `icon`:
`{ type: "asset", key: string }` or `{ type: "text", text: string }`. Asset keys
match `^[a-z0-9][a-z0-9-]{0,63}$`; text matches `^[A-Za-z0-9]{1,4}$`. No URLs,
@ -44,21 +44,23 @@ player order after removing Automa players; they are not raw engine player numbe
Automa never receives a result. Dropped humans retain their human seat index and
return `{ seat, earned: [] }`, with no outcome, rather than shifting later seats.
## Revision 3 catalog (36 stable IDs)
## Revision 4 catalog (36 IDs)
IDs follow BGS's `^[a-z0-9][a-z0-9-]{0,63}$` validator: lowercase letters,
ASCII digits, and hyphens, at most 64 characters. All 36 IDs are unique. The
pre-publication dotted spellings were replaced with hyphens; they are not aliases
and were never published. Revision 2 added 18 faction asset references and four
150/200 text emblems. Revision 3 replaces those text emblems with two shared
150/200 text emblems. Revision 3 replaced those text emblems with two shared
raster score assets: `achievement-score-150` and `achievement-score-200`.
All 36 IDs and earned predicates remain unchanged. There are 22 icon-bearing
That revision-2-to-3 artwork change preserved all 36 IDs and earned predicates.
Revision 4 raises both federation thresholds to four and renames the general
federation ID, as detailed below. There are still 22 icon-bearing
definitions referencing 20 unique assets; the remaining 14 definitions have no icon.
**Deployment order:** the platform icon contract (platform commit
`fca050c9509c1dec3afd8d4631cc57245f834f29`, platform PR
[578](https://codeberg.org/boardgamers/boardgamers/pulls/578)) must be deployed
before activating this revision-3 manifest. Older strict validators reject `icon`.
before activating this revision-4 manifest. Older strict validators reject `icon`.
No production assets or achievement activation are implied by this source change.
### Faction victories (18)
@ -126,10 +128,10 @@ human in an authoritatively completed game.
| ID | Requirement |
| ------------------------------------- | ---------------------------------------------------------------------------- |
| `build-all-standard` | All 18 standard building pieces simultaneously deployed at game end |
| `federation-form-3` | At least three federation formations in one game |
| `federation-form-4` | At least four federation formations in one game |
| `explore-all-types-base` | Main-owned colonies on all 9 required physical types in a base game |
| `explore-all-types-lost-fleet` | Main-owned colonies on all 11 required physical types in a Lost Fleet game |
| `faction-ivits-growing-federation` | As Ivits, at least three federation formation milestones |
| `faction-ivits-growing-federation` | As Ivits, at least four federation formation milestones |
| `faction-lantids-shared-civilization` | As Lantids, at least six additional mines on opponents' colonies at game end |
| `faction-bescods-balanced-research` | As Bescods, finish at level 3 or higher on all six research tracks |
@ -145,7 +147,18 @@ possibility a claim of a demonstrated legal all-18 game.
**Federations:** use `federationCount`, not federation-token inventory. Rewards and
rescores do not count as formations. Ivits' growing-federation extensions count as
formation milestones; qualifying Ivits earn both the general and faction feat.
formation milestones; four completed formations qualify Ivits for both the general
and faction feat. Ivits' existing cost rule is `7 * (1 + federationCount)`, so the
fourth milestone requires 28 total federation value, not 28 newly added value.
Normal connection, satellite/QIC and token-availability constraints still apply.
The rules support this milestone without a three-formation cap; the threshold
unit test is not evidence of a demonstrated legal full-game route.
Revision 4 raises both federation feats from three to four as a user-authorized
pre-adoption correction (no existing awards reported). The general ID becomes
`federation-form-4`; the Ivits ID remains `faction-ivits-growing-federation`.
The old general ID is absent from the active catalog. There is no migration,
revocation or backfill. The other 34 definitions and all artwork are unchanged.
**Physical colony types:** the base set is Terra, Desert, Swamp, Oxide, Volcanic,
Titanium, Ice, Gaia, and Lost Planet (9). Lost Fleet adds Asteroid and Protoplanet

View file

@ -4,7 +4,7 @@ Javascript engine for Gaia Project.
## Achievements
See the [achievement hooks and revision 3 catalog](../docs/achievements.md) for the
See the [achievement hooks and revision 4 catalog](../docs/achievements.md) for the
optional BGS contract, completion requirements, award semantics, and verification scope.
## Play online at

View file

@ -54,10 +54,13 @@ function solo(difficulty = "automa"): Record<string, any> {
}
describe("BGS achievement hooks", () => {
it("exports a complete, unique, isolated revision-3 catalog", () => {
it("exports a complete, unique, isolated revision-4 catalog", () => {
const manifest = achievementDefinitions();
const ids = manifest.achievements.map((definition) => definition.id);
expect(manifest.revision).to.equal(3);
expect(manifest.revision).to.equal(4);
expect(ids).to.include("federation-form-4");
expect(ids).not.to.include("federation-form-3");
expect(ids).to.include("faction-ivits-growing-federation");
expect(ids).to.have.length(36);
expect(new Set(ids).size).to.equal(ids.length);
// BGS packages/protocol/achievements.ts: achievementIdSchema.
@ -242,20 +245,27 @@ describe("BGS achievement hooks", () => {
}
});
it("counts formations, not token inventory, and applies Ivits' growing-federation feat only to Ivits", () => {
const data = state();
data.players[0].data.federationCount = 2;
data.players[0].data.tiles.federations = Array(5).fill({ tile: "fed1", green: true });
data.players[0].data.spaceshipFederations = [{ tile: "unused", green: true }];
expect(earned(data)).not.to.include("federation-form-3");
data.players[0].data.federationCount = 3;
data.players[0].data.tiles.federations = [];
data.players[0].data.spaceshipFederations = [];
expect(earned(data)).to.include("federation-form-3");
expect(earned(data)).not.to.include("faction-ivits-growing-federation");
data.players[0].faction = Faction.Ivits;
delete data.players[0].variant;
expect(earned(data)).to.include("faction-ivits-growing-federation");
it("requires four actual formations, not token rewards or rescores, for both federation feats", () => {
for (const faction of [Faction.Terrans, Faction.Ivits]) {
const data = state();
data.players[0].faction = faction;
delete data.players[0].variant;
data.players[0].data.federationCount = 3;
data.players[0].data.tiles.federations = Array(5).fill({ tile: "fed1", green: true });
data.players[0].data.spaceshipFederations = [{ tile: "unused", green: true }];
expect(earned(data)).not.to.include("federation-form-4");
expect(earned(data)).not.to.include("faction-ivits-growing-federation");
data.players[0].data.tiles.federations = [];
data.players[0].data.spaceshipFederations = [];
for (const count of [4, 5]) {
data.players[0].data.federationCount = count;
const ids = earned(data);
expect(ids).to.include("federation-form-4");
expect(ids.includes("faction-ivits-growing-federation")).to.equal(faction === Faction.Ivits);
expect(ids).not.to.include("federation-form-3");
}
}
});
it("requires all nine physical base types including Lost, but never Transdim", () => {

View file

@ -1,6 +1,6 @@
{
"name": "@gaia-project/engine",
"version": "4.17.8",
"version": "4.17.9",
"description": "Javascript engine for project gaia",
"main": "dist/index.js",
"types": "index.ts",

View file

@ -77,10 +77,10 @@ export function achievementDefinitions(): AchievementManifest {
"Finish with all 18 standard building pieces simultaneously deployed: 8 mines, 4 trading stations, 3 research labs, the institute and both academies. Excludes Lost Planet, artifacts, Gaiaformers and space stations. No win required.",
},
{
id: "federation-form-3",
id: "federation-form-4",
name: "Federation Builder",
description:
"Complete at least three federation formations in one game (extensions of the growing federation for Ivits). Token rewards and rescores do not count. No win required.",
"Complete at least four federation formations in one game (extensions of the growing federation for Ivits). Token rewards and rescores do not count. No win required.",
},
{
id: "explore-all-types-base",
@ -97,7 +97,8 @@ export function achievementDefinitions(): AchievementManifest {
{
id: "faction-ivits-growing-federation",
name: "Growing Federation",
description: "As Ivits, complete three federation formation milestones in one game. No win required.",
description:
"As Ivits, complete at least four formation milestones of your growing federation in one game. No win required.",
},
{
id: "faction-lantids-shared-civilization",
@ -110,7 +111,7 @@ export function achievementDefinitions(): AchievementManifest {
description: "As Bescods, finish at level 3 or higher on all six research tracks. No win required.",
}
);
return { revision: 3, achievements: definitions };
return { revision: 4, achievements: definitions };
}
/** Evaluate authoritative completed state only; never advance play or recompute final scoring. */
@ -148,8 +149,8 @@ export function achievements(data: Engine | Record<string, any>): SeatAchievemen
if (standardBuildings.every((building) => player.data.buildings[building] === player.maxBuildings(building))) {
earned.push("build-all-standard");
}
if (player.data.federationCount >= 3) {
earned.push("federation-form-3");
if (player.data.federationCount >= 4) {
earned.push("federation-form-4");
if (player.faction === Faction.Ivits) earned.push("faction-ivits-growing-federation");
}
// Unlike Condition.PlanetType, ownedPlanets excludes virtual artifact types and shared mines.

View file

@ -1,10 +1,15 @@
import { expect } from "chai";
import Engine, { AuctionVariant } from "../engine";
import { Command, Player } from "../enums";
import { Command, Faction, Player } from "../enums";
import { federationCost } from "../federation";
const parseMoves = Engine.parseMoves;
describe("Ivits", () => {
it("requires 28 total federation value for the fourth growing-federation milestone", () => {
expect([0, 1, 2, 3].map((count) => federationCost(Faction.Ivits, true, count))).to.deep.equal([7, 14, 21, 28]);
});
it("starts with 2 power in area I and 2 in area II under Lost Fleet", () => {
const engine = new Engine(["init 2 ivits-power-check", "p1 faction ivits", "p2 faction geodens"]);