feat: remove Frontiers expansion; fix import cycles + base-game scoring clip; Vite dev app (engine 4.11.0, viewer 5.15.0)
FRONTIERS REMOVAL (engine + viewer). Old BGS games pin old engine versions so replay compatibility is unaffected; no current-version games used Frontiers. Engine (745 tests passing, 0 lint errors): - deleted available/ships.ts (+spec), move/ships.ts - enums: Frontiers bitflag, ResearchField.Diplomacy, Resource Trade*/ ShipRange/UpgradeDiplomacy, Building ships/Colony/CustomsPost block (+ships()/isShip()/isAvailableShip()/Ship), Command.MoveShip, Phase.RoundShip, Condition.Trade, TechFrontiers1, Diplomacy tech pos members; Expansion.All now = LostFleet - research-tracks: Diplomacy track, frontiersEco, ship-range rewards stripped from base Navigation track; all other Frontiers-only fields, handlers, cases and AI dimensions removed - wrapper.ts: frontiers expansion flag Viewer (863 tests passing, lint clean): - deleted logic/trade-rewards.ts, logic/buttons/ships.ts, charts/testdata/frontiers/; zero 'frontiers' references remain IMPORT-CYCLE + CJS FIXES surfaced by the Vite dev server (ESM strict order), all pre-existing bugs webpack/CJS masked: - engine/src/buildings.ts imported from ".." (package root -> compiled dist) - now "./enums" - engine/index.ts re-exported ~15 type-only names as values (BrainstoneDest, MaxLeech, EventSource, EngineOptions, the Available* block, ResourceConversion, FederationInfo, GaiaHexData, AvailableSetupOption, PreferenceSplit*/SilentAuction* types) - split into 'export type' (load-bearing for rolldown too) - viewer: Rules.vue registers FactionInfoCard async, breaking the Rules -> FactionInfoCard -> PlayerInfo -> Rules cycle - viewer: buttonStringLabel moved from logic/buttons/utils.ts to shortcuts.ts (re-exported), breaking utils <-> shortcuts DEV APP ON VITE (npm run serve = vite --port 8080): - vite.config.ts mode-aware: dev = SPA (index.html + public/ + engine-source aliases + optimizeDeps exclusion), build = the published IIFE lib (unchanged single-file contract, verified) - package.json: pruned webpack-era files/unpkg entries (.map dropped - no map uploads per owner decision); deleted scripts/fix-package-imports.ts (referenced the vite build's nonexistent dist/package/css) - dev boot verified in Chromium: self-contained picker renders, zero page errors BASE-GAME SCORING CLIP (follow-up on 5.14.2, which shipped without the intended fix due to a no-op string replace): ScoringBoard's y=-25 offset removed for real; spec pins y===null; verified in the built bundle (first final tile fully inside the canvas top). AGENTS.md: no sourcemap upload to BGS (owner decision); bodyparser exemption noted as deployed.
This commit is contained in:
parent
ac75ca9ab4
commit
14347432f0
86 changed files with 361 additions and 2884 deletions
13
AGENTS.md
13
AGENTS.md
|
|
@ -11,7 +11,7 @@ pnpm install # pnpm 10+; CI=true to avoid the modules-purg
|
|||
cd engine && npm test # mocha + ts-node (TS via tsconfig "module": "commonjs")
|
||||
cd engine && npm run build # tsc -> dist/ (wrapper.js, index.js)
|
||||
cd viewer && npm test # vitest (jsdom); needs --max-old-space-size=12288
|
||||
cd viewer && npm run package # vite lib build -> dist/package/viewer.umd.js + .css + .map
|
||||
cd viewer && npm run package # vite lib build -> dist/package/viewer.umd.js + .css (+ .map, not uploaded)
|
||||
```
|
||||
|
||||
- Viewer unit tests: `NODE_OPTIONS="--max-old-space-size=12288" npm test` (the suite peaks ~10 GB).
|
||||
|
|
@ -45,8 +45,8 @@ All calls take `Authorization: Bearer <token>`.
|
|||
--data-binary @gaia-project-engine-<version>.tgz
|
||||
```
|
||||
2. **Viewer files** — upload the freshly built bundle. These endpoints take the file as the
|
||||
**raw request body** (no multipart!), with parameters in the query string; js+css+map that
|
||||
belong together share a `bundle` id so the map's relative `sourceMappingURL` resolves:
|
||||
**raw request body** (no multipart!), with parameters in the query string; js+css share a
|
||||
`bundle` id so they belong together:
|
||||
```bash
|
||||
curl -X POST "$BASE/viewer/file?filename=viewer.umd.min.js&bundle=<new-bundle-id>" \
|
||||
-H "Authorization: Bearer $TOKEN" -H "Content-Type: text/javascript" \
|
||||
|
|
@ -54,12 +54,9 @@ All calls take `Authorization: Bearer <token>`.
|
|||
curl -X POST "$BASE/viewer/file?filename=viewer.css&bundle=<new-bundle-id>" \
|
||||
-H "Authorization: Bearer $TOKEN" -H "Content-Type: text/css" \
|
||||
--data-binary @dist/package/viewer.css
|
||||
# map: use application/octet-stream (NOT application/json - koa-bodyparser's 1MB jsonLimit
|
||||
# intercepts json bodies before the route's raw-body reader and 413s large maps):
|
||||
curl -X POST "$BASE/viewer/file?filename=viewer.umd.min.js.map&bundle=<new-bundle-id>" \
|
||||
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/octet-stream" \
|
||||
--data-binary @dist/package/viewer.umd.min.js.map
|
||||
```
|
||||
No sourcemap upload needed — owner decision (2026-09): the platform doesn't deploy maps
|
||||
in general. The bundle's trailing sourceMappingURL is harmless (the map 404s quietly).
|
||||
Get a fresh `<new-bundle-id>` (uuidgen or a timestamped tag) — every upload gets a unique
|
||||
one, and the doc's `viewer.url` then points at the new bundle's file URL.
|
||||
3. **Update the doc** — `GET $BASE` to fetch the current gameinfo doc, update the
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { finalRankings, gainFinalScoringVictoryPoints } from "./src/algorithms/scoring";
|
||||
import { stdBuildingValue } from "./src/buildings";
|
||||
import Engine from "./src/engine";
|
||||
import Event, { EventSource } from "./src/events";
|
||||
import Event from "./src/events";
|
||||
import SpaceMap, { parseLocation } from "./src/map";
|
||||
import Player, { BuildWarning, MAX_SATELLITES } from "./src/player";
|
||||
import PlayerData, { BrainstoneDest, effectiveRange, MaxLeech, Power } from "./src/player-data";
|
||||
import PlayerData, { effectiveRange, Power } from "./src/player-data";
|
||||
import Reward from "./src/reward";
|
||||
|
||||
export { boardActions, FreeAction, freeActionConversions, ResourceConversion } from "./src/actions";
|
||||
export { boardActions, FreeAction, freeActionConversions } from "./src/actions";
|
||||
export type { ResourceConversion } from "./src/actions";
|
||||
export {
|
||||
defaultPreferenceSplitBudget,
|
||||
isValidPreferenceSplitBudget,
|
||||
|
|
@ -15,26 +16,24 @@ export {
|
|||
MIN_PREFERENCE_SPLIT_BUDGET,
|
||||
MIN_PREFERENCE_SPLIT_PLAYERS,
|
||||
PREFERENCE_SPLIT_BUDGET_PER_PLAYER,
|
||||
PreferenceSplitAllocation,
|
||||
PreferenceSplitBid,
|
||||
preferenceSplitBidError,
|
||||
PreferenceSplitFactionSummary,
|
||||
PreferenceSplitResult,
|
||||
resolvePreferenceSplitAuction,
|
||||
roundVictoryPoints,
|
||||
} from "./src/algorithms/preference-split-auction";
|
||||
export {
|
||||
MAX_SILENT_BID,
|
||||
resolveSilentAuction,
|
||||
SilentAuctionBid,
|
||||
silentAuctionBidError,
|
||||
SilentAuctionResult,
|
||||
SilentAuctionStep,
|
||||
} from "./src/algorithms/silent-auction";
|
||||
export type {
|
||||
PreferenceSplitAllocation,
|
||||
PreferenceSplitBid,
|
||||
PreferenceSplitFactionSummary,
|
||||
PreferenceSplitResult,
|
||||
} from "./src/algorithms/preference-split-auction";
|
||||
export { MAX_SILENT_BID, resolveSilentAuction, silentAuctionBidError } from "./src/algorithms/silent-auction";
|
||||
export type { SilentAuctionBid, SilentAuctionResult, SilentAuctionStep } from "./src/algorithms/silent-auction";
|
||||
export { conversionToFreeAction } from "./src/available/actions";
|
||||
export { canResearchField, canTakeAdvancedTechTile } from "./src/available/research";
|
||||
export { shipsInHex } from "./src/available/ships";
|
||||
export {
|
||||
// BrainstoneWarning is an enum (runtime value); everything else in this block is type-only, so
|
||||
// it must re-export via `export type` for per-file ESM transformers (vite dev / rolldown).
|
||||
export { BrainstoneWarning } from "./src/available/types";
|
||||
export type {
|
||||
AvailableBoardAction,
|
||||
AvailableBoardActionData,
|
||||
AvailableBuilding,
|
||||
|
|
@ -43,22 +42,13 @@ export {
|
|||
AvailableFreeAction,
|
||||
AvailableFreeActionData,
|
||||
AvailableHex,
|
||||
AvailableMoveShipData,
|
||||
AvailableResearchData,
|
||||
AvailableResearchTrack,
|
||||
BrainstoneActionData,
|
||||
BrainstoneWarning,
|
||||
ChooseTechTile,
|
||||
ShipAction,
|
||||
} from "./src/available/types";
|
||||
export {
|
||||
AuctionVariant,
|
||||
EngineOptions,
|
||||
FactionCustomization,
|
||||
FactionVariant,
|
||||
LogEntry,
|
||||
LogEntryChanges,
|
||||
} from "./src/engine";
|
||||
export { AuctionVariant } from "./src/engine";
|
||||
export type { EngineOptions, FactionCustomization, FactionVariant, LogEntry, LogEntryChanges } from "./src/engine";
|
||||
export {
|
||||
AdvTechTile,
|
||||
AdvTechTilePos,
|
||||
|
|
@ -73,7 +63,6 @@ export {
|
|||
Federation,
|
||||
FinalTile,
|
||||
hasExpansion,
|
||||
isShip,
|
||||
Operator,
|
||||
Phase,
|
||||
Planet,
|
||||
|
|
@ -95,8 +84,10 @@ export {
|
|||
} from "./src/enums";
|
||||
export { FactionBoard, factionBoard, factionVariantBoard } from "./src/faction-boards";
|
||||
export { factionPlanet } from "./src/factions";
|
||||
export { federationCost, FederationInfo, parseFederationLocation } from "./src/federation";
|
||||
export { GaiaHex, GaiaHexData } from "./src/gaia-hex";
|
||||
export { federationCost, parseFederationLocation } from "./src/federation";
|
||||
export type { FederationInfo } from "./src/federation";
|
||||
export { GaiaHex } from "./src/gaia-hex";
|
||||
export type { GaiaHexData } from "./src/gaia-hex";
|
||||
export { applyChargePowers } from "./src/income";
|
||||
export { classifySectorId, LostFleetSectorType } from "./src/lost-fleet-map";
|
||||
export { moveAI } from "./src/move/ai";
|
||||
|
|
@ -104,20 +95,22 @@ export { ANALYSIS_CHEAP_BUILD } from "./src/move/buildings";
|
|||
export { endSetupFactionPhase, leechPossible } from "./src/move/phase";
|
||||
export { planetNames, terraformingStepsRequired } from "./src/planets";
|
||||
export { lastTile, researchEvents } from "./src/research-tracks";
|
||||
export { AvailableSetupOption, SetupType } from "./src/setup";
|
||||
export { SetupType } from "./src/setup";
|
||||
export type { AvailableSetupOption } from "./src/setup";
|
||||
export { artifactSlotCount, shipsInPlay, spaceshipBoards } from "./src/spaceships";
|
||||
export { artifactTokenRewards, artifactTokenSpec } from "./src/tiles/artifacts";
|
||||
export { finalScorings } from "./src/tiles/scoring";
|
||||
// Type re-exports must be `export type` for per-file ESM transformers (vite dev / rolldown):
|
||||
// a plain re-export of a type-only binding becomes a runtime import of a non-existent export.
|
||||
export type { EventSource } from "./src/events";
|
||||
export type { BrainstoneDest, MaxLeech } from "./src/player-data";
|
||||
export {
|
||||
BrainstoneDest,
|
||||
BuildWarning,
|
||||
effectiveRange,
|
||||
Event,
|
||||
EventSource,
|
||||
finalRankings,
|
||||
gainFinalScoringVictoryPoints,
|
||||
MAX_SATELLITES,
|
||||
MaxLeech,
|
||||
parseLocation,
|
||||
Player,
|
||||
PlayerData,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/engine",
|
||||
"version": "4.10.3",
|
||||
"version": "4.11.0",
|
||||
"description": "Javascript engine for project gaia",
|
||||
"main": "dist/index.js",
|
||||
"types": "index.ts",
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ Explicit rejections:
|
|||
- non-`standard` faction-board variants;
|
||||
- `DeadEnd`, because it is an undo signal rather than an executable candidate;
|
||||
- custom Federation fallback commands with no enumerated geometry;
|
||||
- custom setup/rotation, bidding/ban commands, initialization, and Frontiers ship movement, which
|
||||
- custom setup/rotation, bidding/ban commands, and initialization, which
|
||||
are outside the locked challenge boundary;
|
||||
- any offered executable command with an empty option set or unfamiliar command branch.
|
||||
|
||||
|
|
@ -175,8 +175,7 @@ every projection to the canonical committed source/action timing context and inc
|
|||
- credits, ore, knowledge, Q.I.C., and victory points;
|
||||
- all four power bowls and exact brainstone placement;
|
||||
- Gaiaformer total, Gaia-area, on-board, asteroid-used, other-used, and available counts;
|
||||
- token modifier, terraform discount, temporary range/steps, satellites, and Frontiers trade
|
||||
counters;
|
||||
- token modifier, terraform discount, temporary range/steps, and satellites;
|
||||
- actor, faction, round/final-round marker, Planetary Institute state, timing, and the sorted set of
|
||||
conversion rights.
|
||||
|
||||
|
|
|
|||
|
|
@ -586,11 +586,5 @@ describe("Phase 1.2 typed atomic decision expansion", () => {
|
|||
expect(() => expandAtomicDecisions(customFederation))
|
||||
.to.throw(AtomicExpansionError)
|
||||
.with.property("code", "empty-command-data");
|
||||
|
||||
const frontiers = lockedRoundOneEngine();
|
||||
frontiers.availableCommands = [{ name: Command.MoveShip, player: Player.Player1, data: [] }];
|
||||
expect(() => expandAtomicDecisions(frontiers))
|
||||
.to.throw(AtomicExpansionError)
|
||||
.with.property("code", "unsupported-command");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -722,7 +722,6 @@ function expandCommand(
|
|||
case Command.BanFaction:
|
||||
case Command.Bid:
|
||||
case Command.Init:
|
||||
case Command.MoveShip:
|
||||
case Command.PreferenceBid:
|
||||
case Command.RotateSectors:
|
||||
case Command.Setup:
|
||||
|
|
|
|||
|
|
@ -263,9 +263,6 @@ function afterWalletSignature(engine: Engine, actor: Player): string {
|
|||
temporaryRange: data.temporaryRange,
|
||||
temporaryStep: data.temporaryStep,
|
||||
satellites: data.satellites,
|
||||
tradeBonus: data.tradeBonus,
|
||||
tradeDiscount: data.tradeDiscount,
|
||||
tradeShips: data.tradeShips,
|
||||
hasPlanetaryInstitute: data.hasPlanetaryInstitute(),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,14 +187,6 @@ describe("canonical-state", () => {
|
|||
engine.boardActions[BoardAction.Power1] = PlayerEnum.Player1;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "map-hex-state",
|
||||
build: () => buildEngine(CORPUS[2]),
|
||||
mutate: (engine: Engine) => {
|
||||
const hex = engine.map.getS("-1x0");
|
||||
hex.data.tradeTokens = [PlayerEnum.Player1];
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "player-resource",
|
||||
build: () => buildEngine(CORPUS[2]),
|
||||
|
|
@ -345,10 +337,10 @@ describe("canonical-state", () => {
|
|||
}));
|
||||
|
||||
expect(hashes).to.deep.equal([
|
||||
{ id: "base-setup-faction", hash: "eadc55a22a11410b35b4a97271eacfc7eb2d802a49d1f61d279b520c884de54e" },
|
||||
{ id: "base-round1-start", hash: "7304cadb68460015fdff1764e2c694e9e8eddc5be7b00247168b4712a86a3e55" },
|
||||
{ id: "base-round1-leech", hash: "6da29f291c9831b0e43ab1b8793f4e645bae816ac136ff2b31a0d80afb75d27e" },
|
||||
{ id: "phase0-challenge", hash: "f181469e8a3cbf6148a7a471151515f09cf5329a3c068664074a3b7a1ac2c2f7" },
|
||||
{ id: "base-setup-faction", hash: "a9e8e293be80425602a7b744f740274e2af008408fdfe85a4338e9ac7e8dda68" },
|
||||
{ id: "base-round1-start", hash: "646ab3c7f54fd5726149dcaa14e4b0b266a8472192f1113c07f280228357ba57" },
|
||||
{ id: "base-round1-leech", hash: "51df79a25990d93a45b5d7e7d15fd953c477f0730a21dee3c92c0ce815595f74" },
|
||||
{ id: "phase0-challenge", hash: "91842ba26604fd58365bd37f8d2c37ff455b986c4bcf260334aa01a21f242fbe" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ const ALL_RESEARCH_FIELDS: readonly ResearchField[] = [
|
|||
ResearchField.GaiaProject,
|
||||
ResearchField.Economy,
|
||||
ResearchField.Science,
|
||||
ResearchField.Diplomacy,
|
||||
];
|
||||
|
||||
type CanonicalPoint = {
|
||||
|
|
@ -49,7 +48,6 @@ type CanonicalOptions = {
|
|||
customBoardSetup: boolean;
|
||||
noFedCheck: boolean;
|
||||
flexibleFederations: boolean;
|
||||
frontiers: boolean;
|
||||
lostFleet: boolean;
|
||||
factionVariant: string;
|
||||
factionVariantVersion: number;
|
||||
|
|
@ -71,8 +69,6 @@ type CanonicalMapHex = {
|
|||
building: Building | null;
|
||||
player: PlayerEnum | null;
|
||||
federations: PlayerEnum[];
|
||||
tradeTokens: PlayerEnum[];
|
||||
customPosts: PlayerEnum[];
|
||||
additionalMine: PlayerEnum | null;
|
||||
powerRing: PlayerEnum | null;
|
||||
spaceship: Spaceship | null;
|
||||
|
|
@ -107,20 +103,14 @@ type CanonicalPlayer = {
|
|||
};
|
||||
brainstone: string | null;
|
||||
buildings: Array<{ building: string; count: number }>;
|
||||
destroyedShips: Array<{ building: string; count: number }>;
|
||||
deployedShips: Array<{ building: string; count: number }>;
|
||||
satellites: number;
|
||||
research: Array<{ field: string; level: number }>;
|
||||
range: number;
|
||||
shipRange: number;
|
||||
gaiaformers: number;
|
||||
gaiaformersInGaia: number;
|
||||
gaiaformersUsedForAsteroid: number;
|
||||
gaiaformersUsedForOther: number;
|
||||
terraformCostDiscount: number;
|
||||
tradeBonus: number;
|
||||
tradeDiscount: number;
|
||||
tradeShips: number;
|
||||
leechPossible: number;
|
||||
tokenModifier: number;
|
||||
lostPlanet: number;
|
||||
|
|
@ -131,7 +121,6 @@ type CanonicalPlayer = {
|
|||
lostFleetCost3Planets: string[];
|
||||
artifactPlanetTypes: string[];
|
||||
artifacts: string[];
|
||||
ships: Array<{ type: string; player: PlayerEnum; location: string; moved: boolean }>;
|
||||
explorationShips: Array<{ ship: string; slot: number }>;
|
||||
tiles: {
|
||||
booster: string | null;
|
||||
|
|
@ -307,8 +296,6 @@ export function projectCanonicalState(engine: Engine): CanonicalState {
|
|||
building: hex.data.building ?? null,
|
||||
player: normalizeNullableNumber(hex.data.player),
|
||||
federations: sortNumbers(hex.data.federations ?? []),
|
||||
tradeTokens: sortNumbers(hex.data.tradeTokens ?? []),
|
||||
customPosts: sortNumbers(hex.data.customPosts ?? []),
|
||||
additionalMine: normalizeNullableNumber(hex.data.additionalMine),
|
||||
powerRing: normalizeNullableNumber(hex.data.powerRing),
|
||||
spaceship: hex.data.spaceship ?? null,
|
||||
|
|
@ -343,23 +330,17 @@ export function projectCanonicalState(engine: Engine): CanonicalState {
|
|||
},
|
||||
brainstone: player.data.brainstone ?? null,
|
||||
buildings: projectBuildingCounts(player.data.buildings),
|
||||
destroyedShips: projectShipBuildingCounts(player.data.destroyedShips),
|
||||
deployedShips: projectShipBuildingCounts(player.data.deployedShips),
|
||||
satellites: player.data.satellites,
|
||||
research: ALL_RESEARCH_FIELDS.map((field) => ({
|
||||
field,
|
||||
level: player.data.research[field] ?? 0,
|
||||
})),
|
||||
range: player.data.range,
|
||||
shipRange: player.data.shipRange,
|
||||
gaiaformers: player.data.gaiaformers,
|
||||
gaiaformersInGaia: player.data.gaiaformersInGaia,
|
||||
gaiaformersUsedForAsteroid: player.data.gaiaformersUsedForAsteroid,
|
||||
gaiaformersUsedForOther: player.data.gaiaformersUsedForOther,
|
||||
terraformCostDiscount: player.data.terraformCostDiscount,
|
||||
tradeBonus: player.data.tradeBonus,
|
||||
tradeDiscount: player.data.tradeDiscount,
|
||||
tradeShips: player.data.tradeShips,
|
||||
leechPossible: player.data.leechPossible ?? 0,
|
||||
tokenModifier: player.data.tokenModifier,
|
||||
lostPlanet: player.data.lostPlanet,
|
||||
|
|
@ -370,14 +351,6 @@ export function projectCanonicalState(engine: Engine): CanonicalState {
|
|||
lostFleetCost3Planets: [...player.data.lostFleetCost3Planets].sort(),
|
||||
artifactPlanetTypes: [...player.data.artifactPlanetTypes].sort(),
|
||||
artifacts: [...player.data.artifacts].sort(),
|
||||
ships: [...player.data.ships]
|
||||
.map((ship) => ({
|
||||
type: ship.type,
|
||||
player: ship.player,
|
||||
location: ship.location,
|
||||
moved: ship.moved,
|
||||
}))
|
||||
.sort(compareShips),
|
||||
explorationShips: Object.keys(player.data.explorationShips)
|
||||
.sort()
|
||||
.map((ship) => ({
|
||||
|
|
@ -522,7 +495,6 @@ function projectOptions(options: EngineOptions): CanonicalOptions {
|
|||
customBoardSetup: !!options.customBoardSetup,
|
||||
noFedCheck: !!options.noFedCheck,
|
||||
flexibleFederations: !!options.flexibleFederations,
|
||||
frontiers: !!options.frontiers,
|
||||
lostFleet: !!options.lostFleet,
|
||||
factionVariant: options.factionVariant ?? "standard",
|
||||
factionVariantVersion: options.factionVariantVersion ?? 0,
|
||||
|
|
@ -539,16 +511,6 @@ function projectBuildingCounts(counts: Record<string, number>): Array<{ building
|
|||
}));
|
||||
}
|
||||
|
||||
function projectShipBuildingCounts(counts: Record<string, number>): Array<{ building: string; count: number }> {
|
||||
return Building.ships()
|
||||
.slice()
|
||||
.sort()
|
||||
.map((building) => ({
|
||||
building,
|
||||
count: counts?.[building] ?? 0,
|
||||
}));
|
||||
}
|
||||
|
||||
function projectPoint(point: { q: number; r: number; s: number }): CanonicalPoint {
|
||||
return { q: point.q, r: point.r, s: point.s };
|
||||
}
|
||||
|
|
@ -565,18 +527,6 @@ function compareHexes(left: { q: number; r: number; s: number }, right: { q: num
|
|||
return left.q - right.q || left.r - right.r || left.s - right.s;
|
||||
}
|
||||
|
||||
function compareShips(
|
||||
left: { type: string; location: string; moved: boolean; player: number },
|
||||
right: { type: string; location: string; moved: boolean; player: number }
|
||||
): number {
|
||||
return (
|
||||
left.type.localeCompare(right.type) ||
|
||||
left.location.localeCompare(right.location) ||
|
||||
Number(left.moved) - Number(right.moved) ||
|
||||
left.player - right.player
|
||||
);
|
||||
}
|
||||
|
||||
function stableJson(value: unknown): string {
|
||||
if (value === null) {
|
||||
return "null";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
"factionVariant": "standard",
|
||||
"factionVariantVersion": 0,
|
||||
"flexibleFederations": false,
|
||||
"frontiers": false,
|
||||
"layout": "standard",
|
||||
"lostFleet": true,
|
||||
"noFedCheck": false,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { ChallengeDefinition } from "./types";
|
|||
|
||||
const CHALLENGE_OPTIONS: EngineOptions = {
|
||||
lostFleet: true,
|
||||
frontiers: false,
|
||||
officialCenterSectors: false,
|
||||
advancedRules: false,
|
||||
customBoardSetup: false,
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ export const PARETO_EXACT_DIMENSIONS = [
|
|||
"temporaryRange",
|
||||
"temporaryStep",
|
||||
"satellites",
|
||||
"tradeBonus",
|
||||
"tradeDiscount",
|
||||
"tradeShips",
|
||||
"hasPlanetaryInstitute",
|
||||
"conversionRights",
|
||||
] as const;
|
||||
|
|
@ -211,9 +208,6 @@ function projectState(
|
|||
temporaryRange: data.temporaryRange,
|
||||
temporaryStep: data.temporaryStep,
|
||||
satellites: data.satellites,
|
||||
tradeBonus: data.tradeBonus,
|
||||
tradeDiscount: data.tradeDiscount,
|
||||
tradeShips: data.tradeShips,
|
||||
hasPlanetaryInstitute: data.hasPlanetaryInstitute(),
|
||||
conversionRights: [...rights],
|
||||
};
|
||||
|
|
@ -261,9 +255,6 @@ function exactDimensions(state: ProjectedConversionState): unknown {
|
|||
temporaryRange: state.temporaryRange,
|
||||
temporaryStep: state.temporaryStep,
|
||||
satellites: state.satellites,
|
||||
tradeBonus: state.tradeBonus,
|
||||
tradeDiscount: state.tradeDiscount,
|
||||
tradeShips: state.tradeShips,
|
||||
hasPlanetaryInstitute: state.hasPlanetaryInstitute,
|
||||
conversionRights: [...state.conversionRights].sort(),
|
||||
};
|
||||
|
|
@ -583,9 +574,6 @@ function applyProjectedState(engine: Engine, state: ProjectedConversionState): v
|
|||
data.temporaryRange = state.temporaryRange;
|
||||
data.temporaryStep = state.temporaryStep;
|
||||
data.satellites = state.satellites;
|
||||
data.tradeBonus = state.tradeBonus;
|
||||
data.tradeDiscount = state.tradeDiscount;
|
||||
data.tradeShips = state.tradeShips;
|
||||
player.federationCache = null;
|
||||
engine.clearAvailableCommands();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,9 +64,6 @@ export interface ProjectedConversionState {
|
|||
temporaryRange: number;
|
||||
temporaryStep: number;
|
||||
satellites: number;
|
||||
tradeBonus: number;
|
||||
tradeDiscount: number;
|
||||
tradeShips: number;
|
||||
hasPlanetaryInstitute: boolean;
|
||||
conversionRights: string[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import {
|
|||
possiblePreferenceBids,
|
||||
possibleSilentBids,
|
||||
} from "./setup";
|
||||
import { possibleShipMovements } from "./ships";
|
||||
import {
|
||||
possibleInstantGaiaforming,
|
||||
possibleSpaceshipActions,
|
||||
|
|
@ -79,7 +78,7 @@ export function generate(engine: Engine, subPhase: SubPhase = null, data?: any):
|
|||
case SubPhase.PlacePowerRing:
|
||||
return possiblePowerRingPlacements(engine, player);
|
||||
case SubPhase.BuildMine:
|
||||
return [...possibleMineBuildings(engine, player, false), ...possibleShipMovements(engine, player, true)];
|
||||
return possibleMineBuildings(engine, player, false);
|
||||
case SubPhase.BuildMineOrGaiaFormer:
|
||||
return [...possibleMineBuildings(engine, player, true, data), ...possibleExplorations(engine, player)];
|
||||
case SubPhase.SpaceStation:
|
||||
|
|
@ -90,13 +89,10 @@ export function generate(engine: Engine, subPhase: SubPhase = null, data?: any):
|
|||
return possibleLabDowngrades(engine, player);
|
||||
case SubPhase.BrainStone:
|
||||
return [{ name: Command.BrainStone, player, data }];
|
||||
// case SubPhase.MoveShip:
|
||||
// return possibleShipMovements(engine, player);
|
||||
case SubPhase.BeforeMove: {
|
||||
return [
|
||||
...possibleBuildings(engine, player),
|
||||
...possibleExplorations(engine, player),
|
||||
...possibleShipMovements(engine, player, false),
|
||||
...possibleFederations(engine, player),
|
||||
...possibleResearchAreas(engine, player, UPGRADE_RESEARCH_COST),
|
||||
...possibleBoardActions(engine.boardActions, engine.player(player), engine.replay),
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@ import { uniq } from "lodash";
|
|||
import { upgradedBuildings } from "../buildings";
|
||||
import { qicForDistance } from "../cost";
|
||||
import Engine from "../engine";
|
||||
import { Building, Command, Expansion, Faction, hasExpansion, Planet, Player, Resource } from "../enums";
|
||||
import { Building, Command, Faction, Planet, Player, Resource } from "../enums";
|
||||
import { GaiaHex } from "../gaia-hex";
|
||||
import SpaceMap from "../map";
|
||||
import PlayerObject, { BuildCheck, BuildWarning } from "../player";
|
||||
import Reward from "../reward";
|
||||
import { possibleShips } from "./ships";
|
||||
import {
|
||||
AvailableBuildCommandData,
|
||||
AvailableBuilding,
|
||||
|
|
@ -95,10 +94,6 @@ export function possibleBuildings(engine: Engine, player: Player): AvailableComm
|
|||
continue;
|
||||
}
|
||||
|
||||
if (hex.isRangeStartingPoint(player) && hasExpansion(engine.expansions, Expansion.Frontiers)) {
|
||||
buildings.push(...possibleShips(pl, engine, map, hex));
|
||||
}
|
||||
|
||||
if (player !== hex.data.player) {
|
||||
// This is a secondary building, so we can't upgrade it
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1,399 +0,0 @@
|
|||
import { expect } from "chai";
|
||||
import Engine from "../engine";
|
||||
|
||||
describe("Trade ships", () => {
|
||||
describe("trade costs", () => {
|
||||
const moves = [
|
||||
"init 2 Pleasant-barrel-3642",
|
||||
"p1 faction ambas",
|
||||
"p2 faction firaks (0/0/0/0 ⇒ 2/4/0/0)",
|
||||
"ambas build m 7B2",
|
||||
"firaks build m 7A6",
|
||||
"firaks build m 2A10",
|
||||
"ambas build m 2B3",
|
||||
"firaks booster booster9",
|
||||
"ambas booster booster5 (2/4/0/0 ⇒ 0/6/0/0)",
|
||||
"ambas build ts 7B2.",
|
||||
"firaks charge 1pw (0/4/2/0 ⇒ 0/3/3/0)",
|
||||
"firaks build tradeShip 7B3.",
|
||||
"ambas pass booster2 returning booster5",
|
||||
"firaks pass booster6 returning booster9",
|
||||
"ambas pass booster9 returning booster2",
|
||||
];
|
||||
|
||||
it("can trade when the trade cost is fulfilled", () => {
|
||||
const engine = new Engine(moves, { frontiers: true });
|
||||
expect(() => engine.move("firaks move tradeShip 7B3 7B3 trade 7B2.")).to.not.throw();
|
||||
});
|
||||
|
||||
it("can not trade when the trade cost is not fulfilled", () => {
|
||||
const engine = new Engine(moves, { frontiers: true });
|
||||
expect(() =>
|
||||
engine.move("spend 3pw for 1o (0/3/3/0 ⇒ 3/3/0/0). firaks move tradeShip 7B3 7B3 trade 7B2.")
|
||||
).to.throw();
|
||||
});
|
||||
});
|
||||
|
||||
it("academy", function () {
|
||||
this.timeout(5000);
|
||||
|
||||
const moves = [
|
||||
"init 4 Epic-way-5435",
|
||||
"p4 rotate 0x0 3 -6x10 3 -1x8 4 2x3 3 -8x7 2 -2x-3 2 5x-2 4 3x-5 5",
|
||||
"p1 faction ambas",
|
||||
"p2 faction xenos",
|
||||
"p3 faction hadsch-hallas",
|
||||
"p4 faction itars (0/0/0/0 ⇒ 4/4/0/0)",
|
||||
"ambas build m 7A9",
|
||||
"xenos build m 5A6",
|
||||
"hadsch-hallas build m 7B4",
|
||||
"itars build m 3B2",
|
||||
"itars build m 9A8",
|
||||
"hadsch-hallas build m 10A11",
|
||||
"xenos build m 10B1",
|
||||
"ambas build m 6B1",
|
||||
"xenos build m 3A6",
|
||||
"itars booster booster5",
|
||||
"hadsch-hallas booster booster4",
|
||||
"xenos booster booster1",
|
||||
"ambas booster booster10",
|
||||
"itars income 2pw (4/4/0/0 ⇒ 3/6/0/0)",
|
||||
"ambas build ts 7A9.",
|
||||
"xenos charge 1pw (2/4/0/0 ⇒ 1/5/0/0)",
|
||||
"hadsch-hallas charge 1pw (2/4/0/0 ⇒ 1/5/0/0)",
|
||||
"itars charge 1pw (3/6/0/0 ⇒ 2/7/0/0)",
|
||||
"xenos build ts 10B1.",
|
||||
"hadsch-hallas charge 1pw (1/5/0/0 ⇒ 0/6/0/0)",
|
||||
"hadsch-hallas build ts 7B4.",
|
||||
"ambas charge 2pw (2/4/0/0 ⇒ 0/6/0/0)",
|
||||
"itars special range+3. build m 6B5.",
|
||||
"ambas charge 1pw (0/6/0/0 ⇒ 0/5/1/0)",
|
||||
"ambas build lab 7A9. tech nav. up nav (1 ⇒ 2).",
|
||||
"xenos charge 1pw (1/5/0/0 ⇒ 0/6/0/0)",
|
||||
"hadsch-hallas charge 2pw (0/6/0/0 ⇒ 0/4/2/0)",
|
||||
"itars charge 1pw (2/7/0/0 ⇒ 1/8/0/0)",
|
||||
"xenos build lab 10B1. tech nav. up nav (0 ⇒ 1).",
|
||||
"hadsch-hallas charge 1pw (0/4/2/0 ⇒ 0/3/3/0)",
|
||||
"hadsch-hallas special step. build m 10A0.",
|
||||
"xenos charge 2pw (0/6/0/0 ⇒ 0/4/2/0)",
|
||||
"itars build ts 6B5.",
|
||||
"ambas charge 1pw (0/5/1/0 ⇒ 0/4/2/0)",
|
||||
"ambas build m 7B0.",
|
||||
"xenos charge 1pw (0/4/2/0 ⇒ 0/3/3/0)",
|
||||
"hadsch-hallas charge 2pw (0/3/3/0 ⇒ 0/1/5/0)",
|
||||
"xenos up nav (1 ⇒ 2).",
|
||||
"hadsch-hallas action power3. (0/1/5/0 ⇒ 4/1/1/0)",
|
||||
"itars up gaia (0 ⇒ 1).",
|
||||
"ambas build m 7B2.",
|
||||
"hadsch-hallas charge 2pw (4/1/1/0 ⇒ 2/3/1/0)",
|
||||
"xenos action power6. build m 5A7. (0/3/3/0 ⇒ 3/3/0/0)",
|
||||
"hadsch-hallas build lab 7B4. tech dip. up dip (0 ⇒ 1).",
|
||||
"ambas charge 2pw (0/4/2/0 ⇒ 0/2/4/0)",
|
||||
"itars burn 3. action power7. (1/8/0/0 ⇒ 6/2/0/3)",
|
||||
"ambas action power4. (0/2/4/0 ⇒ 4/2/0/0)",
|
||||
"xenos build m 10B4.",
|
||||
"hadsch-hallas charge 1pw (2/3/1/0 ⇒ 1/4/1/0)",
|
||||
"hadsch-hallas build tradeShip 10B0.",
|
||||
"itars build gf 6A9 using area1: 6. (6/2/0/3 ⇒ 0/2/0/9)",
|
||||
"ambas special 4pw. (4/2/0/0 ⇒ 0/6/0/0)",
|
||||
"xenos build m 5B5.",
|
||||
"hadsch-hallas build tradeShip 7B5.",
|
||||
"itars build PI 6B5.",
|
||||
"ambas charge 1pw (0/6/0/0 ⇒ 0/5/1/0)",
|
||||
"ambas up eco (0 ⇒ 1).",
|
||||
"xenos special 4pw. (3/3/0/0 ⇒ 0/5/1/0)",
|
||||
"hadsch-hallas up dip (1 ⇒ 2).",
|
||||
"itars burn 1. spend 1pw for 1c. build tradeShip 3A4. (0/2/0/9 ⇒ 1/0/0/10)",
|
||||
"ambas pass booster6 returning booster10",
|
||||
"xenos pass booster8 returning booster1",
|
||||
"hadsch-hallas pass booster1 returning booster4",
|
||||
"itars pass booster10 returning booster5",
|
||||
"itars income 1t. income 4pw (1/0/0/10 ⇒ 1/0/2/10)",
|
||||
"itars spend 4tg for tech. tech dip. up dip (0 ⇒ 1). spend 4tg for tech. tech eco. up eco (0 ⇒ 1) (1/0/2/10 ⇒ 3/0/2/0)",
|
||||
"ambas build tradeShip 7B5.",
|
||||
"xenos special 4pw. (0/5/1/0 ⇒ 0/1/5/0)",
|
||||
"hadsch-hallas move tradeShip 10B0 10C trade 10B1. (0/4/2/0 ⇒ 2/4/0/0)",
|
||||
"itars build m 6A9.",
|
||||
"hadsch-hallas charge 1pw (2/4/0/0 ⇒ 1/5/0/0)",
|
||||
"ambas special 4pw. (0/5/1/0 ⇒ 0/1/5/0)",
|
||||
"xenos action power4. (0/1/5/0 ⇒ 4/1/1/0)",
|
||||
"hadsch-hallas up dip (2 ⇒ 3). (1/5/0/0 ⇒ 0/4/2/0)",
|
||||
"itars move tradeShip 3A4 7A8 trade 7A9. (3/0/2/0 ⇒ 5/0/0/0)",
|
||||
"ambas action power3. (0/1/5/0 ⇒ 4/1/1/0)",
|
||||
"xenos build m 6A8.",
|
||||
"hadsch-hallas charge 1pw (0/4/2/0 ⇒ 0/3/3/0)",
|
||||
"itars charge 3pw (5/0/0/0 ⇒ 2/3/0/0)",
|
||||
"hadsch-hallas action power6. build m 1B1. (0/3/3/0 ⇒ 3/3/0/0)",
|
||||
"itars spend 1o for 1t. build gf 8A3 using area1: 3, area2: 3. (2/3/0/0 ⇒ 0/0/0/6)",
|
||||
"ambas build ac1 7A9. tech dip. up dip (0 ⇒ 1).",
|
||||
"xenos charge 1pw (4/1/1/0 ⇒ 3/2/1/0)",
|
||||
"hadsch-hallas charge 2pw (3/3/0/0 ⇒ 1/5/0/0)",
|
||||
"xenos build ts 10B4.",
|
||||
"hadsch-hallas charge 1pw (1/5/0/0 ⇒ 0/6/0/0)",
|
||||
"hadsch-hallas build ts 10A0.",
|
||||
"xenos charge 2pw (3/2/1/0 ⇒ 1/4/1/0)",
|
||||
"itars pass booster2 returning booster10",
|
||||
"ambas build tradeShip 6A1.",
|
||||
"xenos build ts 5A6.",
|
||||
"ambas charge 3pw (4/1/1/0 ⇒ 1/4/1/0)",
|
||||
"hadsch-hallas burn 1. move tradeShip 7B5 7C trade 7B2. (0/6/0/0 ⇒ 1/4/0/0)",
|
||||
"ambas pass booster5 returning booster6",
|
||||
"xenos up terra (0 ⇒ 1).",
|
||||
"hadsch-hallas build lab 10A0. tech free1. up dip (3 ⇒ 4).",
|
||||
"xenos charge 2pw (1/4/1/0 ⇒ 0/4/2/0)",
|
||||
"xenos pass booster4 returning booster8",
|
||||
"hadsch-hallas pass booster6 returning booster1",
|
||||
"itars income 2t. income 4pw. income 1t. income 1pw (0/0/0/6 ⇒ 1/1/2/6)",
|
||||
"itars spend 4tg for tech. tech gaia. up gaia (1 ⇒ 2) (1/1/2/6 ⇒ 6/1/2/0)",
|
||||
"itars build m 8A3.",
|
||||
"xenos charge 1pw (0/4/2/0 ⇒ 0/3/3/0)",
|
||||
"hadsch-hallas charge 2pw (0/2/3/0 ⇒ 0/0/5/0)",
|
||||
"ambas move tradeShip 7B5 7C trade 7B0.",
|
||||
"xenos action power7. (0/3/3/0 ⇒ 5/3/0/0)",
|
||||
"hadsch-hallas action power3. (0/0/5/0 ⇒ 4/0/1/0)",
|
||||
"itars build gf 9A7 using area1: 6. (6/1/2/0 ⇒ 0/1/2/6)",
|
||||
"ambas up dip (1 ⇒ 2).",
|
||||
"xenos build PI 10B4.",
|
||||
"hadsch-hallas charge 1pw (4/0/1/0 ⇒ 3/1/1/0)",
|
||||
"hadsch-hallas move tradeShip 7C 7A10 trade 5A6. (3/1/1/0 ⇒ 2/3/0/0)",
|
||||
"itars build ts 6A9.",
|
||||
"xenos charge 1pw (5/3/0/0 ⇒ 4/4/0/0)",
|
||||
"hadsch-hallas charge 2pw (2/3/0/0 ⇒ 0/5/0/0)",
|
||||
"ambas move tradeShip 6A1 6A1 trade 9A8. (0/3/3/0 ⇒ 2/3/1/0)",
|
||||
"xenos federation 10A1,10B1,10B4,10C,6A8 fed5 using area1: 2. (4/4/0/0 ⇒ 2/4/0/0)",
|
||||
"hadsch-hallas build ts 10A11.",
|
||||
"xenos charge 3pw (2/4/0/0 ⇒ 0/5/1/0)",
|
||||
"itars federation 6A9,6B5,8A3 fed3. (0/1/2/6 ⇒ 2/1/2/6)",
|
||||
"ambas special 4pw. (2/3/1/0 ⇒ 0/3/3/0)",
|
||||
"xenos special 4pw. (0/5/1/0 ⇒ 0/1/5/0)",
|
||||
"hadsch-hallas build PI 10A11.",
|
||||
"xenos charge 1pw (0/1/5/0 ⇒ 0/0/6/0)",
|
||||
"itars up nav (0 ⇒ 1).",
|
||||
"ambas special range+3. build m 1B5.",
|
||||
"hadsch-hallas charge 1pw (0/5/0/0 ⇒ 0/4/1/0)",
|
||||
"xenos action power6. build m 8B2. (0/0/6/0 ⇒ 3/0/3/0)",
|
||||
"hadsch-hallas charge 3pw (0/4/1/0 ⇒ 0/1/4/0)",
|
||||
"itars charge 2pw (2/1/2/6 ⇒ 0/3/2/6)",
|
||||
"hadsch-hallas action power4. (0/1/4/0 ⇒ 4/1/0/0)",
|
||||
"itars move tradeShip 7A8 7B3 trade 7B2. (0/3/2/6 ⇒ 2/3/0/6)",
|
||||
"ambas build ts 7B0.",
|
||||
"xenos charge 2pw (3/0/3/0 ⇒ 1/2/3/0)",
|
||||
"hadsch-hallas charge 2pw (4/1/0/0 ⇒ 2/3/0/0)",
|
||||
"itars charge 1pw (2/3/0/6 ⇒ 1/4/0/6)",
|
||||
"xenos special step. build m 9A2.",
|
||||
"hadsch-hallas spend 3c for 1o. spend 1o for 1t. burn 1. move tradeShip 10C 10B5 trade 10B4. (2/3/0/0 ⇒ 0/1/5/0)",
|
||||
"itars burn 2. spend 1pw for 1c. build m 4A1. (1/4/0/6 ⇒ 2/0/1/8)",
|
||||
"xenos charge 1pw (1/2/3/0 ⇒ 0/3/3/0)",
|
||||
"ambas pass booster10 returning booster5",
|
||||
"xenos spend 3pw for 1o. build m 1A9. (0/3/3/0 ⇒ 3/3/0/0)",
|
||||
"ambas charge 1pw (0/3/3/0 ⇒ 0/2/4/0)",
|
||||
"hadsch-hallas spend 3c for 1o. spend 4c for 1q. action power2. build m 8B4. (0/1/5/0 ⇒ 5/1/0/0)",
|
||||
"xenos charge 1pw (3/3/0/0 ⇒ 2/4/0/0)",
|
||||
"itars pass booster8 returning booster2",
|
||||
"xenos pass booster2 returning booster4",
|
||||
"hadsch-hallas up terra (0 ⇒ 1).",
|
||||
"hadsch-hallas build ts 8B4.",
|
||||
"xenos charge 1pw (2/4/0/0 ⇒ 1/5/0/0)",
|
||||
"hadsch-hallas federation 10A0,10A11,8A5,8B3,8B4 fed5 using area1: 2. (5/1/0/0 ⇒ 3/1/0/0)",
|
||||
"hadsch-hallas spend 12c for 3q. action qic2. fedtile fed5.",
|
||||
"hadsch-hallas spend 4c for 1q. spend 3c for 1o. build m 1A6.",
|
||||
"hadsch-hallas pass booster4 returning booster6",
|
||||
"itars income 4pw. income 1t. income 1pw (2/0/1/8 ⇒ 1/1/3/8)",
|
||||
"xenos income 4pw (1/5/0/0 ⇒ 2/3/3/0)",
|
||||
"hadsch-hallas income 1t (3/1/0/0 ⇒ 0/1/4/0)",
|
||||
"itars spend 4tg for tech. tech nav. up nav (1 ⇒ 2). spend 4tg for tech. tech free2. up gaia (2 ⇒ 3) (1/1/3/8 ⇒ 0/0/5/0)",
|
||||
"ambas action power6. build m 3A3. (0/0/6/0 ⇒ 3/0/3/0)",
|
||||
"xenos charge 2pw (2/3/3/0 ⇒ 0/5/3/0)",
|
||||
"hadsch-hallas charge 1pw (0/1/4/0 ⇒ 0/0/5/0)",
|
||||
"itars action power7. (0/0/5/0 ⇒ 5/0/2/0)",
|
||||
"xenos special 4pw. (0/5/3/0 ⇒ 0/1/7/0)",
|
||||
"hadsch-hallas spend 12c for 3q. action qic2. fedtile fed5. spend 1pw for 1c. (0/0/5/0 ⇒ 1/0/4/0)",
|
||||
"ambas build PI 7B0.",
|
||||
"xenos charge 1pw (0/1/7/0 ⇒ 0/0/8/0)",
|
||||
"hadsch-hallas charge 2pw (1/0/4/0 ⇒ 0/0/5/0)",
|
||||
"itars charge 1pw (5/0/2/0 ⇒ 4/1/2/0)",
|
||||
"itars build m 3B5.",
|
||||
"xenos action power4. (0/0/8/0 ⇒ 4/0/4/0)",
|
||||
"hadsch-hallas action power3. (0/0/5/0 ⇒ 4/0/1/0)",
|
||||
"ambas federation 3A3,7A9,7B0,7B5 fed6 using area1: 1. (3/0/3/0 ⇒ 2/0/3/0)",
|
||||
"itars build gf 3A0 using area1: 4. (4/1/2/0 ⇒ 0/1/2/4)",
|
||||
"xenos build lab 5A6. tech free2. up nav (2 ⇒ 3). (4/0/4/0 ⇒ 1/3/4/0)",
|
||||
"ambas charge 3pw (2/0/3/0 ⇒ 0/1/4/0)",
|
||||
"hadsch-hallas up dip (4 ⇒ 5).",
|
||||
"ambas action power5. (0/1/4/0 ⇒ 4/1/0/0)",
|
||||
"itars build m 9A7.",
|
||||
"ambas charge 1pw (4/1/0/0 ⇒ 3/2/0/0)",
|
||||
"xenos up nav (3 ⇒ 4).",
|
||||
"hadsch-hallas special step. build m 1A5.",
|
||||
"ambas up dip (2 ⇒ 3). (3/2/0/0 ⇒ 0/5/0/0)",
|
||||
"itars build ts 4A1.",
|
||||
"xenos charge 1pw (1/3/4/0 ⇒ 0/4/4/0)",
|
||||
"xenos action qic3.",
|
||||
"hadsch-hallas move tradeShip 10B5 10A1 trade 6A8.",
|
||||
"ambas up dip (3 ⇒ 4).",
|
||||
"itars spend 1pw for 1c. special 4pw. spend 3pw for 1o. (0/1/2/4 ⇒ 3/0/0/4)",
|
||||
"xenos build ac1 5A6. tech adv-nav. cover free2. up terra (1 ⇒ 2).",
|
||||
"ambas decline 3pw",
|
||||
"hadsch-hallas build ac1 7B4. tech free2. up eco (1 ⇒ 2).",
|
||||
"itars charge 1pw (3/0/0/4 ⇒ 2/1/0/4)",
|
||||
"ambas charge 3pw (0/5/0/0 ⇒ 0/2/3/0)",
|
||||
"ambas move tradeShip 7C 7B5 trade 7B4. (0/2/3/0 ⇒ 1/2/2/0)",
|
||||
"itars build lab 4A1. tech free1. up nav (2 ⇒ 3). (2/1/0/4 ⇒ 0/2/1/4)",
|
||||
"xenos charge 1pw (0/4/4/0 ⇒ 0/3/5/0)",
|
||||
"xenos spend 1pw for 1c. pass booster6 returning booster2 (0/3/5/0 ⇒ 1/3/4/0)",
|
||||
"hadsch-hallas build ts 1B1.",
|
||||
"ambas charge 1pw (1/2/2/0 ⇒ 0/3/2/0)",
|
||||
"ambas up nav (2 ⇒ 3). (0/3/2/0 ⇒ 0/0/5/0)",
|
||||
"itars burn 1. move tradeShip 7B3 7A11 trade 7B0. (0/2/1/4 ⇒ 1/2/0/5)",
|
||||
"hadsch-hallas federation 1A1,1A5,1A6,1B1,1B2,7A8,7B4 fed5 using area1: 3. (4/0/1/0 ⇒ 1/0/1/0)",
|
||||
"ambas action power2. build m 2B3. (0/0/5/0 ⇒ 5/0/0/0)",
|
||||
"itars spend 1q for 1o. spend 1o for 1t. build gf 6A5 using area1: 2, area2: 2. (1/2/0/5 ⇒ 0/0/0/9)",
|
||||
"hadsch-hallas move tradeShip 7A10 7A10 trade 7A9. spend 1pw for 1c. (1/0/1/0 ⇒ 2/0/0/0)",
|
||||
"ambas build m 2B0.",
|
||||
"itars pass booster2 returning booster8",
|
||||
"hadsch-hallas up eco (2 ⇒ 3). spend 1pw for 1c. (2/0/0/0 ⇒ 1/1/0/0)",
|
||||
"ambas special 4pw. (5/0/0/0 ⇒ 1/4/0/0)",
|
||||
"hadsch-hallas spend 3c for 1o. build tradeShip 1B0.",
|
||||
"ambas special swap-PI (from 7B0). swap-PI 6B1 (from 7B0).",
|
||||
"hadsch-hallas spend 3c for 1o. spend 1o for 1t. pass booster8 returning booster4 (1/1/0/0 ⇒ 2/1/0/0)",
|
||||
"ambas burn 1. move tradeShip 6A1 6B4 trade 6A8. (1/4/0/0 ⇒ 2/2/0/0)",
|
||||
"ambas pass booster4 returning booster10",
|
||||
"itars income 2t. income 4pw. income 1t. income 1pw (0/0/0/9 ⇒ 1/1/2/9)",
|
||||
"hadsch-hallas income 1t (2/1/0/0 ⇒ 0/0/4/0)",
|
||||
"ambas income 2t (2/2/0/0 ⇒ 0/2/4/0)",
|
||||
"itars spend 4tg for tech. tech free3. up nav (3 ⇒ 4). decline tech (1/1/2/9 ⇒ 6/1/2/0)",
|
||||
"xenos action power4. (0/1/7/0 ⇒ 4/1/3/0)",
|
||||
"itars up nav (4 ⇒ 5). lostPlanet 1A0.",
|
||||
"ambas charge 2pw (0/2/4/0 ⇒ 0/0/6/0)",
|
||||
"xenos charge 1pw (4/1/3/0 ⇒ 3/2/3/0)",
|
||||
"hadsch-hallas action power5. (0/0/4/0 ⇒ 4/0/0/0)",
|
||||
"ambas action power6. build m 4A4. (0/0/6/0 ⇒ 3/0/3/0)",
|
||||
"xenos charge 1pw (3/2/3/0 ⇒ 2/3/3/0)",
|
||||
"xenos build m 2A7.",
|
||||
"itars charge 1pw (6/1/2/0 ⇒ 5/2/2/0)",
|
||||
"ambas charge 1pw (3/0/3/0 ⇒ 2/1/3/0)",
|
||||
"itars build ac1 4A1. tech terra. up terra (0 ⇒ 1).",
|
||||
"xenos charge 1pw (2/3/3/0 ⇒ 1/4/3/0)",
|
||||
"hadsch-hallas spend 8c for 2q. action qic2. fedtile fed5.",
|
||||
"ambas move tradeShip 6B4 10A1 trade 10B1. (2/1/3/0 ⇒ 3/1/2/0)",
|
||||
"xenos up terra (2 ⇒ 3). (1/4/3/0 ⇒ 0/3/5/0)",
|
||||
"itars move tradeShip 7A11 5B3 trade 5A6. (5/2/2/0 ⇒ 7/2/0/0)",
|
||||
"hadsch-hallas spend 8c for 2q. action qic3.",
|
||||
"ambas move tradeShip 7B5 3A2 trade 5A6. (3/1/2/0 ⇒ 4/1/1/0)",
|
||||
"xenos action power3. (0/3/5/0 ⇒ 4/3/1/0)",
|
||||
"itars up gaia (3 ⇒ 4).",
|
||||
"hadsch-hallas up terra (1 ⇒ 2).",
|
||||
"ambas special 4pw. (4/1/1/0 ⇒ 0/5/1/0)",
|
||||
"xenos federation 5A10,5A6,5A7,5B4,5B5,9A2 fed3 using area1: 2.",
|
||||
"itars build gf 7A6 using area1: 3. (7/2/0/0 ⇒ 4/2/0/3)",
|
||||
"hadsch-hallas up terra (2 ⇒ 3). (4/0/0/0 ⇒ 1/3/0/0)",
|
||||
"ambas up terra (0 ⇒ 1).",
|
||||
"xenos build ts 2A7.",
|
||||
"itars charge 1pw (4/2/0/3 ⇒ 3/3/0/3)",
|
||||
"ambas charge 1pw (0/5/1/0 ⇒ 0/4/2/0)",
|
||||
"itars build m 3A0.",
|
||||
"xenos charge 1pw (4/3/1/0 ⇒ 3/4/1/0)",
|
||||
"hadsch-hallas spend 4c for 1q. build m 6B3.",
|
||||
"itars charge 4pw (3/3/0/3 ⇒ 0/5/1/3)",
|
||||
"ambas charge 3pw (0/4/2/0 ⇒ 0/1/5/0)",
|
||||
"xenos charge 1pw (3/4/1/0 ⇒ 2/5/1/0)",
|
||||
"ambas action power2. build m 2A3. (0/1/5/0 ⇒ 5/1/0/0)",
|
||||
"itars charge 1pw (0/5/1/3 ⇒ 0/4/2/3)",
|
||||
"xenos build m 4B2.",
|
||||
"itars charge 4pw (0/4/2/3 ⇒ 0/0/6/3)",
|
||||
"ambas charge 1pw (5/1/0/0 ⇒ 4/2/0/0)",
|
||||
"itars action power7. (0/0/6/3 ⇒ 5/0/3/3)",
|
||||
"hadsch-hallas move tradeShip 10A1 6B4 trade 6A9. spend 1pw for 1c. (1/3/0/0 ⇒ 1/2/1/0)",
|
||||
"ambas build ts 4A4.",
|
||||
"xenos charge 1pw (2/5/1/0 ⇒ 1/6/1/0)",
|
||||
"xenos special 4pw. (1/6/1/0 ⇒ 0/4/4/0)",
|
||||
"itars build gf 2A9 using area1: 3. (5/0/3/3 ⇒ 2/0/3/6)",
|
||||
"hadsch-hallas build ts 6B3.",
|
||||
"itars charge 4pw (2/0/3/6 ⇒ 0/0/5/6)",
|
||||
"ambas decline 3pw",
|
||||
"xenos charge 1pw (0/4/4/0 ⇒ 0/3/5/0)",
|
||||
"ambas special step. build m 2A4.",
|
||||
"xenos spend 2pw for 2c. build lab 2A7. tech terra. up terra (3 ⇒ 4). (0/3/5/0 ⇒ 2/3/3/0)",
|
||||
"ambas charge 1pw (4/2/0/0 ⇒ 3/3/0/0)",
|
||||
"itars spend 3pw for 1o. build m 6A5. (0/0/5/6 ⇒ 3/0/2/6)",
|
||||
"ambas decline 3pw",
|
||||
"hadsch-hallas charge 2pw (1/2/1/0 ⇒ 0/2/2/0)",
|
||||
"hadsch-hallas move tradeShip 1B0 1A10 trade 1B5.",
|
||||
"ambas up nav (3 ⇒ 4).",
|
||||
"xenos up terra (4 ⇒ 5).",
|
||||
"itars special 4pw. (3/0/2/6 ⇒ 0/2/3/6)",
|
||||
"hadsch-hallas spend 4c for 1q. build m 4B0. spend 1pw for 1c. (0/2/2/0 ⇒ 1/2/1/0)",
|
||||
"itars charge 2pw (0/2/3/6 ⇒ 0/0/5/6)",
|
||||
"xenos charge 1pw (2/3/3/0 ⇒ 1/4/3/0)",
|
||||
"ambas federation 2A3,2A4,2A5,2B0,2B1,2B3,6A0,6A1,6B1 fed2 using area1: 3, area2: 1. (3/3/0/0 ⇒ 0/2/0/0)",
|
||||
"xenos spend 3pw for 3c. build ts 8B2. (1/4/3/0 ⇒ 4/4/0/0)",
|
||||
"hadsch-hallas charge 3pw (1/2/1/0 ⇒ 0/1/3/0)",
|
||||
"ambas charge 1pw (0/2/0/0 ⇒ 0/1/1/0)",
|
||||
"itars spend 3pw for 1o. build gf 1A3 using area1: 3. (0/0/5/6 ⇒ 0/0/2/9)",
|
||||
"hadsch-hallas spend 1pw for 1c. move tradeShip 7A10 3A1 trade 5A7. (0/1/3/0 ⇒ 1/1/2/0)",
|
||||
"ambas build ts 7B2.",
|
||||
"hadsch-hallas charge 3pw (1/1/2/0 ⇒ 0/0/4/0)",
|
||||
"xenos burn 2. spend 2pw for 2c. build m 8B0. (4/4/0/0 ⇒ 6/0/0/0)",
|
||||
"itars build ts 9A8.",
|
||||
"ambas charge 1pw (0/1/1/0 ⇒ 0/0/2/0)",
|
||||
"hadsch-hallas build lab 6B3. tech terra. up terra (3 ⇒ 4). spend 2pw for 2c. (0/0/4/0 ⇒ 2/0/2/0)",
|
||||
"xenos charge 1pw (6/0/0/0 ⇒ 5/1/0/0)",
|
||||
"ambas spend 1pw for 1c. spend 1pw for 1c. build lab 4A4. tech terra. up terra (1 ⇒ 2). (0/0/2/0 ⇒ 2/0/0/0)",
|
||||
"xenos charge 1pw (5/1/0/0 ⇒ 4/2/0/0)",
|
||||
"hadsch-hallas charge 1pw (2/0/2/0 ⇒ 1/1/2/0)",
|
||||
"xenos pass booster10 returning booster6",
|
||||
"itars pass booster6 returning booster2",
|
||||
"hadsch-hallas spend 9c for 3o. build ac2 6B3. tech free3. up eco (3 ⇒ 4). spend 1pw for 1c. (1/1/2/0 ⇒ 2/1/1/0)",
|
||||
"ambas decline 3pw",
|
||||
"xenos charge 1pw (4/2/0/0 ⇒ 3/3/0/0)",
|
||||
"ambas up eco (1 ⇒ 2).",
|
||||
"hadsch-hallas special q.",
|
||||
"ambas up eco (2 ⇒ 3). (2/0/0/0 ⇒ 0/1/1/0)",
|
||||
"hadsch-hallas up int (0 ⇒ 1).",
|
||||
"ambas special swap-PI (from 6B1). swap-PI 1B5 (from 6B1).",
|
||||
"hadsch-hallas spend 1q for 1o. spend 3c for 1o. build m 3A7.",
|
||||
"xenos charge 1pw (3/3/0/0 ⇒ 2/4/0/0)",
|
||||
"ambas spend 1pw for 1c. spend 1k for 1c. build m 4B4. (0/1/1/0 ⇒ 1/1/0/0)",
|
||||
"xenos charge 1pw (2/4/0/0 ⇒ 1/5/0/0)",
|
||||
"hadsch-hallas charge 1pw (2/1/1/0 ⇒ 1/2/1/0)",
|
||||
"hadsch-hallas spend 1pw for 1c. pass booster2 returning booster8 (1/2/1/0 ⇒ 2/2/0/0)",
|
||||
"ambas pass booster8 returning booster4",
|
||||
"itars income 1t. income 1t (0/0/2/9 ⇒ 0/0/4/9)",
|
||||
"hadsch-hallas income 1t. income 2t (2/2/0/0 ⇒ 0/0/7/0)",
|
||||
"ambas income 2t (1/1/0/0 ⇒ 0/0/4/0)",
|
||||
"itars decline tech (0/0/4/9 ⇒ 9/0/4/0)",
|
||||
"xenos burn 1. action power4. (0/3/3/0 ⇒ 4/1/0/0)",
|
||||
"itars build m 1A3.",
|
||||
"hadsch-hallas spend 8c for 2q. spend 2pw for 2c. action qic3. (0/0/7/0 ⇒ 2/0/5/0)",
|
||||
"ambas action power5. (0/0/4/0 ⇒ 4/0/0/0)",
|
||||
"xenos build ts 3A6.",
|
||||
"hadsch-hallas charge 1pw (2/0/5/0 ⇒ 1/1/5/0)",
|
||||
"itars decline 4pw",
|
||||
"ambas decline 3pw",
|
||||
"itars build m 2A9.",
|
||||
"ambas charge 1pw (4/0/0/0 ⇒ 3/1/0/0)",
|
||||
"xenos charge 2pw (4/1/0/0 ⇒ 2/3/0/0)",
|
||||
"hadsch-hallas spend 12c for 3q. action qic2. fedtile fed5.",
|
||||
"ambas up eco (3 ⇒ 4).",
|
||||
"xenos build m 9B5.",
|
||||
"itars charge 2pw (9/0/4/0 ⇒ 7/2/4/0)",
|
||||
"ambas charge 1pw (3/1/0/0 ⇒ 2/2/0/0)",
|
||||
"itars federation 3A0,3A11,3A8,3A9,3B5,4A1,6A4,6A5 fed4 using area1: 4. (7/2/4/0 ⇒ 3/2/4/0)",
|
||||
"hadsch-hallas build lab 8B4. tech adv-dip. cover free2. up int (1 ⇒ 2).",
|
||||
"xenos charge 2pw (2/3/0/0 ⇒ 0/5/0/0)",
|
||||
"ambas build lab 7B2. tech adv-eco. cover terra. up eco (4 ⇒ 5). spend 1pw for 1c. (2/2/0/0 ⇒ 1/0/3/0)",
|
||||
"hadsch-hallas decline 3pw",
|
||||
"itars charge 1pw (3/2/4/0 ⇒ 2/3/4/0)",
|
||||
"xenos spend 1q for 1o. build ac2 2A7. tech free3. up int (1 ⇒ 2).",
|
||||
"itars charge 1pw (2/3/4/0 ⇒ 1/4/4/0)",
|
||||
"ambas charge 1pw (1/0/3/0 ⇒ 0/1/3/0)",
|
||||
"itars build ts 9A7.",
|
||||
"ambas charge 1pw (0/1/3/0 ⇒ 0/0/4/0)",
|
||||
"xenos charge 1pw (0/5/0/0 ⇒ 0/4/1/0)",
|
||||
"hadsch-hallas build m 4A8. spend 1pw for 1c. (1/1/5/0 ⇒ 2/1/4/0)",
|
||||
];
|
||||
|
||||
const engine = new Engine(moves, { frontiers: true, advancedRules: true });
|
||||
expect(() => engine.move("ambas move tradeShip 10A1 6A7 trade 6B3.")).to.not.throw();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,293 +0,0 @@
|
|||
import Engine from "../engine";
|
||||
import { Building, Command, Expansion, Planet, Player, ResearchField, Resource, Ship } from "../enums";
|
||||
import { GaiaHex } from "../gaia-hex";
|
||||
import SpaceMap from "../map";
|
||||
import PlayerObject from "../player";
|
||||
import PlayerData, { ResearchProgress } from "../player-data";
|
||||
import Reward from "../reward";
|
||||
import { newAvailableBuilding } from "./buildings";
|
||||
import {
|
||||
AvailableBuilding,
|
||||
AvailableCommand,
|
||||
AvailableHex,
|
||||
AvailableShipAction,
|
||||
ShipAction,
|
||||
ShipActionLocation,
|
||||
TradingLocation,
|
||||
} from "./types";
|
||||
|
||||
const MAX_SHIPS_PER_HEX = 3;
|
||||
const SHIP_ACTION_RANGE = 1;
|
||||
export const TRADE_COST = 3;
|
||||
|
||||
export type TradeOption = {
|
||||
buildings: Building[];
|
||||
domestic?: boolean;
|
||||
free?: boolean;
|
||||
base: Reward[];
|
||||
bonus: Reward[];
|
||||
researchAdvancementBonus?: boolean;
|
||||
build?: Building;
|
||||
};
|
||||
|
||||
export const tradeOptions: TradeOption[] = [
|
||||
{
|
||||
buildings: [Building.Mine],
|
||||
domestic: true,
|
||||
free: true,
|
||||
base: Reward.parse("1o"),
|
||||
bonus: [],
|
||||
},
|
||||
{
|
||||
buildings: [Building.Mine],
|
||||
base: [],
|
||||
bonus: Reward.parse("1c,1o"),
|
||||
build: Building.CustomsPost,
|
||||
},
|
||||
{
|
||||
buildings: [Building.TradingStation],
|
||||
base: Reward.parse("5c"),
|
||||
bonus: Reward.parse("3c,1pw"),
|
||||
},
|
||||
{
|
||||
buildings: [Building.ResearchLab],
|
||||
base: Reward.parse("2k"),
|
||||
bonus: Reward.parse("1k"),
|
||||
},
|
||||
{
|
||||
buildings: [Building.Academy1, Building.Academy2],
|
||||
base: Reward.parse("2k"),
|
||||
bonus: Reward.parse("1k"),
|
||||
researchAdvancementBonus: true,
|
||||
},
|
||||
{
|
||||
buildings: [Building.PlanetaryInstitute],
|
||||
base: Reward.parse("1t,2pw"),
|
||||
bonus: Reward.parse("4pw"),
|
||||
},
|
||||
{
|
||||
buildings: [Building.Colony],
|
||||
base: Reward.parse("3vp"),
|
||||
bonus: Reward.parse("2vp"),
|
||||
},
|
||||
];
|
||||
|
||||
export function shipsInHex(location: string, data): Ship[] {
|
||||
return data.players.flatMap((p) => p.data.ships).filter((s) => s.location === location);
|
||||
}
|
||||
|
||||
export function possibleShips(pl: PlayerObject, engine: Engine, map: SpaceMap, hex: GaiaHex) {
|
||||
const buildings: AvailableBuilding[] = [];
|
||||
for (const ship of Building.ships()) {
|
||||
const check = pl.canBuild(null, null, null, ship, engine.isLastRound, engine.replay);
|
||||
if (check) {
|
||||
for (const h of map.withinDistance(hex, 1)) {
|
||||
if (!h.hasPlanet() && shipsInHex(h.toString(), engine).length < MAX_SHIPS_PER_HEX) {
|
||||
buildings.push(newAvailableBuilding(ship, h, check, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return buildings;
|
||||
}
|
||||
|
||||
function shipTargets(
|
||||
source: string,
|
||||
hex: string,
|
||||
range: number,
|
||||
targets: AvailableHex[],
|
||||
engine: Engine
|
||||
): AvailableHex[] {
|
||||
if (
|
||||
!targets.find((t) => t.coordinates === hex) &&
|
||||
(shipsInHex(hex, engine).length < MAX_SHIPS_PER_HEX || source === hex)
|
||||
) {
|
||||
targets.push({ coordinates: hex });
|
||||
}
|
||||
if (range === 0) {
|
||||
return targets;
|
||||
}
|
||||
const map = engine.map;
|
||||
for (const h of map.withinDistance(map.getS(hex), 1)) {
|
||||
const c = h.toString();
|
||||
if (!h.hasPlanet() && c !== source) {
|
||||
shipTargets(source, c, range - 1, targets, engine);
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
function possibleShipActionsOfType(
|
||||
engine: Engine,
|
||||
ship: Ship,
|
||||
shipLocation: string,
|
||||
type: ShipAction,
|
||||
allowDecline: boolean,
|
||||
locationFactory: (h: GaiaHex) => ShipActionLocation[]
|
||||
): AvailableShipAction[] {
|
||||
const map = engine.map;
|
||||
const locations: AvailableHex[] = map
|
||||
.withinDistance(map.getS(shipLocation), SHIP_ACTION_RANGE)
|
||||
.flatMap((h) => locationFactory(h));
|
||||
const actions: AvailableShipAction[] = [];
|
||||
if (locations.length > 0) {
|
||||
actions.push({
|
||||
type,
|
||||
locations,
|
||||
} as AvailableShipAction);
|
||||
}
|
||||
if (allowDecline) {
|
||||
actions.push({
|
||||
type: ShipAction.Nothing,
|
||||
locations: [],
|
||||
});
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
export function tradeBonus(data: PlayerData, option: TradeOption): Reward[] {
|
||||
let rewards = [];
|
||||
for (let i = 0; i < data.tradeBonus; i++) {
|
||||
rewards = Reward.merge(rewards.concat(option.bonus));
|
||||
}
|
||||
return rewards;
|
||||
}
|
||||
|
||||
function isFurther(guest: ResearchProgress, host: ResearchProgress): number {
|
||||
return ResearchField.values(Expansion.All).filter((f) => host[f] > guest[f]).length;
|
||||
}
|
||||
|
||||
export function baseTradeReward(option: TradeOption, guest: PlayerData, host: PlayerData): Reward[] {
|
||||
if (option.researchAdvancementBonus) {
|
||||
const base = option.base[0];
|
||||
return [new Reward(Math.max(base.count, isFurther(guest.research, host.research)), base.type)];
|
||||
}
|
||||
return option.base;
|
||||
}
|
||||
|
||||
function tradeLocation(cost: Reward, rewards: Reward[], target: AvailableHex | AvailableBuilding): TradingLocation {
|
||||
return {
|
||||
...target,
|
||||
tradeCost: cost.toStringWithZero(),
|
||||
rewards: rewards.map((r) => r.toStringWithZero()).join(","),
|
||||
};
|
||||
}
|
||||
|
||||
function possibleBuilding(
|
||||
engine: Engine,
|
||||
h: GaiaHex,
|
||||
player: Player,
|
||||
building: Building,
|
||||
rewards: Reward[],
|
||||
cost: Reward
|
||||
): TradingLocation[] {
|
||||
const p = engine.player(player);
|
||||
const canBuildAfterTrade = p.canBuild(engine.map, h, h.data.planet, building, engine.isLastRound, engine.replay, {
|
||||
addedCost: Reward.negative(rewards),
|
||||
});
|
||||
if (canBuildAfterTrade) {
|
||||
canBuildAfterTrade.cost = p.board.cost(building, false);
|
||||
const availableBuilding = newAvailableBuilding(building, h, canBuildAfterTrade, false);
|
||||
return [tradeLocation(cost, rewards, availableBuilding)];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function tradeRewards(option: TradeOption, guest: PlayerData, host: PlayerData) {
|
||||
return Reward.merge(baseTradeReward(option, guest, host).concat(tradeBonus(guest, option)));
|
||||
}
|
||||
|
||||
export function tradeCost(guest: PlayerData, option: TradeOption): Reward {
|
||||
return option.free ? new Reward(0, Resource.ChargePower) : guest.tradeCost();
|
||||
}
|
||||
|
||||
function tradeLocations(h: GaiaHex, player: Player, engine: Engine): ShipActionLocation[] {
|
||||
const p = engine.player(player);
|
||||
if (h.hasStructure() && !h.tradeTokens.some((t) => t === player) && !h.customPosts.some((t) => t === player)) {
|
||||
const building = h.data.building;
|
||||
const host = engine.player(h.data.player).data;
|
||||
const guest = p.data;
|
||||
const domestic = h.data.player === player;
|
||||
const option = tradeOptions.find((o) => o.buildings.includes(building) && !!o.domestic === domestic);
|
||||
if (option) {
|
||||
const cost = tradeCost(guest, option);
|
||||
if (engine.player(player).data.canPay([cost])) {
|
||||
const rewards = tradeRewards(option, guest, host);
|
||||
return option.build
|
||||
? possibleBuilding(engine, h, player, option.build, rewards, cost)
|
||||
: [tradeLocation(cost, rewards, { coordinates: h.toString() })];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function colonyActions(engine: Engine, ship: Ship, h: GaiaHex): AvailableBuilding[] {
|
||||
const player = engine.player(ship.player);
|
||||
const existingBuilding = h.buildingOf(player.player);
|
||||
if (
|
||||
h.hasPlanet() &&
|
||||
h.data.planet !== Planet.Transdim &&
|
||||
(!h.occupied() || existingBuilding === Building.GaiaFormer)
|
||||
) {
|
||||
const check = player.canBuild(engine.map, h, h.data.planet, Building.Colony, engine.isLastRound, engine.replay, {
|
||||
existingBuilding,
|
||||
});
|
||||
if (check) {
|
||||
return [newAvailableBuilding(Building.Colony, h, check, false)];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function possibleShipActions(
|
||||
engine: Engine,
|
||||
ship: Ship,
|
||||
shipLocation: string,
|
||||
requireTemporaryStep: boolean
|
||||
): AvailableShipAction[] {
|
||||
switch (ship.type) {
|
||||
case Building.ColonyShip:
|
||||
return possibleShipActionsOfType(engine, ship, shipLocation, ShipAction.BuildColony, !requireTemporaryStep, (h) =>
|
||||
colonyActions(engine, ship, h)
|
||||
);
|
||||
case Building.TradeShip:
|
||||
return possibleShipActionsOfType(engine, ship, shipLocation, ShipAction.Trade, true, (h) =>
|
||||
tradeLocations(h, ship.player, engine)
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function possibleShipMovements(
|
||||
engine: Engine,
|
||||
player: Player,
|
||||
requireTemporaryStep: boolean
|
||||
): AvailableCommand<Command.MoveShip>[] {
|
||||
const pl = engine.player(player);
|
||||
|
||||
const ships = pl.data.ships.filter((s) => !s.moved && (!requireTemporaryStep || s.type === Building.ColonyShip));
|
||||
if (ships.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const shipRange = engine.player(player).data.shipRange;
|
||||
return [
|
||||
{
|
||||
name: Command.MoveShip,
|
||||
player,
|
||||
data: ships
|
||||
.map((s) => ({
|
||||
ship: s.type,
|
||||
source: s.location,
|
||||
targets: shipTargets(s.location, s.location, shipRange, [], engine)
|
||||
.map((t) => ({
|
||||
location: t,
|
||||
actions: possibleShipActions(engine, s, t.coordinates, requireTemporaryStep),
|
||||
}))
|
||||
.filter((t) => t.actions.length > 0),
|
||||
}))
|
||||
.filter((d) => d.targets.length > 0),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -123,18 +123,6 @@ export type ChooseTechTile = StandardTechTileChoice | AdvTechTileWithPos;
|
|||
export type AvailableBuildCommandData = { buildings: AvailableBuilding[] };
|
||||
export type AvailableFederation = { hexes: string; warnings: BuildWarning[] };
|
||||
|
||||
export enum ShipAction {
|
||||
Nothing = "nothing",
|
||||
BuildColony = "buildColony",
|
||||
Trade = "trade",
|
||||
}
|
||||
|
||||
export type TradingLocation = (AvailableHex | AvailableBuilding) & { tradeCost: string; rewards: string };
|
||||
export type ShipActionLocation = TradingLocation | AvailableBuilding;
|
||||
export type AvailableShipAction = { type: ShipAction; locations: ShipActionLocation[] };
|
||||
export type AvailableShipTarget = { location: AvailableHex; actions: AvailableShipAction[] };
|
||||
export type AvailableMoveShipData = { ship: Building; source: string; targets: AvailableShipTarget[] };
|
||||
|
||||
interface CommandData {
|
||||
[Command.Action]: AvailableBoardActionData;
|
||||
[Command.BanFaction]: Faction[];
|
||||
|
|
@ -172,7 +160,6 @@ interface CommandData {
|
|||
[Command.Pass]: { boosters: Booster[] };
|
||||
[Command.PISwap]: AvailableBuildCommandData;
|
||||
[Command.PlaceLostPlanet]: { spaces: AvailableHex[] };
|
||||
[Command.MoveShip]: AvailableMoveShipData[];
|
||||
[Command.PlacePowerRing]: { spaces: AvailableHex[] };
|
||||
[Command.RotateSectors]: never;
|
||||
[Command.Setup]: AvailableSetupOption;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import { Building, Faction } from "..";
|
||||
// Relative import (was `from ".."` - the package root, which resolves to the compiled dist
|
||||
// under node/cjs and broke the viewer's vite dev server, which can't interop the CJS dist for
|
||||
// named ESM imports; the enums module is the real source of Building/Faction either way).
|
||||
import { Building, Faction } from "./enums";
|
||||
|
||||
export function upgradedBuildings(currentBuilding: Building, faction: Faction): Building[] {
|
||||
switch (currentBuilding) {
|
||||
|
|
@ -20,7 +23,6 @@ export function upgradedBuildings(currentBuilding: Building, faction: Faction):
|
|||
export function stdBuildingValue(building: Building): number {
|
||||
switch (building) {
|
||||
case Building.Mine:
|
||||
case Building.CustomsPost:
|
||||
return 1;
|
||||
case Building.TradingStation:
|
||||
case Building.ResearchLab:
|
||||
|
|
@ -28,7 +30,6 @@ export function stdBuildingValue(building: Building): number {
|
|||
case Building.PlanetaryInstitute:
|
||||
case Building.Academy1:
|
||||
case Building.Academy2:
|
||||
case Building.Colony:
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ import {
|
|||
moveSetup,
|
||||
moveSilentBid,
|
||||
} from "./move/setup";
|
||||
import { moveShip } from "./move/ships";
|
||||
import { moveGaiaFormTransdim, moveSpaceshipAction } from "./move/spaceship-actions";
|
||||
import Player from "./player";
|
||||
import { MoveTokens, powerLogString } from "./player-data";
|
||||
|
|
@ -139,8 +138,6 @@ export interface EngineOptions {
|
|||
map?: MapConfiguration;
|
||||
/** Are the federations flexible (allows you to avoid planets with buildings to form federation even if it's not the shortest route)? */
|
||||
flexibleFederations?: boolean;
|
||||
/** Frontiers expansion */
|
||||
frontiers?: boolean;
|
||||
/** Lost Fleet expansion */
|
||||
lostFleet?: boolean;
|
||||
/**
|
||||
|
|
@ -210,7 +207,7 @@ export interface LogEntry {
|
|||
* other three are the states a live async game actually SITS in between turns - waiting on someone
|
||||
* else's power-charge answer, or on a start-of-round income/gaia choice - which is precisely when a
|
||||
* player reaches for a premove. Everything else (setup, auction, scoring, endgame, and the transient
|
||||
* `RoundStart`/`RoundFinish`/`RoundShip` the engine never rests in) has no well-defined "my next turn"
|
||||
* `RoundStart`/`RoundFinish` the engine never rests in) has no well-defined "my next turn"
|
||||
* to preview.
|
||||
*/
|
||||
const premovePreviewablePhases: Phase[] = [Phase.RoundMove, Phase.RoundLeech, Phase.RoundIncome, Phase.RoundGaia];
|
||||
|
|
@ -383,7 +380,7 @@ export default class Engine {
|
|||
}
|
||||
|
||||
get expansions(): Expansion {
|
||||
return 0 | (this.options.frontiers ? Expansion.Frontiers : 0) | (this.options.lostFleet ? Expansion.LostFleet : 0);
|
||||
return 0 | (this.options.lostFleet ? Expansion.LostFleet : 0);
|
||||
}
|
||||
|
||||
round: number = Round.None;
|
||||
|
|
@ -1050,9 +1047,6 @@ export default class Engine {
|
|||
[Phase.RoundFinish]: () => {
|
||||
throw new Error("roundFinish cannot be executed");
|
||||
},
|
||||
[Phase.RoundShip]: () => {
|
||||
throw new Error("roundShip cannot be executed");
|
||||
},
|
||||
[Phase.SetupInit]: phaseSetupInit,
|
||||
[Phase.SetupBoard]: phaseSetupBoard,
|
||||
[Phase.SetupFactionBan]: phaseSetupFactionBan,
|
||||
|
|
@ -1135,7 +1129,6 @@ export default class Engine {
|
|||
[Command.PreferenceBid]: movePreferenceBid,
|
||||
[Command.Build]: moveBuild,
|
||||
[Command.PlaceLostPlanet]: moveLostPlanet,
|
||||
[Command.MoveShip]: moveShip,
|
||||
[Command.Special]: moveSpecial,
|
||||
[Command.Spend]: moveSpend,
|
||||
[Command.BurnPower]: moveBurn,
|
||||
|
|
|
|||
|
|
@ -1,42 +1,26 @@
|
|||
import { expect } from "chai";
|
||||
import Engine from "./engine";
|
||||
import { AdvTechTile, BoardAction, Building, Expansion, FinalTile, hasExpansion } from "./enums";
|
||||
import { AdvTechTile, BoardAction, Expansion, FinalTile, hasExpansion } from "./enums";
|
||||
|
||||
describe("Expansion", () => {
|
||||
it("hasExpansion tests individual bits", () => {
|
||||
expect(hasExpansion(Expansion.Frontiers, Expansion.Frontiers)).to.be.true;
|
||||
expect(hasExpansion(Expansion.Frontiers, Expansion.LostFleet)).to.be.false;
|
||||
expect(hasExpansion(Expansion.LostFleet, Expansion.LostFleet)).to.be.true;
|
||||
expect(hasExpansion(Expansion.None, Expansion.Frontiers)).to.be.false;
|
||||
expect(hasExpansion(Expansion.None, Expansion.LostFleet)).to.be.false;
|
||||
});
|
||||
|
||||
it("All is the combination of every expansion bit", () => {
|
||||
expect(Expansion.All).to.equal(Expansion.Frontiers | Expansion.LostFleet);
|
||||
expect(hasExpansion(Expansion.All, Expansion.Frontiers)).to.be.true;
|
||||
expect(Expansion.All).to.equal(Expansion.LostFleet);
|
||||
expect(hasExpansion(Expansion.All, Expansion.LostFleet)).to.be.true;
|
||||
});
|
||||
|
||||
it("Building.values(All) still includes Frontiers-only content", () => {
|
||||
expect(Building.values(Expansion.All)).to.contain(Building.ColonyShip);
|
||||
expect(Building.values(Expansion.All)).to.contain(Building.Colony);
|
||||
expect(Building.values(Expansion.None)).to.not.contain(Building.ColonyShip);
|
||||
});
|
||||
|
||||
it("engine.expansions reflects the configured option flags", () => {
|
||||
const engine = new Engine(["init 2 randomSeed"], {});
|
||||
expect(engine.expansions).to.equal(Expansion.None);
|
||||
|
||||
const frontiersEngine = new Engine(["init 2 randomSeed"], { frontiers: true });
|
||||
expect(frontiersEngine.expansions).to.equal(Expansion.Frontiers);
|
||||
|
||||
const lostFleetEngine = new Engine(["init 2 randomSeed"], { lostFleet: true });
|
||||
expect(lostFleetEngine.expansions).to.equal(Expansion.LostFleet);
|
||||
});
|
||||
|
||||
it("Frontiers and Lost Fleet can not be combined", () => {
|
||||
expect(() => new Engine(["init 2 randomSeed"], { frontiers: true, lostFleet: true })).to.throw();
|
||||
});
|
||||
|
||||
it("AdvTechTile.values(LostFleet) includes the 6 §G2 tiles, AdvTechTile.values(None) does not", () => {
|
||||
const lostFleetOnlyTiles = [
|
||||
AdvTechTile.AsteroidPass,
|
||||
|
|
@ -59,11 +43,9 @@ describe("Expansion", () => {
|
|||
it("BoardAction.values(LostFleet) excludes qic1-3, replaced by the spaceship boards' own Q.I.C. actions (RULES_CLARIFICATIONS.md §E4/§K3)", () => {
|
||||
const qicActions = [BoardAction.Qic1, BoardAction.Qic2, BoardAction.Qic3];
|
||||
|
||||
for (const expansions of [Expansion.None, Expansion.Frontiers]) {
|
||||
const values = BoardAction.values(expansions);
|
||||
for (const action of qicActions) {
|
||||
expect(values).to.contain(action);
|
||||
}
|
||||
const withoutExpansion = BoardAction.values(Expansion.None);
|
||||
for (const action of qicActions) {
|
||||
expect(withoutExpansion).to.contain(action);
|
||||
}
|
||||
|
||||
const withLostFleet = BoardAction.values(Expansion.LostFleet);
|
||||
|
|
|
|||
|
|
@ -21,16 +21,14 @@ export enum ResearchField {
|
|||
GaiaProject = "gaia",
|
||||
Economy = "eco",
|
||||
Science = "sci",
|
||||
Diplomacy = "dip",
|
||||
}
|
||||
|
||||
export enum Expansion {
|
||||
// 1 was the old spaceships expansion
|
||||
None = 0,
|
||||
Frontiers = 2,
|
||||
LostFleet = 4,
|
||||
// "all content" sentinel for `.values()` enumeration only - never a valid game-config selection
|
||||
All = Frontiers | LostFleet,
|
||||
All = LostFleet,
|
||||
}
|
||||
|
||||
export function hasExpansion(expansions: Expansion, expansion: Expansion): boolean {
|
||||
|
|
@ -72,10 +70,6 @@ export namespace ResearchField {
|
|||
ResearchField.Science,
|
||||
];
|
||||
|
||||
if (hasExpansion(expansions, Expansion.Frontiers)) {
|
||||
ret.push(ResearchField.Diplomacy);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,7 +94,6 @@ export enum Resource {
|
|||
VictoryPoint = "vp",
|
||||
TerraformCostDiscount = "d",
|
||||
Range = "r",
|
||||
ShipRange = "ship-range",
|
||||
GaiaFormer = "gf",
|
||||
MoveGaiaFormerFromGaiaAreaToArea1 = "gf->t",
|
||||
InstantGaiaforming = "instant-gaiaforming",
|
||||
|
|
@ -112,7 +105,6 @@ export enum Resource {
|
|||
UpgradeGaiaProject = "up-gaia",
|
||||
UpgradeEconomy = "up-eco",
|
||||
UpgradeScience = "up-sci",
|
||||
UpgradeDiplomacy = "up-dip",
|
||||
UpgradeLowest = "up-lowest",
|
||||
TechTile = "tech",
|
||||
RescoreFederation = "fed",
|
||||
|
|
@ -122,24 +114,9 @@ export enum Resource {
|
|||
MoveTokenFromArea3ToGaia = "t-a3",
|
||||
PISwap = "swap-PI",
|
||||
Turn = "turn",
|
||||
TradeBonus = "tradeBonus",
|
||||
TradeDiscount = "tradeDiscount",
|
||||
TradeShip = "tradeShip",
|
||||
PowerRing = "power-ring",
|
||||
}
|
||||
|
||||
export function isResourceUsed(resource: Resource, expansion: Expansion) {
|
||||
switch (resource) {
|
||||
case Resource.ShipRange:
|
||||
case Resource.TradeBonus:
|
||||
case Resource.TradeDiscount:
|
||||
case Resource.TradeShip:
|
||||
case Resource.UpgradeDiplomacy:
|
||||
return hasExpansion(expansion, Expansion.Frontiers);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export enum Operator {
|
||||
/** One-time income */
|
||||
Once = ">",
|
||||
|
|
@ -187,7 +164,6 @@ export enum Condition {
|
|||
AdvanceResearch = "a",
|
||||
TerraformStep = "step",
|
||||
GaiaFormer = "gf",
|
||||
Trade = "trade",
|
||||
// Lost Fleet
|
||||
SpaceshipQicAction = "shipq",
|
||||
/** A mine built in a Space/Deep Space sector not colonized by this player before (§G4 "sector3"). */
|
||||
|
|
@ -205,7 +181,7 @@ export namespace Condition {
|
|||
case Condition.MineOnGaia:
|
||||
return building === Building.Mine && planet === Planet.Gaia;
|
||||
case Condition.BigBuilding:
|
||||
return building === Building.PlanetaryInstitute || isAcademy(building) || building === Building.Colony;
|
||||
return building === Building.PlanetaryInstitute || isAcademy(building);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -220,77 +196,12 @@ export enum Building {
|
|||
Academy2 = "ac2",
|
||||
GaiaFormer = "gf",
|
||||
SpaceStation = "sp",
|
||||
|
||||
//frontiers
|
||||
Colony = "colony",
|
||||
CustomsPost = "customsPost",
|
||||
|
||||
ColonyShip = "colonyShip",
|
||||
TradeShip = "tradeShip",
|
||||
ConstructionShip = "constructionShip",
|
||||
ResearchShip = "researchShip",
|
||||
|
||||
Scout = "scout",
|
||||
Frigate = "frigate",
|
||||
BattleShip = "battleShip",
|
||||
}
|
||||
|
||||
export namespace Building {
|
||||
export function values(expansion: Expansion): Building[] {
|
||||
return (Object.values(Building) as Building[]).filter((b: Building) => {
|
||||
if (typeof b !== "string") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isShip(b)) {
|
||||
if (!isAvailableShip(b)) {
|
||||
return false;
|
||||
}
|
||||
return hasExpansion(expansion, Expansion.Frontiers);
|
||||
}
|
||||
switch (b) {
|
||||
case Building.Colony:
|
||||
case Building.CustomsPost:
|
||||
return hasExpansion(expansion, Expansion.Frontiers);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
export function values(_expansion: Expansion): Building[] {
|
||||
return (Object.values(Building) as Building[]).filter((b: Building) => typeof b === "string");
|
||||
}
|
||||
export function ships(): Building[] {
|
||||
return values(Expansion.Frontiers).filter((b) => isShip(b));
|
||||
}
|
||||
}
|
||||
|
||||
export type Ship = {
|
||||
type: Building;
|
||||
player: Player;
|
||||
location: string;
|
||||
moved: boolean;
|
||||
};
|
||||
|
||||
function isAvailableShip(b: Building) {
|
||||
//some ships are not implemented yet
|
||||
switch (b) {
|
||||
case Building.ColonyShip:
|
||||
case Building.TradeShip:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isShip(b: Building) {
|
||||
switch (b) {
|
||||
case Building.ColonyShip:
|
||||
case Building.TradeShip:
|
||||
case Building.ConstructionShip:
|
||||
case Building.ResearchShip:
|
||||
case Building.Scout:
|
||||
case Building.Frigate:
|
||||
case Building.BattleShip:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isAcademy(b: Building) {
|
||||
|
|
@ -366,7 +277,6 @@ export enum Command {
|
|||
FormFederation = "federation",
|
||||
GaiaFormTransdim = "gaiaFormTransdim",
|
||||
Init = "init",
|
||||
MoveShip = "move",
|
||||
PISwap = "swap-PI",
|
||||
Pass = "pass",
|
||||
PlaceLostPlanet = "lostPlanet",
|
||||
|
|
@ -390,7 +300,6 @@ export enum Player {
|
|||
Player3,
|
||||
Player4,
|
||||
Player5,
|
||||
All,
|
||||
}
|
||||
|
||||
export enum Round {
|
||||
|
|
@ -476,17 +385,11 @@ export enum TechTile {
|
|||
Tech7 = "tech7",
|
||||
Tech8 = "tech8",
|
||||
Tech9 = "tech9",
|
||||
TechFrontiers1 = "tech-frontiers1",
|
||||
}
|
||||
|
||||
export namespace TechTile {
|
||||
export function values(expansions: Expansion): TechTile[] {
|
||||
return (Object.values(TechTile) as TechTile[]).filter((val: TechTile) => {
|
||||
if (typeof val !== "string") {
|
||||
return;
|
||||
}
|
||||
return !val.includes("frontiers") || hasExpansion(expansions, Expansion.Frontiers);
|
||||
}) as TechTile[];
|
||||
export function values(_expansions: Expansion): TechTile[] {
|
||||
return (Object.values(TechTile) as TechTile[]).filter((val: TechTile) => typeof val === "string") as TechTile[];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -497,7 +400,6 @@ export enum TechPos {
|
|||
GaiaProject = "tech-gaia",
|
||||
Economy = "tech-eco",
|
||||
Science = "tech-sci",
|
||||
Diplomacy = "tech-dip",
|
||||
Free1 = "tech-free1",
|
||||
Free2 = "tech-free2",
|
||||
Free3 = "tech-free3",
|
||||
|
|
@ -517,10 +419,6 @@ export namespace TechPos {
|
|||
"tech-free3",
|
||||
] as TechPos[];
|
||||
|
||||
if (hasExpansion(expansions, Expansion.Frontiers)) {
|
||||
ret.push(TechPos.Diplomacy);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -532,7 +430,6 @@ export enum TechTilePos {
|
|||
GaiaProject = "gaia",
|
||||
Economy = "eco",
|
||||
Science = "sci",
|
||||
Diplomacy = "dip",
|
||||
Free1 = "free1",
|
||||
Free2 = "free2",
|
||||
Free3 = "free3",
|
||||
|
|
@ -542,10 +439,6 @@ export namespace TechTilePos {
|
|||
export function values(expansions: Expansion): TechTilePos[] {
|
||||
const ret = ["terra", "nav", "int", "gaia", "eco", "sci", "free1", "free2", "free3"] as TechTilePos[];
|
||||
|
||||
if (hasExpansion(expansions, Expansion.Frontiers)) {
|
||||
ret.push(TechTilePos.Diplomacy);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -618,7 +511,6 @@ export enum AdvTechTilePos {
|
|||
GaiaProject = "adv-gaia",
|
||||
Economy = "adv-eco",
|
||||
Science = "adv-sci",
|
||||
Diplomacy = "adv-dip",
|
||||
// Lost Fleet's Scoring Board Extension: a 7th Advanced Tech slot not tied to any research field.
|
||||
ScoringExtension = "adv-ext",
|
||||
}
|
||||
|
|
@ -627,10 +519,6 @@ export namespace AdvTechTilePos {
|
|||
export function values(expansions: Expansion): AdvTechTilePos[] {
|
||||
const ret = ["adv-terra", "adv-nav", "adv-int", "adv-gaia", "adv-eco", "adv-sci"] as AdvTechTilePos[];
|
||||
|
||||
if (hasExpansion(expansions, Expansion.Frontiers)) {
|
||||
ret.push(AdvTechTilePos.Diplomacy);
|
||||
}
|
||||
|
||||
if (hasExpansion(expansions, Expansion.LostFleet)) {
|
||||
ret.push(AdvTechTilePos.ScoringExtension);
|
||||
}
|
||||
|
|
@ -789,7 +677,6 @@ export enum Phase {
|
|||
RoundStart = "roundStart",
|
||||
RoundIncome = "roundIncome",
|
||||
RoundGaia = "roundGaia",
|
||||
RoundShip = "roundShip",
|
||||
RoundMove = "roundMove",
|
||||
RoundLeech = "roundLeech",
|
||||
RoundFinish = "roundFinish",
|
||||
|
|
|
|||
|
|
@ -57,9 +57,6 @@ function findOperator(spec: string): [Operator, string] {
|
|||
return [Operator.Once, spec];
|
||||
}
|
||||
|
||||
export const tradeSource = "trade";
|
||||
export const tradeCostSource = "tradeCost";
|
||||
|
||||
export type EventSource =
|
||||
| Booster
|
||||
| TechPos
|
||||
|
|
@ -81,9 +78,7 @@ export type EventSource =
|
|||
| Command.Explore
|
||||
| Command.GaiaFormTransdim
|
||||
| Faction
|
||||
| Command.Bid
|
||||
| typeof tradeSource
|
||||
| typeof tradeCostSource;
|
||||
| Command.Bid;
|
||||
|
||||
/**
|
||||
* Whether an event's source is a Booster/standard-Tech-tile/Advanced-Tech-tile - i.e. something
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ const geodens: FactionBoardVariants = {
|
|||
income: ["3k,4o,15c,q,up-terra", "+o,k"],
|
||||
handlers: {
|
||||
[`build-${Building.Mine}`]: (player: Player, hex: GaiaHex) => gainExtraKnowledge(player, hex),
|
||||
[`build-${Building.Colony}`]: (player: Player, hex: GaiaHex) => gainExtraKnowledge(player, hex),
|
||||
},
|
||||
},
|
||||
variants: [
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ const gleens: FactionBoardVariants = {
|
|||
handlers: {
|
||||
[`build-${Building.PlanetaryInstitute}`]: (player: Player) => player.gainFederationToken(Federation.Gleens),
|
||||
[`build-${Building.Mine}`]: (player: Player, hex: GaiaHex) => gaiaVp(hex, player),
|
||||
[`build-${Building.Colony}`]: (player: Player, hex: GaiaHex) => gaiaVp(hex, player),
|
||||
},
|
||||
},
|
||||
variants: [
|
||||
|
|
|
|||
|
|
@ -78,50 +78,6 @@ const defaultBoard: FactionBoardRaw = {
|
|||
cost: "~",
|
||||
income: [[], [], [], [], [], []],
|
||||
},
|
||||
|
||||
//frontiers
|
||||
[Building.Colony]: {
|
||||
cost: "~",
|
||||
income: [
|
||||
["+3c", "+3pw", "+3vp", "2vp"],
|
||||
["+3c", "+3pw", "+4vp", "2vp"],
|
||||
["+3c", "+3pw", "+5vp", "2vp"],
|
||||
],
|
||||
},
|
||||
[Building.CustomsPost]: {
|
||||
cost: "2c",
|
||||
income: [["+2c"], ["+2c"], ["+2c"], ["+2c"], ["+2c"]],
|
||||
},
|
||||
|
||||
[Building.ColonyShip]: {
|
||||
cost: "4c,3o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
[Building.ConstructionShip]: {
|
||||
cost: "3c,2o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
[Building.ResearchShip]: {
|
||||
cost: "3c,2o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
[Building.TradeShip]: {
|
||||
cost: "5c,1o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
|
||||
[Building.Scout]: {
|
||||
cost: "1c,1o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
[Building.Frigate]: {
|
||||
cost: "3c,2o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
[Building.BattleShip]: {
|
||||
cost: "5c,5o",
|
||||
income: [[], [], []],
|
||||
},
|
||||
},
|
||||
income: ["3k,4o,15c,q", "+o,k"],
|
||||
power: {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* - Guard against free-action loops (`Spend`, `BurnPower`): cap conversions per line, then
|
||||
* force progress (pass weighting grows as the round ages).
|
||||
* - v1 scope: `factionVariant: "standard"`, no auction, no `customBoardSetup`, players 2-4.
|
||||
* Commands outside that scope (Bid, Setup, RotateSectors, MoveShip) throw GeneratorError.
|
||||
* Commands outside that scope (Bid, Setup, RotateSectors) throw GeneratorError.
|
||||
*/
|
||||
import { AvailableCommand } from "../available/types";
|
||||
import { Command, Faction, Phase } from "../enums";
|
||||
|
|
@ -289,7 +289,6 @@ function movePartFor(command: AvailableCommand, ctx: PlayContext): string | null
|
|||
case Command.Bid:
|
||||
case Command.Setup:
|
||||
case Command.RotateSectors:
|
||||
case Command.MoveShip:
|
||||
throw new GeneratorError(`Command ${command.name} is outside the fuzzer's v1 scope (plan §2) but was offered`);
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@ export interface GaiaHexData {
|
|||
player?: Player;
|
||||
/** List of players who have a federation occupying this square */
|
||||
federations?: Player[];
|
||||
/** List of players who have a traded with this planet */
|
||||
tradeTokens?: Player[];
|
||||
/** List of players who have build a customs post on this planet */
|
||||
customPosts?: Player[];
|
||||
/** Additional mine of lantids */
|
||||
additionalMine?: Player;
|
||||
/** Lost Fleet Moweyds: +2 power value ring placed on this planet */
|
||||
|
|
@ -59,8 +55,7 @@ export class GaiaHex extends Hex<GaiaHexData> {
|
|||
|
||||
// Space stations do not count as colonized, gaia-formers do not count as colonized
|
||||
colonizedBy(player: Player): boolean {
|
||||
const building = this.buildingOf(player);
|
||||
return stdBuildingValue(building) > 0 && building !== Building.CustomsPost;
|
||||
return stdBuildingValue(this.buildingOf(player)) > 0;
|
||||
}
|
||||
|
||||
isMainOccupier(player: Player): boolean {
|
||||
|
|
@ -113,14 +108,6 @@ export class GaiaHex extends Hex<GaiaHexData> {
|
|||
return true;
|
||||
}
|
||||
|
||||
get customPosts(): Player[] {
|
||||
return this.data.customPosts ?? [];
|
||||
}
|
||||
|
||||
get tradeTokens(): Player[] {
|
||||
return this.data.tradeTokens ?? [];
|
||||
}
|
||||
|
||||
// Can probably math this better
|
||||
get relativeCoordinates() {
|
||||
if (this.data.sectorCenter) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,5 @@
|
|||
import seedrandom from "seedrandom";
|
||||
import {
|
||||
AvailableBuilding,
|
||||
AvailableCommand,
|
||||
AvailableFreeAction,
|
||||
AvailableMoveShipData,
|
||||
AvailableShipAction,
|
||||
Offer,
|
||||
PossibleBid,
|
||||
ShipAction,
|
||||
TradingLocation,
|
||||
} from "../available/types";
|
||||
import { AvailableBuilding, AvailableCommand, AvailableFreeAction, Offer, PossibleBid } from "../available/types";
|
||||
import Engine from "../engine";
|
||||
import { Command, Player as PlayerEnum } from "../enums";
|
||||
import { AvailableSetupOption } from "../setup";
|
||||
|
|
@ -96,7 +86,6 @@ export function moveAI(engine: Engine, player: PlayerEnum, salt = 0): string {
|
|||
(cmd: AvailableCommand<Command.PlaceLostPlanet>) =>
|
||||
`${Command.PlaceLostPlanet} ${pick(rng, cmd.data.spaces).coordinates}`,
|
||||
],
|
||||
[Command.MoveShip, (cmd: AvailableCommand<Command.MoveShip>) => randomShipMove(rng, cmd.data)],
|
||||
[
|
||||
Command.Special,
|
||||
(cmd: AvailableCommand<Command.Special>) => `${Command.Special} ${pick(rng, cmd.data.specialacts).income}`,
|
||||
|
|
@ -247,32 +236,6 @@ function randomFreeAction(rng: () => number, acts: AvailableFreeAction[]): strin
|
|||
return `${act.cost} for ${act.income}`;
|
||||
}
|
||||
|
||||
function randomShipMove(rng: () => number, data: AvailableMoveShipData[]): string {
|
||||
const ship = pick(rng, data);
|
||||
const target = pick(rng, ship.targets);
|
||||
const action = randomShipAction(rng, target.actions);
|
||||
|
||||
return `${Command.MoveShip} ${ship.ship} ${ship.source} ${target.location.coordinates}${action}`;
|
||||
}
|
||||
|
||||
function randomShipAction(rng: () => number, actions: AvailableShipAction[]): string {
|
||||
const choices = (actions ?? []).filter((action) => action.type !== ShipAction.Nothing && action.locations.length > 0);
|
||||
|
||||
if (choices.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const action = pick(rng, choices);
|
||||
const location = pick(rng, action.locations);
|
||||
|
||||
// `cost` contains the satellite cost for trading locations near other players'
|
||||
// structures, it is not part of the command
|
||||
const tradeCost = (location as TradingLocation).tradeCost;
|
||||
const cost = tradeCost ? ` ${tradeCost}` : "";
|
||||
|
||||
return ` ${action.type} ${location.coordinates}${cost}`;
|
||||
}
|
||||
|
||||
function freeCommandMove(rng: () => number, cmd: AvailableCommand): string {
|
||||
switch (cmd.name) {
|
||||
case Command.Spend:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { isEqual } from "lodash";
|
||||
import { AvailableBuilding, AvailableCommand } from "../available/types";
|
||||
import Engine from "../engine";
|
||||
import { Building, Command, isShip, Phase, Planet, Player as PlayerEnum } from "../enums";
|
||||
import { Building, Command, Phase, Planet, Player as PlayerEnum } from "../enums";
|
||||
import Player from "../player";
|
||||
import Reward from "../reward";
|
||||
import assert from "../utils/assert";
|
||||
|
|
@ -61,7 +61,7 @@ export function placeBuilding(engine: Engine, pl: Player, building: AvailableBui
|
|||
);
|
||||
|
||||
// will trigger a LeechPhase
|
||||
if ((engine.phase === Phase.RoundMove || engine.phase === Phase.RoundShip) && !isShip(building.building)) {
|
||||
if (engine.phase === Phase.RoundMove) {
|
||||
engine.leechSources.unshift({ player: pl.player, coordinates: building.coordinates });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,9 +420,6 @@ function beginRoundStartPhase(engine: Engine) {
|
|||
|
||||
for (const player of engine.playersInOrder()) {
|
||||
player.loadEvents(engine.currentRoundScoringEvents);
|
||||
player.data.ships?.forEach((s) => {
|
||||
s.moved = false;
|
||||
});
|
||||
}
|
||||
|
||||
beginIncomePhase(engine);
|
||||
|
|
@ -592,10 +589,7 @@ function beginLeechingPhase(engine: Engine) {
|
|||
}
|
||||
// Do not use PlayerData.maxLeech() here, cuz taklons
|
||||
pl.data.leechPossible = leechPossible(engine, sourceHex, (hex) =>
|
||||
pl.buildingValue(engine.map.grid.get(hex), {
|
||||
building:
|
||||
hex.buildingOf(pl.player) ?? (hex.customPosts.some((c) => c === pl.player) ? Building.CustomsPost : null),
|
||||
})
|
||||
pl.buildingValue(engine.map.grid.get(hex), { building: hex.buildingOf(pl.player) })
|
||||
);
|
||||
if (pl.canLeech()) {
|
||||
canLeechPlayers.push(pl);
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ import assert from "../utils/assert";
|
|||
|
||||
export function moveInit(engine: Engine, players: number, seed: string) {
|
||||
assert(players >= 2 && players <= 5, "Invalid number of players");
|
||||
assert(
|
||||
!(engine.options.frontiers && engine.options.lostFleet),
|
||||
"Frontiers and Lost Fleet expansions cannot be combined"
|
||||
);
|
||||
assert(
|
||||
!(engine.options.lostFleet && engine.options.map?.sectors),
|
||||
"A custom map configuration cannot be combined with the Lost Fleet expansion"
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
import { AvailableBuilding, AvailableCommand, ShipAction, TradingLocation } from "../available/types";
|
||||
import Engine from "../engine";
|
||||
import { Building, Command, Condition, Player as PlayerEnum } from "../enums";
|
||||
import { tradeCostSource, tradeSource } from "../events";
|
||||
import Player from "../player";
|
||||
import Reward from "../reward";
|
||||
import assert from "../utils/assert";
|
||||
import { placeBuilding } from "./buildings";
|
||||
|
||||
export function moveShip(
|
||||
engine: Engine,
|
||||
command: AvailableCommand<Command.MoveShip>,
|
||||
player: PlayerEnum,
|
||||
shipType: Building,
|
||||
source: string,
|
||||
dest: string,
|
||||
actionType?: ShipAction,
|
||||
actionLocation?: string
|
||||
) {
|
||||
const pl = engine.player(player);
|
||||
|
||||
const data = command.data;
|
||||
|
||||
const shipCommand = data.find((s) => s.ship === shipType && s.source === source);
|
||||
assert(shipCommand, `There is no ship ${shipType} at ${source}`);
|
||||
|
||||
const target = shipCommand.targets.find((t) => t.location.coordinates === dest);
|
||||
assert(target, `The ship ${shipType} doesn't have the range to move from ${source} to ${dest}`);
|
||||
|
||||
const ship = pl.findUnmovedShip(shipType, source);
|
||||
assert(ship, `No ${shipType} at ${source} (or has already moved)`);
|
||||
|
||||
ship.moved = true;
|
||||
ship.location = dest;
|
||||
|
||||
const actions = target.actions;
|
||||
|
||||
if (actionType) {
|
||||
const action = actions?.find((a) => a.type === actionType);
|
||||
|
||||
assert(action, `action ${actionType} not possible for ship ${shipType} at ship location ${dest}`);
|
||||
assert(actionLocation, "no action location provided");
|
||||
|
||||
const location = action.locations.find((l) => l.coordinates === actionLocation);
|
||||
assert(location, `action ${actionType} not possible for ship ${shipType} at action location ${actionLocation}`);
|
||||
|
||||
switch (actionType) {
|
||||
case ShipAction.BuildColony:
|
||||
placeBuilding(engine, pl, location as AvailableBuilding);
|
||||
pl.removeShip(ship, false);
|
||||
break;
|
||||
case ShipAction.Trade:
|
||||
trade(engine, pl, location as TradingLocation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function trade(engine: Engine, pl: Player, location: TradingLocation) {
|
||||
if (location.tradeCost) {
|
||||
pl.payCosts(Reward.parse(location.tradeCost), tradeCostSource);
|
||||
}
|
||||
if (location.rewards) {
|
||||
pl.gainRewards(Reward.parse(location.rewards), tradeSource);
|
||||
}
|
||||
|
||||
const hex = engine.map.getS(location.coordinates);
|
||||
if (hex.data.building === Building.Mine && pl.player !== hex.data.player) {
|
||||
const cost = location.cost ? Reward.parse(location.cost) : [];
|
||||
pl.build(Building.CustomsPost, hex, cost, engine.map);
|
||||
} else {
|
||||
hex.data.tradeTokens = hex.tradeTokens.concat(pl.player);
|
||||
}
|
||||
pl.receiveTriggerIncome(Condition.Trade);
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import { EventEmitter } from "eventemitter3";
|
||||
import { cloneDeep, fromPairs } from "lodash";
|
||||
import { TRADE_COST } from "./available/ships";
|
||||
import { BrainstoneActionData, BrainstoneWarning, ChooseTechTile } from "./available/types";
|
||||
import {
|
||||
ArtifactToken,
|
||||
|
|
@ -13,7 +12,6 @@ import {
|
|||
PowerArea,
|
||||
ResearchField,
|
||||
Resource,
|
||||
Ship,
|
||||
Spaceship,
|
||||
SpaceshipFederation,
|
||||
SpaceshipTechTile,
|
||||
|
|
@ -78,14 +76,6 @@ export default class PlayerData extends EventEmitter {
|
|||
[key in Building]: number;
|
||||
} = fromPairs(Building.values(Expansion.All).map((bld) => [bld, 0])) as any;
|
||||
|
||||
destroyedShips: {
|
||||
[key in Building]: number;
|
||||
} = fromPairs(Building.ships().map((bld) => [bld, 0])) as any;
|
||||
|
||||
deployedShips: {
|
||||
[key in Building]: number;
|
||||
} = fromPairs(Building.ships().map((bld) => [bld, 0])) as any;
|
||||
|
||||
satellites = 0;
|
||||
research: ResearchProgress = {
|
||||
terra: 0,
|
||||
|
|
@ -94,10 +84,8 @@ export default class PlayerData extends EventEmitter {
|
|||
gaia: 0,
|
||||
eco: 0,
|
||||
sci: 0,
|
||||
dip: 0,
|
||||
};
|
||||
range = 1;
|
||||
shipRange = 2;
|
||||
/** Total number of gaiaformers gained (including those on the board & the gaia area) */
|
||||
gaiaformers = 0;
|
||||
/** number of gaiaformers gained that are in gaia area */
|
||||
|
|
@ -116,9 +104,6 @@ export default class PlayerData extends EventEmitter {
|
|||
*/
|
||||
gaiaformersUsedForOther = 0;
|
||||
terraformCostDiscount = 0;
|
||||
tradeBonus = 0;
|
||||
tradeDiscount = 0;
|
||||
tradeShips = 0;
|
||||
|
||||
tiles: {
|
||||
booster: Booster;
|
||||
|
|
@ -149,7 +134,6 @@ export default class PlayerData extends EventEmitter {
|
|||
|
||||
/** Hexes occupied by buildings with value (not gaia formers), refs match the map hexes with a simple equality test */
|
||||
occupied: GaiaHex[] = [];
|
||||
ships: Ship[] = [];
|
||||
leechPossible: number;
|
||||
tokenModifier = 1;
|
||||
lostPlanet = 0;
|
||||
|
|
@ -211,8 +195,6 @@ export default class PlayerData extends EventEmitter {
|
|||
leechPossible: this.leechPossible,
|
||||
tokenModifier: this.tokenModifier,
|
||||
buildings: this.buildings,
|
||||
destroyedShips: this.destroyedShips,
|
||||
deployedShips: this.deployedShips,
|
||||
federationCount: this.federationCount,
|
||||
spaceshipFederations: this.spaceshipFederations,
|
||||
explorationShips: this.explorationShips,
|
||||
|
|
@ -223,11 +205,6 @@ export default class PlayerData extends EventEmitter {
|
|||
lostPlanet: this.lostPlanet,
|
||||
artifactPlanetTypes: this.artifactPlanetTypes,
|
||||
artifacts: this.artifacts,
|
||||
ships: this.ships,
|
||||
shipRange: this.shipRange,
|
||||
tradeBonus: this.tradeBonus,
|
||||
tradeDiscount: this.tradeDiscount,
|
||||
tradeShips: this.tradeShips,
|
||||
temporaryRange: this.temporaryRange,
|
||||
temporaryStep: this.temporaryStep,
|
||||
};
|
||||
|
|
@ -362,21 +339,9 @@ export default class PlayerData extends EventEmitter {
|
|||
case Resource.Range:
|
||||
this.range += count;
|
||||
break;
|
||||
case Resource.ShipRange:
|
||||
this.shipRange += count;
|
||||
break;
|
||||
case Resource.TemporaryRange:
|
||||
this.temporaryRange += count;
|
||||
break;
|
||||
case Resource.TradeBonus:
|
||||
this.tradeBonus += count;
|
||||
break;
|
||||
case Resource.TradeDiscount:
|
||||
this.tradeDiscount += count;
|
||||
break;
|
||||
case Resource.TradeShip:
|
||||
this.tradeShips += count;
|
||||
break;
|
||||
case Resource.GaiaFormer:
|
||||
if (count > 0) {
|
||||
this.gaiaformers += count;
|
||||
|
|
@ -774,10 +739,6 @@ export default class PlayerData extends EventEmitter {
|
|||
return this.gaiaformers > 1 ? this.gaiaformers : 0;
|
||||
}
|
||||
|
||||
tradeCost(): Reward {
|
||||
return new Reward(TRADE_COST - this.tradeDiscount, Resource.ChargePower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert all resources into knowledge / ore / credits,
|
||||
* to have the maximum victory points
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import {
|
|||
Federation,
|
||||
FinalTile,
|
||||
isAcademy,
|
||||
isShip,
|
||||
LostFleetEconomySide,
|
||||
Operator,
|
||||
Phase,
|
||||
|
|
@ -26,7 +25,6 @@ import {
|
|||
ResearchField,
|
||||
Resource,
|
||||
Resource as ResourceEnum,
|
||||
Ship,
|
||||
Spaceship,
|
||||
SpaceshipFederation,
|
||||
TechTile,
|
||||
|
|
@ -377,7 +375,7 @@ export default class Player extends EventEmitter {
|
|||
addedCost = [];
|
||||
}
|
||||
|
||||
if (hex?.hasSpaceship() && !isShip(building)) {
|
||||
if (hex?.hasSpaceship()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +399,7 @@ export default class Player extends EventEmitter {
|
|||
// gaiaforming discount
|
||||
if (building === Building.GaiaFormer) {
|
||||
addedCost.push(new Reward(-this.data.gaiaFormingDiscount(), Resource.MoveTokenToGaiaArea));
|
||||
} else if (building === Building.Mine || building === Building.Colony) {
|
||||
} else if (building === Building.Mine) {
|
||||
// habitability costs
|
||||
if (targetPlanet === Planet.Gaia) {
|
||||
if (this.data.temporaryStep > 0 && !replay) {
|
||||
|
|
@ -486,8 +484,6 @@ export default class Player extends EventEmitter {
|
|||
switch (building) {
|
||||
case Building.GaiaFormer:
|
||||
return this.data.gaiaformers - this.data.gaiaformersInGaia - this.data.gaiaformersUsedForAsteroid;
|
||||
case Building.TradeShip:
|
||||
return this.data.tradeShips;
|
||||
default:
|
||||
return this.board.buildings[building].income.length;
|
||||
}
|
||||
|
|
@ -675,7 +671,7 @@ export default class Player extends EventEmitter {
|
|||
}
|
||||
|
||||
// excluding Gaiaformers as occupied
|
||||
if (building !== Building.GaiaFormer && building !== Building.CustomsPost && !isShip(building)) {
|
||||
if (building !== Building.GaiaFormer) {
|
||||
if (!wasOccupied) {
|
||||
this.data.occupied.push(hex);
|
||||
// Clear federation cache on new building
|
||||
|
|
@ -706,7 +702,7 @@ export default class Player extends EventEmitter {
|
|||
|
||||
// remove upgraded building and the associated event
|
||||
const upgradedBuilding = hex.buildingOf(this.player);
|
||||
if (upgradedBuilding && building !== Building.CustomsPost) {
|
||||
if (upgradedBuilding) {
|
||||
this.data.buildings[upgradedBuilding] -= 1;
|
||||
this.removeEvents(this.board.buildings[upgradedBuilding].income[this.data.buildings[upgradedBuilding]]);
|
||||
}
|
||||
|
|
@ -720,22 +716,16 @@ export default class Player extends EventEmitter {
|
|||
// Lantids
|
||||
const isAdditionalMine = !upgradedBuilding && hex.occupied();
|
||||
|
||||
if (isShip(building)) {
|
||||
this.placeShip(building, hex);
|
||||
} else if (building === Building.CustomsPost) {
|
||||
hex.data.customPosts = hex.customPosts.concat(this.player);
|
||||
} else {
|
||||
if (isAdditionalMine) {
|
||||
hex.data.additionalMine = this.player;
|
||||
if (this.data.hasPlanetaryInstitute()) {
|
||||
this.gainRewards([new Reward("2k")], Faction.Lantids);
|
||||
}
|
||||
} else {
|
||||
hex.data.building = building;
|
||||
hex.data.player = this.player;
|
||||
if (isAdditionalMine) {
|
||||
hex.data.additionalMine = this.player;
|
||||
if (this.data.hasPlanetaryInstitute()) {
|
||||
this.gainRewards([new Reward("2k")], Faction.Lantids);
|
||||
}
|
||||
this.addBuildingToNearbyFederation(building, hex, map);
|
||||
} else {
|
||||
hex.data.building = building;
|
||||
hex.data.player = this.player;
|
||||
}
|
||||
this.addBuildingToNearbyFederation(building, hex, map);
|
||||
|
||||
// get triggered income for new building
|
||||
this.receiveBuildingTriggerIncome(building, hex.data.planet, isAdditionalMine);
|
||||
|
|
@ -777,25 +767,6 @@ export default class Player extends EventEmitter {
|
|||
return added;
|
||||
}
|
||||
|
||||
placeShip(ship: Building, hex: GaiaHex) {
|
||||
this.data.ships.push({ type: ship, location: hex.toString(), moved: true, player: this.player });
|
||||
}
|
||||
|
||||
findUnmovedShip(ship: Building, location: string): Ship | null {
|
||||
return this.data.ships.find((s) => s.location === location && s.type === ship && !s.moved);
|
||||
}
|
||||
|
||||
removeShip(ship: Ship, destroyed: boolean) {
|
||||
const l = this.data.ships;
|
||||
l.splice(l.indexOf(ship), 1);
|
||||
if (destroyed) {
|
||||
this.data.destroyedShips[ship.type]++;
|
||||
this.data.buildings[ship.type]--;
|
||||
} else {
|
||||
this.data.deployedShips[ship.type]++;
|
||||
}
|
||||
}
|
||||
|
||||
resetTemporaryVariables() {
|
||||
// reset temporary benefits
|
||||
this.data.temporaryRange = 0;
|
||||
|
|
@ -985,8 +956,6 @@ export default class Player extends EventEmitter {
|
|||
switch (building) {
|
||||
case Building.SpaceStation:
|
||||
return 1;
|
||||
case Building.CustomsPost:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1132,8 +1101,7 @@ export default class Player extends EventEmitter {
|
|||
return (
|
||||
this.data.buildings[Building.Academy1] +
|
||||
this.data.buildings[Building.Academy2] +
|
||||
this.data.buildings[Building.PlanetaryInstitute] +
|
||||
this.data.buildings[Building.Colony]
|
||||
this.data.buildings[Building.PlanetaryInstitute]
|
||||
);
|
||||
case Condition.Federation:
|
||||
return this.data.tiles.federations.length + this.data.spaceshipFederations.length;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,15 @@
|
|||
import { Expansion, hasExpansion, isResourceUsed, LostFleetEconomySide, ResearchField } from "./enums";
|
||||
import { Expansion, hasExpansion, LostFleetEconomySide, ResearchField } from "./enums";
|
||||
import Event from "./events";
|
||||
|
||||
const researchTracks: { [key in ResearchField]: string[][] } = {
|
||||
[ResearchField.Terraforming]: [[], ["2o"], ["d"], ["d", "3pw"], ["2o"], []],
|
||||
[ResearchField.Navigation]: [[], ["q"], ["r", "ship-range"], ["q", "3pw"], ["r", "ship-range"], ["r", "2ship-range"]],
|
||||
[ResearchField.Navigation]: [[], ["q"], ["r"], ["q", "3pw"], ["r"], ["r"]],
|
||||
[ResearchField.Intelligence]: [[], ["q"], ["q"], ["2q", "3pw"], ["2q"], ["4q"]],
|
||||
[ResearchField.GaiaProject]: [[], [">gf"], ["3t"], [">gf", "3pw"], [">gf"], ["4vp", "g > vp"]],
|
||||
[ResearchField.Economy]: [[], ["+2c,pw"], ["+2c,1o,2pw"], ["+3c,1o,3pw", "3pw"], ["+4c,2o,4pw"], ["6c,3o,6pw"]],
|
||||
[ResearchField.Science]: [[], ["+k"], ["+2k"], ["+3k", "3pw"], ["+4k"], ["9k"]],
|
||||
[ResearchField.Diplomacy]: [
|
||||
[],
|
||||
["+pw", "tradeDiscount"],
|
||||
["+2pw", "tradeBonus"],
|
||||
["+3pw", "tradeDiscount", "3pw"],
|
||||
["+4pw", "tradeBonus"],
|
||||
["+6pw", "tradeBonus", "tradeDiscount"],
|
||||
],
|
||||
};
|
||||
|
||||
const frontiersEco: string[][] = [
|
||||
["tradeShip"],
|
||||
["+2c", "tradeShip"],
|
||||
["+2c,1o,1pw"],
|
||||
["+3c,1o,1pw", "3pw", "tradeShip"],
|
||||
["+4c,2o,2pw"],
|
||||
["6c,3o,6pw"],
|
||||
];
|
||||
|
||||
// Lost Fleet §F1: a single overlay tile (one of 2 possible sides, chosen at random at setup) covers
|
||||
// only the base game's level 3/4 Economy income boxes - levels 0/1/2/5 are untouched, so those
|
||||
// entries are copied straight from the base `researchTracks[Economy]` above.
|
||||
|
|
@ -55,12 +38,10 @@ export function researchEvents(
|
|||
lostFleetEconomySide?: LostFleetEconomySide
|
||||
) {
|
||||
const spec: string[] =
|
||||
field === ResearchField.Economy && hasExpansion(expansion, Expansion.Frontiers)
|
||||
? frontiersEco[level]
|
||||
: field === ResearchField.Economy && hasExpansion(expansion, Expansion.LostFleet)
|
||||
? (lostFleetEconomySide === LostFleetEconomySide.VictoryPoints ? lostFleetEcoVp : lostFleetEcoPw)[level]
|
||||
: researchTracks[field][level];
|
||||
return spec.map((s) => new Event(s, field)).filter((e) => e.rewards.every((r) => isResourceUsed(r.type, expansion)));
|
||||
field === ResearchField.Economy && hasExpansion(expansion, Expansion.LostFleet)
|
||||
? (lostFleetEconomySide === LostFleetEconomySide.VictoryPoints ? lostFleetEcoVp : lostFleetEcoPw)[level]
|
||||
: researchTracks[field][level];
|
||||
return spec.map((s) => new Event(s, field));
|
||||
}
|
||||
|
||||
export function lastTile(field: ResearchField): number {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ describe("Spaceship boards", () => {
|
|||
|
||||
it("should be empty without the Lost Fleet expansion", () => {
|
||||
expect(shipsInPlay(Expansion.None, 4)).to.deep.equal([]);
|
||||
expect(shipsInPlay(Expansion.Frontiers, 4)).to.deep.equal([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ const techTileSpec: { [key in AnyTechTile]: string[] } = {
|
|||
[TechTile.Tech7]: ["mg >> 3vp"],
|
||||
[TechTile.Tech8]: ["+4c"],
|
||||
[TechTile.Tech9]: ["=> 4pw"],
|
||||
[TechTile.TechFrontiers1]: ["trade >> 2c"],
|
||||
[AdvTechTile.AdvTech1]: ["fed | 3vp"],
|
||||
[AdvTechTile.AdvTech2]: ["a >> 2vp"],
|
||||
[AdvTechTile.AdvTech3]: ["=> q,5c"],
|
||||
|
|
|
|||
|
|
@ -23,10 +23,6 @@ export async function init(
|
|||
options.creator = creator;
|
||||
}
|
||||
|
||||
if (expansions.includes("frontiers")) {
|
||||
options.frontiers = true;
|
||||
}
|
||||
|
||||
if (expansions.includes("lost-fleet")) {
|
||||
options.lostFleet = true;
|
||||
}
|
||||
|
|
|
|||
44
viewer/index.html
Normal file
44
viewer/index.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<link rel="shortcut icon" type="image/png" id="favicon-gp" href="/favicon.png?v=5.36.4" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=5.36.4" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<meta name="theme-color" content="#1c2027" />
|
||||
<script>
|
||||
// Apply dark-by-default or the persisted choice before CSS and Vue mount, avoiding a theme
|
||||
// flash.
|
||||
(function () {
|
||||
var theme = "dark";
|
||||
try {
|
||||
var storedTheme = window.localStorage.getItem("gp-fight-club-theme");
|
||||
if (storedTheme === "light" || storedTheme === "dark") {
|
||||
theme = storedTheme;
|
||||
}
|
||||
} catch (_) {
|
||||
// Storage is optional in privacy-restricted contexts.
|
||||
}
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
document.documentElement.style.colorScheme = theme;
|
||||
document
|
||||
.querySelector('meta[name="theme-color"]')
|
||||
.setAttribute("content", theme === "dark" ? "#1c2027" : "#ffffff");
|
||||
})();
|
||||
</script>
|
||||
<meta name="description" content="Gaia Project multiplayer and offline pass-and-play" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-title" content="Fight Club" />
|
||||
<title>GP: Fight Club</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We are sorry, javascript is needed for the website.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/viewer",
|
||||
"version": "5.14.2",
|
||||
"version": "5.15.0",
|
||||
"description": "Functions to visualize the map and boards for gaia project inside html canvas",
|
||||
"contributors": [
|
||||
"coyotte508",
|
||||
|
|
@ -12,26 +12,23 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --port 8080",
|
||||
"serve": "vite --port 8080",
|
||||
"build": "vite build",
|
||||
"fix-package": "ts-node scripts/fix-package-imports.ts",
|
||||
"lint": "vue-cli-service lint",
|
||||
"package": "vite build",
|
||||
"prepublishOnly": "npm run package && npm run fix-package",
|
||||
"prepublishOnly": "npm run package",
|
||||
"test": "vitest run",
|
||||
"quick-test": "vitest run --changed"
|
||||
},
|
||||
"unpkg": "dist/package/viewer.umd.min.js",
|
||||
"unpkg": "dist/package/viewer.umd.js",
|
||||
"files": [
|
||||
"index.ts",
|
||||
"tsconfig.json",
|
||||
"src",
|
||||
"README.md",
|
||||
"public",
|
||||
"dist/package/viewer.umd.min.js",
|
||||
"dist/package/viewer.umd.min.*.js",
|
||||
"dist/package/viewer.umd.min.js.map",
|
||||
"dist/package/viewer.umd.min.*.js.map",
|
||||
"dist/package/viewer.umd.js",
|
||||
"dist/package/viewer.umd.*.js",
|
||||
"dist/package/viewer.css",
|
||||
"dist/package/img",
|
||||
"dist/package/css"
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const folder = "dist/package/css";
|
||||
const files = fs.readdirSync(folder);
|
||||
|
||||
for (const file of files.filter((f) => f.endsWith(".css"))) {
|
||||
const content = fs.readFileSync(path.join(folder, file), "utf-8");
|
||||
fs.writeFileSync(path.join(folder, file), content.replace(/url\(img\//g, "url(../img/"));
|
||||
}
|
||||
|
|
@ -1,18 +1,5 @@
|
|||
<template>
|
||||
<g v-if="isShip" class="ship">
|
||||
<circle v-if="shipMoved" r="7" />
|
||||
<Planet :planet="planetClass" transform="scale(7)" :classes="['ship']" />
|
||||
<text transform="translate(-2, -.7) scale(5)" :class="`board-text ${planetClass}`" style="font-weight: bolder">{{
|
||||
shipLetter
|
||||
}}</text>
|
||||
</g>
|
||||
<g v-else-if="customsPost" class="ship">
|
||||
<Planet :planet="planetClass" transform="scale(7)" />
|
||||
<text transform="translate(-2, -.7) scale(5)" :class="`board-text ${planetClass}`" style="font-weight: bolder"
|
||||
>C</text
|
||||
>
|
||||
</g>
|
||||
<g v-else :class="['building']">
|
||||
<g :class="['building']">
|
||||
<g :class="['planet-fill', planetClass]" v-if="flat">
|
||||
<rect v-if="mine" x="-20" y="-20" width="40" height="40" />
|
||||
<rect v-else-if="planetaryInstitute" x="-37.5" y="-37.5" width="75" height="75" />
|
||||
|
|
@ -20,7 +7,6 @@
|
|||
<circle v-else-if="lab" r="30" />
|
||||
<circle v-else-if="academy" r="50" />
|
||||
<polygon v-else-if="tradingStation" points="-20,-20 0,-38 20,-20 20,20 -20,20" transform="translate(0, 0.08)" />
|
||||
<polygon v-else-if="colony" points="-35,30 0,-40 35,30" transform="translate(0, 0.08)" />
|
||||
<circle v-else-if="spaceStation" r="20" />
|
||||
</g>
|
||||
<use
|
||||
|
|
@ -32,20 +18,14 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Building as BuildingEnum, Faction, isShip } from "@gaia-project/engine";
|
||||
import { Building as BuildingEnum, Faction } from "@gaia-project/engine";
|
||||
import { isAcademy } from "@gaia-project/engine/src/enums";
|
||||
import Vue from "vue";
|
||||
import { Component, Prop } from "vue-property-decorator";
|
||||
import { shipLetter } from "../data/building";
|
||||
import { corners } from "../graphics/hex";
|
||||
import { planetClass } from "../graphics/utils";
|
||||
import Planet from "./Planet.vue";
|
||||
|
||||
@Component<Building>({
|
||||
components: {
|
||||
Planet,
|
||||
},
|
||||
})
|
||||
@Component<Building>({})
|
||||
export default class Building extends Vue {
|
||||
@Prop()
|
||||
faction: Faction;
|
||||
|
|
@ -53,9 +33,6 @@ export default class Building extends Vue {
|
|||
@Prop({ default: false, type: Boolean })
|
||||
flat: boolean;
|
||||
|
||||
@Prop()
|
||||
shipMoved: boolean;
|
||||
|
||||
@Prop()
|
||||
building: BuildingEnum;
|
||||
|
||||
|
|
@ -80,16 +57,6 @@ export default class Building extends Vue {
|
|||
.join(" ");
|
||||
}
|
||||
|
||||
get triangleCorners() {
|
||||
return [
|
||||
{ x: -0.5, y: Math.sqrt(3) / 4 },
|
||||
{ x: 0.5, y: Math.sqrt(3) / 4 },
|
||||
{ x: 0, y: -Math.sqrt(3) / 4 },
|
||||
]
|
||||
.map(({ x, y }) => `${x * 0.5},${y * 0.5}`)
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
get mine() {
|
||||
return this.building === BuildingEnum.Mine;
|
||||
}
|
||||
|
|
@ -114,25 +81,9 @@ export default class Building extends Vue {
|
|||
return this.building === BuildingEnum.GaiaFormer;
|
||||
}
|
||||
|
||||
get colony() {
|
||||
return this.building === BuildingEnum.Colony;
|
||||
}
|
||||
|
||||
get spaceStation() {
|
||||
return this.building === BuildingEnum.SpaceStation;
|
||||
}
|
||||
|
||||
get customsPost() {
|
||||
return this.building === BuildingEnum.CustomsPost;
|
||||
}
|
||||
|
||||
get isShip() {
|
||||
return isShip(this.building);
|
||||
}
|
||||
|
||||
get shipLetter() {
|
||||
return shipLetter(this.building);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
/>
|
||||
</g>
|
||||
<Resource v-else-if="condition === 'step'" kind="step" />
|
||||
<Resource v-else-if="condition === 'trade'" kind="tradeShip" />
|
||||
<Resource v-else-if="condition === 'tt'" kind="tech" />
|
||||
<circle v-else-if="condition === 'ast'" r="9" class="planet-fill a" style="stroke: black; stroke-width: 0.5" />
|
||||
<g v-else-if="condition === 'shipq'">
|
||||
|
|
|
|||
|
|
@ -258,17 +258,18 @@ describe("Game", () => {
|
|||
const researchBoard = svg.querySelector("svg.research-board");
|
||||
const scoringBoard = researchBoard.nextElementSibling;
|
||||
expect(scoringBoard.tagName).to.equal("svg");
|
||||
// Base game keeps its long-standing framing: the research board at the viewBox origin, the
|
||||
// side ScoringBoard nudged up 25 units (its own content has built-in top padding).
|
||||
// Base game framing: the research board at the viewBox origin, and the side ScoringBoard
|
||||
// with NO y offset. The pre-LF y="-25" pushed the final scoring tiles 25 units above the
|
||||
// canvas' minY=0 and clipped them at the top (owner report, 2026-09) - y is absent now.
|
||||
expect(researchBoard.getAttribute("y")).to.equal(null);
|
||||
expect(scoringBoard.getAttribute("y")).to.equal("-25");
|
||||
expect(scoringBoard.getAttribute("y")).to.equal(null);
|
||||
|
||||
const [, minY, , height] = svg.getAttribute("viewBox").split(" ").map(Number);
|
||||
expect(minY).to.equal(0);
|
||||
// ScoringBoard renders at width=90 against its own `viewBox="0 0 80 480"` with no explicit
|
||||
// height, so its rendered height auto-scales to preserve aspect ratio: 90 * (480/80) = 540,
|
||||
// starting 25 units above the viewBox top - a 505-tall viewBox shows it down to y=480 of its
|
||||
// own 540, which is where its actual content ends (the rest is padding).
|
||||
// starting exactly at the viewBox top - a 505-tall viewBox shows it down to y=505 of its
|
||||
// own 540; its content (final scoring + round tiles) ends at y=480, the rest is padding.
|
||||
expect(height).to.equal(505);
|
||||
|
||||
vm.$el.remove();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
<Charts />
|
||||
</b-modal>
|
||||
<Rules id="rules" />
|
||||
<Rules id="trade" type="trade" />
|
||||
|
||||
<!-- Analysis mode (docs/lost-fleet/ANALYSIS_MODE_PLAN.md §12) - only staleness notices and the
|
||||
saved-line prompt live here now, because both have to be readable while sandbox mode is NOT
|
||||
|
|
@ -115,13 +114,10 @@
|
|||
ref="researchBoard"
|
||||
x="-50"
|
||||
/>
|
||||
<ScoringBoard
|
||||
v-if="!engine.options.lostFleet"
|
||||
class="ml-4"
|
||||
width="90"
|
||||
:x="researchBoardWidth + 20"
|
||||
y="-25"
|
||||
/>
|
||||
<!-- No y offset: the pre-LF y="-25" pushed the final scoring tiles 25 units above
|
||||
the canvas' minY=0, clipping them at the top (owner report, 2026-09). y=0 aligns
|
||||
the section's top with the research tracks' top. -->
|
||||
<ScoringBoard v-if="!engine.options.lostFleet" class="ml-4" width="90" :x="researchBoardWidth + 20" />
|
||||
<!-- Right under the 6 tracks' own bottom edge (BASE_RESEARCH_BOARD_HEIGHT, a fixed
|
||||
5-unit gap) - NOT researchBoardViewHeight, which Lost Fleet's 7th column (round
|
||||
scoring + final scoring, positioned further right) can inflate well past where the
|
||||
|
|
|
|||
|
|
@ -62,20 +62,11 @@
|
|||
:transform="resourceTranslate(i, index)"
|
||||
style="opacity: 0.7"
|
||||
/>
|
||||
<g v-if="isDeployed(i)">
|
||||
<line y1="-.1" y2=".1" x1="-.1" x2=".1" stroke="#333" stroke-width="2" />
|
||||
<line y1=".1" y2="-.1" x1="-.1" x2=".1" stroke="#333" stroke-width="2" />
|
||||
</g>
|
||||
<!-- Lost Fleet §E2: a Gaiaformer consumed to colonize an Asteroid never appears on the map (it's
|
||||
gone for good), unlike one placed on Gaia/a transdim/Protoplanet - so mark its board slot
|
||||
with the same "used" X as a power/special action, scaled down to fit this circle. -->
|
||||
<UsedActionMark v-if="isAsteroidConsumed(i)" class="asteroid-consumed-mark" transform="scale(0.05)" />
|
||||
</g>
|
||||
<!-- not displayed because military is not implemented yet-->
|
||||
<!-- <g v-if="isShip" transform="translate(7.5,0)" v-b-tooltip="destroyedTooltip">-->
|
||||
<!-- <circle r=".6" class="destroyed" />-->
|
||||
<!-- <text transform="translate(-.33,-.1)" class="board-text">{{ destroyed }}</text>-->
|
||||
<!-- </g>-->
|
||||
</g>
|
||||
</template>
|
||||
|
||||
|
|
@ -84,7 +75,6 @@ import Engine, {
|
|||
Building as BuildingEnum,
|
||||
factionBoard,
|
||||
factionVariantBoard,
|
||||
isShip,
|
||||
Operator,
|
||||
Planet as PlanetEnum,
|
||||
Player,
|
||||
|
|
@ -132,12 +122,6 @@ export default class BuildingGroup extends Vue {
|
|||
@Prop({ default: 0 })
|
||||
asteroidConsumed: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
destroyed: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
deployed: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
discount: number;
|
||||
|
||||
|
|
@ -180,10 +164,6 @@ export default class BuildingGroup extends Vue {
|
|||
return this.building === BuildingEnum.PlanetaryInstitute;
|
||||
}
|
||||
|
||||
get isShip() {
|
||||
return isShip(this.building);
|
||||
}
|
||||
|
||||
tooltip(i: number) {
|
||||
const building = this.building;
|
||||
const b = this.board.buildings[building];
|
||||
|
|
@ -191,11 +171,9 @@ export default class BuildingGroup extends Vue {
|
|||
? b.cost.map((c) => `${c.count - this.discount}${c.type}`).join(", ")
|
||||
: b.cost.join(", ") || "~";
|
||||
const isolatedCost = b.isolatedCost ? " Isolated cost: " + (b.isolatedCost.join(", ") || "~") : "";
|
||||
const income =
|
||||
building === BuildingEnum.GaiaFormer || isShip(building) ? null : this.resources(i, true).join(", ") || "~";
|
||||
const income = building === BuildingEnum.GaiaFormer ? null : this.resources(i, true).join(", ") || "~";
|
||||
const rows = [
|
||||
buildingName(building, this.faction) +
|
||||
(this.isDeployed(i) ? " (deployed)" : this.isAsteroidConsumed(i) ? " (crashed on an Asteroid)" : ""),
|
||||
buildingName(building, this.faction) + (this.isAsteroidConsumed(i) ? " (crashed on an Asteroid)" : ""),
|
||||
`Cost: ${cost}${isolatedCost}`,
|
||||
income,
|
||||
`Power Value: ${this.player.buildingValue(null, { building })}`,
|
||||
|
|
@ -203,10 +181,6 @@ export default class BuildingGroup extends Vue {
|
|||
return rows.filter((r) => r).join("<br/>");
|
||||
}
|
||||
|
||||
get destroyedTooltip() {
|
||||
return `Destroyed ${buildingName(this.building, this.faction)}s`;
|
||||
}
|
||||
|
||||
get offset() {
|
||||
return this.resource.length == 0 ? 0.2 : 1.4;
|
||||
}
|
||||
|
|
@ -225,8 +199,6 @@ export default class BuildingGroup extends Vue {
|
|||
minWidth = 3;
|
||||
} else if (this.building === BuildingEnum.PlanetaryInstitute) {
|
||||
minWidth = this.incomeTypes;
|
||||
} else if (isShip(this.building)) {
|
||||
minWidth = 3.6;
|
||||
}
|
||||
return Math.max(this.nBuildings, minWidth) * this.buildingSpacing + this.offset + this.paddingRight;
|
||||
}
|
||||
|
|
@ -260,10 +232,6 @@ export default class BuildingGroup extends Vue {
|
|||
return i >= this.placed + this.gaia + this.asteroidConsumed;
|
||||
}
|
||||
|
||||
isDeployed(i: number): boolean {
|
||||
return i < this.deployed;
|
||||
}
|
||||
|
||||
isAsteroidConsumed(i: number): boolean {
|
||||
if (this.building !== BuildingEnum.GaiaFormer) {
|
||||
return false;
|
||||
|
|
@ -382,11 +350,6 @@ export default class BuildingGroup extends Vue {
|
|||
fill: var(--recent);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.destroyed {
|
||||
fill: red;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -147,14 +147,10 @@
|
|||
<text class="board-text" transform="scale(0.7)">+{{ income("q") }}</text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
v-for="i in researchFields"
|
||||
:key="i"
|
||||
:transform="`translate(${(i * 2 + -1.4) * (isFrontiers ? 0.85 : 1)},3.5) scale(1)`"
|
||||
>
|
||||
<g v-for="i in researchFields" :key="i" :transform="`translate(${(i * 2 + -1.4) * 1},3.5) scale(1)`">
|
||||
<polygon
|
||||
points="-7.5,3 -3,7.5 3,7.5 7.5,3 7.5,-3 3,-7.5 -3,-7.5 -7.5,-3"
|
||||
:transform="`scale(${isFrontiers ? 0.085 : 0.1})`"
|
||||
:transform="`scale(0.1)`"
|
||||
:class="['board-info', 'research-tile', researchClass(i - 1)]"
|
||||
:style="`fill: ${researchStyle(i - 1).backgroundColor}`"
|
||||
/>
|
||||
|
|
@ -168,9 +164,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Engine, {
|
||||
Expansion,
|
||||
Faction,
|
||||
hasExpansion,
|
||||
MAX_SATELLITES,
|
||||
Player,
|
||||
PlayerData,
|
||||
|
|
@ -220,10 +214,6 @@ export default class PlayerBoardInfo extends Vue {
|
|||
return this.$store.state.data;
|
||||
}
|
||||
|
||||
get isFrontiers() {
|
||||
return hasExpansion(this.engine.expansions, Expansion.Frontiers);
|
||||
}
|
||||
|
||||
get researchFields(): number {
|
||||
return ResearchField.values(this.engine.expansions).length;
|
||||
}
|
||||
|
|
@ -261,7 +251,6 @@ export default class PlayerBoardInfo extends Vue {
|
|||
"<li>Click on the sectors icon to highlight all colonized sectors (also works for other players)</li>" +
|
||||
"<li>Click on the federation icon to highlight all federation (also works for other players)</li>" +
|
||||
"<li>Click on the network icon (right of power bowl) to leech network - how much power can be gained if other players upgrade buildings</li>" +
|
||||
(this.isFrontiers ? "<li>Click on the trade bonus or cost icons to see the trade rewards table</li>" : "") +
|
||||
"</ul>"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,24 +52,6 @@
|
|||
:resource="['q']"
|
||||
:reveal-income="preview"
|
||||
/>
|
||||
<BuildingGroup
|
||||
v-if="isFrontiers"
|
||||
transform="translate(21, 10.7) scale(1.65)"
|
||||
:nBuildings="3"
|
||||
building="colony"
|
||||
:player="player"
|
||||
:placed="playerData.buildings.colony"
|
||||
:resource="[]"
|
||||
/>
|
||||
<BuildingGroup
|
||||
v-if="isFrontiers"
|
||||
transform="translate(13.47, 20.57) scale(.6)"
|
||||
:nBuildings="5"
|
||||
building="customsPost"
|
||||
:player="player"
|
||||
:placed="playerData.buildings.customsPost"
|
||||
:resource="[]"
|
||||
/>
|
||||
<BuildingGroup
|
||||
transform="translate(0, 13)"
|
||||
:nBuildings="4"
|
||||
|
|
@ -126,42 +108,9 @@
|
|||
kind="r"
|
||||
:tooltip="rangeTooltip"
|
||||
:count="playerRange"
|
||||
:transform="`translate(35.5,${isFrontiers ? 0.3 : 1}) scale(0.1)`"
|
||||
:transform="`translate(35.5,1) scale(0.1)`"
|
||||
style="opacity: 0.7"
|
||||
/>
|
||||
<Resource
|
||||
v-if="isFrontiers"
|
||||
kind="ship-range"
|
||||
tooltip="Ship Range"
|
||||
:count="playerData.shipRange"
|
||||
transform="translate(35.5,1.5) scale(0.1)"
|
||||
style="opacity: 0.7"
|
||||
/>
|
||||
<g transform="translate(35.5,3.2) scale(0.1)">
|
||||
<Resource v-if="isFrontiers" kind="tradeBonus" :count="playerData.tradeBonus" style="opacity: 0.7" />
|
||||
<circle
|
||||
r="10"
|
||||
style="opacity: 0"
|
||||
v-b-modal.modal-center="'trade'"
|
||||
role="button"
|
||||
v-b-tooltip.hover="'Trade Bonus'"
|
||||
/>
|
||||
</g>
|
||||
<g transform="translate(37.3,3.2) scale(0.1)">
|
||||
<Resource
|
||||
v-if="isFrontiers"
|
||||
kind="tradeDiscount"
|
||||
:count="playerData.tradeCost().count"
|
||||
style="opacity: 0.7"
|
||||
/>
|
||||
<circle
|
||||
r="10"
|
||||
style="opacity: 0"
|
||||
v-b-modal.modal-center="'trade'"
|
||||
role="button"
|
||||
v-b-tooltip.hover="'Trading Cost in pw'"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<BuildingGroup
|
||||
transform="translate(21, 1.2)"
|
||||
|
|
@ -188,21 +137,6 @@
|
|||
/>
|
||||
</g>
|
||||
|
||||
<g transform="translate(0, 18.5) scale(0.7)" v-if="isFrontiers">
|
||||
<BuildingGroup
|
||||
v-for="s in ships"
|
||||
:key="s"
|
||||
:transform="shipPositions[s]"
|
||||
:nBuildings="s === 'tradeShip' ? playerData.tradeShips : 3"
|
||||
:destroyed="playerData.destroyedShips[s]"
|
||||
:deployed="playerData.deployedShips[s]"
|
||||
:building="s"
|
||||
:player="player"
|
||||
:placed="playerData.buildings[s]"
|
||||
:resource="[]"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<PowerBowls :transform="`translate(30,${height - 7})`" :player="player" :data="playerData" />
|
||||
|
||||
<g transform="translate(29.3, 4.7) scale(0.9) translate(0, 1)">
|
||||
|
|
@ -320,7 +254,6 @@
|
|||
<script lang="ts">
|
||||
import Engine, {
|
||||
ArtifactToken,
|
||||
Building,
|
||||
effectiveRange,
|
||||
Expansion,
|
||||
factionPlanet,
|
||||
|
|
@ -650,10 +583,6 @@ export default class PlayerInfo extends Vue {
|
|||
return (this.player.ownedPlanetsCount.l ?? 0) > 0;
|
||||
}
|
||||
|
||||
get isFrontiers() {
|
||||
return hasExpansion(this.engine.expansions, Expansion.Frontiers);
|
||||
}
|
||||
|
||||
get isLostFleet() {
|
||||
return hasExpansion(this.engine.expansions, Expansion.LostFleet);
|
||||
}
|
||||
|
|
@ -699,23 +628,7 @@ export default class PlayerInfo extends Vue {
|
|||
}
|
||||
|
||||
get height() {
|
||||
return this.isFrontiers ? "26.2" : "21.4";
|
||||
}
|
||||
|
||||
get ships(): Building[] {
|
||||
return Building.ships();
|
||||
}
|
||||
|
||||
get shipPositions() {
|
||||
return {
|
||||
[Building.ColonyShip]: "translate(0, 0)",
|
||||
[Building.ConstructionShip]: "translate(8.5, 0)",
|
||||
[Building.ResearchShip]: "translate(17, 0)",
|
||||
[Building.TradeShip]: "translate(25.5, 0)",
|
||||
[Building.Scout]: "translate(0, 3)",
|
||||
[Building.Frigate]: "translate(8.5, 3)",
|
||||
[Building.BattleShip]: "translate(17, 3)",
|
||||
};
|
||||
return "21.4";
|
||||
}
|
||||
|
||||
togglePlanetHighlight(planet: Planet) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<Resource
|
||||
v-for="(resource, i) in resources"
|
||||
:key="'field-' + i"
|
||||
:transform="`translate(${2 + 56 / 2 + resourceX(i)}, ${resourceY(i)}) scale(${scale(resource.type)})`"
|
||||
:transform="`translate(${2 + 56 / 2 + resourceX(i)}, ${resourceY(i)}) scale(1)`"
|
||||
:kind="resource.type"
|
||||
:count="resource.count"
|
||||
/>
|
||||
|
|
@ -61,16 +61,13 @@ import Engine, {
|
|||
canTakeAdvancedTechTile,
|
||||
Condition,
|
||||
Event,
|
||||
Expansion,
|
||||
Federation,
|
||||
hasExpansion,
|
||||
Operator,
|
||||
Planet as PlanetEnum,
|
||||
Player,
|
||||
PlayerEnum,
|
||||
researchEvents,
|
||||
ResearchField,
|
||||
Resource as ResourceEnum,
|
||||
} from "@gaia-project/engine";
|
||||
import Vue from "vue";
|
||||
import { Component, Prop } from "vue-property-decorator";
|
||||
|
|
@ -104,33 +101,15 @@ export default class ResearchTile extends Vue {
|
|||
|
||||
resourceX(index: number) {
|
||||
const res = this.resources;
|
||||
const range = this.smallRange(res[0].type);
|
||||
|
||||
let l = res.length;
|
||||
if (range) {
|
||||
l = 1;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
const l = res.length;
|
||||
const sep = l <= 2 ? 7 : 6;
|
||||
|
||||
return -6 * (l - 1) + index * 2 * sep - ((res[0].count as any) === "+" ? 2 : 0);
|
||||
}
|
||||
|
||||
resourceY(index: number): number {
|
||||
const range = this.smallRange(this.resources[0].type);
|
||||
return (this.height / 3) * 2 + 3 + this.resourceOffset + (range ? (index - 0.4) * 10 : 0);
|
||||
}
|
||||
|
||||
scale(resource: ResourceEnum): number {
|
||||
return this.smallRange(resource) ? 0.8 : 1;
|
||||
}
|
||||
|
||||
smallRange(resource: ResourceEnum): boolean {
|
||||
return (
|
||||
(resource === ResourceEnum.ShipRange || resource === ResourceEnum.Range) &&
|
||||
hasExpansion(this.engine.expansions, Expansion.Frontiers)
|
||||
);
|
||||
return (this.height / 3) * 2 + 3 + this.resourceOffset;
|
||||
}
|
||||
|
||||
tokenX(index: PlayerEnum) {
|
||||
|
|
@ -295,10 +274,6 @@ svg {
|
|||
fill: var(--rt-sci);
|
||||
}
|
||||
|
||||
&.dip {
|
||||
fill: var(--rt-dip);
|
||||
}
|
||||
|
||||
&.terra {
|
||||
fill: var(--rt-terra);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,18 +7,6 @@
|
|||
<!-- <rect v-if="kind="='q'"" class="qic" width="14" height="14" x="-7" y="-7" /> -->
|
||||
<rect v-else-if="kind === 'o'" class="ore" width="14" height="14" x="-7" y="-7" />
|
||||
<rect v-else-if="kind === 'c'" class="credit" width="16" height="16" ry="8" rx="8" x="-8" y="-8" />
|
||||
<rect v-else-if="kind === 'tradeBonus'" class="trade-bonus" width="16" height="16" ry="8" rx="8" x="-8" y="-8" />
|
||||
<rect
|
||||
v-else-if="kind === 'tradeDiscount'"
|
||||
class="trade-discount"
|
||||
width="16"
|
||||
height="16"
|
||||
ry="8"
|
||||
rx="8"
|
||||
x="-8"
|
||||
y="-8"
|
||||
/>
|
||||
<rect v-else-if="kind === 'tradeShip'" class="trade-ship" width="16" height="16" ry="8" rx="8" x="-8" y="-8" />
|
||||
<rect
|
||||
v-else-if="['tg', 't->tg', 'tg->t'].includes(kind)"
|
||||
class="gaia"
|
||||
|
|
@ -162,30 +150,6 @@
|
|||
{{ count }}
|
||||
</text>
|
||||
</template>
|
||||
<template v-else-if="kind === 'ship-range'">
|
||||
<g transform="scale(1) translate(-13,0)">
|
||||
<image xlink:href="../assets/resources/flat-hex.svg" :height="(162 / 328) * 20" width="20" x="-10" y="-4" />
|
||||
</g>
|
||||
<g transform="scale(1) translate(13,0)">
|
||||
<image xlink:href="../assets/resources/flat-hex.svg" :height="(162 / 328) * 20" width="20" x="-10" y="-4" />
|
||||
</g>
|
||||
<g transform="translate(1,0) rotate(70)">
|
||||
<image xlink:href="../assets/resources/range-arrow.svg" :height="(285 / 164) * 9" width="10" x="-5" y="-8" />
|
||||
</g>
|
||||
<text v-if="count >= 1" x="13" y="1.2" fill="black" stroke-width="0.3" style="font-weight: bold; font-size: 10px">
|
||||
{{ count }}
|
||||
</text>
|
||||
<text
|
||||
v-if="count >= 1"
|
||||
x="-13"
|
||||
y="1.2"
|
||||
fill="black"
|
||||
stroke-width="0.3"
|
||||
style="font-weight: bold; font-size: 10px"
|
||||
>
|
||||
S
|
||||
</text>
|
||||
</template>
|
||||
<template v-else-if="kind === 'up-lowest'">
|
||||
<Condition condition="a" transform="scale(0.75)" />
|
||||
<Token faction="bescods" transform="scale(0.15) translate(50,-24)" />
|
||||
|
|
@ -228,11 +192,8 @@
|
|||
'q',
|
||||
'gf',
|
||||
'gf->t',
|
||||
'tradeShip',
|
||||
].includes(kind)) ||
|
||||
count === '+' ||
|
||||
kind === 'tradeBonus' ||
|
||||
kind === 'tradeDiscount'
|
||||
count === '+'
|
||||
"
|
||||
:class="{ plus: count === '+', overdrawn: typeof count === 'number' && count < 0 }"
|
||||
:text-decoration="kind === 'burn-token' ? 'line-through' : ''"
|
||||
|
|
@ -359,18 +320,6 @@ g.resource {
|
|||
fill: var(--gaia);
|
||||
}
|
||||
|
||||
.trade-bonus {
|
||||
fill: var(--current-round);
|
||||
}
|
||||
|
||||
.trade-discount {
|
||||
fill: var(--oxide);
|
||||
}
|
||||
|
||||
.trade-ship {
|
||||
fill: var(--volcanic);
|
||||
}
|
||||
|
||||
.ore,
|
||||
.credit,
|
||||
.building.r {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
<b-dropdown size="sm" class="mr-2 mb-2" text="Type">
|
||||
<b-dropdown-item @click="selectRule('rules')">Rules</b-dropdown-item>
|
||||
<b-dropdown-item @click="selectRule('scoring')">Final Scoring</b-dropdown-item>
|
||||
<b-dropdown-item v-if="isFrontiers" @click="selectRule('trade')">Trade Rewards</b-dropdown-item>
|
||||
<b-dropdown-divider />
|
||||
<b-dropdown-item
|
||||
v-for="(f, i) in factions"
|
||||
|
|
@ -19,7 +18,6 @@
|
|||
<h4>
|
||||
<div v-text="'Final Scoring'" v-if="rule === 'scoring'" />
|
||||
<div v-text="'Rules'" v-else-if="rule === 'rules'" />
|
||||
<div v-text="'Trade Rewards'" v-else-if="rule === 'trade'" />
|
||||
<div v-text="factionName(this.rule)" v-else />
|
||||
</h4>
|
||||
</div>
|
||||
|
|
@ -41,27 +39,6 @@
|
|||
<b-checkbox :checked="data.value" disabled />
|
||||
</template>
|
||||
</b-table-lite>
|
||||
<div v-else-if="rule === 'trade'">
|
||||
<table class="table-bordered">
|
||||
<thead>
|
||||
<td v-for="(h, i) in tradeHeaders" :key="i" class="trade header">
|
||||
<b>{{ h }}</b>
|
||||
</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, i) in tradeRows" :key="i">
|
||||
<td v-for="(c, j) in row.cells" :key="j" class="trade" :style="row.style">
|
||||
<RichTextView :content="c" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<span
|
||||
>*: You get an additional 1k for each research track where the Academy owner is more advanced than you, except
|
||||
for the first 2 (e.g. 2k if the Academy owner has Science 2, Terraforming 3, Gaia Forming 4, and Economy 1,
|
||||
but your advancements are 1, 2, 2, and 0, respectively).</span
|
||||
>
|
||||
</div>
|
||||
<div v-else-if="rule === 'rules'">
|
||||
<ul>
|
||||
<li>
|
||||
|
|
@ -70,9 +47,6 @@
|
|||
>Rules for the base game</a
|
||||
>
|
||||
</li>
|
||||
<li v-if="isFrontiers">
|
||||
<a href="https://www.boardgamers.space/page/gaia-project/frontiers">Rules for the Frontiers expansion</a>
|
||||
</li>
|
||||
<li><a href="https://www.boardgamers.space/page/gaia-project/changes">Changes</a></li>
|
||||
<li><a href="https://www.boardgamers.space/page/gaia-project/auction">Rules for auction</a></li>
|
||||
<li><a href="https://www.boardgamers.space/page/gaia-project/settings">Game settings</a></li>
|
||||
|
|
@ -92,17 +66,21 @@
|
|||
import type { FactionBoardRaw } from "@gaia-project/engine/src/faction-boards";
|
||||
import { factionName } from "../data/factions";
|
||||
|
||||
import Engine, { Expansion, Faction, factionVariantBoard, hasExpansion } from "@gaia-project/engine";
|
||||
import Engine, { Faction, factionVariantBoard } from "@gaia-project/engine";
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { factionColor, factionPiecePlanet, planetFill } from "../graphics/utils";
|
||||
import { finalScoringFields, finalScoringItems } from "../logic/final-scoring-rules";
|
||||
import { tradeHeaders, tradeRows } from "../logic/trade-rewards";
|
||||
import FactionInfoCard from "./FactionInfoCard.vue";
|
||||
import RichTextView from "./Resources/RichTextView.vue";
|
||||
|
||||
type Rule = Faction | "rules" | "scoring" | "trade";
|
||||
type Rule = Faction | "rules" | "scoring";
|
||||
@Component({
|
||||
components: { RichTextView, FactionInfoCard },
|
||||
components: {
|
||||
// Async on purpose: FactionInfoCard -> PlayerInfo -> Rules is a static import cycle, and
|
||||
// under ESM (vite dev / rolldown) the class decoration in this file evaluates while
|
||||
// FactionInfoCard's module is still mid-initialization ("Cannot access 'FactionInfoCard'
|
||||
// before initialization"). The card only renders once the modal is opened, so deferring its
|
||||
// module evaluation to first render breaks the cycle without any behavior change.
|
||||
FactionInfoCard: () => import("./FactionInfoCard.vue").then((m) => m.default),
|
||||
},
|
||||
})
|
||||
export default class Rules extends Vue {
|
||||
@Prop()
|
||||
|
|
@ -120,10 +98,6 @@ export default class Rules extends Vue {
|
|||
return this.$store.state.data;
|
||||
}
|
||||
|
||||
get isFrontiers(): boolean {
|
||||
return hasExpansion(this.engine.expansions, Expansion.Frontiers);
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.finalScoringFields = finalScoringFields();
|
||||
this.finalScoringItems = finalScoringItems();
|
||||
|
|
@ -131,14 +105,6 @@ export default class Rules extends Vue {
|
|||
this.selectRule(this.type ?? "rules");
|
||||
}
|
||||
|
||||
get tradeHeaders() {
|
||||
return tradeHeaders();
|
||||
}
|
||||
|
||||
get tradeRows() {
|
||||
return tradeRows();
|
||||
}
|
||||
|
||||
selectRule(rule: Rule) {
|
||||
this.rule = rule;
|
||||
}
|
||||
|
|
@ -181,13 +147,4 @@ footer.rules .btn-secondary {
|
|||
.rule-table th > div {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.trade {
|
||||
padding: 4px;
|
||||
|
||||
&.header {
|
||||
background: var(--rt-dip);
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -97,28 +97,6 @@
|
|||
:flat="flat"
|
||||
outline
|
||||
/>
|
||||
<Building
|
||||
v-for="(s, i) in ships"
|
||||
:key="`b-${i}`"
|
||||
:building="s.type"
|
||||
:ship-moved="s.moved"
|
||||
:faction="faction(s.player)"
|
||||
outline
|
||||
:flat="flat"
|
||||
:transform="shipTransform(i)"
|
||||
/>
|
||||
<Building
|
||||
v-for="(p, i) in hex.customPosts"
|
||||
:key="`cp-${i}`"
|
||||
building="customsPost"
|
||||
:faction="faction(p)"
|
||||
outline
|
||||
:flat="flat"
|
||||
:transform="radiusTransform(p, 0.05)"
|
||||
/>
|
||||
<g v-for="(p, i) in hex.tradeTokens" :key="`tt-${i}`">
|
||||
<Planet :planet="playerPlanet(p)" :transform="radiusTransform(p, 0.35)" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</template>
|
||||
|
|
@ -135,10 +113,8 @@ import Engine, {
|
|||
Player,
|
||||
PlayerEnum,
|
||||
Reward,
|
||||
shipsInHex,
|
||||
Spaceship,
|
||||
} from "@gaia-project/engine";
|
||||
import type { Ship } from "@gaia-project/engine/src/enums";
|
||||
import { max } from "lodash";
|
||||
import Vue from "vue";
|
||||
import { Component, Prop } from "vue-property-decorator";
|
||||
|
|
@ -158,7 +134,7 @@ import { factionPiecePlanet } from "../graphics/utils";
|
|||
import { isFree } from "../logic/buttons/utils";
|
||||
import type { CommandObject } from "../logic/recent";
|
||||
import { hexMoveLabel } from "../logic/recent";
|
||||
import { leechPlanets, radiusTranslate, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
|
||||
import { leechPlanets, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
|
||||
import Building from "./Building.vue";
|
||||
import Planet from "./Planet.vue";
|
||||
|
||||
|
|
@ -193,21 +169,6 @@ export default class SpaceHex extends Vue {
|
|||
@Prop({ default: 0 })
|
||||
contentRotation: number;
|
||||
|
||||
shipTransform(index: number): string {
|
||||
switch (this.ships.length) {
|
||||
case 1:
|
||||
return "scale(0.1)";
|
||||
case 2:
|
||||
return `scale(0.07) ${radiusTranslate(5.8, 2 * index + 1, 4)}`;
|
||||
default:
|
||||
return `scale(0.06) ${radiusTranslate(7.5, index, this.ships.length)}`;
|
||||
}
|
||||
}
|
||||
|
||||
radiusTransform(index: number, scale: number): string {
|
||||
return `scale(${scale}) ${radiusTranslate(0.63 / scale, index, 7)}`;
|
||||
}
|
||||
|
||||
get hexCorners() {
|
||||
return corners();
|
||||
}
|
||||
|
|
@ -220,21 +181,6 @@ export default class SpaceHex extends Vue {
|
|||
return this.engine.map;
|
||||
}
|
||||
|
||||
get ships(): Ship[] {
|
||||
let firstHidden = false;
|
||||
return shipsInHex(this.hex.toString(), this.engine).filter((s) => {
|
||||
if (firstHidden) {
|
||||
return true;
|
||||
}
|
||||
const b = this.hideBuilding;
|
||||
const hide = b && b.building == s.type && b.player == s.player;
|
||||
if (hide) {
|
||||
firstHidden = true;
|
||||
}
|
||||
return !hide;
|
||||
});
|
||||
}
|
||||
|
||||
private get engine(): Engine {
|
||||
return this.$store.state.data;
|
||||
}
|
||||
|
|
@ -564,9 +510,6 @@ export default class SpaceHex extends Vue {
|
|||
highlightHex?.building ? `Build ${buildingData[highlightHex.building].name} for ${c}` : `Cost: ${c}`
|
||||
);
|
||||
}
|
||||
if (highlightHex?.tradeCost) {
|
||||
messages.push(`Trade Cost: ${highlightHex.tradeCost}`);
|
||||
}
|
||||
if (highlightHex?.rewards) {
|
||||
messages.push(`Reward: ${highlightHex.rewards}`);
|
||||
}
|
||||
|
|
@ -587,20 +530,12 @@ export default class SpaceHex extends Vue {
|
|||
};
|
||||
|
||||
const buildings: string[] = [];
|
||||
let ships: string[] = [];
|
||||
if (data.building) {
|
||||
buildings.push(buildingLabel(this.player(data.player), data.building));
|
||||
if (data.additionalMine != null) {
|
||||
buildings.push(buildingLabel(this.player(data.additionalMine), BuildingEnum.Mine));
|
||||
}
|
||||
} else if (this.ships) {
|
||||
ships = this.ships.map((s) => {
|
||||
const faction = this.player(s.player).faction;
|
||||
return `${buildingName(s.type, faction)} (${factionName(faction)})`;
|
||||
});
|
||||
}
|
||||
buildings.push(...hex.customPosts.map((p) => buildingLabel(this.player(p), BuildingEnum.CustomsPost)));
|
||||
buildings.push(...hex.tradeTokens.map((p) => `Traded: ${factionName(this.player(p).faction)}`));
|
||||
const w = this.warning(hex, true);
|
||||
if (w) {
|
||||
messages.push(`Warning: ${w}`);
|
||||
|
|
@ -610,7 +545,7 @@ export default class SpaceHex extends Vue {
|
|||
const spaceship = this.lostFleetSpaceship
|
||||
? `Lost Fleet spaceship: ${this.lostFleetSpaceshipNames[this.lostFleetSpaceship]}`
|
||||
: null;
|
||||
return [coord, sector, spaceship, planet].concat(buildings).concat(ships).concat(messages).join(" ");
|
||||
return [coord, sector, spaceship, planet].concat(buildings).concat(messages).join(" ");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -287,9 +287,6 @@ svg {
|
|||
&.sci .tech-border {
|
||||
fill: var(--rt-sci);
|
||||
}
|
||||
&.dip .tech-border {
|
||||
fill: var(--rt-dip);
|
||||
}
|
||||
&.terra .tech-border {
|
||||
fill: var(--rt-terra);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,17 +71,6 @@
|
|||
y="-50"
|
||||
/>
|
||||
</g>
|
||||
|
||||
<g :key="'colony-' + faction" :id="'colony-' + faction">
|
||||
<image
|
||||
xlink:href="../../assets/buildings/colony.svg"
|
||||
:filter="faction ? `url(#color-${faction})` : ''"
|
||||
width="80"
|
||||
:height="(335 / 543) * 80"
|
||||
x="-40"
|
||||
y="-20"
|
||||
/>
|
||||
</g>
|
||||
</template>
|
||||
</defs>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { AvailableBuilding } from "@gaia-project/engine";
|
||||
import { Building, Building as BuildingEnum, Expansion, Faction, isShip, ShipAction } from "@gaia-project/engine";
|
||||
import { Building, Expansion, Faction } from "@gaia-project/engine";
|
||||
import { colorCodes } from "../logic/color-codes";
|
||||
|
||||
export const buildingData: { [key in Building]: { name: string; color: string } } = {
|
||||
|
|
@ -35,42 +35,6 @@ export const buildingData: { [key in Building]: { name: string; color: string }
|
|||
name: "Space Station",
|
||||
color: "--current-round",
|
||||
},
|
||||
[Building.Colony]: {
|
||||
name: "Colony",
|
||||
color: "--rt-nav",
|
||||
},
|
||||
[Building.CustomsPost]: {
|
||||
name: "Customs Post",
|
||||
color: "--res-credit",
|
||||
},
|
||||
[Building.ColonyShip]: {
|
||||
name: "Colony Ship",
|
||||
color: "--rt-gaia",
|
||||
},
|
||||
[Building.ConstructionShip]: {
|
||||
name: "Construction Ship",
|
||||
color: "--current-round",
|
||||
},
|
||||
[Building.ResearchShip]: {
|
||||
name: "Research Ship",
|
||||
color: "--current-round",
|
||||
},
|
||||
[Building.TradeShip]: {
|
||||
name: "Trade Ship",
|
||||
color: colorCodes.tradeShip.color,
|
||||
},
|
||||
[Building.Scout]: {
|
||||
name: "Scout",
|
||||
color: "--current-round",
|
||||
},
|
||||
[Building.Frigate]: {
|
||||
name: "Frigate",
|
||||
color: "--current-round",
|
||||
},
|
||||
[Building.BattleShip]: {
|
||||
name: "Battle Ship",
|
||||
color: "--current-round",
|
||||
},
|
||||
};
|
||||
|
||||
export function allBuildings(expansion: Expansion, gaiaFormer: boolean) {
|
||||
|
|
@ -86,40 +50,7 @@ export function buildingName(building: Building, faction: Faction): string {
|
|||
return buildingData[building].name;
|
||||
}
|
||||
|
||||
export function shipLetter(building: BuildingEnum): string {
|
||||
switch (building) {
|
||||
case BuildingEnum.ColonyShip:
|
||||
return "L";
|
||||
case BuildingEnum.TradeShip:
|
||||
return "T";
|
||||
case BuildingEnum.ConstructionShip:
|
||||
return "C";
|
||||
case BuildingEnum.ResearchShip:
|
||||
return "R";
|
||||
case BuildingEnum.Scout:
|
||||
return "S";
|
||||
case BuildingEnum.Frigate:
|
||||
return "F";
|
||||
case BuildingEnum.BattleShip:
|
||||
return "B";
|
||||
}
|
||||
}
|
||||
|
||||
export function shipActionName(action: ShipAction): string {
|
||||
switch (action) {
|
||||
case ShipAction.Nothing:
|
||||
return "<u>D</u>ecline";
|
||||
case ShipAction.BuildColony:
|
||||
return "Build <u>C</u>olony";
|
||||
case ShipAction.Trade:
|
||||
return "<u>T</u>rade";
|
||||
}
|
||||
}
|
||||
|
||||
export function buildingShortcut(building: Building, faction?: Faction): string {
|
||||
if (isShip(building)) {
|
||||
return shipLetter(building).toLowerCase();
|
||||
}
|
||||
switch (building) {
|
||||
case Building.Mine:
|
||||
return "m";
|
||||
|
|
@ -143,10 +74,6 @@ export function buildingShortcut(building: Building, faction?: Faction): string
|
|||
return "g";
|
||||
case Building.SpaceStation:
|
||||
return colorCodes.spaceStation.shortcut;
|
||||
case Building.Colony:
|
||||
return "c";
|
||||
case Building.CustomsPost:
|
||||
return "u";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ const conditionsTrigger: { [key in Condition]?: string } = {
|
|||
[Condition.MineOnGaia]: "building a mine on a gaia planet",
|
||||
[Condition.AdvanceResearch]: "advancing a level in research",
|
||||
[Condition.TerraformStep]: "terraforming a planet one step",
|
||||
[Condition.Trade]: "trading (afterwards)",
|
||||
[Condition.SpaceshipQicAction]: "taking a spaceship Q.I.C. action",
|
||||
[Condition.NewSector]:
|
||||
"building a mine in a Space or Deep Space sector you had not colonized before (Interspace doesn't count)",
|
||||
|
|
@ -76,17 +75,9 @@ function rewardDesc(rewards: Reward[], long: boolean) {
|
|||
|
||||
export function eventDesc(event: Event, expansion: Expansion, long = false): string {
|
||||
const op = event.operator;
|
||||
const operatorString =
|
||||
op == Operator.FourPowerBuildings && expansion == Expansion.Frontiers
|
||||
? "Planetary institutes, academies, and colonies have a power value of 4, when forming federations and charging power."
|
||||
: operators[op];
|
||||
const colony = event.condition === Condition.BigBuilding && expansion == Expansion.Frontiers;
|
||||
const cond = colony
|
||||
? "planetary institute, academy, or colony"
|
||||
: conditionsCount[event.condition as keyof typeof conditionsCount];
|
||||
const trigger = colony
|
||||
? "building a planetary institute, academy, or colony"
|
||||
: conditionsTrigger[event.condition as keyof typeof conditionsTrigger];
|
||||
const operatorString = operators[op];
|
||||
const cond = conditionsCount[event.condition as keyof typeof conditionsCount];
|
||||
const trigger = conditionsTrigger[event.condition as keyof typeof conditionsTrigger];
|
||||
const conditionString = op === Operator.Trigger ? trigger + "," : cond && "for each " + cond + ",";
|
||||
const rewardString = event.rewards.length === 0 ? "" : rewardDesc(event.rewards, long);
|
||||
|
||||
|
|
@ -101,14 +92,8 @@ export function eventDescForCounters(event: Event, expansions: Expansion, long:
|
|||
return `Each terraforming step costs you ${TERRAFORMING_COST - value} ore`;
|
||||
case Resource.Range:
|
||||
return `Your basic range is ${value}`;
|
||||
case Resource.ShipRange:
|
||||
return `Your ship range is ${value}`;
|
||||
case Resource.MoveTokenToGaiaArea:
|
||||
return `To start a Gaia project, you must move ${value} power tokens to your Gaia area`;
|
||||
case Resource.TradeBonus:
|
||||
return `Your trade bonus level is ${value}`;
|
||||
case Resource.TradeDiscount:
|
||||
return `Trading costs ${value} power`;
|
||||
}
|
||||
|
||||
return eventDesc(event, expansions, long);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {
|
|||
FactionBoard,
|
||||
factionBoard,
|
||||
factionPlanet,
|
||||
isShip,
|
||||
Operator,
|
||||
Planet,
|
||||
Player,
|
||||
|
|
@ -228,7 +227,7 @@ export function buildingDesc(b: Building, faction: Faction, board: FactionBoard,
|
|||
return (
|
||||
(player && b === Building.GaiaFormer
|
||||
? cost.toString().replace(String(GAIA_FORMER_COST), String(GAIA_FORMER_COST - player.data.gaiaFormingDiscount()))
|
||||
: cost) + (b === Building.GaiaFormer || isShip(b) ? "" : income)
|
||||
: cost) + (b === Building.GaiaFormer ? "" : income)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ export interface ButtonData {
|
|||
|
||||
export type HighlightHex = {
|
||||
cost?: string;
|
||||
tradeCost?: string;
|
||||
rewards?: string;
|
||||
warnings?: WarningWithKey[];
|
||||
building?: Building;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import Engine, { Event, Expansion, Player, researchEvents, ResearchField, Resource } from "@gaia-project/engine";
|
||||
import Engine, { Event, Player, researchEvents, ResearchField, Resource } from "@gaia-project/engine";
|
||||
import { GAIA_FORMER_COST } from "@gaia-project/engine/src/faction-boards/types";
|
||||
import type { CellStyle } from "../graphics/colors";
|
||||
import { staticCellStyle } from "../graphics/colors";
|
||||
|
|
@ -11,11 +11,9 @@ export const researchData: { [key in ResearchField]: { name: string; shortcut: s
|
|||
[ResearchField.GaiaProject]: { name: "Gaia Project", shortcut: "g" },
|
||||
[ResearchField.Economy]: { name: "Economy", shortcut: "e" },
|
||||
[ResearchField.Science]: { name: "Science", shortcut: "s" },
|
||||
[ResearchField.Diplomacy]: { name: "Diplomacy", shortcut: "p" },
|
||||
};
|
||||
|
||||
type ResearchEffectCounter = {
|
||||
expansion?: Expansion;
|
||||
field: ResearchField;
|
||||
minLevel?: number;
|
||||
from: Resource;
|
||||
|
|
@ -35,18 +33,6 @@ const researchEffectCounters: ResearchEffectCounter[] = [
|
|||
from: Resource.Range,
|
||||
currentValue: (p) => p.data.range,
|
||||
},
|
||||
{
|
||||
expansion: Expansion.Frontiers,
|
||||
field: ResearchField.Navigation,
|
||||
from: Resource.ShipRange,
|
||||
currentValue: (p) => p.data.shipRange,
|
||||
},
|
||||
{
|
||||
expansion: Expansion.Frontiers,
|
||||
field: ResearchField.Economy,
|
||||
from: Resource.TradeShip,
|
||||
currentValue: (p) => p.data.tradeShips,
|
||||
},
|
||||
{
|
||||
field: ResearchField.GaiaProject,
|
||||
minLevel: 1,
|
||||
|
|
@ -54,26 +40,12 @@ const researchEffectCounters: ResearchEffectCounter[] = [
|
|||
to: Resource.MoveTokenToGaiaArea,
|
||||
currentValue: (p) => GAIA_FORMER_COST - p.data.gaiaFormingDiscount(),
|
||||
},
|
||||
{
|
||||
expansion: Expansion.Frontiers,
|
||||
field: ResearchField.Diplomacy,
|
||||
from: Resource.TradeBonus,
|
||||
currentValue: (p) => p.data.tradeBonus,
|
||||
},
|
||||
{
|
||||
expansion: Expansion.Frontiers,
|
||||
field: ResearchField.Diplomacy,
|
||||
from: Resource.TradeDiscount,
|
||||
currentValue: (p) => p.data.tradeCost().count,
|
||||
},
|
||||
];
|
||||
|
||||
export function researchEventsWithCounters(engine: Engine, field: ResearchField, level: number): Event[] {
|
||||
let events = researchEvents(field, level, engine.expansions, engine.lostFleetEconomySide);
|
||||
|
||||
const counters = researchEffectCounters.filter(
|
||||
(c) => c.field == field && (c.expansion == null || c.expansion == engine.expansions)
|
||||
);
|
||||
const counters = researchEffectCounters.filter((c) => c.field == field);
|
||||
|
||||
const p = new Player();
|
||||
|
||||
|
|
|
|||
|
|
@ -137,10 +137,6 @@ export const resourceData: { [key in Resource]?: ResourceName } = {
|
|||
shortcut: "d",
|
||||
color: "--titanium",
|
||||
},
|
||||
[Resource.TradeShip]: colorCodes.tradeShip.add({
|
||||
label: "Trade Ship",
|
||||
plural: "Trade Ships",
|
||||
}),
|
||||
[Resource.PowerRing]: {
|
||||
label: "Power Ring",
|
||||
plural: "Power Rings",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ export const baseTechTileData: {
|
|||
[TechTile.Tech7]: colorCodes.gaia.add({ name: "3 VP / build mine on gaia" }),
|
||||
[TechTile.Tech8]: { name: "4c income", color: "--res-credit", shortcut: "c" },
|
||||
[TechTile.Tech9]: { name: "4pw special action", color: "--res-power", shortcut: "p" },
|
||||
[TechTile.TechFrontiers1]: colorCodes.tradeShip.add({ name: "2c per trade" }),
|
||||
};
|
||||
|
||||
export const advancedTechTileData: {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,8 @@ const invertedForeground: string[] = [
|
|||
"--current-round",
|
||||
"--rt-terra",
|
||||
"--rt-nav",
|
||||
"--rt-dip",
|
||||
"--rt-int",
|
||||
"--rt-gaia",
|
||||
"--rt-dip",
|
||||
"--federation",
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Engine, {
|
|||
Command,
|
||||
Expansion,
|
||||
Faction,
|
||||
isShip,
|
||||
Planet,
|
||||
Player,
|
||||
Round,
|
||||
|
|
@ -25,10 +24,6 @@ import { confirmationButton, hexMap, isFree, symbolButton, textButton } from "./
|
|||
import { commonButtonWarning } from "./warnings";
|
||||
|
||||
function buildingMenu(building: Building, faction: Faction): { richText?: RichText; label: string } | null {
|
||||
if (isShip(building)) {
|
||||
return { label: "<u>B</u>uild Ship" };
|
||||
}
|
||||
|
||||
if (isAcademy(building)) {
|
||||
return { label: "Upgrade to A<u>c</u>ademy", richText: [richTextBuilding(Building.Academy1, faction, 1, true)] };
|
||||
}
|
||||
|
|
@ -76,12 +71,7 @@ function buildingLabel(
|
|||
} else if (bld.downgrade) {
|
||||
label = `Downgrade to ${name}`;
|
||||
rich.unshift(richText("Downgrade to"));
|
||||
} else if (
|
||||
isFree(bld.cost) ||
|
||||
building === Building.SpaceStation ||
|
||||
building === Building.GaiaFormer ||
|
||||
isShip(building)
|
||||
) {
|
||||
} else if (isFree(bld.cost) || building === Building.SpaceStation || building === Building.GaiaFormer) {
|
||||
label = `Place a ${name}`;
|
||||
}
|
||||
return { label, richText: rich };
|
||||
|
|
@ -104,7 +94,7 @@ function buildingButton(
|
|||
commandSuffix?: string
|
||||
) {
|
||||
const hexes = hexMap(engine, buildings, false);
|
||||
if (!upgrade && engine.round != Round.None && building != Building.SpaceStation && !isShip(building)) {
|
||||
if (!upgrade && engine.round != Round.None && building != Building.SpaceStation) {
|
||||
const map = engine.map;
|
||||
for (const hex of map.grid.values()) {
|
||||
if (hex.data.planet == Planet.Empty) {
|
||||
|
|
@ -123,7 +113,7 @@ function buildingButton(
|
|||
shortcuts: shortcut ? [shortcut] : [],
|
||||
command,
|
||||
hexes,
|
||||
smartAutoClick: !isShip(building),
|
||||
smartAutoClick: true,
|
||||
}),
|
||||
() => textButton({ buttons: confirm }),
|
||||
building,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import { endTurnButton, passButton } from "./pass";
|
|||
import { brainstoneButtons, chargePowerButtons } from "./power";
|
||||
import { researchButtons, techTiles } from "./research";
|
||||
import { sectorRotationButton, setupButton } from "./setup";
|
||||
import { moveShipButton } from "./ships";
|
||||
import { finalizeShortcutsAndParents } from "./shortcuts";
|
||||
import { chooseTinkeringTileButton } from "./tinkering";
|
||||
import type { AvailableConversions, CommandController } from "./types";
|
||||
|
|
@ -45,9 +44,6 @@ function commandButton(
|
|||
case Command.Build:
|
||||
return buildButtons(controller, engine, command, player);
|
||||
|
||||
case Command.MoveShip:
|
||||
return [moveShipButton(controller, engine, command)];
|
||||
|
||||
case Command.PISwap:
|
||||
return [
|
||||
hexSelectionButton(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { buildingData } from "../../data/building";
|
|||
import { planetNames } from "../../data/planets";
|
||||
import { splitCostBonus } from "../../data/resources";
|
||||
import type { RichText } from "../../graphics/rich-text";
|
||||
import { richText, richTextArrow, richTextPlanet, richTextRewards } from "../../graphics/rich-text";
|
||||
import { richText, richTextPlanet, richTextRewards } from "../../graphics/rich-text";
|
||||
import { sortBy } from "../lodash-utils";
|
||||
import { prependShortcut, tooltipWithShortcut } from "./shortcuts";
|
||||
import type { CommandController } from "./types";
|
||||
|
|
@ -75,9 +75,6 @@ export function hexSelectionButton(
|
|||
}
|
||||
|
||||
const highlightHex = hexes.get(hex);
|
||||
if (highlightHex.tradeCost) {
|
||||
label.push(richTextRewards(Reward.parse(highlightHex.tradeCost)), richTextArrow);
|
||||
}
|
||||
if (highlightHex.rewards) {
|
||||
label.push(richTextRewards(Reward.parse(highlightHex.rewards)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,123 +0,0 @@
|
|||
import Engine, {
|
||||
AvailableBuilding,
|
||||
AvailableCommand,
|
||||
AvailableHex,
|
||||
AvailableMoveShipData,
|
||||
Command,
|
||||
GaiaHex,
|
||||
Player,
|
||||
Reward,
|
||||
ShipAction,
|
||||
} from "@gaia-project/engine";
|
||||
import type { TradingLocation } from "@gaia-project/engine/src/available/types";
|
||||
import type { ButtonData } from "../../data";
|
||||
import { shipActionName, shipLetter } from "../../data/building";
|
||||
import { richTextBuilding } from "../../graphics/rich-text";
|
||||
import { sortedUniq } from "../lodash-utils";
|
||||
import { hexSelectionButton } from "./hex";
|
||||
import type { CommandController } from "./types";
|
||||
import { hexMap, symbolButton, textButton } from "./utils";
|
||||
import { rewardWarnings } from "./warnings";
|
||||
|
||||
function moveTargetButton(
|
||||
controller: CommandController,
|
||||
data: AvailableMoveShipData,
|
||||
target: GaiaHex,
|
||||
engine: Engine,
|
||||
player: Player
|
||||
): ButtonData {
|
||||
const actions = data.targets.find((t) => t.location.coordinates === target.toString()).actions;
|
||||
if (actions.length == 0) {
|
||||
return textButton({});
|
||||
}
|
||||
return textButton({
|
||||
buttons: actions.map((a) => {
|
||||
const hexes = hexMap(engine, a.locations, false);
|
||||
for (const location of a.locations) {
|
||||
const hex = hexes.hexes.get(engine.map.getS(location.coordinates));
|
||||
const l = location as TradingLocation;
|
||||
hex.tradeCost = l.tradeCost;
|
||||
hex.rewards = l.rewards;
|
||||
hex.building = (location as AvailableBuilding).building;
|
||||
|
||||
if (a.type == ShipAction.Trade) {
|
||||
//don't merge the rewards, because we want the trade cost to be applied first
|
||||
hex.warnings = rewardWarnings(
|
||||
player,
|
||||
Reward.negative(Reward.parse(l.tradeCost)).concat(Reward.parse(l.rewards))
|
||||
);
|
||||
}
|
||||
}
|
||||
hexes.hexes.set(target, { building: data.ship, preventClick: true });
|
||||
hexes.hexes.set(engine.map.getS(data.source), { hideBuilding: data.ship, preventClick: true });
|
||||
|
||||
return hexSelectionButton(
|
||||
controller,
|
||||
textButton({
|
||||
command: a.type === ShipAction.Nothing ? null : a.type,
|
||||
label: shipActionName(a.type),
|
||||
hexes,
|
||||
}),
|
||||
() => textButton({})
|
||||
);
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
function moveSourceButton(
|
||||
controller: CommandController,
|
||||
engine: Engine,
|
||||
player: Player,
|
||||
data: AvailableMoveShipData
|
||||
): ButtonData {
|
||||
return hexSelectionButton(
|
||||
controller,
|
||||
textButton({
|
||||
hexes: hexMap(
|
||||
engine,
|
||||
data.targets.map((t) => t.location),
|
||||
false
|
||||
),
|
||||
}),
|
||||
(target) => moveTargetButton(controller, data, target, engine, player),
|
||||
data.ship,
|
||||
{ building: data.ship, hex: engine.map.getS(data.source) }
|
||||
);
|
||||
}
|
||||
|
||||
export function moveShipButton(
|
||||
controller: CommandController,
|
||||
engine: Engine,
|
||||
command: AvailableCommand<Command.MoveShip>
|
||||
): ButtonData {
|
||||
const player = engine.player(command.player);
|
||||
const faction = player.faction;
|
||||
|
||||
return textButton({
|
||||
label: "Move Ship",
|
||||
shortcuts: ["o"],
|
||||
command: Command.MoveShip,
|
||||
buttons: sortedUniq(command.data.map((e) => e.ship)).map((ship) =>
|
||||
hexSelectionButton(
|
||||
controller,
|
||||
symbolButton({
|
||||
richText: [richTextBuilding(ship, faction)],
|
||||
command: ship,
|
||||
shortcuts: [shipLetter(ship).toLowerCase()],
|
||||
hexes: hexMap(
|
||||
engine,
|
||||
command.data.filter((e) => e.ship === ship).map((l) => ({ coordinates: l.source }) as AvailableHex),
|
||||
false
|
||||
),
|
||||
}),
|
||||
(hex) =>
|
||||
moveSourceButton(
|
||||
controller,
|
||||
engine,
|
||||
player,
|
||||
command.data.find((d) => d.ship == ship && d.source == hex.toString())
|
||||
)
|
||||
)
|
||||
),
|
||||
});
|
||||
}
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
import type { ButtonData, ButtonWarning } from "../../data";
|
||||
import { buttonStringLabel } from "./utils";
|
||||
// Defined here rather than in utils.ts so the utils <-> shortcuts circular import is a one-way
|
||||
// edge (utils -> shortcuts); utils.ts re-exports it for its existing importers.
|
||||
export function buttonStringLabel(button: ButtonData) {
|
||||
return (button.richText?.find((l) => typeof l == "string") as string) ?? button.label ?? button.command;
|
||||
}
|
||||
|
||||
export const forceNumericShortcut = (label: string) => ["Charge", "Income"].find((b) => label.startsWith(b));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import Engine, { AvailableHex, GaiaHex } from "@gaia-project/engine";
|
|||
import type { ButtonData, HexSelection, HighlightHex, HighlightHexData } from "../../data";
|
||||
import type { RichText } from "../../graphics/rich-text";
|
||||
import { richText } from "../../graphics/rich-text";
|
||||
import { tooltipWithShortcut, withShortcut } from "./shortcuts";
|
||||
import { buttonStringLabel, tooltipWithShortcut, withShortcut } from "./shortcuts";
|
||||
import { translateWarnings } from "./warnings";
|
||||
|
||||
export function buttonStringLabel(button: ButtonData) {
|
||||
return (button.richText?.find((l) => typeof l == "string") as string) ?? button.label ?? button.command;
|
||||
}
|
||||
// Moved to shortcuts.ts (it was the one edge making utils <-> shortcuts circular); re-exported
|
||||
// here so existing `from "./utils"` importers (Commands.vue) keep working.
|
||||
export { buttonStringLabel };
|
||||
|
||||
export function buttonRichTextLabel(button: ButtonData): RichText {
|
||||
if (button.richText) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import {
|
|||
} from "@gaia-project/engine";
|
||||
import { UPGRADE_RESEARCH_COST } from "@gaia-project/engine/src/available/types";
|
||||
import type { AnyTechTile, AnyTechTilePos } from "@gaia-project/engine/src/enums";
|
||||
import { tradeCostSource, tradeSource } from "@gaia-project/engine/src/events";
|
||||
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
|
||||
import { federationRewards } from "@gaia-project/engine/src/tiles/federations";
|
||||
import { techTileEventSource, techTileRewards } from "@gaia-project/engine/src/tiles/techs";
|
||||
|
|
@ -76,140 +75,126 @@ function eventTypes(events: Event[]): Resource[] {
|
|||
}
|
||||
|
||||
export function balanceSheetEventSources(expansion: Expansion): BalanceSheetSourceTemplate[] {
|
||||
return (
|
||||
[
|
||||
{
|
||||
label: "Game start",
|
||||
costResources: [],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: [Phase.BeginGame],
|
||||
color: "--gaia",
|
||||
},
|
||||
{
|
||||
label: "Base",
|
||||
costResources: [],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: [Command.ChooseIncome],
|
||||
color: "--res-credit",
|
||||
},
|
||||
{
|
||||
label: "Faction abilities",
|
||||
costResources: [],
|
||||
incomeResources: [Resource.Knowledge],
|
||||
eventSources: Faction.values(expansion),
|
||||
color: "--volcanic",
|
||||
},
|
||||
{
|
||||
label: "Tech Tiles",
|
||||
description: "Tech Tiles income, including the free 4k for the free research step when gained",
|
||||
costResources: [],
|
||||
incomeResources: rewardTypes(
|
||||
(TechTile.values(expansion) as AnyTechTile[])
|
||||
.concat(AdvTechTile.values(expansion))
|
||||
.flatMap((t) => techTileRewards(t))
|
||||
),
|
||||
eventSources: (TechPos.values(expansion) as (TechPos | AdvTechTilePos)[]).concat(
|
||||
AdvTechTilePos.values(expansion)
|
||||
),
|
||||
color: "--current-round",
|
||||
},
|
||||
{
|
||||
label: "Research",
|
||||
costResources: [Resource.Knowledge],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: (ResearchField.values(expansion) as EventSource[]).concat(Command.UpgradeResearch),
|
||||
color: colorCodes.researchStep.color,
|
||||
},
|
||||
{
|
||||
label: "Booster",
|
||||
costResources: [],
|
||||
incomeResources: eventTypes(Booster.values(expansion).flatMap((b) => boosterEvents(b))),
|
||||
eventSources: Booster.values(expansion),
|
||||
color: colorCodes.booster.color,
|
||||
},
|
||||
{
|
||||
label: "Build",
|
||||
costResources: [Resource.Credit, Resource.Ore, Resource.Knowledge, Resource.Qic],
|
||||
incomeResources: [],
|
||||
eventSources: [Command.Build],
|
||||
color: "--res-ore",
|
||||
},
|
||||
{
|
||||
label: "Free actions",
|
||||
costResources: rewardTypes(Object.values(freeActionConversions).flatMap((c) => Reward.parse(c.cost))).concat(
|
||||
Resource.GainToken
|
||||
), //for burn
|
||||
incomeResources: rewardTypes(Object.values(freeActionConversions).flatMap((c) => Reward.parse(c.income))),
|
||||
eventSources: [Command.Spend],
|
||||
color: "--res-power",
|
||||
},
|
||||
{
|
||||
label: "Power/Q.I.C Actions",
|
||||
costResources: rewardTypes(BoardAction.values(expansion).flatMap((a) => Reward.parse(boardActions[a].cost))),
|
||||
incomeResources: eventTypes(
|
||||
BoardAction.values(expansion).flatMap((a) => Event.parse(boardActions[a].income, null))
|
||||
),
|
||||
eventSources: BoardAction.values(),
|
||||
color: "--specialAction",
|
||||
},
|
||||
{
|
||||
label: "Free Leech",
|
||||
incomeResources: [Resource.ChargePower, Resource.GainToken],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.freeLeech],
|
||||
color: "--res-power",
|
||||
},
|
||||
{
|
||||
label: "Paid Leech",
|
||||
incomeResources: [Resource.ChargePower, Resource.GainToken],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.paidLeech],
|
||||
color: "--res-qic",
|
||||
},
|
||||
{
|
||||
label: "Powerful Power Tokens",
|
||||
incomeResources: [Resource.ChargePower],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.powerLeverage],
|
||||
color: "--tech-tile",
|
||||
},
|
||||
{
|
||||
label: "Terrans",
|
||||
description: "Tokens are moved from the gaia area to area 2",
|
||||
incomeResources: [Resource.ChargePower],
|
||||
costResources: [],
|
||||
eventSources: [Faction.Terrans],
|
||||
color: "--terra",
|
||||
},
|
||||
{
|
||||
label: "Federations",
|
||||
costResources: [Resource.GainToken, Resource.Qic],
|
||||
incomeResources: rewardTypes(Federation.values(expansion).flatMap((f) => federationRewards(f))),
|
||||
eventSources: [Command.FormFederation],
|
||||
color: "--federation",
|
||||
},
|
||||
{
|
||||
label: "Waste",
|
||||
description: "Also includes tye use of tokens in area2 or area3 for gaia forming or forming federations",
|
||||
costResources: balanceSheetResources,
|
||||
incomeResources: [],
|
||||
eventSources: [waste],
|
||||
color: "--res-qic",
|
||||
},
|
||||
] as BalanceSheetSourceTemplate[]
|
||||
).concat(
|
||||
expansion == Expansion.Frontiers
|
||||
? [
|
||||
{
|
||||
label: "Trade",
|
||||
costResources: [Resource.ChargePower],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: [tradeSource, tradeCostSource],
|
||||
color: colorCodes.tradeShip.color,
|
||||
},
|
||||
]
|
||||
: []
|
||||
);
|
||||
return [
|
||||
{
|
||||
label: "Game start",
|
||||
costResources: [],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: [Phase.BeginGame],
|
||||
color: "--gaia",
|
||||
},
|
||||
{
|
||||
label: "Base",
|
||||
costResources: [],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: [Command.ChooseIncome],
|
||||
color: "--res-credit",
|
||||
},
|
||||
{
|
||||
label: "Faction abilities",
|
||||
costResources: [],
|
||||
incomeResources: [Resource.Knowledge],
|
||||
eventSources: Faction.values(expansion),
|
||||
color: "--volcanic",
|
||||
},
|
||||
{
|
||||
label: "Tech Tiles",
|
||||
description: "Tech Tiles income, including the free 4k for the free research step when gained",
|
||||
costResources: [],
|
||||
incomeResources: rewardTypes(
|
||||
(TechTile.values(expansion) as AnyTechTile[])
|
||||
.concat(AdvTechTile.values(expansion))
|
||||
.flatMap((t) => techTileRewards(t))
|
||||
),
|
||||
eventSources: (TechPos.values(expansion) as (TechPos | AdvTechTilePos)[]).concat(
|
||||
AdvTechTilePos.values(expansion)
|
||||
),
|
||||
color: "--current-round",
|
||||
},
|
||||
{
|
||||
label: "Research",
|
||||
costResources: [Resource.Knowledge],
|
||||
incomeResources: balanceSheetResources,
|
||||
eventSources: (ResearchField.values(expansion) as EventSource[]).concat(Command.UpgradeResearch),
|
||||
color: colorCodes.researchStep.color,
|
||||
},
|
||||
{
|
||||
label: "Booster",
|
||||
costResources: [],
|
||||
incomeResources: eventTypes(Booster.values(expansion).flatMap((b) => boosterEvents(b))),
|
||||
eventSources: Booster.values(expansion),
|
||||
color: colorCodes.booster.color,
|
||||
},
|
||||
{
|
||||
label: "Build",
|
||||
costResources: [Resource.Credit, Resource.Ore, Resource.Knowledge, Resource.Qic],
|
||||
incomeResources: [],
|
||||
eventSources: [Command.Build],
|
||||
color: "--res-ore",
|
||||
},
|
||||
{
|
||||
label: "Free actions",
|
||||
costResources: rewardTypes(Object.values(freeActionConversions).flatMap((c) => Reward.parse(c.cost))).concat(
|
||||
Resource.GainToken
|
||||
), //for burn
|
||||
incomeResources: rewardTypes(Object.values(freeActionConversions).flatMap((c) => Reward.parse(c.income))),
|
||||
eventSources: [Command.Spend],
|
||||
color: "--res-power",
|
||||
},
|
||||
{
|
||||
label: "Power/Q.I.C Actions",
|
||||
costResources: rewardTypes(BoardAction.values(expansion).flatMap((a) => Reward.parse(boardActions[a].cost))),
|
||||
incomeResources: eventTypes(
|
||||
BoardAction.values(expansion).flatMap((a) => Event.parse(boardActions[a].income, null))
|
||||
),
|
||||
eventSources: BoardAction.values(),
|
||||
color: "--specialAction",
|
||||
},
|
||||
{
|
||||
label: "Free Leech",
|
||||
incomeResources: [Resource.ChargePower, Resource.GainToken],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.freeLeech],
|
||||
color: "--res-power",
|
||||
},
|
||||
{
|
||||
label: "Paid Leech",
|
||||
incomeResources: [Resource.ChargePower, Resource.GainToken],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.paidLeech],
|
||||
color: "--res-qic",
|
||||
},
|
||||
{
|
||||
label: "Powerful Power Tokens",
|
||||
incomeResources: [Resource.ChargePower],
|
||||
costResources: [],
|
||||
eventSources: [PowerChargeSource.powerLeverage],
|
||||
color: "--tech-tile",
|
||||
},
|
||||
{
|
||||
label: "Terrans",
|
||||
description: "Tokens are moved from the gaia area to area 2",
|
||||
incomeResources: [Resource.ChargePower],
|
||||
costResources: [],
|
||||
eventSources: [Faction.Terrans],
|
||||
color: "--terra",
|
||||
},
|
||||
{
|
||||
label: "Federations",
|
||||
costResources: [Resource.GainToken, Resource.Qic],
|
||||
incomeResources: rewardTypes(Federation.values(expansion).flatMap((f) => federationRewards(f))),
|
||||
eventSources: [Command.FormFederation],
|
||||
color: "--federation",
|
||||
},
|
||||
{
|
||||
label: "Waste",
|
||||
description: "Also includes tye use of tokens in area2 or area3 for gaia forming or forming federations",
|
||||
costResources: balanceSheetResources,
|
||||
incomeResources: [],
|
||||
eventSources: [waste],
|
||||
color: "--res-qic",
|
||||
},
|
||||
] as BalanceSheetSourceTemplate[];
|
||||
}
|
||||
|
||||
function isPayPower(wantResource: Resource, reward: Reward) {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,4 @@
|
|||
import Engine, {
|
||||
Building,
|
||||
Command,
|
||||
Expansion,
|
||||
GaiaHex,
|
||||
PlayerData,
|
||||
ShipAction,
|
||||
stdBuildingValue,
|
||||
} from "@gaia-project/engine";
|
||||
import Engine, { Building, Command, Expansion, GaiaHex, PlayerData, stdBuildingValue } from "@gaia-project/engine";
|
||||
import { allBuildings, buildingData } from "../../data/building";
|
||||
import type { CommandObject } from "../recent";
|
||||
import { ChartSource } from "./charts";
|
||||
|
|
@ -14,18 +6,9 @@ import type { ExtractLogArg, SimpleSourceFactory } from "./simple-charts";
|
|||
import { ChartSummary, ExtractLog } from "./simple-charts";
|
||||
|
||||
function buildingFromLog(e: ExtractLogArg<ChartSource<Building>>): Building | null {
|
||||
const args = e.cmd.args;
|
||||
switch (e.cmd.command) {
|
||||
case Command.Build:
|
||||
return args[0] as Building;
|
||||
case Command.MoveShip:
|
||||
if (args.some((a) => a === ShipAction.BuildColony)) {
|
||||
return Building.Colony;
|
||||
}
|
||||
if (e.log.changes?.[Command.Build] != null) {
|
||||
return Building.CustomsPost;
|
||||
}
|
||||
return null;
|
||||
return e.cmd.args[0] as Building;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class FederationSimulator {
|
|||
|
||||
hasBuildingValue(h: GaiaHex) {
|
||||
const building = h.data.building;
|
||||
return building != null && stdBuildingValue(building) > 0 && building !== Building.CustomsPost;
|
||||
return building != null && stdBuildingValue(building) > 0;
|
||||
}
|
||||
|
||||
addBuilding(location: string, building: Building): number {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import {
|
|||
TechPos,
|
||||
} from "@gaia-project/engine";
|
||||
import type { LogEntryChange } from "@gaia-project/engine/src/engine";
|
||||
import { tradeCostSource, tradeSource } from "@gaia-project/engine/src/events";
|
||||
import type { MoveTokens } from "@gaia-project/engine/src/player-data";
|
||||
import { sum } from "../lodash-utils";
|
||||
import type { CommandObject } from "../recent";
|
||||
|
|
@ -87,8 +86,6 @@ const commandEventSource = (c: CommandObject): EventSource[] => {
|
|||
return [c.command as EventSource, c.args[0] as EventSource];
|
||||
case Command.Build:
|
||||
return [c.command as EventSource, Faction.Gleens, Faction.Geodens, Faction.Lantids, Command.FormFederation];
|
||||
case Command.MoveShip:
|
||||
return [tradeCostSource, tradeSource, Command.Build];
|
||||
}
|
||||
return [c.command as EventSource];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
{
|
||||
"tableMeta": {
|
||||
"weights": [1, 2, 2, 3, 3, 3, 0, 3, 1, 0, 0],
|
||||
"colors": [
|
||||
"--res-ore",
|
||||
"--res-credit",
|
||||
"--res-knowledge",
|
||||
"--current-round",
|
||||
"--rt-terra",
|
||||
"--res-qic",
|
||||
"--gaia",
|
||||
"--rt-nav",
|
||||
"--res-credit",
|
||||
"--rt-gaia",
|
||||
"--volcanic"
|
||||
],
|
||||
"datasetMeta": {
|
||||
"Nevlas (27)": {
|
||||
"label": "Nevlas",
|
||||
"total": 21,
|
||||
"weightedTotal": 27
|
||||
},
|
||||
"Hadsch Hallas (30)": {
|
||||
"label": "Hadsch Hallas",
|
||||
"total": 23,
|
||||
"weightedTotal": 30
|
||||
},
|
||||
"Terrans (25)": {
|
||||
"label": "Terrans",
|
||||
"total": 25,
|
||||
"weightedTotal": 25
|
||||
},
|
||||
"Taklons (29)": {
|
||||
"label": "Taklons",
|
||||
"total": 19,
|
||||
"weightedTotal": 29
|
||||
}
|
||||
}
|
||||
},
|
||||
"labels": [
|
||||
"Mine",
|
||||
"Trading Station",
|
||||
"Research Lab",
|
||||
"Planetary Institute",
|
||||
"Knowledge Academy",
|
||||
"Academy 2",
|
||||
"Gaia Former",
|
||||
"Colony",
|
||||
"Customs Post",
|
||||
"Colony Ship",
|
||||
"Trade Ship"
|
||||
],
|
||||
"datasets": [
|
||||
{
|
||||
"label": "Terrans (25)",
|
||||
"data": [8, 2, 1, 1, 0, 0, 5, 2, 2, 2, 2]
|
||||
},
|
||||
{
|
||||
"label": "Hadsch Hallas (30)",
|
||||
"data": [4, 2, 1, 1, 0, 1, 0, 3, 5, 3, 3]
|
||||
},
|
||||
{
|
||||
"label": "Nevlas (27)",
|
||||
"data": [9, 2, 1, 1, 0, 1, 0, 2, 0, 2, 3]
|
||||
},
|
||||
{
|
||||
"label": "Taklons (29)",
|
||||
"data": [4, 4, 4, 0, 1, 0, 0, 2, 0, 3, 1]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"tableMeta": {
|
||||
"weights": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -2, -2, -1, -2],
|
||||
"colors": [
|
||||
"--gaia",
|
||||
"--res-credit",
|
||||
"--current-round",
|
||||
"--rt-sci",
|
||||
"--oxide",
|
||||
"--res-power",
|
||||
"--res-qic",
|
||||
"--tech-tile",
|
||||
"--terra",
|
||||
"--volcanic",
|
||||
"--res-power",
|
||||
"--specialAction",
|
||||
"--res-qic",
|
||||
"--volcanic"
|
||||
],
|
||||
"datasetMeta": {
|
||||
"Nevlas (206)": {
|
||||
"label": "Nevlas",
|
||||
"income": 206,
|
||||
"cost": -197,
|
||||
"balance": 9
|
||||
},
|
||||
"Hadsch Hallas (68)": {
|
||||
"label": "Hadsch Hallas",
|
||||
"income": 68,
|
||||
"cost": -54,
|
||||
"balance": 14
|
||||
},
|
||||
"Terrans (67)": {
|
||||
"label": "Terrans",
|
||||
"income": 67,
|
||||
"cost": -56,
|
||||
"balance": 11
|
||||
},
|
||||
"Taklons (125)": {
|
||||
"label": "Taklons",
|
||||
"income": 125,
|
||||
"cost": -116,
|
||||
"balance": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
"labels": [
|
||||
"Game start income",
|
||||
"Base income",
|
||||
"Tech Tiles income",
|
||||
"Research income",
|
||||
"Booster income",
|
||||
"Free Leech income",
|
||||
"Paid Leech income",
|
||||
"Powerful Power Tokens income",
|
||||
"Terrans income",
|
||||
"Trade income",
|
||||
"Free actions cost",
|
||||
"Power/Q.I.C Actions cost",
|
||||
"Waste cost",
|
||||
"Trade cost"
|
||||
],
|
||||
"datasets": [
|
||||
{
|
||||
"label": "Nevlas (206)",
|
||||
"data": [4, 40, 20, 6, 0, 24, 20, 86, 0, 6, 42, 34, 35, 5]
|
||||
},
|
||||
{
|
||||
"label": "Taklons (125)",
|
||||
"data": [4, 10, 16, 17, 2, 8, 6, 60, 0, 2, 35, 20, 0, 3]
|
||||
},
|
||||
{
|
||||
"label": "Terrans (67)",
|
||||
"data": [4, 24, 0, 3, 4, 5, 3, 0, 24, 0, 7, 7, 10, 9]
|
||||
},
|
||||
{
|
||||
"label": "Hadsch Hallas (68)",
|
||||
"data": [4, 18, 0, 15, 6, 13, 2, 0, 0, 10, 4, 16, 2, 6]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
"tableMeta": {
|
||||
"weights": [1, 3, 4, 4, 0, 0, 0],
|
||||
"colors": ["--res-credit", "--res-ore", "--res-knowledge", "--res-qic", "--res-power", "--recent", "--res-power"],
|
||||
"datasetMeta": {
|
||||
"Nevlas (12)": {
|
||||
"label": "Nevlas",
|
||||
"income": 12,
|
||||
"cost": 0,
|
||||
"balance": 12
|
||||
},
|
||||
"Hadsch Hallas (72)": {
|
||||
"label": "Hadsch Hallas",
|
||||
"income": 72,
|
||||
"cost": 0,
|
||||
"balance": 72
|
||||
},
|
||||
"Terrans (8)": {
|
||||
"label": "Terrans",
|
||||
"income": 8,
|
||||
"cost": 0,
|
||||
"balance": 8
|
||||
},
|
||||
"Taklons (43)": {
|
||||
"label": "Taklons",
|
||||
"income": 43,
|
||||
"cost": 0,
|
||||
"balance": 43
|
||||
}
|
||||
}
|
||||
},
|
||||
"labels": [
|
||||
"Credits income",
|
||||
"Ores income",
|
||||
"Knowledge income",
|
||||
"QICs income",
|
||||
"Power Charges income",
|
||||
"Power Tokens income",
|
||||
"Power Charges cost"
|
||||
],
|
||||
"datasets": [
|
||||
{
|
||||
"label": "Hadsch Hallas (72)",
|
||||
"data": [9, 9, 9, 0, 10, 1, 6]
|
||||
},
|
||||
{
|
||||
"label": "Taklons (43)",
|
||||
"data": [11, 0, 8, 0, 2, 0, 3]
|
||||
},
|
||||
{
|
||||
"label": "Nevlas (12)",
|
||||
"data": [0, 0, 3, 0, 6, 1, 5]
|
||||
},
|
||||
{
|
||||
"label": "Terrans (8)",
|
||||
"data": [0, 0, 2, 0, 0, 0, 9]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
{
|
||||
"types": ["Buildings", "Resources/Power Charges", "Resources/Trade"],
|
||||
"options": {
|
||||
"layout": "standard",
|
||||
"factionVariant": "more-balanced",
|
||||
"frontiers": true,
|
||||
"factionVariantVersion": 0,
|
||||
"map": {
|
||||
"sectors": [
|
||||
{
|
||||
"sector": "5A",
|
||||
"rotation": 0,
|
||||
"center": {
|
||||
"q": 0,
|
||||
"r": 0,
|
||||
"s": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "6A",
|
||||
"rotation": 4,
|
||||
"center": {
|
||||
"q": 5,
|
||||
"r": -2,
|
||||
"s": -3
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "8",
|
||||
"rotation": 4,
|
||||
"center": {
|
||||
"q": 2,
|
||||
"r": 3,
|
||||
"s": -5
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "9",
|
||||
"rotation": 1,
|
||||
"center": {
|
||||
"q": -3,
|
||||
"r": 5,
|
||||
"s": -2
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "3",
|
||||
"rotation": 1,
|
||||
"center": {
|
||||
"q": -5,
|
||||
"r": 2,
|
||||
"s": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "1",
|
||||
"rotation": 1,
|
||||
"center": {
|
||||
"q": -2,
|
||||
"r": -3,
|
||||
"s": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "4",
|
||||
"rotation": 3,
|
||||
"center": {
|
||||
"q": 3,
|
||||
"r": -5,
|
||||
"s": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "10",
|
||||
"rotation": 4,
|
||||
"center": {
|
||||
"q": -1,
|
||||
"r": 8,
|
||||
"s": -7
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "7A",
|
||||
"rotation": 4,
|
||||
"center": {
|
||||
"q": -6,
|
||||
"r": 10,
|
||||
"s": -4
|
||||
}
|
||||
},
|
||||
{
|
||||
"sector": "2",
|
||||
"rotation": 2,
|
||||
"center": {
|
||||
"q": -8,
|
||||
"r": 7,
|
||||
"s": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"mirror": false
|
||||
}
|
||||
},
|
||||
"moveHistory": [
|
||||
"init 4 Frontiers-4",
|
||||
"p1 faction nevlas",
|
||||
"p2 faction hadsch-hallas",
|
||||
"p3 faction terrans",
|
||||
"p4 faction taklons (0/0/0/0 ⇒ 2,B/4/0/0)",
|
||||
"nevlas build m 9A4",
|
||||
"hadsch-hallas build m 5A3",
|
||||
"terrans build m 1B2",
|
||||
"taklons build m 7A9",
|
||||
"taklons build m 9A10",
|
||||
"terrans build m 8A8",
|
||||
"hadsch-hallas build m 7B4",
|
||||
"nevlas build m 5A0",
|
||||
"taklons booster booster5",
|
||||
"terrans booster booster9",
|
||||
"hadsch-hallas booster booster2",
|
||||
"nevlas booster booster3",
|
||||
"taklons brainstone area2 (2,B/4/0/0 ⇒ 1/5,B/0/0)",
|
||||
"nevlas build ts 9A4.",
|
||||
"hadsch-hallas charge 1pw (4/4/0/0 ⇒ 3/5/0/0)",
|
||||
"taklons charge 1pw (1/5,B/0/0 ⇒ 0/6,B/0/0)",
|
||||
"hadsch-hallas build m 2A11.",
|
||||
"nevlas charge 2pw (2/4/0/0 ⇒ 0/6/0/0)",
|
||||
"terrans build ts 8A8.",
|
||||
"nevlas charge 1pw (0/6/0/0 ⇒ 0/5/1/0)",
|
||||
"taklons burn 2. action power3. (0/6,B/0/0 ⇒ 1,B/3/0/0)",
|
||||
"nevlas build ts 5A0.",
|
||||
"terrans charge 2pw (0/8/0/0 ⇒ 0/6/2/0)",
|
||||
"hadsch-hallas build ts 2A11.",
|
||||
"nevlas charge 2pw (0/5/1/0 ⇒ 0/3/3/0)",
|
||||
"terrans burn 1. action power6. build m 8B4. (0/6/2/0 ⇒ 3/4/0/0)",
|
||||
"nevlas charge 2pw (0/3/3/0 ⇒ 0/1/5/0)",
|
||||
"taklons build ts 7A9.",
|
||||
"nevlas charge 1pw (0/1/5/0 ⇒ 0/0/6/0)",
|
||||
"hadsch-hallas charge 1pw (3/5/0/0 ⇒ 2/6/0/0)",
|
||||
"nevlas spend 1q for 1o. build PI 9A4. spend 6pw for 2o. (0/0/6/0 ⇒ 3/0/3/0)",
|
||||
"hadsch-hallas charge 2pw (2/6/0/0 ⇒ 0/8/0/0)",
|
||||
"taklons charge 2pw (1,B/3/0/0 ⇒ 0/4,B/0/0)",
|
||||
"hadsch-hallas up dip (0 ⇒ 1).",
|
||||
"terrans build PI 8A8.",
|
||||
"nevlas charge 2pw (3/0/3/0 ⇒ 1/2/3/0)",
|
||||
"taklons burn 1. spend 3pw for 1o. build lab 7A9. tech dip. up dip (0 ⇒ 1). (0/4,B/0/0 ⇒ 0,B/3/0/0)",
|
||||
"nevlas charge 3pw (1/2/3/0 ⇒ 0/1/5/0)",
|
||||
"hadsch-hallas charge 1pw (0/8/0/0 ⇒ 0/7/1/0)",
|
||||
"nevlas action power4. (0/1/5/0 ⇒ 2/1/3/0)",
|
||||
"hadsch-hallas build tradeShip 5B1.",
|
||||
"terrans build gf 1A5 using area1: 3, area2: 3. (3/4/0/0 ⇒ 0/1/0/6)",
|
||||
"taklons special 4pw. brainstone area3. spend 3pw for 1o. (0,B/3/0/0 ⇒ 0,B/1/2/0)",
|
||||
"nevlas up nav (0 ⇒ 1).",
|
||||
"hadsch-hallas build lab 2A11. tech free2. up dip (1 ⇒ 2).",
|
||||
"nevlas charge 3pw (2/1/3/0 ⇒ 0/2/4/0)",
|
||||
"terrans up eco (0 ⇒ 1).",
|
||||
"taklons build ac1 7A9. tech free3. up dip (1 ⇒ 2).",
|
||||
"nevlas charge 2pw (0/2/4/0 ⇒ 0/0/6/0)",
|
||||
"hadsch-hallas charge 1pw (0/7/1/0 ⇒ 0/6/2/0)",
|
||||
"nevlas spend 6pw for 2o. build lab 5A0. tech dip. up dip (0 ⇒ 1). (0/0/6/0 ⇒ 3/0/3/0)",
|
||||
"terrans charge 1pw (0/1/0/6 ⇒ 0/0/1/6)",
|
||||
"hadsch-hallas build tradeShip 9A9.",
|
||||
"terrans spend 1pw for 1c. pass booster10 returning booster9 (0/0/1/6 ⇒ 1/0/0/6)",
|
||||
"taklons up dip (2 ⇒ 3). spend 3pw for 1o. brainstone area1. (0,B/1/2/0 ⇒ 0,B/0/3/0)",
|
||||
"nevlas special 4pw. (3/0/3/0 ⇒ 0/2/4/0)",
|
||||
"hadsch-hallas pass booster9 returning booster2",
|
||||
"taklons spend 1pw for 1c. special range+3. build m 2B0. (0,B/0/3/0 ⇒ 1,B/0/2/0)",
|
||||
"nevlas charge 2pw (0/2/4/0 ⇒ 0/0/6/0)",
|
||||
"hadsch-hallas decline 2pw",
|
||||
"nevlas action power5. (0/0/6/0 ⇒ 2/0/4/0)",
|
||||
"taklons pass booster2 returning booster5",
|
||||
"nevlas spend 1t-a3 for 1k. spend 1t-a3 for 1k. up nav (1 ⇒ 2). (2/0/4/0 ⇒ 2/0/2/2)",
|
||||
"nevlas spend 4pw for 1o,1c. build m 9B3. (2/0/2/2 ⇒ 4/0/0/2)",
|
||||
"hadsch-hallas decline 2pw",
|
||||
"nevlas build m 5B5.",
|
||||
"nevlas pass booster5 returning booster3",
|
||||
"terrans income 1t (1/0/0/6 ⇒ 0/0/2/6)",
|
||||
"taklons income 3pw. brainstone area3 (1,B/0/2/0 ⇒ 2/1/2,B/0)",
|
||||
"nevlas income 1t (4/0/0/2 ⇒ 0/1/4/2)",
|
||||
"terrans spend 6tg for 2o (0/0/2/6 ⇒ 0/6/2/0)",
|
||||
"terrans build tradeShip 1A3.",
|
||||
"hadsch-hallas action power5. (0/0/8/0 ⇒ 4/0/4/0)",
|
||||
"taklons action power4. (2/1/2,B/0 ⇒ 3,B/1/1/0)",
|
||||
"nevlas action power6. build m 9B5. (2/1/4/0 ⇒ 4/1/2/0)",
|
||||
"hadsch-hallas charge 1pw (4/0/4/0 ⇒ 3/1/4/0)",
|
||||
"taklons charge 1pw. brainstone area2 (3,B/1/1/0 ⇒ 3/1,B/1/0)",
|
||||
"terrans build colonyShip 1A4.",
|
||||
"hadsch-hallas up dip (2 ⇒ 3). (3/1/4/0 ⇒ 0/4/4/0)",
|
||||
"taklons burn 1. action power3. (3/1,B/1/0 ⇒ 4,B/0/0/0)",
|
||||
"nevlas special range+3. build m 3B3.",
|
||||
"terrans build m 1A5.",
|
||||
"hadsch-hallas move tradeShip 5B1 5C trade 5B5. (0/4/4/0 ⇒ 1/4/3/0)",
|
||||
"taklons special 4pw. brainstone area2. (4,B/0/0/0 ⇒ 1/3,B/0/0)",
|
||||
"nevlas special 4pw. (4/1/2/0 ⇒ 0/5/2/0)",
|
||||
"terrans spend 1pw for 1c. spend 1pw for 1c. build gf 8A3 using area1: 2, area2: 4. (0/6/2/0 ⇒ 0/2/0/6)",
|
||||
"hadsch-hallas move tradeShip 9A9 9A9 trade 9A10. (1/4/3/0 ⇒ 2/4/2/0)",
|
||||
"taklons build ts 9A10.",
|
||||
"nevlas charge 1pw (0/5/2/0 ⇒ 0/4/3/0)",
|
||||
"hadsch-hallas charge 1pw (2/4/2/0 ⇒ 1/5/2/0)",
|
||||
"nevlas spend 1t-a3 for 1k. spend 1t-a3 for 1k. up eco (0 ⇒ 1). (0/4/3/0 ⇒ 0/4/1/2)",
|
||||
"terrans pass booster3 returning booster10",
|
||||
"hadsch-hallas build colonyShip 7C.",
|
||||
"taklons build lab 9A10. tech free2. up dip (3 ⇒ 4). burn 1. spend 3pw for 3c. (1/3,B/0/0 ⇒ 1,B/2/0/0)",
|
||||
"nevlas charge 1pw (0/4/1/2 ⇒ 0/3/2/2)",
|
||||
"hadsch-hallas charge 1pw (1/5/2/0 ⇒ 0/6/2/0)",
|
||||
"nevlas spend 2pw for 2c. build m 4A3. (0/3/2/2 ⇒ 1/3/1/2)",
|
||||
"hadsch-hallas charge 1pw (0/6/2/0 ⇒ 0/5/3/0)",
|
||||
"hadsch-hallas build ts 5A3.",
|
||||
"taklons charge 2pw (1,B/2/0/0 ⇒ 0/3,B/0/0)",
|
||||
"nevlas charge 1pw (1/3/1/2 ⇒ 0/4/1/2)",
|
||||
"taklons build tradeShip 2A0.",
|
||||
"nevlas spend 2pw for 2c. pass booster8 returning booster5 (0/4/1/2 ⇒ 1/4/0/2)",
|
||||
"hadsch-hallas pass booster5 returning booster9",
|
||||
"taklons pass booster7 returning booster2",
|
||||
"terrans income 1t (0/2/0/6 ⇒ 0/0/3/6)",
|
||||
"nevlas income 1t (1/4/0/2 ⇒ 0/1/5/2)",
|
||||
"terrans spend 6tg for 2o (0/0/3/6 ⇒ 0/6/3/0)",
|
||||
"terrans build ts 8B4.",
|
||||
"nevlas charge 2pw (2/1/5/0 ⇒ 0/3/5/0)",
|
||||
"nevlas action power4. (0/3/5/0 ⇒ 2/3/3/0)",
|
||||
"hadsch-hallas action power5. (0/0/8/0 ⇒ 4/0/4/0)",
|
||||
"taklons action power3. (0/0/3,B/0 ⇒ 1,B/0/2/0)",
|
||||
"terrans build m 8A3.",
|
||||
"nevlas special 4pw. (2/3/3/0 ⇒ 0/3/5/0)",
|
||||
"hadsch-hallas up dip (3 ⇒ 4).",
|
||||
"taklons move tradeShip 2A0 9A6 trade 2A11. (1,B/0/2/0 ⇒ 2,B/0/1/0)",
|
||||
"terrans spend 3pw for 3c. build gf 10A9 using area1: 3, area2: 3. (0/6/3/0 ⇒ 0/3/0/6)",
|
||||
"nevlas build tradeShip 5A1.",
|
||||
"hadsch-hallas move tradeShip 5C 5A1 trade 8A8. spend 4pw for 1q. (4/0/4/0 ⇒ 4/2/3/0)",
|
||||
"taklons special 4pw. brainstone area3. (2,B/0/1/0 ⇒ 0/2/1,B/0)",
|
||||
"terrans move tradeShip 1A3 1A1.",
|
||||
"nevlas build tradeShip 7A8.",
|
||||
"hadsch-hallas move colonyShip 7C 7C buildColony 7B0.",
|
||||
"taklons charge 2pw (0/2/1,B/0 ⇒ 0/0/3,B/0)",
|
||||
"taklons up nav (0 ⇒ 1). spend 3pw for 1o. brainstone area1. (0/0/3,B/0 ⇒ 0,B/0/3/0)",
|
||||
"terrans move colonyShip 1A4 3A10 buildColony 3A9.",
|
||||
"nevlas charge 1pw (0/3/5/0 ⇒ 0/2/6/0)",
|
||||
"nevlas spend 1t-a3 for 1k. up terra (0 ⇒ 1). (0/2/6/0 ⇒ 0/2/5/1)",
|
||||
"hadsch-hallas special range+3. build m 10A3.",
|
||||
"taklons up nav (1 ⇒ 2).",
|
||||
"terrans pass booster2 returning booster3",
|
||||
"nevlas spend 4pw for 4c. build colonyShip 9A6. (0/2/5/1 ⇒ 2/2/3/1)",
|
||||
"hadsch-hallas move tradeShip 9A9 9C trade 9B5. (4/2/3/0 ⇒ 5/2/2/0)",
|
||||
"taklons build m 3B0.",
|
||||
"nevlas charge 1pw (2/2/3/1 ⇒ 1/3/3/1)",
|
||||
"terrans decline 3pw",
|
||||
"nevlas spend 4pw for 1o,1c. spend 2pw for 2c. build colonyShip 5A10. (1/3/3/1 ⇒ 4/3/0/1)",
|
||||
"hadsch-hallas build colonyShip 7A7.",
|
||||
"taklons build ts 2B0.",
|
||||
"nevlas charge 2pw (4/3/0/1 ⇒ 2/5/0/1)",
|
||||
"hadsch-hallas charge 2pw (5/2/2/0 ⇒ 3/4/2/0)",
|
||||
"nevlas pass booster9 returning booster8",
|
||||
"hadsch-hallas pass booster3 returning booster5",
|
||||
"taklons spend 3pw for 3c. build colonyShip 3B5. (0,B/0/3/0 ⇒ 3,B/0/0/0)",
|
||||
"taklons pass booster8 returning booster7",
|
||||
"terrans income 2t. income 4pw. income 3pw (0/3/0/6 ⇒ 1/0/5/6)",
|
||||
"nevlas income 1t (2/5/0/1 ⇒ 0/0/8/1)",
|
||||
"terrans spend 6tg for 2o (1/0/5/6 ⇒ 1/6/5/0)",
|
||||
"terrans action power3. (1/6/5/0 ⇒ 5/6/1/0)",
|
||||
"nevlas action power4. (1/0/8/0 ⇒ 3/0/6/0)",
|
||||
"hadsch-hallas move colonyShip 7A7 7B3 buildColony 7B2.",
|
||||
"taklons up nav (2 ⇒ 3). brainstone area3. spend 3pw for 1o. (0/3,B/0/0 ⇒ 0,B/1/2/0)",
|
||||
"terrans build m 10A9.",
|
||||
"nevlas move colonyShip 9A6 2C buildColony 2B3.",
|
||||
"taklons charge 2pw. brainstone area3 (0,B/1/2/0 ⇒ 0/1/2,B/0)",
|
||||
"hadsch-hallas move tradeShip 9C 9A5 trade 9B3. (0/3/6/0 ⇒ 1/3/5/0)",
|
||||
"taklons spend 3pw for 1o. move tradeShip 9A6 9A9 trade 5A3. (0/1/2,B/0 ⇒ 0/2,B/1/0)",
|
||||
"terrans spend 1pw for 1c. build gf 10A10 using area1: 6. (5/6/1/0 ⇒ 0/6/0/6)",
|
||||
"nevlas spend 4pw for 1q. move colonyShip 5A10 6B2 buildColony 6B1. (3/0/6/0 ⇒ 5/0/4/0)",
|
||||
"hadsch-hallas build PI 5A3.",
|
||||
"taklons charge 2pw. brainstone area3 (0/2,B/1/0 ⇒ 0/1/2,B/0)",
|
||||
"nevlas charge 1pw (5/0/4/0 ⇒ 4/1/4/0)",
|
||||
"taklons move colonyShip 3B5 1B1 buildColony 1B0. spend 3pw for 1o. (0/1/2,B/0 ⇒ 0,B/1/2/0)",
|
||||
"terrans charge 1pw (0/6/0/6 ⇒ 0/5/1/6)",
|
||||
"terrans burn 2. move tradeShip 1A1 4A4 trade 4A3. (0/5/1/6 ⇒ 3/1/0/6)",
|
||||
"nevlas spend 1t-a3 for 1k. spend 1t-a3 for 1k. up dip (1 ⇒ 2). (4/1/4/0 ⇒ 4/1/2/2)",
|
||||
"hadsch-hallas move tradeShip 5A1 5A1 trade 5A0. (1/3/5/0 ⇒ 2/3/4/0)",
|
||||
"taklons build colonyShip 1A0.",
|
||||
"terrans build colonyShip 6A4.",
|
||||
"nevlas move tradeShip 5A1 5B2 trade 5A3. (4/1/2/2 ⇒ 0/7/1/2)",
|
||||
"hadsch-hallas spend 6c for 2o. build colonyShip 10B1.",
|
||||
"taklons spend 1pw for 1c. special 4pw. brainstone area3 (0,B/1/2/0 ⇒ 0/1/2,B/0). spend 3pw for 1o.",
|
||||
"terrans build tradeShip 8A7.",
|
||||
"nevlas special 4pw. (0/7/1/2 ⇒ 0/3/5/2)",
|
||||
"hadsch-hallas up eco (1 ⇒ 2).",
|
||||
"taklons build colonyShip 7A10.",
|
||||
"terrans pass booster5 returning booster2",
|
||||
"nevlas move tradeShip 7A8 7A8 trade 7A9. (0/3/5/2 ⇒ 1/3/4/2)",
|
||||
"hadsch-hallas action power5. (2/3/4/0 ⇒ 6/3/0/0)",
|
||||
"taklons up eco (0 ⇒ 1).",
|
||||
"nevlas spend 1t-a3 for 1k. up eco (1 ⇒ 2). (1/3/4/2 ⇒ 1/3/3/3)",
|
||||
"hadsch-hallas up eco (2 ⇒ 3). (6/3/0/0 ⇒ 3/6/0/0)",
|
||||
"taklons pass booster2 returning booster8",
|
||||
"nevlas spend 4pw for 1o,1c. build ac2 5A0. tech eco. up eco (2 ⇒ 3). (1/3/3/3 ⇒ 0/6/1/3)",
|
||||
"hadsch-hallas charge 1pw (3/6/0/0 ⇒ 2/7/0/0)",
|
||||
"terrans decline 3pw",
|
||||
"hadsch-hallas spend 3c for 1o. build tradeShip 5A4.",
|
||||
"nevlas special q.",
|
||||
"hadsch-hallas spend 3c for 1o. pass booster10 returning booster3",
|
||||
"nevlas burn 1. spend 4pw for 1o,1c. build tradeShip 5A10. (0/6/1/3 ⇒ 2/4/0/3)",
|
||||
"nevlas pass booster3 returning booster9",
|
||||
"terrans income 1t (3/1/0/6 ⇒ 0/0/5/6)",
|
||||
"taklons income 2t. brainstone area3 (0,B/1/2/0 ⇒ 0/0/5,B/0)",
|
||||
"hadsch-hallas income 1t (2/7/0/0 ⇒ 0/0/10/0)",
|
||||
"nevlas income 1t (2/4/0/3 ⇒ 0/0/7/3)",
|
||||
"terrans spend 3tg for 1o. spend 3tg for 3c (0/0/5/6 ⇒ 0/6/5/0)",
|
||||
"terrans move colonyShip 6A4 6C buildColony 6B5.",
|
||||
"nevlas charge 4pw (3/0/7/0 ⇒ 0/2/8/0)",
|
||||
"taklons action power3. brainstone area1. (0/0/5,B/0 ⇒ 1,B/0/4/0)",
|
||||
"hadsch-hallas spend 4c for 1q. move colonyShip 10B1 10B1 buildColony 10B0.",
|
||||
"terrans charge 1pw (0/6/5/0 ⇒ 0/5/6/0)",
|
||||
"nevlas action qic3.",
|
||||
"terrans move tradeShip 8A7 9A11 trade 9A10. (0/5/6/0 ⇒ 3/5/3/0)",
|
||||
"taklons move colonyShip 1A0 4C buildColony 4B5.",
|
||||
"hadsch-hallas spend 3c for 1o. build ac2 2A11. tech eco. up eco (3 ⇒ 4).",
|
||||
"taklons charge 2pw (1,B/0/4/0 ⇒ 0/1,B/4/0)",
|
||||
"nevlas charge 2pw (0/2/8/0 ⇒ 0/0/10/0)",
|
||||
"nevlas action power2. build m 6B3. (0/0/10/0 ⇒ 3/0/7/0)",
|
||||
"terrans decline 3pw",
|
||||
"terrans build m 10A10.",
|
||||
"taklons up terra (0 ⇒ 1).",
|
||||
"hadsch-hallas action power5. (0/0/10/0 ⇒ 4/0/6/0)",
|
||||
"nevlas special 4pw. (3/0/7/0 ⇒ 0/2/8/0)",
|
||||
"terrans move tradeShip 4A4 5B4 trade 5B5. (3/5/3/0 ⇒ 6/5/0/0)",
|
||||
"taklons build lab 2B0. tech free1. up nav (3 ⇒ 4).",
|
||||
"nevlas charge 2pw (0/2/8/0 ⇒ 0/0/10/0)",
|
||||
"hadsch-hallas decline 4pw",
|
||||
"hadsch-hallas federation 7B0,7B1,7B2 fed5 using area1: 1. (4/0/6/0 ⇒ 3/0/6/0)",
|
||||
"nevlas action power1. (0/0/10/0 ⇒ 4/0/6/0)",
|
||||
"terrans build gf 6A9 using area1: 6. (6/5/0/0 ⇒ 0/5/0/6)",
|
||||
"taklons move tradeShip 9A9 5B0 trade 5A0. (0/1,B/4/0 ⇒ 1/1,B/3/0)",
|
||||
"hadsch-hallas up dip (4 ⇒ 5).",
|
||||
"nevlas up dip (2 ⇒ 3). (4/0/6/0 ⇒ 1/3/6/0)",
|
||||
"terrans special range+3. build m 4A10.",
|
||||
"taklons decline 3pw",
|
||||
"taklons up terra (1 ⇒ 2).",
|
||||
"hadsch-hallas move tradeShip 5A4 3A11 trade 3B0.",
|
||||
"nevlas spend 3t-a3 for 3k. up dip (3 ⇒ 4). (1/3/6/0 ⇒ 1/3/3/3)",
|
||||
"terrans build lab 8B4. tech free1. up gaia (1 ⇒ 2). (0/5/0/6 ⇒ 3/5/0/6)",
|
||||
"nevlas charge 4pw (1/3/3/3 ⇒ 0/1/6/3)",
|
||||
"taklons build ts 3B0.",
|
||||
"nevlas charge 1pw (0/1/6/3 ⇒ 0/0/7/3)",
|
||||
"hadsch-hallas charge 1pw (3/0/6/0 ⇒ 2/1/6/0)",
|
||||
"terrans decline 3pw",
|
||||
"hadsch-hallas move tradeShip 9A5 2A1 trade 2B0.",
|
||||
"nevlas action power6. build m 3A5. (0/0/7/3 ⇒ 2/0/5/3)",
|
||||
"terrans up gaia (2 ⇒ 3). (3/5/0/6 ⇒ 0/8/0/6)",
|
||||
"taklons build lab 3B0. tech terra. up terra (2 ⇒ 3). brainstone area3. spend 3pw for 1o. brainstone area1. (1/1,B/3/0 ⇒ 0,B/1/4/0)",
|
||||
"nevlas charge 1pw (2/0/5/3 ⇒ 1/1/5/3)",
|
||||
"hadsch-hallas charge 1pw (2/1/6/0 ⇒ 1/2/6/0)",
|
||||
"terrans charge 3pw (0/8/0/6 ⇒ 0/5/3/6)",
|
||||
"hadsch-hallas special q.",
|
||||
"nevlas move tradeShip 7A8 7B3 trade 7B2. (1/1/5/3 ⇒ 2/1/4/3)"
|
||||
]
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ import Engine, {
|
|||
Faction,
|
||||
finalRankings,
|
||||
gainFinalScoringVictoryPoints,
|
||||
Operator,
|
||||
Player,
|
||||
PlayerEnum,
|
||||
ResearchField,
|
||||
|
|
@ -21,7 +20,6 @@ import Engine, {
|
|||
TechPos,
|
||||
} from "@gaia-project/engine";
|
||||
import { boosterData } from "../../data/boosters";
|
||||
import { playerHasReceivedAllIncome } from "../../data/resources";
|
||||
import { advancedTechTileData } from "../../data/tech-tiles";
|
||||
import { colorCodes } from "../color-codes";
|
||||
import type { DatasetFactory, IncludeRounds } from "./charts";
|
||||
|
|
@ -109,15 +107,6 @@ function passIncomeProjection(
|
|||
};
|
||||
}
|
||||
|
||||
function incomeProjection(sources: EventSource[]): (e: Engine, p: Player) => Map<number, number> | null {
|
||||
return (e, p) => {
|
||||
if (e.isLastRound) {
|
||||
return null;
|
||||
}
|
||||
return vpProjection(p.events[Operator.Income], sources, e, true, playerHasReceivedAllIncome(e, p) ? 1 : 0);
|
||||
};
|
||||
}
|
||||
|
||||
function finalScoringProjection(finalTile: number): (engine: Engine, pl: Player) => Map<any, number> {
|
||||
return (engine: Engine, pl: Player) => {
|
||||
const points = simulateIncome(
|
||||
|
|
@ -293,23 +282,6 @@ export const victoryPointSources = (
|
|||
new Map([[finalScoringRound, simulateIncome(pl, (clone) => clone.data.finalResourceHandling(), e.version)]]),
|
||||
},
|
||||
];
|
||||
if (expansion == Expansion.Frontiers) {
|
||||
sources.push(
|
||||
{
|
||||
types: [Command.ChooseIncome],
|
||||
label: "Colonies",
|
||||
description: "Income from colonies",
|
||||
color: "--rt-nav",
|
||||
roundValues: incomeProjection([Command.ChooseIncome]),
|
||||
},
|
||||
{
|
||||
types: ["trade"],
|
||||
label: "Trade",
|
||||
description: "Trade with colonies",
|
||||
color: "--rt-dip",
|
||||
}
|
||||
);
|
||||
}
|
||||
// The Gleens VP source only ever scores for a Gleens player, so drop its (always-empty) column
|
||||
// unless Gleens is actually in the game (owner request). Statistics mode passes every faction, so
|
||||
// it stays there.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,5 @@ export const colorCodes = {
|
|||
range: new ColorCoded("r", "--rt-nav"),
|
||||
gaia: new ColorCoded("g", "--gaia"),
|
||||
researchStep: new ColorCoded("r", "--rt-sci"),
|
||||
tradeShip: new ColorCoded("s", "--volcanic"),
|
||||
spaceStation: new ColorCoded("s", "--oxide"),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ const TRACK_LABELS: Record<string, string> = {
|
|||
[ResearchField.GaiaProject]: "Gaia",
|
||||
[ResearchField.Economy]: "eco",
|
||||
[ResearchField.Science]: "sci",
|
||||
[ResearchField.Diplomacy]: "dip",
|
||||
};
|
||||
|
||||
const SHIP_LABELS: Record<string, string> = {
|
||||
|
|
@ -400,7 +399,6 @@ function normalizeReleasedCompactSummary(summary: string): string {
|
|||
"GAIA↑": "up Gaia",
|
||||
"ECO↑": "up eco",
|
||||
"SCI↑": "up sci",
|
||||
"DIP↑": "up dip",
|
||||
};
|
||||
for (const [oldLabel, newLabel] of Object.entries(oldTracks)) {
|
||||
detail = detail.split(oldLabel).join(newLabel);
|
||||
|
|
@ -448,7 +446,7 @@ export function normalizeCachedMoveSummary(summary: string): string {
|
|||
|
||||
const patterns: Array<[RegExp, (match: RegExpMatchArray) => string]> = [
|
||||
[/^(.+?) submitted silent bids\.?$/i, (m) => `${m[1]}: bids in`],
|
||||
[/^(.+?) up (terra|nav|int|gaia|eco|sci|dip)\.?$/i, (m) => `${m[1]}: up ${TRACK_LABELS[m[2].toLowerCase()]}`],
|
||||
[/^(.+?) up (terra|nav|int|gaia|eco|sci)\.?$/i, (m) => `${m[1]}: up ${TRACK_LABELS[m[2].toLowerCase()]}`],
|
||||
[/^(.+?) build mine sector (\S+?)\.?$/i, (m) => `${m[1]}: build m @ S${cleanArg(m[2])}`],
|
||||
[
|
||||
/^(.+?) build (ts|lab|PI|academy)\.?$/i,
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
import {
|
||||
Building,
|
||||
Expansion,
|
||||
Faction,
|
||||
factionBoard,
|
||||
lastTile,
|
||||
PlayerData,
|
||||
researchEvents,
|
||||
ResearchField,
|
||||
Resource,
|
||||
} from "@gaia-project/engine";
|
||||
import type { TradeOption } from "@gaia-project/engine/src/available/ships";
|
||||
import { tradeCost, tradeOptions, tradeRewards } from "@gaia-project/engine/src/available/ships";
|
||||
import { buildingData } from "../data/building";
|
||||
import type { RichText } from "../graphics/rich-text";
|
||||
import { richText, richTextArrow, richTextRewards } from "../graphics/rich-text";
|
||||
import { cellStyle } from "./table/util";
|
||||
|
||||
type TradeRow = { style: string; cells: RichText[] };
|
||||
|
||||
const levels = Array.from({ length: lastTile(ResearchField.Diplomacy) + 1 }, (_, i) => i);
|
||||
|
||||
export function tradeHeaders(): string[] {
|
||||
return ["Name"].concat(levels.map((level) => `Diplomacy ${level}`));
|
||||
}
|
||||
|
||||
function row(option: TradeOption): TradeRow {
|
||||
const b = option.buildings[0];
|
||||
const data = buildingData[b];
|
||||
const name: RichText = [
|
||||
richText(`${option.domestic ? "Domestic" : "Foreign"} ${b === Building.Academy1 ? "Academy" : data.name}`),
|
||||
];
|
||||
|
||||
const cells: RichText[] = levels.map((level) => {
|
||||
const guest = new PlayerData();
|
||||
|
||||
Array.from({ length: level + 1 }, (_, i) => i)
|
||||
.map((l) => researchEvents(ResearchField.Diplomacy, l, Expansion.Frontiers))
|
||||
.forEach((events, l) => {
|
||||
for (const e of events) {
|
||||
guest.gainRewards(e.rewards);
|
||||
}
|
||||
});
|
||||
|
||||
const cost = tradeCost(guest, option);
|
||||
cost.type = Resource.PayPower;
|
||||
const rewards = tradeRewards(option, guest, guest);
|
||||
const bld = option.build;
|
||||
const buildDesc = bld
|
||||
? `<br/>Build ${buildingData[bld].name} for ${factionBoard(Faction.Terrans).buildings[bld].cost.join(",")}`
|
||||
: "";
|
||||
const academy = option.researchAdvancementBonus ? ` *` : "";
|
||||
return [richTextRewards([cost]), richTextArrow, { rewards }, richText(`${buildDesc}${academy}`)];
|
||||
});
|
||||
|
||||
return {
|
||||
style: cellStyle(data.color),
|
||||
cells: [name].concat(cells),
|
||||
};
|
||||
}
|
||||
|
||||
export function tradeRows(): TradeRow[] {
|
||||
return tradeOptions.map((option) => row(option));
|
||||
}
|
||||
|
|
@ -115,9 +115,6 @@ export function leechPlanets(map: SpaceMap, player: PlayerEnum, hex: GaiaHex): {
|
|||
if (h.colonizedBy(player)) {
|
||||
return [{ hex: h, building: h.buildingOf(player) }];
|
||||
}
|
||||
if (h.customPosts.includes(player)) {
|
||||
return [{ hex: h, building: Building.CustomsPost }];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,19 +11,16 @@ describe("self-contained setup", () => {
|
|||
expect(setup.players).to.equal(2);
|
||||
expect(setup.seed).to.equal("lf-demo");
|
||||
expect(setup.options.lostFleet).to.equal(true);
|
||||
expect(setup.options.frontiers).to.equal(false);
|
||||
});
|
||||
|
||||
it("lets explicit falsy values disable build-time flags", () => {
|
||||
const setup = parseSelfContainedSetup("?lostFleet=0", {
|
||||
VUE_APP_players: "4",
|
||||
VUE_APP_lostFleet: "1",
|
||||
VUE_APP_frontiers: "0",
|
||||
});
|
||||
|
||||
expect(setup.players).to.equal(4);
|
||||
expect(setup.options.lostFleet).to.equal(false);
|
||||
expect(setup.options.frontiers).to.equal(false);
|
||||
});
|
||||
|
||||
it("defaults offline games to Silent Auction with a ban phase and allows an explicit override", () => {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ export type SelfContainedSetup = {
|
|||
randomFactions: boolean;
|
||||
advancedRules: boolean;
|
||||
customBoardSetup: boolean;
|
||||
frontiers: boolean;
|
||||
lostFleet: boolean;
|
||||
};
|
||||
};
|
||||
|
|
@ -104,7 +103,6 @@ export function parseSelfContainedSetup(search = "", env: SelfContainedEnv = pro
|
|||
randomFactions: flag("randomFactions", env.VUE_APP_randomFactions),
|
||||
advancedRules: flag("advancedRules") || flag("rotateSectors", env.VUE_APP_rotateSectors),
|
||||
customBoardSetup: flag("customBoardSetup", env.VUE_APP_customBoardSetup),
|
||||
frontiers: flag("frontiers", env.VUE_APP_frontiers),
|
||||
lostFleet: flag("lostFleet", env.VUE_APP_lostFleet),
|
||||
},
|
||||
};
|
||||
|
|
@ -128,13 +126,13 @@ function launchSelfContained(selector = "#app", debug = true) {
|
|||
const emitter = launch(selector, debug ? Wrapper : Game);
|
||||
|
||||
// Game setup can be configured at runtime via URL query params (no rebuild
|
||||
// needed) — e.g. ?players=4&seed=42&factionVariant=beta&frontiers=1
|
||||
// needed) — e.g. ?players=4&seed=42&factionVariant=beta&lostFleet=1
|
||||
// Query params take precedence over the VUE_APP_* build-time env vars.
|
||||
// Supported: players (2-5), seed, layout (standard|balanced|xshape),
|
||||
// auction (none|silent|choose-bid|bid-while-choosing), banPhase,
|
||||
// factionVariant (standard|more-balanced|beta), and the flags
|
||||
// randomFactions, advancedRules (alias rotateSectors), customBoardSetup,
|
||||
// frontiers, lostFleet. Alternatively, ?state=<base64url-json> boots
|
||||
// lostFleet. Alternatively, ?state=<base64url-json> boots
|
||||
// directly into an exported game state, and ?scenario=<id> loads a named
|
||||
// Lost Fleet test position. State URLs take precedence over scenario URLs.
|
||||
// Optional loadType and stopMove are supported for state URLs.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
--rt-nav: #516372;
|
||||
--rt-gaia: #a5589c;
|
||||
--rt-int: #508344;
|
||||
--rt-dip: #243e83;
|
||||
|
||||
--tech-tile: #e5e5ea;
|
||||
--adv-tech-tile: #6888fa;
|
||||
|
|
|
|||
|
|
@ -21,16 +21,26 @@ const root = dirname(fileURLToPath(import.meta.url));
|
|||
* - CSS extracts to viewer.css alongside the bundle; the sourcemap's relative
|
||||
* sourceMappingURL keeps working because js+map share the BGS bundle directory.
|
||||
*/
|
||||
// `vite` / `vite serve` runs the dev app (index.html + src/main.ts entry, public/ assets);
|
||||
// `vite build` produces the published IIFE lib (src/wrapper.ts). Everything lib-specific
|
||||
// (appType/publicDir/lib entry/externals) is scoped to the build; the dev app gets the
|
||||
// standard SPA treatment.
|
||||
const building = process.argv.includes("build");
|
||||
|
||||
export default defineConfig({
|
||||
// no app shell: the lib entry only; dev serves from src/demo for local testing
|
||||
appType: "custom",
|
||||
publicDir: false,
|
||||
// Lib build only: no app shell, no public assets, NODE_ENV baked to production (the
|
||||
// published bundle must not keep dev branches). The dev app flips all of these.
|
||||
...(building ? { appType: "custom", publicDir: false } : {}),
|
||||
// Dev only: never let the dep-optimizer pre-bundle the workspace engine - the aliases below
|
||||
// point the bare specifier at engine SOURCE, and esbuild pre-bundling would race the first
|
||||
// page load with a stale CJS dist snapshot ("does not provide an export named ...").
|
||||
...(building ? {} : { optimizeDeps: { exclude: ["@gaia-project/engine"] } }),
|
||||
define: {
|
||||
// vue-cli's DefinePlugin supplied `process.env` (empty object) plus VUE_APP_* vars that
|
||||
// default to undefined. webpack also auto-shimmed bare `process` in the browser; rolldown
|
||||
// doesn't, so replace the whole expression. Empty object reproduces the old defaults:
|
||||
// !!undefined === false, `?? x` falls through, for-in over {} iterates nothing.
|
||||
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||
"process.env.NODE_ENV": JSON.stringify(building ? "production" : "development"),
|
||||
"process.env": "({})",
|
||||
},
|
||||
plugins: [vue()],
|
||||
|
|
@ -43,15 +53,20 @@ export default defineConfig({
|
|||
// from the same bundle dir; keep cssCodeSplit false so it lands in one viewer.css.
|
||||
cssCodeSplit: false,
|
||||
minify: true,
|
||||
lib: {
|
||||
entry: join(root, "src/wrapper.ts"),
|
||||
name: "gaiaViewerLib",
|
||||
formats: ["iife"],
|
||||
fileName: () => "viewer.umd.js",
|
||||
},
|
||||
...(building
|
||||
? {
|
||||
lib: {
|
||||
entry: join(root, "src/wrapper.ts"),
|
||||
name: "gaiaViewerLib",
|
||||
formats: ["iife"],
|
||||
fileName: () => "viewer.umd.js",
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
rollupOptions: {
|
||||
// IIFE externals resolve to plain global identifier reads at runtime.
|
||||
external: ["vue", "bootstrap-vue"],
|
||||
// IIFE externals resolve to plain global identifier reads at runtime (build only -
|
||||
// the dev app bundles its own copies).
|
||||
external: building ? ["vue", "bootstrap-vue"] : [],
|
||||
output: {
|
||||
globals: { vue: "Vue", "bootstrap-vue": "BootstrapVue" },
|
||||
sourcemap: true,
|
||||
|
|
@ -98,10 +113,23 @@ export default defineConfig({
|
|||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
// keep `~` scss imports (~bootstrap/..., ~bootstrap-vue) working
|
||||
"~": join(root, "node_modules"),
|
||||
},
|
||||
// Array form so the dev-only engine aliases can be conditionally spread. The workspace-linked
|
||||
// engine package is CJS (main = dist/index.js) which the dev server can't interop for named
|
||||
// ESM imports (`Planet` fails with "does not provide an export"), and its /wrapper + /src/*
|
||||
// subpaths have no package.json "exports" map for vite to follow - so dev maps everything
|
||||
// onto the engine SOURCE (vite transpiles TS natively). The lib build (building=true) keeps
|
||||
// the real package resolution: same emitted shapes, and `~` scss imports (~bootstrap/...,
|
||||
// ~bootstrap-vue) must keep resolving into node_modules either way.
|
||||
alias: [
|
||||
{ find: "~", replacement: join(root, "node_modules") },
|
||||
...(building
|
||||
? []
|
||||
: [
|
||||
{ find: /^@gaia-project\/engine\/wrapper$/, replacement: join(root, "..", "engine", "wrapper.ts") },
|
||||
{ find: /^@gaia-project\/engine\/src\//, replacement: join(root, "..", "engine", "src/") },
|
||||
{ find: /^@gaia-project\/engine$/, replacement: join(root, "..", "engine", "index.ts") },
|
||||
]),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue