From 717d446a3b7cc8e7681d99d041cf72b58ad2f4fc Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Mon, 23 Nov 2026 10:14:59 +0000 Subject: [PATCH] fix: charge Tinkeroids two QIC for Gaia habitability --- docs/lost-fleet/RULES_CLARIFICATIONS.md | 13 ++- engine/package.json | 2 +- engine/src/available/federations.spec.ts | 4 +- engine/src/gaia-mine-cost.spec.ts | 105 +++++++++++++++++++++++ engine/src/player.spec.ts | 4 +- engine/src/player.ts | 10 ++- old-ui/package.json | 2 +- viewer/package.json | 2 +- viewer/src/data/faction-overview.spec.ts | 23 ++++- viewer/src/data/faction-overview.ts | 2 +- 10 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 engine/src/gaia-mine-cost.spec.ts diff --git a/docs/lost-fleet/RULES_CLARIFICATIONS.md b/docs/lost-fleet/RULES_CLARIFICATIONS.md index b73a5e60..148c7a82 100644 --- a/docs/lost-fleet/RULES_CLARIFICATIONS.md +++ b/docs/lost-fleet/RULES_CLARIFICATIONS.md @@ -113,9 +113,14 @@ text (effect + depiction plan) is kept here. Concretely, each component-type ent base values → high trust)`. Confidence: **CONFIRMED** (owner-verified 2026-06-25: 2k start + 4/2 power split). - Terraform: 3 steps for the "cost-3" base colors, 1 step for all others; the cost-3 set is determined at setup via the Moweyds/Tinkeroids Terraforming board (see revised §B5). - **Gaia planet: a mine costs the normal 1 Q.I.C. — NOT 2** (corrected 2026-06-27; only Darkanians & - Space Giants pay the 2-Q.I.C. Gaia surcharge, see §B2/§B4). Source: `RULEBOOK-TEXT p.13` + owner - 2026-06-27. CONFIRMED. + **Gaia planet: making it habitable costs 2 Q.I.C.s.** Source: `rulebook-v1.0.pdf`, + p.13, Appendix I, Tinkeroids: “Making a Gaia planet habitable costs you 2 Q.I.C.s.” + This supersedes the incorrect 2026-06-27 clarification claiming 1 Q.I.C.; that claim + contradicted the cited rulebook. A mine replacing your Gaiaformer still pays no habitability cost + and is considered accessible (base rules p.11, + [official English rulebook](https://www.feuerland-spiele.de/fileadmin/game/Gaia_Project/GAIA_PROJECT_EN_rules_Web.pdf)). + Otherwise, range-extension Q.I.C.s are additional to the habitability cost. This is a faction + ability, not a blanket surcharge for every faction playing with Lost Fleet. - Starts with Planetary Institute (not mines), placed in stage 2. Source: p.13. CONFIRMED. - 6 Tinkering tiles (3 for rounds 1-3, 3 for 4-6); PI: once/round use current Tinkering tile as action. Individual tile effects, all confirmed (owner board-read 2026-06-27): @@ -153,7 +158,7 @@ base values → high trust)`. Confidence: **CONFIRMED** (owner-verified 2026-06- - Starts with 1 mine (stage 2) AND an Exploration Shuttle already on T F Mars. Terraform: 3 steps for the "cost-3" base colors, 1 step for all others; cost-3 set determined at setup via the Terraforming board (see revised §B5). **Gaia planet: a mine costs the normal 1 Q.I.C. — NOT 2** (corrected - 2026-06-27; only Darkanians & Space Giants pay the 2-Q.I.C. Gaia surcharge). Source: p.13 + owner + 2026-06-27; Tinkeroids, Darkanians & Space Giants pay the 2-Q.I.C. Gaia surcharge). Source: p.13 + owner 2026-06-27. CONFIRMED. - PI: once/round place a Power Ring (action) on a planet with your building; +2 power value there. 6 Power Rings available. Source: p.13. CONFIRMED. diff --git a/engine/package.json b/engine/package.json index 2cb5017e..d1271a81 100644 --- a/engine/package.json +++ b/engine/package.json @@ -1,6 +1,6 @@ { "name": "@gaia-project/engine", - "version": "4.17.11", + "version": "4.17.12", "description": "Javascript engine for project gaia", "main": "dist/index.js", "types": "index.ts", diff --git a/engine/src/available/federations.spec.ts b/engine/src/available/federations.spec.ts index 3bbd5865..85cf67fb 100644 --- a/engine/src/available/federations.spec.ts +++ b/engine/src/available/federations.spec.ts @@ -307,14 +307,14 @@ describe("possibleFederationTokenBuildMine", () => { ); }); - [Faction.Darkanians, Faction.SpaceGiants].forEach((faction) => { + [Faction.Tinkeroids, Faction.Darkanians, Faction.SpaceGiants].forEach((faction) => { it(`charges ${faction}'s 2-QIC Gaia-forming surcharge (instead of the normal 1 QIC) on Gaia planets, for either token`, () => { const engine = createLostFleetRoundMoveEngine(2, [faction, Faction.Terrans]); occupyStartingHex(engine, PlayerEnum.Player1); const player = engine.player(PlayerEnum.Player1); // Independent of player.gaiaFormingCost(), so this can't pass merely by mirroring the - // implementation: §G5/player.ts hardcode this surcharge at exactly 2 QIC for these 2 factions. + // implementation: Lost Fleet rulebook p.13 specifies exactly 2 QIC for these factions. const gaiaSurcharge = new Reward(2, Resource.Qic); expect(player.gaiaFormingCost()).to.deep.equal(gaiaSurcharge); diff --git a/engine/src/gaia-mine-cost.spec.ts b/engine/src/gaia-mine-cost.spec.ts new file mode 100644 index 00000000..2d79ca28 --- /dev/null +++ b/engine/src/gaia-mine-cost.spec.ts @@ -0,0 +1,105 @@ +import { expect } from "chai"; +import "mocha"; +import Engine from "./engine"; +import { Building, Command, Faction, Phase, Planet, Player as PlayerEnum, Resource } from "./enums"; +import Reward from "./reward"; + +// Synthetic round-move positions: exercise the real command availability and payment path, +// without relying on faction setup income or a particular map's planet distribution. +function position(faction: Faction, lostFleet: boolean, rangeQic: number, gaiaformer = false) { + const engine = new Engine(["init 2 gaia-mine-cost"], { lostFleet }); + engine.players.forEach((player, index) => { + player.faction = index === 0 ? faction : Faction.Xenos; + player.loadFaction(null, engine.expansions); + player.data.credits = 10; + player.data.ores = 10; + }); + const player = engine.players[0]; + const hexes = [...engine.map.grid.values()].filter((hex) => !hex.hasSpaceship()); + const start = hexes[0]; + const target = hexes.find((hex) => engine.map.distance(start, hex) === 3); + expect(target, "need a target at distance 3").not.to.equal(undefined); + start.data.planet = Planet.Terra; + start.data.player = PlayerEnum.Player1; + start.data.building = Building.Mine; + player.data.occupied.push(start); + player.data.buildings[Building.Mine] = 1; + player.data.range = rangeQic ? 1 : 3; + target.data.planet = Planet.Gaia; + if (gaiaformer) { + target.data.player = PlayerEnum.Player1; + target.data.building = Building.GaiaFormer; + player.data.buildings[Building.GaiaFormer] = 1; + } + engine.phase = Phase.RoundMove; + engine.round = 1; + engine.turnOrder = [PlayerEnum.Player1, PlayerEnum.Player2]; + engine.currentPlayer = PlayerEnum.Player1; + const offered = () => { + engine.clearAvailableCommands(); + return engine + .findAvailableCommand(PlayerEnum.Player1, Command.Build) + ?.data.buildings.find((build) => build.coordinates === target.toString() && build.building === Building.Mine); + }; + return { engine, player, target, offered }; +} + +const cases: [Faction, number, Resource][] = [ + [Faction.Tinkeroids, 2, Resource.Qic], + [Faction.Darkanians, 2, Resource.Qic], + [Faction.SpaceGiants, 2, Resource.Qic], + [Faction.Moweyds, 1, Resource.Qic], + [Faction.Terrans, 1, Resource.Qic], + [Faction.Gleens, 1, Resource.Ore], +]; + +describe("Gaia mine habitability costs", () => { + for (const [faction, surcharge, resource] of cases) { + for (const lostFleet of [false, true]) { + for (const rangeQic of [0, 1]) { + it(`${faction}: faction-specific cost with Lost Fleet=${lostFleet}, range QIC=${rangeQic}`, () => { + const { engine, player, target, offered } = position(faction, lostFleet, rangeQic); + const qics = rangeQic + (resource === Resource.Qic ? surcharge : 0); + const ores = 1 + (resource === Resource.Ore ? surcharge : 0); + player.data.qics = qics; + player.data.ores = ores; + const build = offered(); + expect(build).not.to.equal(undefined); + expect( + Reward.match(Reward.parse(`2c,${ores}o${qics ? `,${qics}q` : ""}`), Reward.parse(build.cost)) + ).to.equal(true); + + if (qics > 0) { + player.data.qics = qics - 1; + } else { + player.data.ores = ores - 1; + } + expect(offered(), "one resource short must not offer the mine").to.equal(undefined); + expect(() => engine.move(`${faction} build m ${target}`)).to.throw(); + player.data.qics = qics; + player.data.ores = ores; + offered(); + engine.move(`${faction} build m ${target}`); + expect(target.data.building).to.equal(Building.Mine); + expect(player.data.qics).to.equal(0); + expect(player.data.ores).to.equal(0); + expect(player.data.credits).to.equal(8); + }); + } + } + + it(`${faction}: a mine replacing its Gaiaformer waives habitability and range QIC`, () => { + const { engine, player, target, offered } = position(faction, true, 1, true); + player.data.qics = 0; + player.data.ores = 1; + const build = offered(); + expect(build).not.to.equal(undefined); + expect(Reward.match(Reward.parse("2c,o"), Reward.parse(build.cost))).to.equal(true); + engine.move(`${faction} build m ${target}`); + expect(target.data.building).to.equal(Building.Mine); + expect(player.data.qics).to.equal(0); + expect(player.data.ores).to.equal(0); + expect(player.data.buildings[Building.GaiaFormer]).to.equal(0); + }); + } +}); diff --git a/engine/src/player.spec.ts b/engine/src/player.spec.ts index 65b6c1c5..2770bcac 100644 --- a/engine/src/player.spec.ts +++ b/engine/src/player.spec.ts @@ -99,8 +99,8 @@ describe("Player", () => { expect(Reward.match(Reward.parse("2c,7o"), cost)).to.be.true; }); - it("should charge a 2 QIC surcharge (instead of the standard 1) for Darkanians/Space Giants building a mine on a Gaia planet", () => { - for (const faction of [Faction.Darkanians, Faction.SpaceGiants]) { + it("should charge a 2 QIC surcharge (instead of the standard 1) for Tinkeroids/Darkanians/Space Giants building a mine on a Gaia planet", () => { + for (const faction of [Faction.Tinkeroids, Faction.Darkanians, Faction.SpaceGiants]) { const player = new Player(Expansion.LostFleet, PlayerEnum.Player1); player.faction = faction; diff --git a/engine/src/player.ts b/engine/src/player.ts index a09bf288..6aeff278 100644 --- a/engine/src/player.ts +++ b/engine/src/player.ts @@ -1093,9 +1093,13 @@ export default class Player extends EventEmitter { if (this.faction === Faction.Gleens) { return new Reward(1, Resource.Ore); } - // Lost Fleet: Darkanians & Space Giants pay a 2-Q.I.C. surcharge to build a mine on a Gaia - // planet (Tinkeroids/Moweyds pay the normal 1, unlike the rest of this no-home-planet group). - if (this.faction === Faction.Darkanians || this.faction === Faction.SpaceGiants) { + // Lost Fleet rulebook p.13: Tinkeroids, Darkanians and Space Giants pay 2 Q.I.C.s + // to make a Gaia planet habitable. Moweyds retain the normal 1-Q.I.C. cost. + if ( + this.faction === Faction.Tinkeroids || + this.faction === Faction.Darkanians || + this.faction === Faction.SpaceGiants + ) { return new Reward(2, Resource.Qic); } return new Reward(1, Resource.Qic); diff --git a/old-ui/package.json b/old-ui/package.json index a2fb2f8f..f560978a 100644 --- a/old-ui/package.json +++ b/old-ui/package.json @@ -1,6 +1,6 @@ { "name": "@gaia-project/old-ui", - "version": "1.2.39", + "version": "1.2.40", "scripts": { "serve": "vite --port 5193", "build": "vite build", diff --git a/viewer/package.json b/viewer/package.json index de115aa3..ecefea31 100644 --- a/viewer/package.json +++ b/viewer/package.json @@ -1,6 +1,6 @@ { "name": "@gaia-project/viewer", - "version": "5.22.39", + "version": "5.22.40", "description": "Functions to visualize the map and boards for gaia project inside html canvas", "contributors": [ "coyotte508", diff --git a/viewer/src/data/faction-overview.spec.ts b/viewer/src/data/faction-overview.spec.ts index 3d52d1ff..3b48ff6f 100644 --- a/viewer/src/data/faction-overview.spec.ts +++ b/viewer/src/data/faction-overview.spec.ts @@ -1,6 +1,6 @@ -import Engine, { AuctionVariant, Faction, Planet } from "@gaia-project/engine"; +import Engine, { AuctionVariant, Faction, Planet, Resource, Reward } from "@gaia-project/engine"; import { expect } from "chai"; -import { terraformCost3Set } from "./faction-overview"; +import { gaiaMineExtraCost, hasGaiaMineSurcharge, terraformCost3Set } from "./faction-overview"; const row = [Planet.Volcanic, Planet.Ice, Planet.Titanium, Planet.Desert, Planet.Oxide, Planet.Terra, Planet.Swamp]; @@ -47,3 +47,22 @@ describe("auction terraforming previews", () => { expect(terraformCost3Set(engine, Faction.Moweyds, row)).to.have.members([Planet.Ice, Planet.Desert, Planet.Oxide]); }); }); + +describe("Gaia mine surcharge preview", () => { + for (const [faction, qics] of [ + [Faction.Tinkeroids, 2], + [Faction.Darkanians, 2], + [Faction.SpaceGiants, 2], + [Faction.Moweyds, 1], + [Faction.Terrans, 1], + ] as const) { + it(`shows ${faction}'s engine-derived cost`, () => { + const engine = new Engine(["init 2 gaia-preview"], { lostFleet: true }); + const player = engine.players[0]; + player.faction = faction; + player.loadFaction(null, engine.expansions); + expect(gaiaMineExtraCost(player)).to.deep.equal(new Reward(qics, Resource.Qic)); + expect(hasGaiaMineSurcharge(player)).to.equal(qics > 1); + }); + } +}); diff --git a/viewer/src/data/faction-overview.ts b/viewer/src/data/faction-overview.ts index 9dea88b7..b5dc98a1 100644 --- a/viewer/src/data/faction-overview.ts +++ b/viewer/src/data/faction-overview.ts @@ -44,7 +44,7 @@ export function exploreDeployCost(player: Player): Reward[] { } // The cost to build a mine on a Gaia planet: 1 Q.I.C. by default, so only worth surfacing when a -// faction pays a genuine surcharge (Darkanians and Space Giants pay 2 Q.I.C.). Gleens' 1-ore +// faction pays a genuine surcharge (Tinkeroids, Darkanians and Space Giants pay 2 Q.I.C.). Gleens' 1-ore // substitution is a lateral change covered by their faction ability, not an extra cost. export function gaiaMineExtraCost(player: Player): Reward { return player.gaiaFormingCost();