perf(engine): 10x federation enumeration — fixes >10s move timeouts in prod games (#325)

This commit is contained in:
Eliott C. 2026-08-19 12:19:05 +02:00 • committed by GitHub
commit 2e6e4ce4d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
129 changed files with 17913 additions and 1378 deletions

View file

@ -17,13 +17,11 @@ jobs:
lint_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "14"
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
node-version: "24"
- run: corepack enable
- run: pnpm install
- run: yarn build
- run: yarn lint

View file

@ -1,46 +0,0 @@
name: Old UI - Version and Release
on:
workflow_dispatch:
inputs:
newversion:
description: "Semantic Version Bump Type (major minor patch)"
default: patch
env:
node_version: 24
defaults:
run:
working-directory: old-ui
jobs:
version_and_release:
runs-on: ubuntu-latest
permissions:
contents: write # git push --follow-tags
id-token: write # OIDC trusted publishing
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
# registry-url is required so npm publish targets the public npm registry
registry-url: "https://registry.npmjs.org"
- run: corepack enable
- run: pnpm install
- run: git config --global user.name github-actions
- run: git config --global user.email bot@github.com
- run: yarn config set version-git-message "🔖 (old-ui) v%s"
- run: yarn version --${{ github.event.inputs.newversion }}
# pnpm 10.16+ supports OIDC trusted publishing and rewrites the workspace:../engine
# dependency to a real version range; publish it via npx so we don't have to bump the
# repo-wide pnpm (which would force a lockfile rewrite). No NODE_AUTH_TOKEN is set, so
# publishing authenticates with the OIDC token instead of the (now-rejected) npm token.
# NODE_OPTIONS=--openssl-legacy-provider works around webpack 4's reliance on MD4,
# which OpenSSL 3 (bundled with Node >= 17) no longer supports out of the box.
- run: npx -y pnpm@latest publish . --access public --no-git-checks
env:
NODE_OPTIONS: --openssl-legacy-provider
- run: git push --follow-tags

View file

@ -1,32 +0,0 @@
name: Old UI - Test
on:
push:
paths:
- ".github/workflows/old-ui-test.yml"
- "viewer/**"
branches:
- master
pull_request:
paths:
- ".github/workflows/old-ui-test.yml"
- "viewer/**"
defaults:
run:
working-directory: old-ui
jobs:
test_and_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
- run: pnpm install
- run: pnpm lint
# - run: pnpm test
- run: pnpm build

View file

@ -5,10 +5,10 @@ jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: pnpm/action-setup@v1.2.1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
version: 5.17.1
node-version: "24"
- run: corepack enable
- run: pnpm install
- run: pnpm run prettier-check

View file

@ -19,13 +19,11 @@ jobs:
test_and_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "14"
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
node-version: "24"
- run: corepack enable
- run: pnpm install
- run: pnpm lint
- run: pnpm test

View file

@ -2,5 +2,6 @@
"tabWidth": 2,
"useTabs": false,
"printWidth": 120,
"trailingComma": "es5"
"trailingComma": "es5",
"plugins": ["prettier-plugin-organize-imports"]
}

View file

@ -1,9 +1,7 @@
<template></template>
<script lang="ts">
import {Vue, Component, Prop, Watch} from "vue-property-decorator";
import { Component, Vue } from "vue-property-decorator";
@Component
export default class $0 extends Vue {
}
export default class $0 extends Vue {}
</script>

View file

@ -0,0 +1,93 @@
import { expect } from "chai";
import PilingSong from "./fixtures/Piling-song-3477.data.json";
import WavelyTriangle from "./fixtures/Wavely-triangle-5324.data.json";
import Engine from "./src/engine";
import { isOutclassedBy } from "./src/federation";
import { currentPlayer, logSlice, move, scores } from "./wrapper";
/**
* Regression tests for the federation-enumeration performance issue that got two
* production games stuck: engine.move() took >10s (the platform kills engine calls
* at 10s) because Player.availableFederations exploded combinatorially on late-game
* states with many building groups.
*
* The fixtures are the actual production game states. Before the optimization, the
* moves below took ~5s and ~3.5s on a fast dev machine (and >10s in production);
* they now take well under a second, so the generous bounds here should only trip
* on a real complexity regression, not on slow CI hardware.
*/
describe("federation computation performance", function () {
this.timeout(30000);
const MAX_MS = 5000;
it("Wavely-triangle-5324: 'xenos action qic3.' completes quickly", () => {
const engine = Engine.fromData(JSON.parse(JSON.stringify(WavelyTriangle)));
const historyLength = engine.moveHistory.length;
const start = Date.now();
const result = move(engine, "xenos action qic3.", 1);
const elapsed = Date.now() - start;
expect(result.moveHistory.length).to.be.greaterThan(historyLength);
expect(result.moveHistory[historyLength]).to.match(/^xenos action qic3\./);
expect(elapsed).to.be.lessThan(MAX_MS);
// The follow-up entry points the platform calls on the result also complete
expect(currentPlayer(result)).to.be.a("number");
expect(scores(result)).to.have.length(4);
expect(logSlice(result, { start: historyLength }).log).to.have.length(1);
});
it("Piling-song-3477: baltaks' federation move completes quickly", () => {
// The failing move is at index 203 of the fixture's move history: load the state
// right before it, then apply it as a live move (which triggers the expensive
// legality checks and the next player's federation computation)
const engine = Engine.fromData(JSON.parse(JSON.stringify(PilingSong))).replayedTo(203, false);
const historyLength = engine.moveHistory.length;
const start = Date.now();
const result = move(
engine,
"baltaks federation 10A10,10A3,10A4,10A9,10B0,10B1,10B2,10B3,10B4 fed6 using area1: 3.",
0
);
const elapsed = Date.now() - start;
expect(result.moveHistory.length).to.be.greaterThan(historyLength);
// Same power-token accounting as when the move was accepted in production
expect(result.moveHistory[historyLength]).to.equal(
"baltaks federation 10A10,10A3,10A4,10A9,10B0,10B1,10B2,10B3,10B4 fed6 using area1: 3. (6/1/0/0 ⇒ 3/1/0/0)"
);
expect(elapsed).to.be.lessThan(MAX_MS);
expect(currentPlayer(result)).to.be.a("number");
expect(scores(result)).to.have.length(3);
expect(logSlice(result, { start: historyLength }).log).to.have.length(1);
});
it("Piling-song-3477: availableFederations returns only rules-legal federations", () => {
const engine = Engine.fromData(JSON.parse(JSON.stringify(PilingSong))).replayedTo(203, false);
for (const player of engine.players) {
player.federationCache = null;
const feds = player.availableFederations(engine.map, engine.options.flexibleFederations);
for (const fed of feds) {
expect(fed.powerValue).to.be.at.least(player.federationCost);
expect(fed.newSatellites).to.be.at.most(player.maxSatellites);
// The hexes of a federation must form a single connected group
expect(engine.map.grid.groups(fed.hexes)).to.have.length(1);
}
// No returned federation may be outclassed by another one
for (const fed of feds) {
for (const other of feds) {
if (fed !== other) {
expect(isOutclassedBy(fed, other), "federation should not be outclassed").to.be.false;
}
}
}
}
});
});

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -77,20 +77,20 @@ export { AvailableSetupOption, SetupType } from "./src/setup";
export { finalScorings } from "./src/tiles/scoring";
export {
BrainstoneDest,
MaxLeech,
BuildWarning,
Event,
EventSource,
finalRankings,
gainFinalScoringVictoryPoints,
MAX_SATELLITES,
MaxLeech,
parseLocation,
Player,
PlayerData,
Event,
Power,
Reward,
SpaceMap,
EventSource,
gainFinalScoringVictoryPoints,
finalRankings,
parseLocation,
stdBuildingValue,
Power,
MAX_SATELLITES,
};
export default Engine;

View file

@ -1,6 +1,6 @@
{
"name": "@gaia-project/engine",
"version": "4.8.52",
"version": "4.8.53",
"description": "Javascript engine for project gaia",
"main": "dist/index.js",
"types": "index.ts",
@ -42,7 +42,7 @@
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/lodash": "^4.14.149",
"@types/lodash": "4.14.182",
"@types/mocha": "^2.2.48",
"@types/node": "^14.0.14",
"@types/seedrandom": "^2.4.27",

View file

@ -0,0 +1,99 @@
import { Grid, Hex } from "hexagrid";
/**
* Memoized topology information for a grid: neighbours and walking distances.
*
* `Grid.neighbours` recomputes string keys and does 6 map lookups on every call, and
* `Grid.distance` runs a full A* per hex pair. Both show up as major hotspots when
* computing federations (thousands of shortest-path searches over the same grid).
*
* This helper assumes the grid is not mutated after the topology is created, which
* holds for the map grid and for the throwaway working grids used by the federation
* algorithms.
*/
export interface GridIndex<HexType extends Hex<any>> {
/** index -> hex */
hexList: HexType[];
/** hex -> index */
indexOf: Map<HexType, number>;
/** index -> indices of its neighbours, in `Grid.neighbours` order */
neighbourIndices: number[][];
}
export class GridTopology<HexType extends Hex<any>> {
private adjacency: Map<HexType, HexType[]> = new Map();
private distances: Map<HexType, Map<HexType, number>> = new Map();
private _index: GridIndex<HexType>;
constructor(private grid: Grid<HexType>) {}
/** Integer-indexed view of the grid, for algorithms that want to avoid Map/Set lookups in hot loops */
index(): GridIndex<HexType> {
if (this._index === undefined) {
const hexList = [...this.grid.values()];
const indexOf = new Map(hexList.map((hex, i) => [hex, i] as [HexType, number]));
const neighbourIndices = hexList.map((hex) => this.neighbours(hex).map((neighbour) => indexOf.get(neighbour)));
this._index = { hexList, indexOf, neighbourIndices };
}
return this._index;
}
neighbours(hex: HexType): HexType[] {
let ret = this.adjacency.get(hex);
if (ret === undefined) {
ret = this.grid.neighbours(hex);
this.adjacency.set(hex, ret);
}
return ret;
}
/**
* Walking distance between two hexes of the grid, i.e. the number of steps needed
* to reach `to` from `from` while staying within the grid. -1 if unreachable.
*
* Same semantics as `Grid.distance`, but memoized (one BFS per source hex instead
* of one A* per pair).
*/
distance(from: HexType, to: HexType): number {
let dists = this.distances.get(from);
if (dists === undefined) {
dists = this.bfs(from);
this.distances.set(from, dists);
}
return dists.get(to) ?? -1;
}
private bfs(from: HexType): Map<HexType, number> {
const dist: Map<HexType, number> = new Map([[from, 0]]);
let frontier: HexType[] = [from];
let d = 0;
while (frontier.length > 0) {
const next: HexType[] = [];
d += 1;
for (const hex of frontier) {
for (const neighbour of this.neighbours(hex)) {
if (!dist.has(neighbour)) {
dist.set(neighbour, d);
next.push(neighbour);
}
}
}
frontier = next;
}
return dist;
}
}
const cache = new WeakMap<Grid<any>, GridTopology<any>>();
/** Get (or create) the memoized topology of a grid. The grid must not be mutated afterwards. */
export function topologyOf<HexType extends Hex<any>>(grid: Grid<HexType>): GridTopology<HexType> {
let topology = cache.get(grid) as GridTopology<HexType>;
if (topology === undefined) {
topology = new GridTopology(grid);
cache.set(grid, topology);
}
return topology;
}

View file

@ -1,30 +1,80 @@
import { Grid, Hex } from "hexagrid";
import { difference, flatten } from "lodash";
import { topologyOf } from "./grid-topology";
/**
* Find the cheapest path from any hex of `starts` to any hex of `dests`.
*
* Runs a BFS-style relaxation (all costs are non-negative, typically 0 or 1) over an
* integer-indexed view of the grid, to keep the inner loop free of Map/Set lookups.
*
* @param costOf Cost of adding a hex to the path. Costs must be non-negative. Either a
* function, or a Float64Array indexed like `topologyOf(grid).index()` (cheaper when
* calling repeatedly).
* @param maxCost Paths costing more than this are not explored. If the cheapest path
* exceeds it, undefined is returned. Defaults to unbounded.
*/
export default function shortestPath<T>(
starts: Hex<T>[],
dests: Hex<T>[],
grid: Grid,
costOf = (hex: Hex<T>) => 1
costOf: ((hex: Hex<T>) => number) | Float64Array = () => 1,
maxCost = Infinity
): { path: Hex<T>[]; cost: number } {
const destSet: Set<Hex<T>> = new Set(dests);
const pathTo: Map<Hex<T>, { path: Hex<T>[]; cost: number }> = new Map();
const topology = topologyOf(grid as Grid<Hex<T>>);
const { hexList, indexOf, neighbourIndices } = topology.index();
const size = hexList.length;
for (const start of starts) {
pathTo.set(start, { path: [start], cost: costOf(start) });
if (destSet.has(start)) {
return { path: [start], cost: costOf(start) };
let hexCost: Float64Array;
if (costOf instanceof Float64Array) {
hexCost = costOf;
} else {
hexCost = new Float64Array(size);
for (let i = 0; i < size; i++) {
hexCost[i] = costOf(hexList[i]);
}
}
let toExpand = starts;
let toExpandNext = [];
const isDest = new Uint8Array(size);
for (const dest of dests) {
const i = indexOf.get(dest);
if (i !== undefined) {
isDest[i] = 1;
}
}
let minToDest = grid.size + 1;
// Cheapest known cost to reach each hex, and the hex it was reached from
const costTo = new Float64Array(size).fill(Infinity);
const prev = new Int32Array(size).fill(-1);
let toExpand: number[] = [];
for (const start of starts) {
const i = indexOf.get(start);
if (i === undefined) {
continue;
}
costTo[i] = hexCost[i];
if (isDest[i] && hexCost[i] <= maxCost) {
return { path: [start], cost: hexCost[i] };
}
toExpand.push(i);
}
let toExpandNext: number[] = [];
let minToDest = size + 1;
let bestPath: { path: Hex<T>[]; cost: number };
let minDistance = 0;
const pathTo = (index: number): Hex<T>[] => {
const path: Hex<T>[] = [];
for (let i = index; i !== -1; i = prev[i]) {
path.push(hexList[i]);
}
return path.reverse();
};
const distanceToNextDest = (path: Hex<T>[], excl: Hex<T>[]) => {
const targets = difference(dests, excl);
@ -34,7 +84,7 @@ export default function shortestPath<T>(
path = bestPath ? difference(path, bestPath.path.slice(1, -1)) : path;
return Math.min(...flatten(path.map((x) => targets.map((y) => grid.distance(x, y)))));
return Math.min(...flatten(path.map((x) => targets.map((y) => topology.distance(x, y)))));
};
const isBetter = (path: { path: Hex<T>[]; cost: number }) => {
@ -47,37 +97,46 @@ export default function shortestPath<T>(
// We calculate the min distance between an hex of the path and other dest hexes
// Better but more costly would be to use shortestPath instead of distance calculation
return distanceToNextDest(path.path, [path.path[0], path.path[path.path.length]]) < minDistance;
return distanceToNextDest(path.path, [path.path[0], path.path[path.path.length - 1]]) < minDistance;
};
while (toExpand.length > 0) {
for (const hex of toExpand) {
const curPath = pathTo.get(hex);
const curCost = costTo[hex];
if (curPath.cost > minToDest) {
if (curCost > minToDest) {
continue;
}
for (const neighbour of grid.neighbours(hex)) {
if (pathTo.has(neighbour) && pathTo.get(neighbour).cost <= curPath.cost + costOf(neighbour)) {
for (const neighbour of neighbourIndices[hex]) {
const cost = curCost + hexCost[neighbour];
if (cost > maxCost) {
// This path can never lead to a useful destination (costs are non-negative).
// Note that callers deriving maxCost from a "strictly better than X" bound
// (e.g. spanningTree's X - 1) rely on hex costs being integers.
continue;
}
const extendedPath = {
cost: curPath.cost + costOf(neighbour),
path: [...curPath.path, neighbour],
};
if (costTo[neighbour] <= cost) {
continue;
}
pathTo.set(neighbour, extendedPath);
costTo[neighbour] = cost;
prev[neighbour] = hex;
toExpandNext.push(neighbour);
if (destSet.has(neighbour) && isBetter(extendedPath)) {
minToDest = extendedPath.cost;
bestPath = extendedPath;
minDistance = distanceToNextDest(extendedPath.path.slice(1, -1), [
extendedPath.path[0],
extendedPath.path[extendedPath.path.length - 1],
]);
if (isDest[neighbour]) {
const extendedPath = { cost, path: pathTo(neighbour) };
if (isBetter(extendedPath)) {
minToDest = cost;
bestPath = extendedPath;
minDistance = distanceToNextDest(extendedPath.path.slice(1, -1), [
extendedPath.path[0],
extendedPath.path[extendedPath.path.length - 1],
]);
}
}
}
}

View file

@ -1,6 +1,7 @@
import assert from "assert";
import { Grid, Hex } from "hexagrid";
import { difference, inRange, maxBy, minBy, sumBy, uniq } from "lodash";
import { topologyOf } from "./grid-topology";
import minimumPathLength from "./minimum-path-length";
import shortestPath from "./shortest-path";
@ -54,7 +55,9 @@ function spanningTreeWithHeuristic<T>(
const [minR, maxR] = [minBy(destHexes, "r").r, maxBy(destHexes, "r").r];
const [minS, maxS] = [minBy(destHexes, "s").s, maxBy(destHexes, "s").s];
const startingPoints: Array<Hex<T>> = [];
// Starting from the groups themselves usually finds a good solution right away,
// which then serves as an upper bound that massively prunes the remaining searches.
const startingPoints: Array<Hex<T>> = destGroups.map((group) => group[0]);
if (destGroups.length > 2) {
// We pick all the hexes that are in the middle of the federation buildings, and try to create a network from them
startingPoints.push(
@ -67,30 +70,43 @@ function spanningTreeWithHeuristic<T>(
)
);
}
for (const group of destGroups) {
startingPoints.push(group[0]);
}
const topology = topologyOf(grid);
const groupAround = (hex: Hex<T>) => {
if (destGroupsMap.has(hex)) {
return destGroupsMap.get(hex);
} else {
// If it's an empty hex next to buildings, include those buildings
return uniq([hex, ...grid.neighbours(hex).map((nb) => destGroupsMap.get(nb) ?? [])].flat(1));
return uniq([hex, ...topology.neighbours(hex).map((nb) => destGroupsMap.get(nb) ?? [])].flat(1));
}
};
let minScore = maxAdditional === -1 ? grid.size + 1 : maxAdditional + 1;
let bestSolution: Hex<T>[];
const { hexList, indexOf } = topology.index();
const baseCosts = new Float64Array(hexList.length);
for (let i = 0; i < hexList.length; i++) {
baseCosts[i] = costOf(hexList[i]);
}
for (const startingPoint of startingPoints) {
let hexes = groupAround(startingPoint);
let cost: number;
let cost = sumBy(hexes, costOf);
let toReach = difference(destHexes, hexes);
do {
const hexSet = new Set<Hex<T>>(hexes);
const path = shortestPath<T>(hexes, toReach, grid, (hex) => (hexSet.has(hex) ? 0 : costOf(hex)));
// Hexes already part of the tree cost nothing to pass through
const costs = baseCosts.slice();
for (const hex of hexes) {
costs[indexOf.get(hex)] = 0;
}
// A partial solution only helps if it can be extended into a solution cheaper
// than the best known one, so cap the search at minScore - 1 - cost.
// (The -1 assumes integer hex costs — they are 0 or 1 in practice — so that
// "strictly cheaper than minScore" means "at least 1 cheaper".)
const path = shortestPath<T>(hexes, toReach, grid, costs, minScore - 1 - cost);
if (!path) {
hexes = undefined;
@ -102,7 +118,7 @@ function spanningTreeWithHeuristic<T>(
toReach = difference(toReach, hexes);
} while (cost < minScore && toReach.length > 0);
if (hexes && cost < minScore) {
if (hexes && cost < minScore && toReach.length === 0) {
minScore = cost;
bestSolution = hexes;
}

View file

@ -47,35 +47,39 @@ export type AvailableBoardActionData = {
};
export class Offer {
constructor(readonly offer: string, readonly cost: string) {}
constructor(
readonly offer: string,
readonly cost: string
) {}
}
type BaseCommandData<Command extends string> = { [key in Command]?: any };
type AvailableCommands<
Command extends string,
AvailableCommandData extends BaseCommandData<Command>,
PlayerId = number
PlayerId = number,
> = {
[command in Command]: _AvailableCommand<Command, AvailableCommandData, command, PlayerId>;
};
type __AvailableCommand<
Command extends string,
AvailableCommandData extends BaseCommandData<Command>,
PlayerId = number
PlayerId = number,
> = AvailableCommands<Command, AvailableCommandData, PlayerId>[Command];
type _CommandHelper<
Command extends string,
CommandData extends BaseCommandData<Command>,
move extends Command
move extends Command,
> = move extends keyof CommandData ? CommandData[move] : never;
type _AvailableCommand<
Command extends string,
AvailableCommandData extends BaseCommandData<Command>,
command extends Command,
PlayerId = number
> = _CommandHelper<Command, AvailableCommandData, command> extends never
? { name: command; player: PlayerId }
: { name: command; player: PlayerId; data: _CommandHelper<Command, AvailableCommandData, command> };
PlayerId = number,
> =
_CommandHelper<Command, AvailableCommandData, command> extends never
? { name: command; player: PlayerId }
: { name: command; player: PlayerId; data: _CommandHelper<Command, AvailableCommandData, command> };
type _MoveNameWithData<Command extends string, AvailableCommandData extends BaseCommandData<Command>> = {
[command in Command]: _CommandHelper<Command, AvailableCommandData, command> extends never ? never : command;
};

View file

@ -376,4 +376,4 @@ export default class SpaceMap {
}
}
export { smallConfiguration, bigConfiguration };
export { bigConfiguration, smallConfiguration };

View file

@ -42,7 +42,7 @@ export function moveChooseTechTile(
// AFTER gaining the tech tile (as green federation can be flipped and lock research tracks)
engine.processNextMove(
SubPhase.UpgradeResearch,
ResearchField.values(engine.expansions).includes((pos as any) as ResearchField) ? { pos } : undefined
ResearchField.values(engine.expansions).includes(pos as any as ResearchField) ? { pos } : undefined
);
}

View file

@ -28,7 +28,7 @@ export function movePass(
engine.players[player].pass();
if (!engine.isLastRound) {
moveChooseRoundBooster(engine, (command as any) as AvailableCommand<Command.ChooseRoundBooster>, player, booster);
moveChooseRoundBooster(engine, command as any as AvailableCommand<Command.ChooseRoundBooster>, player, booster);
}
engine.passedPlayers.push(player);

View file

@ -20,7 +20,12 @@ export const resourceLimits = {
};
export class Power {
constructor(public area1: number = 0, public area2: number = 0, public area3: number = 0, public gaia: number = 0) {}
constructor(
public area1: number = 0,
public area2: number = 0,
public area3: number = 0,
public gaia: number = 0
) {}
}
export function powerLogString(power: Power, brainstoneArea: PowerArea): string {

View file

@ -2,6 +2,7 @@ import assert from "assert";
import { EventEmitter } from "eventemitter3";
import { Grid, Hex } from "hexagrid";
import { countBy, difference, merge, sum, uniq, uniqWith, zipWith } from "lodash";
import { topologyOf } from "./algorithms/grid-topology";
import spanningTree from "./algorithms/spanning-tree";
import { ChooseTechTile } from "./available/types";
import { stdBuildingValue } from "./buildings";
@ -118,7 +119,10 @@ export default class Player extends EventEmitter {
/** Is the player dropped (i.e. no move) */
dropped?: boolean;
constructor(expansion: Expansion = Expansion.None, public player: PlayerEnum = PlayerEnum.Player1) {
constructor(
expansion: Expansion = Expansion.None,
public player: PlayerEnum = PlayerEnum.Player1
) {
super();
this.data.on("advance-research", (track, dest) => this.onResearchAdvanced(track, dest, expansion));
}
@ -220,7 +224,7 @@ export default class Player extends EventEmitter {
if (data.federationCache) {
player.federationCache = data.federationCache;
for (const fed of player.federationCache.federations) {
fed.hexes = ((fed.hexes as any) as string[]).map((hex) => map.getS(hex));
fed.hexes = (fed.hexes as any as string[]).map((hex) => map.getS(hex));
}
}
@ -1011,6 +1015,18 @@ export default class Player extends EventEmitter {
// We need to see if they can be connected
const federations: GaiaHex[][] = [];
const occupiedSet = new Set(this.data.occupied);
const mapTopology = topologyOf(map.grid);
const baseHexes = [...map.grid.values()].filter((hex) => !excluded.has(hex));
const buildWorkingGrid = (hexes: GaiaHex[]) =>
new Grid<Hex<{ cost: number }>>(
...hexes.map(
(hex) =>
new Hex(hex.q, hex.r, { cost: occupiedSet.has(hex) || hex.belongsToFederationOf(this.player) ? 0 : 1 })
)
);
// In non-flexible mode, the primary working grid is the same for every combination,
// so build it only once (its memoized topology is then shared by all spanning trees)
const sharedGrid = flexible ? null : buildWorkingGrid(baseHexes);
for (const combination of combinations) {
const destGroups = combination;
@ -1023,31 +1039,28 @@ export default class Player extends EventEmitter {
// However, those possibilites are explored in another combination
const flexibleExcluded: Set<GaiaHex> = new Set(
[].concat(
...this.data.occupied.map((hex) => (buildingsInDestGroups.has(hex) ? [] : [hex, ...map.grid.neighbours(hex)]))
)
);
const allHexes = [...map.grid.values()].filter(
(hex) => !excluded.has(hex) && (!flexible || !flexibleExcluded.has(hex))
);
const workingGrid = new Grid<Hex<{ cost: number }>>(
...allHexes.map(
(hex) =>
new Hex(hex.q, hex.r, { cost: occupiedSet.has(hex) || hex.belongsToFederationOf(this.player) ? 0 : 1 })
...this.data.occupied.map((hex) =>
buildingsInDestGroups.has(hex) ? [] : [hex, ...mapTopology.neighbours(hex)]
)
)
);
const workingGrid = flexible
? buildWorkingGrid(baseHexes.filter((hex) => !flexibleExcluded.has(hex)))
: sharedGrid;
const convertedDestGroups = destGroups.map((destGroup) => destGroup.map((hex) => workingGrid.get(hex)));
let tree = spanningTree(convertedDestGroups, workingGrid, maxSatellites, "heuristic", (hex) => hex.data.cost);
if ("path" in tree && !flexible && flexibleExcluded.size > 0) {
if (
"path" in tree &&
!flexible &&
flexibleExcluded.size > 0 &&
tree.path.some((hex) => flexibleExcluded.has(map.grid.get(hex)))
) {
// In non flexible mode, we still try to suggest federations without extra planets, as long
// as they don't add additional satellites
const allHexes = [...map.grid.values()].filter((hex) => !excluded.has(hex) && !flexibleExcluded.has(hex));
const workingGrid = new Grid<Hex<{ cost: number }>>(
...allHexes.map(
(hex) =>
new Hex(hex.q, hex.r, { cost: occupiedSet.has(hex) || hex.belongsToFederationOf(this.player) ? 0 : 1 })
)
);
// as they don't add additional satellites.
// (If the tree found above doesn't touch any extra planet, it already is such a federation
// and the search can be skipped.)
const workingGrid = buildWorkingGrid(baseHexes.filter((hex) => !flexibleExcluded.has(hex)));
const convertedDestGroups = destGroups.map((destGroup) => destGroup.map((hex) => workingGrid.get(hex)));
const treeWithoutOtherPlanets = spanningTree(
convertedDestGroups,

View file

@ -2,7 +2,13 @@
A Vue.js / SVG UI for Gaia Project
**OLD UI**
**OLD UI — ARCHIVED**
This package is no longer part of the pnpm workspace and is no longer built or
tested in CI. It is kept in the repository for reference only. The active UI is
[`viewer`](../viewer). Its legacy toolchain (`@vue/cli-service` 4 +
`fork-ts-checker-webpack-plugin` 1.6) is incompatible with the current
dependency versions.
## Demo

View file

@ -3,5 +3,5 @@ import launch from "./src/launcher";
import launchSelfContained from "./src/self-contained";
import { gaiaViewer, makeStore } from "./src/store";
export { Game, gaiaViewer, makeStore, launchSelfContained };
export { gaiaViewer, Game, launchSelfContained, makeStore };
export default launch;

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View file

@ -42,9 +42,9 @@
</div>
</template>
<script lang="ts">
import { LogEntry } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { LogEntry } from "@gaia-project/engine";
import { Component } from "vue-property-decorator";
@Component({
computed: {

View file

@ -19,9 +19,9 @@
</template>
<script lang="ts">
import { BoardAction as BoardActionEnum, boardActions, Event } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Event, BoardAction as BoardActionEnum, boardActions } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
@Component<BoardAction>({

View file

@ -16,16 +16,16 @@
</template>
<script lang="ts">
import { Event } from "@gaia-project/engine";
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Event } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
@Component<Booster>({
computed: {
tileObject() {
return boosterEvents(this.booster).map(e => e.spec);
return boosterEvents(this.booster).map((e) => e.spec);
},
event1() {

View file

@ -15,9 +15,9 @@
</template>
<script lang="ts">
import { Building as BuildingEnum, Faction, Planet, factionPlanet } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Faction, Building as BuildingEnum, Planet, factionPlanet } from "@gaia-project/engine";
import { corners } from "../graphics/hex";
import Token from "./Token.vue";

View file

@ -51,27 +51,26 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
AvailableCommand,
Booster,
Building,
Command,
Event,
Expansion,
Faction,
factionPlanet,
GaiaHex,
SpaceMap,
} from "@gaia-project/engine";
import MoveButton from "./MoveButton.vue";
import { buildingName } from "../data/building";
import { ButtonData, GameContext, HighlightHexData } from "../data";
import { eventDesc } from "../data/event";
import { factionDesc, factionName } from "../data/factions";
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
import { federationRewards } from "@gaia-project/engine/src/tiles/federations";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ButtonData, GameContext, HighlightHexData } from "../data";
import { buildingName } from "../data/building";
import { eventDesc } from "../data/event";
import { factionDesc, factionName } from "../data/factions";
import MoveButton from "./MoveButton.vue";
@Component<Commands>({
watch: {
@ -308,7 +307,9 @@ export default class Commands extends Vue {
label: `Booster ${i + 1}`,
booster,
needConfirm: true,
tooltip: boosterEvents(booster).map((e) => eventDesc(e)).join("\n"),
tooltip: boosterEvents(booster)
.map((e) => eventDesc(e))
.join("\n"),
});
}
});

View file

@ -14,30 +14,36 @@
</template>
<script lang="ts">
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
import { Planet } from '@gaia-project/engine';
import { Planet } from "@gaia-project/engine";
import Vue from "vue";
import { Component } from "vue-property-decorator";
@Component
export default class FactionWheel extends Vue {
get r () {
get r() {
return 3;
}
get spacing () {
get spacing() {
return 1.1;
}
angle (deg) {
return deg * 180 / Math.PI;
angle(deg) {
return (deg * 180) / Math.PI;
}
planet (pos: number) {
const list = [Planet.Terra, Planet.Oxide, Planet.Volcanic, Planet.Desert, Planet.Swamp, Planet.Titanium, Planet.Ice];
planet(pos: number) {
const list = [
Planet.Terra,
Planet.Oxide,
Planet.Volcanic,
Planet.Desert,
Planet.Swamp,
Planet.Titanium,
Planet.Ice,
];
return list[pos];
}
}
</script>
<style lang="scss" scoped>

View file

@ -20,15 +20,15 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Federation as FederationEnum } from "@gaia-project/engine";
import { federationRewards } from "@gaia-project/engine/src/tiles/federations";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
@Component<FederationTile>({
computed: {
income() {
const [first, ...others] = federationRewards(this.federation).map(r => r.toString());
const [first, ...others] = federationRewards(this.federation).map((r) => r.toString());
return others.length > 0 ? [first, others.join(", ")] : first.split("-");
},

View file

@ -21,11 +21,11 @@
</template>
<script lang="ts">
import { Faction, Phase, Player, finalScorings } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Phase, Player, finalScorings, Faction } from "@gaia-project/engine";
import Token from "./Token.vue";
import { factionName } from "../data/factions";
import Token from "./Token.vue";
@Component<FinalScoringTile>({
computed: {

View file

@ -38,19 +38,18 @@
</template>
<script lang="ts">
import Engine, { Command, EngineOptions, Phase } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { Command, Phase, Player, EngineOptions, Expansion } from "@gaia-project/engine";
import AdvancedLog from "./AdvancedLog.vue";
import Commands from "./Commands.vue";
import Pool from "./Pool.vue";
import PlayerInfo from "./PlayerInfo.vue";
import Pool from "./Pool.vue";
import ResearchBoard from "./ResearchBoard.vue";
import ScoringBoard from "./ScoringBoard.vue";
import SpaceMap from "./SpaceMap.vue";
import TurnOrder from "./TurnOrder.vue";
import { resolve } from "dns";
@Component<Game>({
created(this: Game) {
@ -188,7 +187,7 @@ export default class Game extends Vue {
handleData(data: Engine, keepMoveHistory?: boolean) {
console.log("handle data", keepMoveHistory);
for (const sector of (document.getElementsByClassName("sector") as any) as Element[]) {
for (const sector of document.getElementsByClassName("sector") as any as Element[]) {
sector.classList.add("notransition");
}
@ -203,7 +202,7 @@ export default class Game extends Vue {
}
setTimeout(() => {
for (const sector of (document.getElementsByClassName("sector") as any) as Element[]) {
for (const sector of document.getElementsByClassName("sector") as any as Element[]) {
sector.classList.remove("notransition");
}
});

View file

@ -36,10 +36,10 @@
</template>
<script lang="ts">
import { GaiaHex, SpaceMap } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { GaiaHex, TechTilePos, AdvTechTilePos, Command, SpaceMap } from "@gaia-project/engine";
import { HighlightHexData, ButtonData } from "../data";
import { ButtonData } from "../data";
import Booster from "./Booster.vue";
@Component({

View file

@ -7,10 +7,10 @@
</template>
<script lang="ts">
import { Faction, factionPlanet, Planet as PlanetEnum } from "@gaia-project/engine";
import Vue from "vue";
import planets from "../data/planets";
import { Component, Prop } from "vue-property-decorator";
import { Planet as PlanetEnum, Faction, factionPlanet } from "@gaia-project/engine";
import planets from "../data/planets";
@Component
export default class Planet extends Vue {

View file

@ -55,22 +55,30 @@
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Prop } from 'vue-property-decorator';
import Building from '../Building.vue';
import Resource from '../Resource.vue';
import { Building as BuildingEnum, Faction, Reward, FactionBoard, factionBoard, Operator, Resource as ResourceEnum } from '@gaia-project/engine';
import {
Building as BuildingEnum,
Faction,
FactionBoard,
factionBoard,
Operator,
Resource as ResourceEnum,
Reward,
} from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Building from "../Building.vue";
import Resource from "../Resource.vue";
@Component({
components: {
Building,
Resource
Resource,
},
watch: {
faction (newVal) {
faction(newVal) {
this.board = factionBoard(newVal);
}
}
},
},
})
export default class BuildingGroup extends Vue {
@Prop()
@ -96,48 +104,50 @@ export default class BuildingGroup extends Vue {
board: FactionBoard = factionBoard(this.faction || Faction.Terrans);
get buildingList () {
get buildingList() {
return [0, 1, 2, 3, 4, 5, 6, 7].slice(0, this.nBuildings);
}
get isPI () {
get isPI() {
return this.building === BuildingEnum.PlanetaryInstitute;
}
tooltip (i: number) {
tooltip(i: number) {
return "Income: " + (this.resources(i, true).join(", ") || "~");
}
get offset () {
get offset() {
return 1.4;
}
get buildingSpacing () {
get buildingSpacing() {
return 2.2;
}
get paddingRight () {
get paddingRight() {
return 0.2;
}
get width () {
get width() {
return Math.max(this.nBuildings, 2) * this.buildingSpacing + this.offset + this.paddingRight;
}
get factionIncome (): Reward[] {
const income: Reward[] = [].concat(...this.board.income.filter(ev => ev.operator === Operator.Income).map(ev => ev.rewards));
get factionIncome(): Reward[] {
const income: Reward[] = [].concat(
...this.board.income.filter((ev) => ev.operator === Operator.Income).map((ev) => ev.rewards)
);
return income.filter(rew => this.resource.includes(rew.type));
return income.filter((rew) => this.resource.includes(rew.type));
}
showBuilding (i: number) {
showBuilding(i: number) {
if (this.ac1 || this.ac2) {
return i === 0 ? !this.ac1 : !this.ac2;
}
return i >= this.placed;
}
resources (i: number, forced = false): Reward[] {
resources(i: number, forced = false): Reward[] {
if (this.showBuilding(i) && !forced) {
return [];
}
@ -149,14 +159,18 @@ export default class BuildingGroup extends Vue {
i = 0;
}
return [].concat(...this.board.buildings[building].income[i].filter(ev => {
if (ev.operator === Operator.Income) {
return true;
}
const rew = ev.rewards.toString();
return [].concat(
...this.board.buildings[building].income[i]
.filter((ev) => {
if (ev.operator === Operator.Income) {
return true;
}
const rew = ev.rewards.toString();
return ev.operator === Operator.Activate && (rew === "q" || rew === "4c");
}).map(ev => ev.rewards));
return ev.operator === Operator.Activate && (rew === "q" || rew === "4c");
})
.map((ev) => ev.rewards)
);
}
}
</script>

View file

@ -85,19 +85,11 @@
</template>
<script lang="ts">
import { Faction, Player, PlayerData, Resource as ResourceEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Resource from "../Resource.vue";
import {
Building as BuildingEnum,
Faction,
Reward,
Operator,
Resource as ResourceEnum,
PlayerData,
Player,
} from "@gaia-project/engine";
import { factionName } from "../../data/factions";
import Resource from "../Resource.vue";
@Component({
components: {

View file

@ -35,18 +35,10 @@
</template>
<script lang="ts">
import { Faction, Player, PlayerData, Resource as ResourceEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Resource from "../Resource.vue";
import {
Faction,
Reward,
FactionBoard,
Operator,
Resource as ResourceEnum,
PlayerData,
Player,
} from "@gaia-project/engine";
@Component({
components: {

View file

@ -139,18 +139,18 @@
</template>
<script lang="ts">
import { Planet, Player, factionPlanet } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Player, Planet, factionPlanet } from "@gaia-project/engine";
import { factionDesc, planetsWithSteps } from "../data/factions";
import { factionColor } from "../graphics/utils";
import TechTile from "./TechTile.vue";
import Booster from "./Booster.vue";
import SpecialAction from "./SpecialAction.vue";
import FederationTile from "./FederationTile.vue";
import BuildingGroup from "./PlayerBoard/BuildingGroup.vue";
import PlayerBoardInfo from "./PlayerBoard/Info.vue";
import PowerBowls from "./PlayerBoard/PowerBowls.vue";
import { factionDesc, planetsWithSteps } from "../data/factions";
import SpecialAction from "./SpecialAction.vue";
import TechTile from "./TechTile.vue";
@Component({
components: {

View file

@ -14,11 +14,11 @@
</template>
<script lang="ts">
import { Booster as BoosterEnum, Expansion } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Component } from "vue-property-decorator";
import Booster from "./Booster.vue";
import FederationTile from "./FederationTile.vue";
import { Booster as BoosterEnum, Expansion } from "@gaia-project/engine";
@Component({
computed: {

View file

@ -19,12 +19,12 @@
</template>
<script lang="ts">
import { BoardAction as BoardActionEnum, ResearchField } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ResearchField, BoardAction as BoardActionEnum } from "@gaia-project/engine";
import BoardAction from "./BoardAction.vue";
import ResearchTrack from "./ResearchTrack.vue";
import TechTile from "./TechTile.vue";
import BoardAction from "./BoardAction.vue";
@Component({
computed: {

View file

@ -46,25 +46,24 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import {
ResearchField,
Player,
Expansion,
Federation,
Resource as ResourceEnum,
researchEvents,
Event,
Reward,
Operator,
Planet as PlanetEnum,
Expansion,
Player,
ResearchField,
Resource as ResourceEnum,
Reward,
researchEvents,
} from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { descriptions } from "../data/research";
import Token from "./Token.vue";
import FederationTile from "./FederationTile.vue";
import Planet from "./Planet.vue";
import Resource from "./Resource.vue";
import Token from "./Token.vue";
@Component<ResearchTile>({
computed: {
@ -144,12 +143,12 @@ export default class ResearchTile extends Vue {
return this.level === 0
? "nav 1"
: this.level === 2
? "nav 2"
: this.level === 4
? "nav 3"
: this.level === 5
? "nav 4"
: "";
? "nav 2"
: this.level === 4
? "nav 3"
: this.level === 5
? "nav 4"
: "";
}
if (this.field === ResearchField.GaiaProject) {
return this.level === 5 ? "4vp, g>vp" : "";

View file

@ -14,9 +14,9 @@
</template>
<script lang="ts">
import { ResearchField } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ResearchField } from "@gaia-project/engine";
import ResearchTile from "./ResearchTile.vue";
import TechTile from "./TechTile.vue";

View file

@ -39,14 +39,14 @@
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Prop } from 'vue-property-decorator';
import Building from './Building.vue';
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Building from "./Building.vue";
@Component({
components: {
Building,
}
},
})
export default class Resource extends Vue {
@Prop()

View file

@ -14,8 +14,8 @@
<script lang="ts">
import Vue from "vue";
import { Component } from "vue-property-decorator";
import ScoringTile from "./ScoringTile.vue";
import FinalScoringTile from "./FinalScoringTile.vue";
import ScoringTile from "./ScoringTile.vue";
@Component({
components: {

View file

@ -7,11 +7,11 @@
</template>
<script lang="ts">
import { Event, Phase } from "@gaia-project/engine";
import { roundScoringEvents } from "@gaia-project/engine/src/tiles/scoring";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Event, Phase } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import { roundScoringEvents } from "@gaia-project/engine/src/tiles/scoring";
@Component<ScoringTile>({
computed: {

View file

@ -11,13 +11,12 @@
</template>
<script lang="ts">
import { GaiaHex } from "@gaia-project/engine";
import { CubeCoordinates, Hex } from "hexagrid";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { MapData, HighlightHexData } from "../data";
import { GaiaHex, GaiaHexData } from "@gaia-project/engine";
import { hexCenter } from "../graphics/hex";
import SpaceHex from "./SpaceHex.vue";
import { CubeCoordinates, Hex } from "hexagrid";
@Component<Sector>({
components: {

View file

@ -47,20 +47,20 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import {
GaiaHex,
Building as BuildingEnum,
Planet as PlanetEnum,
GaiaHex,
SpaceMap as ISpaceMap,
Planet as PlanetEnum,
factionPlanet,
} from "@gaia-project/engine";
import { corners } from "../graphics/hex";
import Planet from "./Planet.vue";
import Building from "./Building.vue";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { buildingName } from "../data/building";
import { planetNames } from "../data/planets";
import { corners } from "../graphics/hex";
import Building from "./Building.vue";
import Planet from "./Planet.vue";
@Component<SpaceHex>({
components: {

View file

@ -13,13 +13,13 @@
</template>
<script lang="ts">
import { GaiaHex, SpaceMap as SpaceMapData } from "@gaia-project/engine";
import { CubeCoordinates } from "hexagrid";
import Vue from "vue";
import { Component } from "vue-property-decorator";
import { GaiaHex, SpaceMap as SpaceMapData } from "@gaia-project/engine";
import { hexCenter } from "../graphics/hex";
import Sector from "./Sector.vue";
import { CubeCoordinates } from "hexagrid";
import FactionWheel from "./FactionWheel.vue";
import Sector from "./Sector.vue";
@Component<SpaceMap>({
components: {

View file

@ -16,11 +16,11 @@
</template>
<script lang="ts">
import { AdvTechTilePos, Event, PlayerEnum, TechTilePos } from "@gaia-project/engine";
import { techTileEvents } from "@gaia-project/engine/src/tiles/techs";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { PlayerEnum, Event, TechTilePos, AdvTechTilePos } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import { techTileEvents } from "@gaia-project/engine/src/tiles/techs";
@Component<TechTile>({
computed: {

View file

@ -5,9 +5,9 @@
</template>
<script lang="ts">
import { Faction, Planet, factionPlanet } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Faction, Planet, factionPlanet } from "@gaia-project/engine";
@Component
export default class PlayerToken extends Vue {

View file

@ -34,8 +34,8 @@
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import Engine, { Player, Planet, Phase, factionPlanet } from "@gaia-project/engine";
import Engine, { Phase, Planet, Player, factionPlanet } from "@gaia-project/engine";
import { Component, Vue } from "vue-property-decorator";
@Component
export default class TurnOrder extends Vue {

View file

@ -18,7 +18,7 @@
</div>
</template>
<script lang="ts">
import { Vue, Prop, Watch, Component } from "vue-property-decorator";
import { Component, Vue } from "vue-property-decorator";
import Game from "./Game.vue";
@Component({

View file

@ -14,8 +14,7 @@ const factionData: { [faction in Faction]: { name: string; ability: string; PI:
name: "Terrans",
ability:
"During the Gaia phase, move the power tokens in your Gaia area to area II of your power cycle instead of to area I.",
PI:
"During the Gaia phase, when you move power tokens from your Gaia area to area II of your power cycle, you may gain resources as if you were spending that much power to take free actions.",
PI: "During the Gaia phase, when you move power tokens from your Gaia area to area II of your power cycle, you may gain resources as if you were spending that much power to take free actions.",
},
[Faction.Lantids]: {
name: "Lantids",
@ -26,28 +25,24 @@ const factionData: { [faction in Faction]: { name: string; ability: string; PI:
[Faction.Xenos]: {
name: "Xenos",
ability: "You place a third starting mine after all other starting mines have been placed.",
PI:
"You can form federations with a total power value of six instead of seven. You gain one Q.I.C. as income instead of one power token.",
PI: "You can form federations with a total power value of six instead of seven. You gain one Q.I.C. as income instead of one power token.",
},
[Faction.Gleens]: {
name: "Gleens",
ability:
"If you would ever gain Q.I.C., gain that much ore instead; once you have upgraded to the second academy, this effect no longer applies. To make a Gaia Planet habitable, pay one ore instead of one Q.I.C. Each time you build a mine on a Gaia Planet, gain two additional VP.",
PI:
"When you upgrade to the planetary institute, immediately gain the Gleens’ federation token (2 credits, 1 ore, 1 knowledge). Gaining this tile counts as forming a federation. The planetary institute itself can still be part of a federation on the board.",
PI: "When you upgrade to the planetary institute, immediately gain the Gleens’ federation token (2 credits, 1 ore, 1 knowledge). Gaining this tile counts as forming a federation. The planetary institute itself can still be part of a federation on the board.",
},
[Faction.Taklons]: {
name: "Taklons",
ability:
"The Brainstone counts as one power token (when starting a Gaia Project, building satellites, etc.), but you can spend it as if it were three power.",
PI:
"Each time you would charge power from “Passive Action: Charge Power,” you gain one power token. You can choose to gain the power before or after charging.",
PI: "Each time you would charge power from “Passive Action: Charge Power,” you gain one power token. You can choose to gain the power before or after charging.",
},
[Faction.Ambas]: {
name: "Ambas",
ability: "-",
PI:
"Once per round, as an action, you can swap your planetary institute with one of your mines on the game board (this can help you form a new federation). This has no impact on existing federations, even if their power value becomes less than seven. The swap does not count as a build or upgrade action; no VP or power can be gained from it.",
PI: "Once per round, as an action, you can swap your planetary institute with one of your mines on the game board (this can help you form a new federation). This has no impact on existing federations, even if their power value becomes less than seven. The swap does not count as a build or upgrade action; no VP or power can be gained from it.",
},
[Faction.HadschHallas]: {
name: "Hadsch Hallas",
@ -69,8 +64,7 @@ const factionData: { [faction in Faction]: { name: string; ability: string; PI:
[Faction.Geodens]: {
name: "Geoden",
ability: "-",
PI:
"The first time you build a mine on each planet type, gain 3 knowledge. (You do not gain knowledge for planet types you colonized before upgrading to your planetary institute.)",
PI: "The first time you build a mine on each planet type, gain 3 knowledge. (You do not gain knowledge for planet types you colonized before upgrading to your planetary institute.)",
},
[Faction.BalTaks]: {
name: "Bal T'aks",
@ -81,23 +75,20 @@ const factionData: { [faction in Faction]: { name: string; ability: string; PI:
[Faction.Firaks]: {
name: "Firaks",
ability: "-",
PI:
"As an action, you can “downgrade” a research lab into a trading station and immediately advance one level in a research area of your choice. This counts as an “Upgrade to a Trading Station” action. You can later upgrade the trading station back into a research lab using the normal rules (including gaining a new tech tile).",
PI: "As an action, you can “downgrade” a research lab into a trading station and immediately advance one level in a research area of your choice. This counts as an “Upgrade to a Trading Station” action. You can later upgrade the trading station back into a research lab using the normal rules (including gaining a new tech tile).",
},
[Faction.Bescods]: {
name: "Bescods",
ability: `The positions of your planetary institute and academies are swapped on your faction board, as is the income you gain for trading stations and research labs. As with the other factions, upgrading to an academy or a research lab allows you to gain a tech tile.
Once per round, as an action, you can advance your lowest-level token in a research area (without paying knowledge). If multiple of your tokens are tied for the lowest level, choose which of
the tied tokens to advance. To advance to level 5 this way, you must still flip a federation token as normal. Remember, only one player can reach level 5 of each research area.`,
PI:
"The power value of your structures on gray planets (your home type) is increased by one (in addition to any other effects that increase their power value).",
PI: "The power value of your structures on gray planets (your home type) is increased by one (in addition to any other effects that increase their power value).",
},
[Faction.Nevlas]: {
name: "Nevlas",
ability:
"As a free action, you can move one power token from area III of your power cycle to your Gaia area to gain one knowledge (these power tokens follow the normal Gaia phase rules). This does not count as spending power.",
PI:
"You can spend power tokens in area III of your power cycle as if they were each two power. Otherwise, they count as one power token (when starting a Gaia Project, building satellites, etc.). When paying for a power action with an odd power cost (1, 3, 5, etc.), the unspent power is lost.",
PI: "You can spend power tokens in area III of your power cycle as if they were each two power. Otherwise, they count as one power token (when starting a Gaia Project, building satellites, etc.). When paying for a power action with an odd power cost (1, 3, 5, etc.), the unspent power is lost.",
},
[Faction.Itars]: {
name: "Itars",

View file

@ -4,17 +4,18 @@
"commit-msg-check": "node scripts/check-commit-msg.js",
"lint-staged": "lint-staged",
"postinstall": "husky install",
"prettier": "prettier --plugin-search-dir=. --write .",
"prettier-check": "prettier --plugin-search-dir=. --check ."
"prettier": "prettier --write .",
"prettier-check": "prettier --check ."
},
"devDependencies": {
"husky": "^5.0.9",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"prettier-plugin-organize-imports": "^1.1.1",
"typescript": "^4.1.5"
"prettier": "^3.9.6",
"prettier-plugin-organize-imports": "^4.3.0",
"typescript": "^5.9.3",
"vue-tsc": "^2.2.12"
},
"lint-staged": {
"*.{css,scss,graphql,html,json,js,jsx,md,mdx,ts,tsx,vue,yaml,yml}": "prettier --plugin-search-dir=. --write"
"*.{css,scss,graphql,html,json,js,jsx,md,mdx,ts,tsx,vue,yaml,yml}": "prettier --write"
}
}

13774
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,6 @@
packages:
- "viewer"
- "engine"
- "old-ui"
# pnpm 11 (resolved via corepack in CI) blocks dependency postinstall scripts by default.
# These are all no-op or cosmetic (core-js/ejs banners, an optional native watcher);
# allow them so `pnpm install` exits 0.

View file

@ -3,5 +3,5 @@ import launch from "./src/launcher";
import launchSelfContained from "./src/self-contained";
import { gaiaViewer, makeStore } from "./src/store";
export { Game, gaiaViewer, makeStore, launchSelfContained };
export { gaiaViewer, Game, launchSelfContained, makeStore };
export default launch;

View file

@ -43,15 +43,16 @@
"chart.js": "^3.0.1",
"hexagrid": "^2.1.1",
"lodash": "^4.17.15",
"vue": "^2.6.11",
"vue": "2.6.14",
"vuex": "^3.0.1"
},
"devDependencies": {
"@testing-library/dom": "^7.29.6",
"@testing-library/vue": "^5.6.1",
"@testing-library/dom": "7.31.2",
"@testing-library/vue": "5.6.1",
"@types/aria-query": "^4.2.2",
"@types/chai": "^4.2.15",
"@types/jquery": "^3.3.1",
"@types/lodash": "^4.14.168",
"@types/jquery": "3.5.16",
"@types/lodash": "4.14.182",
"@types/mocha": "^8.2.1",
"@types/node": "^10.5.2",
"@typescript-eslint/eslint-plugin": "^2.26.0",
@ -79,13 +80,13 @@
"typescript": "^3.8.3",
"vue-class-component": "^7.2.6",
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.5.1",
"vue-template-compiler": "^2.6.11",
"vue-router": "3.5.4",
"vue-template-compiler": "2.6.14",
"webpack": "^4.16.1"
},
"peerDependencies": {
"bootstrap-vue": "^2.12.0",
"vue": "^2.6.11"
"vue": "2.6.14"
},
"browserslist": [
"> 1%",

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View file

@ -75,16 +75,16 @@
</div>
</template>
<script lang="ts">
import Engine from "@gaia-project/engine";
import { PlayerColumn } from "src/logic/table/types";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine from "@gaia-project/engine";
import { HistoryEntry, makeHistory } from "../data/log";
import RichTextView from "./Resources/RichTextView.vue";
import { parseRewardsForLog } from "../logic/utils";
import { RichText } from "../graphics/rich-text";
import { PlayerColumn } from "src/logic/table/types";
import { logPlayerTables } from "../logic/table/player";
import { cellStyle } from "../logic/table/util";
import { parseRewardsForLog } from "../logic/utils";
import RichTextView from "./Resources/RichTextView.vue";
type LogScope = "recent" | "all";
@Component({
@ -137,7 +137,13 @@ export default class AdvancedLog extends Vue {
get history(): HistoryEntry[] {
if (this.hideLog) return [];
return makeHistory(this.engine, this.$store.getters.recentMoves, this.scope == "recent", this.currentMove, this.extendedLog);
return makeHistory(
this.engine,
this.$store.getters.recentMoves,
this.scope == "recent",
this.currentMove,
this.extendedLog
);
}
rowSpan(entry: HistoryEntry): number {
@ -145,7 +151,7 @@ export default class AdvancedLog extends Vue {
}
get rowHeaders(): PlayerColumn[] {
return this.extendedLog ? logPlayerTables(this.engine).flatMap(t => t.columns) : [];
return this.extendedLog ? logPlayerTables(this.engine).flatMap((t) => t.columns) : [];
}
cellStyle(c: PlayerColumn): string {
@ -161,14 +167,19 @@ export default class AdvancedLog extends Vue {
return [];
}
return entry.rows ? entry.rows.flatMap(r => r.map((value, i) => ({
value,
leftBorder: i == 0,
})))
: logPlayerTables(this.engine).flatMap(t => t.columns.map((c, i) => ({
value: [],
leftBorder: i == 0,
})));
return entry.rows
? entry.rows.flatMap((r) =>
r.map((value, i) => ({
value,
leftBorder: i == 0,
}))
)
: logPlayerTables(this.engine).flatMap((t) =>
t.columns.map((c, i) => ({
value: [],
leftBorder: i == 0,
}))
);
}
}
</script>

View file

@ -19,8 +19,13 @@
@click="onClick"
/>
<g transform="translate(-15,-15)">
<image v-if="kind === 'power'" xlink:href="../assets/resources/power-charge.svg" width="20" :height=133/345*20
transform=" scale(-1,1) translate(-9, -12)" />
<image
v-if="kind === 'power'"
xlink:href="../assets/resources/power-charge.svg"
width="20"
:height="(133 / 345) * 20"
transform=" scale(-1,1) translate(-9, -12)"
/>
<rect
x="-8"
y="-8"
@ -47,20 +52,21 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
BoardAction as BoardActionEnum,
boardActions,
Command,
factionPlanet,
Planet,
PlayerEnum, Reward,
PlayerEnum,
Reward,
} from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { enabledButtonWarnings } from "../data/warnings";
import { boardActionButton } from "../logic/buttons/actions";
import Resource from "./Resource.vue";
import SpecialAction from "./SpecialAction.vue";
import { boardActionButton } from "../logic/buttons/actions";
import { enabledButtonWarnings } from "../data/warnings";
@Component<BoardAction>({
components: {

View file

@ -27,12 +27,12 @@
</template>
<script lang="ts">
import Engine, { Booster as BoosterEnum, Event } from "@gaia-project/engine";
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { Event, Booster as BoosterEnum } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import TechContent from "./TechContent.vue";
import { boosterEvents } from "@gaia-project/engine/src/tiles/boosters";
@Component<Booster>({
components: {

View file

@ -32,14 +32,14 @@
</template>
<script lang="ts">
import { Building as BuildingEnum, Faction, isShip } from "@gaia-project/engine";
import { isAcademy } from "@gaia-project/engine/src/enums";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Building as BuildingEnum, Expansion, Faction, isShip } from "@gaia-project/engine";
import { shipLetter } from "../data/building";
import { corners } from "../graphics/hex";
import { planetClass } from "../graphics/utils";
import Planet from "./Planet.vue";
import { shipLetter } from "../data/building";
import { isAcademy } from "@gaia-project/engine/src/enums";
@Component<Building>({
components: {

View file

@ -49,12 +49,7 @@
</template>
<script lang="ts">
import {Component, Vue} from "vue-property-decorator";
import {ChartGroup, ChartSelect, ChartStyleDisplay, ChartType} from "../logic/charts/charts";
import PlayerCircle from "./PlayerCircle.vue";
import BuildingImage from "./Building.vue";
import SpecialAction from "./SpecialAction.vue";
import Engine, {PlayerEnum} from "@gaia-project/engine";
import Engine, { PlayerEnum } from "@gaia-project/engine";
import {
BarController,
BarElement,
@ -70,9 +65,21 @@ import {
Title,
Tooltip,
} from "chart.js";
import {barChartKind, ChartKind, ChartKindDisplay, ChartSetup, lineChartKind, TableMeta,} from "../logic/charts/chart-factory";
import {tableHeader, tableItems} from "../logic/charts/table";
import {StatisticsDisplay} from "../data";
import { Component, Vue } from "vue-property-decorator";
import { StatisticsDisplay } from "../data";
import {
barChartKind,
ChartKind,
ChartKindDisplay,
ChartSetup,
lineChartKind,
TableMeta,
} from "../logic/charts/chart-factory";
import { ChartGroup, ChartSelect, ChartStyleDisplay, ChartType } from "../logic/charts/charts";
import { tableHeader, tableItems } from "../logic/charts/table";
import BuildingImage from "./Building.vue";
import PlayerCircle from "./PlayerCircle.vue";
import SpecialAction from "./SpecialAction.vue";
Chart.register(
LineController,
@ -157,7 +164,7 @@ export default class Charts extends Vue {
this.loadChart();
}
selectSelect(s: ChartSelect) {
selectSelect(s: ChartSelect) {
if (this.chartSelect != s) {
this.chartSelect = s;
this.selectType(this.setup.types(s)?.[0] ?? null, true);
@ -187,10 +194,8 @@ export default class Charts extends Vue {
const data = this.gameData;
const isChart = this.chartStyle.type == "chart";
const colorLookup = (color: string): string => {
const canvas = this.canvas();
return color.startsWith("--") && isChart
? window.getComputedStyle(canvas).getPropertyValue(color)
: color;
const canvas = this.canvas();
return color.startsWith("--") && isChart ? window.getComputedStyle(canvas).getPropertyValue(color) : color;
};
if (this.chartKind === barChartKind) {

View file

@ -55,8 +55,6 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
AdvTechTilePos,
AvailableCommand,
@ -72,7 +70,12 @@ import Engine, {
SpaceMap,
TechTilePos,
} from "@gaia-project/engine";
import MoveButton from "./MoveButton.vue";
import { FactionCustomization } from "@gaia-project/engine/src/engine";
import { factionVariantBoard } from "@gaia-project/engine/src/faction-boards";
import { CubeCoordinates } from "hexagrid";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ActionPayload, SubscribeActionOptions, SubscribeOptions } from "vuex";
import {
ButtonData,
GameContext,
@ -80,22 +83,19 @@ import {
HighlightHex,
ModalButtonData,
SpecialActionIncome,
WarningsPreference
WarningsPreference,
} from "../data";
import { factionDesc, factionName, factionShortcut } from "../data/factions";
import { FactionCustomization } from "@gaia-project/engine/src/engine";
import { factionVariantBoard } from "@gaia-project/engine/src/faction-boards";
import { enabledButtonWarnings, isWarningEnabled } from "../data/warnings";
import Undo from "./Resources/Undo.vue";
import { ActionPayload, SubscribeActionOptions, SubscribeOptions } from "vuex";
import { richText, RichText } from "../graphics/rich-text";
import { autoClickStrategy } from "../logic/buttons/autoClick";
import { commandButtons, replaceRepeat } from "../logic/buttons/commands";
import { CommandController, ExecuteBack, FastConversionTooltips } from "../logic/buttons/types";
import { buttonStringLabel, callOnShow } from "../logic/buttons/utils";
import { commandButtons, replaceRepeat } from "../logic/buttons/commands";
import { CubeCoordinates } from "hexagrid";
import { autoClickStrategy } from "../logic/buttons/autoClick";
import RichTextView from "./Resources/RichTextView.vue";
import { richText, RichText } from "../graphics/rich-text";
import { chargePowerToPay } from "../logic/utils";
import MoveButton from "./MoveButton.vue";
import RichTextView from "./Resources/RichTextView.vue";
import Undo from "./Resources/Undo.vue";
let show = false;
@ -113,7 +113,11 @@ export type EmitCommandParams = { disappear?: boolean; times?: number; warnings?
},
methods: {
tooltip(faction: Faction) {
return factionDesc(faction, factionVariantBoard(this.factionCustomization, faction)?.board, this.engine.expansions);
return factionDesc(
faction,
factionVariantBoard(this.factionCustomization, faction)?.board,
this.engine.expansions
);
},
modalDialog(title: string, msg: string): ModalButtonData {
@ -297,12 +301,10 @@ export default class Commands extends Vue implements CommandController {
this.$emit("command", command);
} else {
//decline ignores what's on the the stack (e.g. 'decline up' instead of 'up decline')
const commands: string[] = command.startsWith(Command.Decline) ? [command] : [...this.commandChain.filter((c) => c), command];
this.$emit(
"command",
`${this.playerSlug} ${commands.join(" ")}`,
warnings
);
const commands: string[] = command.startsWith(Command.Decline)
? [command]
: [...this.commandChain.filter((c) => c), command];
this.$emit("command", `${this.playerSlug} ${commands.join(" ")}`, warnings);
}
}
@ -486,7 +488,12 @@ export default class Commands extends Vue implements CommandController {
this.$store.commit("highlightTechs", techs);
}
subscribe(action: string, button: ButtonData, callback: (payload: any) => any, filter: (payload: any) => boolean = null) {
subscribe(
action: string,
button: ButtonData,
callback: (payload: any) => any,
filter: (payload: any) => boolean = null
) {
action = "" + action;
this.unsubscribe(button);
@ -503,13 +510,22 @@ export default class Commands extends Vue implements CommandController {
this.$store.commit("activeButton", buttonData);
}
subscribeHexClick(button: ButtonData, callback: (hex: GaiaHex, highlight: HighlightHex) => void, filter?: (hex: GaiaHex) => boolean) {
subscribeHexClick(
button: ButtonData,
callback: (hex: GaiaHex, highlight: HighlightHex) => void,
filter?: (hex: GaiaHex) => boolean
) {
const heightFilter = () => {
return this.buttonChain.length == button.parents;
};
this.subscribe("hexClick", button, (payload) => {
callback(payload.hex, payload.highlight);
}, payload => (filter ? filter(payload.hex) : true) && heightFilter());
this.subscribe(
"hexClick",
button,
(payload) => {
callback(payload.hex, payload.highlight);
},
(payload) => (filter ? filter(payload.hex) : true) && heightFilter()
);
}
subscribeFinal(action: string, button: ButtonData) {
@ -523,7 +539,7 @@ export default class Commands extends Vue implements CommandController {
button.subscription?.();
button.subscription = null;
button.onShowTriggered = false;
button.buttons?.forEach(b => this.unsubscribe(b));
button.buttons?.forEach((b) => this.unsubscribe(b));
}
async handleButtonClick(button: ButtonData) {
@ -589,9 +605,11 @@ export default class Commands extends Vue implements CommandController {
}
private shouldShowModal(button: ButtonData) {
return this.enabledButtonWarnings(button).length > 0
&& !this.isActiveButton(button)
&& this.warningPreference === WarningsPreference.ModalDialog;
return (
this.enabledButtonWarnings(button).length > 0 &&
!this.isActiveButton(button) &&
this.warningPreference === WarningsPreference.ModalDialog
);
}
get warningPreference(): WarningsPreference {

View file

@ -26,8 +26,15 @@
<Resource v-else-if="condition === 'step'" kind="step" />
<Resource v-else-if="condition === 'trade'" kind="tradeShip" />
<g v-else-if="condition === 'mg'">
<image v-if="!flat" xlink:href="../assets/conditions/planet-flat.svg" :height=120/198*30 width=30 x=-12 y=-13.5
transform="translate(-2,0) scale(-1,-1)" />
<image
v-if="!flat"
xlink:href="../assets/conditions/planet-flat.svg"
:height="(120 / 198) * 30"
width="30"
x="-12"
y="-13.5"
transform="translate(-2,0) scale(-1,-1)"
/>
<circle v-else r="10" :class="['planet-fill', 'g']" transform="translate(0,0)" />
<Building
building="m"
@ -57,21 +64,26 @@
<line x1="-15" x2="15" stroke="#666" />
<line x1="-15" x2="15" y1="-10" y2="-10" stroke="#666" />
<line x1="-15" x2="15" y1="10" y2="10" stroke="#666" />
<image xlink:href="../assets/operators/trigger.svg" width=15 :height=529/328*15 :transform="`rotate(180),
translate(6, -8), scale(0.7)`" />
<!-- <text y=-1 style="font-size: 9px">3</text>
<text y=8.5 style="font-size: 9px">2</text>-->
<image
xlink:href="../assets/operators/trigger.svg"
width="15"
:height="(529 / 328) * 15"
:transform="`rotate(180),
translate(6, -8), scale(0.7)`"
/>
<!-- <text y="-1" style="font-size: 9px">3</text>
<text y="8.5" style="font-size: 9px">2</text>-->
</g>
</g>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { Condition as ConditionEnum, Building as BuildingEnum } from "@gaia-project/engine";
import { Building as BuildingEnum, Condition as ConditionEnum } from "@gaia-project/engine";
import { Component, Prop, Vue } from "vue-property-decorator";
import Building from "./Building.vue";
import Federation from "./FederationTile.vue";
import Planet from "./Planet.vue";
import PlanetType from "./Conditions/PlanetType.vue";
import Sector from "./Conditions/Sector.vue";
import Federation from "./FederationTile.vue";
import Planet from "./Planet.vue";
@Component({
components: {

View file

@ -30,13 +30,13 @@
</template>
<script lang="ts">
import Engine, { factionPlanet, Planet } from "@gaia-project/engine";
import Vue from "vue";
import { Component } from "vue-property-decorator";
import { planetFill } from "../graphics/utils";
import Engine, { factionPlanet, Planet } from "@gaia-project/engine";
import { radiusTranslate } from "../logic/utils";
import { MapMode } from "../data/actions";
import { remainingPlanets } from "../data/planets";
import { planetFill } from "../graphics/utils";
import { radiusTranslate } from "../logic/utils";
const planets = [
Planet.Terra,
@ -106,7 +106,7 @@ export default class FactionWheel extends Vue {
}
togglePlanetHighlight(planet: Planet) {
this.$store.commit("toggleMapMode", { type: "planetType", planet } as MapMode);
this.$store.commit("toggleMapMode", { type: "planetType", planet } as MapMode);
}
}
</script>

View file

@ -1,9 +1,26 @@
<template>
<svg viewBox="-25 -25 50 50" width="50" height="50" style="overflow: visible">
<g :class="['federationTile', { disabled }]">
<image xlink:href="../assets/conditions/federation.svg" :height=739/636*50 v-if="!disabled" style="color: #247B0A"
width=50 x=-25 y=-25 :filter=filter /> <image xlink:href="../assets/conditions/federation-used.svg"
v-if="disabled" :height=739/636*50 style="color: #247B0A" width=50 x=-25 y=-25 :filter=filter />
<image
xlink:href="../assets/conditions/federation.svg"
:height="(739 / 636) * 50"
v-if="!disabled"
style="color: #247b0a"
width="50"
x="-25"
y="-25"
:filter="filter"
/>
<image
xlink:href="../assets/conditions/federation-used.svg"
v-if="disabled"
:height="(739 / 636) * 50"
style="color: #247b0a"
width="50"
x="-25"
y="-25"
:filter="filter"
/>
<circle cx="16.5" cy="-16.5" r="8" stroke="black" stroke-width="1" fill="white" v-if="numTiles > 1" />
<text x="16.5" y="-15.5" v-if="numTiles > 1">
{{ numTiles }}
@ -24,10 +41,10 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Federation as FederationEnum, Reward } from "@gaia-project/engine";
import { federationRewards } from "@gaia-project/engine/src/tiles/federations";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
@Component
export default class FederationTile extends Vue {

View file

@ -29,12 +29,12 @@
</template>
<script lang="ts">
import { Faction, finalScorings, FinalTile, Phase, Player } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Faction, finalScorings, FinalTile, Phase, Player } from "@gaia-project/engine";
import Token from "./Token.vue";
import { factionName } from "../data/factions";
import { MapMode, MapModeType } from "../data/actions";
import { factionName } from "../data/factions";
import Token from "./Token.vue";
@Component<FinalScoringTile>({
computed: {
@ -75,7 +75,8 @@ export default class FinalScoringTile extends Vue {
}
get mapModeType(): { type: MapModeType; player: Player }[] {
const m = (type: MapModeType) => this.players.filter(p => p.faction != "automa").map(player => ({ type, player }));
const m = (type: MapModeType) =>
this.players.filter((p) => p.faction != "automa").map((player) => ({ type, player }));
switch (this.tile) {
case FinalTile.Sector:
return m(MapModeType.sectors);
@ -87,7 +88,7 @@ export default class FinalScoringTile extends Vue {
}
toggleMapMode(mode: MapModeType, player: Player) {
this.$store.commit("toggleMapMode", { type: mode, player: player.player } as MapMode);
this.$store.commit("toggleMapMode", { type: mode, player: player.player } as MapMode);
}
get content() {

View file

@ -75,8 +75,6 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
BoardAction as BoardActionEnum,
BuildWarning,
@ -86,24 +84,26 @@ import Engine, {
Player,
ResearchField,
} from "@gaia-project/engine";
import { currentPlayer } from "@gaia-project/engine/wrapper";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { LogPlacement } from "../data";
import { orderedPlayers } from "../data/player";
import { ExecuteBack } from "../logic/buttons/types";
import { parseCommands } from "../logic/recent";
import { UiMode } from "../store";
import AdvancedLog from "./AdvancedLog.vue";
import BoardAction from "./BoardAction.vue";
import Commands from "./Commands.vue";
import Pool from "./Pool.vue";
import Rules from "./Rules.vue";
import PlayerCircle from "./PlayerCircle.vue";
import PlayerInfo from "./PlayerInfo.vue";
import Pool from "./Pool.vue";
import ResearchBoard from "./ResearchBoard.vue";
import Rules from "./Rules.vue";
import ScoringBoard from "./ScoringBoard.vue";
import SpaceMap from "./SpaceMap.vue";
import TurnOrder from "./TurnOrder.vue";
import { parseCommands } from "../logic/recent";
import { LogPlacement } from "../data";
import { ExecuteBack } from "../logic/buttons/types";
import { currentPlayer } from "@gaia-project/engine/wrapper";
import { UiMode } from "../store";
import Table from "./Table.vue";
import { orderedPlayers } from "../data/player";
import TurnOrder from "./TurnOrder.vue";
@Component<Game>({
components: {
@ -288,7 +288,7 @@ export default class Game extends Vue {
}
handleData(data: Engine, keepMoveHistory?: boolean) {
for (const sector of (document.getElementsByClassName("sector") as any) as Element[]) {
for (const sector of document.getElementsByClassName("sector") as any as Element[]) {
sector.classList.add("notransition");
}
@ -305,7 +305,7 @@ export default class Game extends Vue {
}
setTimeout(() => {
for (const sector of (document.getElementsByClassName("sector") as any) as Element[]) {
for (const sector of document.getElementsByClassName("sector") as any as Element[]) {
sector.classList.remove("notransition");
}
});

View file

@ -45,18 +45,18 @@
</template>
<script lang="ts">
import { Player } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Player } from "@gaia-project/engine";
import { ButtonData, WarningsPreference } from "../data";
import Booster from "./Booster.vue";
import TechTile from "./TechTile.vue";
import BoardAction from "./BoardAction.vue";
import SpecialAction from "./SpecialAction.vue";
import { CommandController, MoveButtonController } from "../logic/buttons/types";
import { callOnShow, buttonRichTextLabel } from "../logic/buttons/utils";
import { enabledButtonWarnings } from "../data/warnings";
import { CommandController, MoveButtonController } from "../logic/buttons/types";
import { buttonRichTextLabel, callOnShow } from "../logic/buttons/utils";
import BoardAction from "./BoardAction.vue";
import Booster from "./Booster.vue";
import RichTextView from "./Resources/RichTextView.vue";
import SpecialAction from "./SpecialAction.vue";
import TechTile from "./TechTile.vue";
@Component({
components: {
@ -180,7 +180,10 @@ export default class MoveButton extends Vue implements MoveButtonController {
}
get variant(): string {
return enabledButtonWarnings(this.button, this.$store.state.preferences).length > 0 && this.warningPreference !== WarningsPreference.Tooltip ? "warning" : "secondary";
return enabledButtonWarnings(this.button, this.$store.state.preferences).length > 0 &&
this.warningPreference !== WarningsPreference.Tooltip
? "warning"
: "secondary";
}
}
</script>

View file

@ -1,12 +1,17 @@
<template>
<g class="operator">
<image xlink:href="../assets/operators/build.svg" v-if="condition !== 'step' && condition !== 'a'" width=15
:height=1152/584*15 :transform="`translate(-22,-24)`" />
<image
xlink:href="../assets/operators/build.svg"
v-if="condition !== 'step' && condition !== 'a'"
width="15"
:height="(1152 / 584) * 15"
:transform="`translate(-22,-24)`"
/>
</g>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { Condition as ConditionEnum, Building as BuildingEnum, Operator as OperatorEnum } from "@gaia-project/engine";
import { Condition as ConditionEnum, Operator as OperatorEnum } from "@gaia-project/engine";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component({
components: {},

View file

@ -7,10 +7,10 @@
</template>
<script lang="ts">
import Vue from "vue";
import planets from "../data/planets";
import { Component, Prop } from "vue-property-decorator";
import { Faction, factionPlanet, Planet as PlanetEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import planets from "../data/planets";
@Component
export default class Planet extends Vue {

View file

@ -76,9 +76,6 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Resource from "../Resource.vue";
import Engine, {
Building as BuildingEnum,
factionBoard,
@ -90,11 +87,14 @@ import Engine, {
Resource as ResourceEnum,
Reward,
} from "@gaia-project/engine";
import { CommandObject, markBuilding } from "../../logic/recent";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { buildingName } from "../../data/building";
import { CommandObject, markBuilding } from "../../logic/recent";
import { radiusTranslate } from "../../logic/utils";
import Planet from "../Planet.vue";
import Building from "../Building.vue";
import Planet from "../Planet.vue";
import Resource from "../Resource.vue";
@Component({
components: {
@ -172,14 +172,15 @@ 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 || isShip(building) ? null : this.resources(i, true).join(", ") || "~";
const rows = [
buildingName(building, this.faction) + (this.isDeployed(i) ? " (deployed)" : ""),
`Cost: ${cost}${isolatedCost}`,
income,
`Power Value: ${this.player.buildingValue(null, {building})}`,
`Power Value: ${this.player.buildingValue(null, { building })}`,
];
return rows.filter(r => r).join("<br/>");
return rows.filter((r) => r).join("<br/>");
}
get destroyedTooltip() {
@ -274,8 +275,9 @@ export default class BuildingGroup extends Vue {
if (i < this.gaia) {
return PlanetEnum.Volcanic;
}
const onGaia = [...this.engine.map.grid.values()]
.filter(h => h.buildingOf(this.player.player) === BuildingEnum.GaiaFormer && h.data.planet == PlanetEnum.Gaia).length;
const onGaia = [...this.engine.map.grid.values()].filter(
(h) => h.buildingOf(this.player.player) === BuildingEnum.GaiaFormer && h.data.planet == PlanetEnum.Gaia
).length;
return i < onGaia + this.gaia ? PlanetEnum.Gaia : PlanetEnum.Transdim;
}
}
@ -288,7 +290,7 @@ export default class BuildingGroup extends Vue {
if (n == 1) {
return `scale(0.08)`;
}
return radiusTranslate(.55, resource, n) + " scale(0.04)";
return radiusTranslate(0.55, resource, n) + " scale(0.04)";
}
}

View file

@ -44,8 +44,16 @@
title="Leech network - number of upgradable buildings by other players within leeching distance"
:transform="`translate(33.5,${height - 16.6}) scale(.08)`"
>
<image xlink:href="../../assets/other/network.svg" :height=155/211*22 width="22" x="0" y="0"
transform="scale(2)" @click="toggleMapMode('leech')" style="cursor: pointer" />
<image
xlink:href="../../assets/other/network.svg"
:height="(155 / 211) * 22"
width="22"
x="0"
y="0"
transform="scale(2)"
@click="toggleMapMode('leech')"
style="cursor: pointer"
/>
<text class="board-text" transform="translate(22,38) scale(10)" text-anchor="middle">
{{ leechNetwork }}
</text>
@ -66,15 +74,29 @@
</g>
</g>
<g transform="translate(15.2, 1.4)" v-b-tooltip title="Satellites and space stations, satellites left ">
<image xlink:href="../../assets/other/satellite.svg" :height=155/211*22 width="22" x="-11" y="-8"
transform="scale(0.07)" />
<image
xlink:href="../../assets/other/satellite.svg"
:height="(155 / 211) * 22"
width="22"
x="-11"
y="-8"
transform="scale(0.07)"
/>
<text class="board-text" transform="translate(1,0) scale(0.8)"
>{{ data.satellites + data.buildings.sp }}, {{ satellitesLeft }}
</text>
</g>
<g transform="translate(12.4, 3.5)" v-b-tooltip title="Sectors with a colonized planet">
<image xlink:href="../../assets/conditions/sector.svg" :height=155/211*22 width="22" x="-11" y="-8"
transform="scale(0.1)" @click="toggleMapMode('sectors')" style="cursor: pointer" />
<image
xlink:href="../../assets/conditions/sector.svg"
:height="(155 / 211) * 22"
width="22"
x="-11"
y="-8"
transform="scale(0.1)"
@click="toggleMapMode('sectors')"
style="cursor: pointer"
/>
<text class="board-text" transform="translate(1.4,-.1) scale(0.8)" text-anchor="middle">{{ sectors }}</text>
</g>
<g
@ -82,8 +104,16 @@
v-b-tooltip
title="Power value of structures in federations, outside of federations"
>
<image xlink:href="../../assets/conditions/federation.svg" :height=155/211*22 width="22" x="-11" y="-8"
transform="scale(0.1)" @click="toggleMapMode('federations')" style="cursor: pointer" />
<image
xlink:href="../../assets/conditions/federation.svg"
:height="(155 / 211) * 22"
width="22"
x="-11"
y="-8"
transform="scale(0.1)"
@click="toggleMapMode('federations')"
style="cursor: pointer"
/>
<text class="board-text" transform="translate(1,-.1) scale(0.8)"
>{{ player.fedValue }}, {{ player.structureValue - player.fedValue }}
</text>
@ -136,10 +166,6 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Resource from "../Resource.vue";
import Undo from "../Resources/Undo.vue";
import Engine, {
Expansion,
Faction,
@ -149,13 +175,17 @@ import Engine, {
ResearchField,
Resource as ResourceEnum,
} from "@gaia-project/engine";
import VictoryPoint from "../Resources/VictoryPoint.vue";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { FastConversionEvent, MapMode, MapModeType } from "../../data/actions";
import { factionName } from "../../data/factions";
import { researchColor } from "../../data/research";
import { showIncome } from "../../data/resources";
import { leechNetwork, sectors } from "../../data/stats";
import { CellStyle } from "../../graphics/colors";
import { researchColor } from "../../data/research";
import Resource from "../Resource.vue";
import Undo from "../Resources/Undo.vue";
import VictoryPoint from "../Resources/VictoryPoint.vue";
@Component({
components: {
@ -212,7 +242,8 @@ export default class PlayerBoardInfo extends Vue {
}
get buttonTooltip() {
return "<ul>" +
return (
"<ul>" +
"<li>Click on the faction name to see the faction rules (and there's a dropdown to see all faction rules)</li>" +
"<li>Click on the buildings to see their cost, income, and power value</li>" +
"<li>Click on the resources to get an additional resource of this kind (using the best conversion available)</li>" +
@ -221,8 +252,9 @@ 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>";
(this.isFrontiers ? "<li>Click on the trade bonus or cost icons to see the trade rewards table</li>" : "") +
"</ul>"
);
}
income(resource: ResourceEnum) {

View file

@ -25,9 +25,9 @@
</template>
<script lang="ts">
import Engine, { Player, PowerArea } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { Player, PowerArea } from "@gaia-project/engine";
import { FastConversionEvent } from "../../data/actions";
@Component

View file

@ -32,12 +32,12 @@
</template>
<script lang="ts">
import Engine, { Faction, Player, Resource as ResourceEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Resource from "../Resource.vue";
import Engine, { Faction, Player, Resource as ResourceEnum } from "@gaia-project/engine";
import PowerBowl from "./PowerBowl.vue";
import { showIncome } from "../../data/resources";
import Resource from "../Resource.vue";
import PowerBowl from "./PowerBowl.vue";
@Component<PowerBowls>({
components: {

View file

@ -8,8 +8,8 @@
</g>
</template>
<script lang="ts">
import Engine, { AuctionVariant, factionPlanet, Phase, Planet, Player, PlayerEnum } from "@gaia-project/engine";
import { Component, Prop, Vue } from "vue-property-decorator";
import Engine, { factionPlanet, AuctionVariant, Phase, Planet, Player, PlayerEnum } from "@gaia-project/engine";
import { phaseBeforeSetupBuilding } from "../logic/utils";
@Component

View file

@ -271,21 +271,21 @@
</template>
<script lang="ts">
import Engine, { Building, Expansion, factionPlanet, Planet, Player } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop, Watch } from "vue-property-decorator";
import Engine, { Building, Expansion, factionPlanet, Planet, Player } from "@gaia-project/engine";
import { MapMode, MapModeType } from "../data/actions";
import { factionData, factionName, planetsWithSteps } from "../data/factions";
import { mapModeTypeOptions } from "../data/stats";
import { factionColor } from "../graphics/utils";
import TechTile from "./TechTile.vue";
import Booster from "./Booster.vue";
import SpecialAction from "./SpecialAction.vue";
import FederationTile from "./FederationTile.vue";
import BuildingGroup from "./PlayerBoard/BuildingGroup.vue";
import PlayerBoardInfo from "./PlayerBoard/Info.vue";
import PowerBowls from "./PlayerBoard/PowerBowls.vue";
import Rules from "./Rules.vue";
import { factionData, factionName, planetsWithSteps } from "../data/factions";
import { MapMode, MapModeType } from "../data/actions";
import { mapModeTypeOptions } from "../data/stats";
import SpecialAction from "./SpecialAction.vue";
import TechTile from "./TechTile.vue";
@Component({
components: {

View file

@ -15,16 +15,18 @@
</template>
<script lang="ts">
import { Booster as BoosterEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Component } from "vue-property-decorator";
import Booster from "./Booster.vue";
import FederationTile from "./FederationTile.vue";
import { Booster as BoosterEnum, Expansion } from "@gaia-project/engine";
@Component({
computed: {
boosters() {
return BoosterEnum.values(this.$store.state.data.expansions).filter((key) => this.$store.state.data.tiles.boosters[key]);
return BoosterEnum.values(this.$store.state.data.expansions).filter(
(key) => this.$store.state.data.tiles.boosters[key]
);
},
federations() {
return Object.entries(this.$store.state.data.tiles.federations).filter(([key, value]) => value > 0);

View file

@ -47,12 +47,12 @@
</template>
<script lang="ts">
import { ResearchField } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ResearchField, BoardAction as BoardActionEnum } from "@gaia-project/engine";
import { Component } from "vue-property-decorator";
import BoardAction from "./BoardAction.vue";
import ResearchTrack from "./ResearchTrack.vue";
import TechTile from "./TechTile.vue";
import BoardAction from "./BoardAction.vue";
@Component({
computed: {

View file

@ -50,31 +50,31 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
AdvTechTilePos,
canResearchField,
canTakeAdvancedTechTile,
Condition,
Event,
Expansion,
Federation,
Operator,
Planet as PlanetEnum,
Player,
PlayerEnum,
researchEvents,
ResearchField,
Resource as ResourceEnum,
Event,
researchEvents,
} from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ButtonData } from "../data";
import { researchEventsWithCounters, researchLevelDesc } from "../data/research";
import Token from "./Token.vue";
import { plusReward } from "../logic/utils";
import FederationTile from "./FederationTile.vue";
import Planet from "./Planet.vue";
import Resource from "./Resource.vue";
import { ButtonData } from "../data";
import { plusReward } from "../logic/utils";
import Token from "./Token.vue";
@Component<ResearchTile>({
components: {
@ -110,8 +110,8 @@ export default class ResearchTile extends Vue {
}
resourceY(index: number): number {
const range = this.smallRange((this.resources)[0].type);
return (this.height / 3) * 2 + 3 + this.resourceOffset + (range ? (index - .4) * 10 : 0);
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 {
@ -119,8 +119,10 @@ export default class ResearchTile extends Vue {
}
smallRange(resource: ResourceEnum): boolean {
return (resource === ResourceEnum.ShipRange || resource === ResourceEnum.Range)
&& this.engine.expansions === Expansion.Frontiers;
return (
(resource === ResourceEnum.ShipRange || resource === ResourceEnum.Range) &&
this.engine.expansions === Expansion.Frontiers
);
}
tokenX(index: PlayerEnum) {
@ -144,7 +146,7 @@ export default class ResearchTile extends Vue {
get resources() {
const events = researchEventsWithCounters(this.engine, this.field, this.level);
const rewards = events
.filter(e => e.spec !== "3pw" && e.condition === Condition.None)
.filter((e) => e.spec !== "3pw" && e.condition === Condition.None)
.flatMap((ev) => ev.rewards);
if (events[0] && events[0].operator === Operator.Income) {
rewards.unshift(plusReward);

View file

@ -18,9 +18,9 @@
</template>
<script lang="ts">
import { ResearchField } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ResearchField } from "@gaia-project/engine";
import ResearchTile from "./ResearchTile.vue";
import TechTile from "./TechTile.vue";

View file

@ -4,7 +4,7 @@
<Qic v-if="!flat" class="qic" :transform="`translate(-0.5,0)`" />
<rect v-else class="qic" width="14" height="14" x="-7" y="-7" />
</template>
<!-- <rect v-if="kind=='q'" class="qic" width="14" height="14" x="-7" y="-7" /> -->
<!-- <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" />
@ -57,12 +57,12 @@
<g v-else-if="kind == 'swap-PI'" transform="scale(-1,1)">
<Building faction="ambas" building="m" transform="translate(-8.5, 0) scale(1.5)" :flat="flat" />
<Building faction="ambas" building="PI" transform="translate(6, 0) scale(1.5)" :flat="flat" />
<image xlink:href="../assets/resources/swap-arrow.svg" width=15 :height=129/343*15 x=-7.5 y=-14 />
<image xlink:href="../assets/resources/swap-arrow.svg" width="15" :height="(129 / 343) * 15" x="-7.5" y="-14" />
</g>
<g v-else-if="kind == 'down-lab'" transform="scale(-1,1)">
<Building faction="firaks" building="lab" transform="translate(-7.5, 0) scale(1.5)" :flat="flat" />
<Building faction="firaks" building="ts" transform="translate(7.5, 0) scale(-1.5,1.5)" :flat="flat" />
<image xlink:href="../assets/resources/arrow-charge.svg" width=15 :height=133/346*15 x=-7.5 y=-14 />
<image xlink:href="../assets/resources/arrow-charge.svg" width="15" :height="(133 / 346) * 15" x="-7.5" y="-14" />
</g>
<Building
v-else-if="kind == 'space-station'"
@ -75,31 +75,44 @@
<image v-if="!flat" xlink:href="../assets/resources/dig-planet.svg" width="20" height="20" x="-10" y="-10" />
<circle v-else r="10" :class="['planet-fill', 'dig']" />
<template v-if="count === 1 || !count">
<image xlink:href='../assets/resources/dig-arrow.svg' width=14 :height=325/308*14 x=-11 y=-4 />
<image xlink:href="../assets/resources/dig-arrow.svg" width="14" :height="(325 / 308) * 14" x="-11" y="-4" />
</template>
<template v-else-if="count === 2">
<image xlink:href='../assets/resources/dig-arrow.svg' width=14 :height=325/308*14 x=-13 y=-7 /> <image
xlink:href='../assets/resources/dig-arrow.svg' width=14 :height=325/308*14 x=-9 y=-2 />
<image xlink:href="../assets/resources/dig-arrow.svg" width="14" :height="(325 / 308) * 14" x="-13" y="-7" />
<image xlink:href="../assets/resources/dig-arrow.svg" width="14" :height="(325 / 308) * 14" x="-9" y="-2" />
</template>
</template>
<template v-else-if="kind === 'd'">
<g transform="translate(3,0)">
<image v-if="!flat" xlink:href="../assets/resources/dig-planet.svg" width="20" height="20" x="-10" y="-10" />
<circle v-else r="10" :class="['planet-fill', 'dig']" />
<image xlink:href='../assets/resources/dig-arrow.svg' :height=325/308*14 width=14 x=-11 y=-4 />
<image xlink:href="../assets/resources/dig-arrow.svg" :height="(325 / 308) * 14" width="14" x="-11" y="-4" />
</g>
<g transform="translate(-7,-7)">
<rect class="ore" width="12" height="12" x="-6" y="-6" />
<text x="0" y="0" fill="black">{{ 3 - count }}</text>
</g>
</template>
<image v-else-if="kind === 'tech'" xlink:href='../assets/resources/tech.svg' :height=155/211*22 width=22 x=-11 y=-8
<image
v-else-if="kind === 'tech'"
xlink:href="../assets/resources/tech.svg"
:height="(155 / 211) * 22"
width="22"
x="-11"
y="-8"
/>
<Federation v-else-if="kind === 'fed'" width="22" x="-11" y="-26.5" :used="true" />
<template v-else-if="kind === 'range'">
<image xlink:href="../assets/resources/flat-hex.svg" :height=162/328*20 width=15 y=-9 x=-2 /> <image
xlink:href="../assets/resources/flat-hex.svg" :height=162/328*20 width=20 y=3 x=-10 /> <image
xlink:href="../assets/resources/range-arrow.svg" :height=285/164*9 width=9 y=-8 x=-2 transform="rotate(5)" />
<image xlink:href="../assets/resources/flat-hex.svg" :height="(162 / 328) * 20" width="15" y="-9" x="-2" />
<image xlink:href="../assets/resources/flat-hex.svg" :height="(162 / 328) * 20" width="20" y="3" x="-10" />
<image
xlink:href="../assets/resources/range-arrow.svg"
:height="(285 / 164) * 9"
width="9"
y="-8"
x="-2"
transform="rotate(5)"
/>
<text
v-if="count > 1"
x="-7"
@ -114,13 +127,13 @@
</template>
<template v-else-if="kind === 'r'">
<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 />
<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 />
<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 />
<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 }}
@ -128,13 +141,13 @@
</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 />
<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 />
<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 />
<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 }}
@ -155,10 +168,21 @@
<Token faction="bescods" transform="scale(0.15) translate(50,-24)" />
<Token faction="bescods" transform="scale(0.15) translate(-5,26)" />
</template>
<image v-if="kind === 'pw'" xlink:href='../assets/resources/power-charge.svg' :height=133/346*20 width=20
transform="translate(-9.5, -13.5)" /> <image v-if="kind === 'pay-pw'"
xlink:href='../assets/resources/power-charge.svg' :height=133/346*20 width=20 transform="translate(9.5, -13.5)
scale(-1,1) " />
<image
v-if="kind === 'pw'"
xlink:href="../assets/resources/power-charge.svg"
:height="(133 / 346) * 20"
width="20"
transform="translate(-9.5, -13.5)"
/>
<image
v-if="kind === 'pay-pw'"
xlink:href="../assets/resources/power-charge.svg"
:height="(133 / 346) * 20"
width="20"
transform="translate(9.5, -13.5)
scale(-1,1) "
/>
<text
x="0"
y="0"
@ -195,13 +219,13 @@
</template>
<script lang="ts">
import { Faction, Resource as ResourceEnum } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Faction, Resource as ResourceEnum } from "@gaia-project/engine";
import Building from "./Building.vue";
import Federation from "./FederationTile.vue";
import Qic from "./Resources/Qic.vue";
import VictoryPoint from "./Resources/VictoryPoint.vue";
import Federation from "./FederationTile.vue";
import Token from "./Token.vue";
@Component({

View file

@ -54,18 +54,18 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { RichText, RichTextBuilding, RichTextElement } from "../../graphics/rich-text";
import { Building as BuildingEnum, Faction, Resource } from "@gaia-project/engine";
import Reward from "@gaia-project/engine/src/reward";
import Building from "../Building.vue";
import SpecialAction from "../SpecialAction.vue";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { foregroundColor } from "../../graphics/colors";
import { RichText, RichTextBuilding, RichTextElement } from "../../graphics/rich-text";
import { factionColorVar } from "../../graphics/utils";
import BoardAction from "../BoardAction.vue";
import TechTile from "../TechTile.vue";
import Booster from "../Booster.vue";
import Building from "../Building.vue";
import SpecialAction from "../SpecialAction.vue";
import TechTile from "../TechTile.vue";
@Component({
components: { Booster, TechTile, BoardAction, Building, SpecialAction },
@ -75,9 +75,9 @@ export default class RichTextView extends Vue {
content: RichText;
get filteredContent(): RichText {
return this.content.flatMap(c => {
return this.content.flatMap((c) => {
if (c.rewards) {
return c.rewards.map(r => ({ rewards: [r] } as RichTextElement));
return c.rewards.map((r) => ({ rewards: [r] }) as RichTextElement);
}
return c;
});
@ -104,7 +104,7 @@ export default class RichTextView extends Vue {
}
width(rewards: Reward[]): number {
return rewards[0].count as any == "+" ? 15 : rewards.length * 30;
return (rewards[0].count as any) == "+" ? 15 : rewards.length * 30;
}
buildingResource(b: RichTextBuilding): Resource | null {
@ -121,7 +121,7 @@ export default class RichTextView extends Vue {
}
buildingCountStyle(b: RichTextBuilding): string {
return `fill: ${(foregroundColor(factionColorVar(b.faction)))}; font-weight: bold;`;
return `fill: ${foregroundColor(factionColorVar(b.faction))}; font-weight: bold;`;
}
}
</script>

View file

@ -91,10 +91,10 @@
<script lang="ts">
import { factionDesc, factionName } from "../data/factions";
import { Component, Prop, Vue } from "vue-property-decorator";
import Engine, { Expansion, Faction, factionPlanet, factionVariantBoard } from "@gaia-project/engine";
import { finalScoringFields, finalScoringItems } from "../logic/final-scoring-rules";
import { Component, Prop, Vue } from "vue-property-decorator";
import { factionColor, planetFill } from "../graphics/utils";
import { finalScoringFields, finalScoringItems } from "../logic/final-scoring-rules";
import { tradeHeaders, tradeRows } from "../logic/trade-rewards";
import RichTextView from "./Resources/RichTextView.vue";

View file

@ -9,8 +9,8 @@
<script lang="ts">
import Vue from "vue";
import { Component } from "vue-property-decorator";
import ScoringTile from "./ScoringTile.vue";
import FinalScoringTile from "./FinalScoringTile.vue";
import ScoringTile from "./ScoringTile.vue";
@Component({
components: {

View file

@ -21,14 +21,14 @@
</template>
<script lang="ts">
import Engine, { Phase } from "@gaia-project/engine";
import { roundScoringEvents } from "@gaia-project/engine/src/tiles/scoring";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { Phase } from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import Condition from "./Condition.vue";
import Resource from "./Resource.vue";
import Operator from "./Operator.vue";
import { roundScoringEvents } from "@gaia-project/engine/src/tiles/scoring";
import Resource from "./Resource.vue";
@Component<ScoringTile>({
components: {

View file

@ -11,12 +11,12 @@
</template>
<script lang="ts">
import { GaiaHex } from "@gaia-project/engine";
import { CubeCoordinates, Hex } from "hexagrid";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { GaiaHex } from "@gaia-project/engine";
import { hexCenter } from "../graphics/hex";
import SpaceHex from "./SpaceHex.vue";
import { CubeCoordinates, Hex } from "hexagrid";
@Component<Sector>({
components: {
@ -44,7 +44,7 @@ export default class Sector extends Vue {
get sector(): GaiaHex[] {
const coords = Hex.hexagon(2, { center: this.center });
const ret = coords.map((coord) => this.map.grid.get(coord)).filter(h => h);
const ret = coords.map((coord) => this.map.grid.get(coord)).filter((h) => h);
return ret;
}

View file

@ -161,33 +161,32 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
Building as BuildingEnum,
Faction,
factionPlanet,
GaiaHex,
SpaceMap as ISpaceMap,
Planet as PlanetEnum,
Player,
PlayerEnum,
shipsInHex,
SpaceMap as ISpaceMap,
} from "@gaia-project/engine";
import { Direction } from "hexagrid";
import { corners, FederationLine, playerFederationLines } from "../graphics/hex";
import Planet from "./Planet.vue";
import Building from "./Building.vue";
import { buildingData, buildingName } from "../data/building";
import planets, { planetNames } from "../data/planets";
import { HexSelection, HighlightHex, HighlightHexData, WarningsPreference } from "../data";
import { isWarningEnabled } from "../data/warnings";
import { factionName } from "../data/factions";
import { leechPlanets, radiusTranslate, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
import { Ship } from "@gaia-project/engine/src/enums";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { HexSelection, HighlightHex, HighlightHexData, WarningsPreference } from "../data";
import { MapMode, MapModeType } from "../data/actions";
import { buildingData, buildingName } from "../data/building";
import { factionName } from "../data/factions";
import planets, { planetNames } from "../data/planets";
import { isWarningEnabled } from "../data/warnings";
import { corners, FederationLine, playerFederationLines } from "../graphics/hex";
import { isFree } from "../logic/buttons/utils";
import { max } from "lodash";
import { max } from "../logic/lodash-utils";
import { leechPlanets, radiusTranslate, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
import Building from "./Building.vue";
import Planet from "./Planet.vue";
type BuildingOverride = { building: BuildingEnum; player: PlayerEnum };
@Component<SpaceHex>({
@ -203,7 +202,7 @@ export default class SpaceHex extends Vue {
@Prop()
isCenter: boolean;
planetColors = Object.entries(planets).map(e => ({ planet: e[0], color: e[1].color }));
planetColors = Object.entries(planets).map((e) => ({ planet: e[0], color: e[1].color }));
shipTransform(index: number): string {
switch (this.ships.length) {
@ -217,7 +216,7 @@ export default class SpaceHex extends Vue {
}
radiusTransform(index: number, scale: number): string {
return `scale(${scale}) ${radiusTranslate(.63 / scale, index, 7)}`;
return `scale(${scale}) ${radiusTranslate(0.63 / scale, index, 7)}`;
}
get hexCorners() {
@ -234,7 +233,7 @@ export default class SpaceHex extends Vue {
get ships(): Ship[] {
let firstHidden = false;
return shipsInHex(this.hex.toString(), this.engine).filter(s => {
return shipsInHex(this.hex.toString(), this.engine).filter((s) => {
if (firstHidden) {
return true;
}
@ -260,18 +259,19 @@ export default class SpaceHex extends Vue {
return null;
}
return this.highlightedHexes?.get(hex)?.warnings
?.filter(w => tooltip || isWarningEnabled(w.disableKey, this.$store.state.preferences))
return this.highlightedHexes
?.get(hex)
?.warnings?.filter((w) => tooltip || isWarningEnabled(w.disableKey, this.$store.state.preferences))
?.map((w) => w.message)
?.join(", ");
}
get highlightBuilding(): BuildingOverride | null {
return this.buildingOverride(this.hex, h => h.building);
return this.buildingOverride(this.hex, (h) => h.building);
}
get hideBuilding(): BuildingOverride | null {
return this.buildingOverride(this.hex, h => h.hideBuilding);
return this.buildingOverride(this.hex, (h) => h.hideBuilding);
}
buildingOverride(hex: GaiaHex, prop: (h: HighlightHex) => BuildingEnum | null): BuildingOverride | null {
@ -359,16 +359,17 @@ export default class SpaceHex extends Vue {
}
get planetMapMode(): boolean {
return this.mapModes.filter(m => m.planet === this.planet).length > 0;
return this.mapModes.filter((m) => m.planet === this.planet).length > 0;
}
private playerMapMode(type: MapModeType): MapMode | null {
return this.mapModes.find(mode => mode.type === type);
return this.mapModes.find((mode) => mode.type === type);
}
get federationLines(): FederationLine[] {
return this.powerHighlightClass ? [] :
this.hex.federations.flatMap(player => playerFederationLines(this.map.grid, this.hex, this.player(player)));
return this.powerHighlightClass
? []
: this.hex.federations.flatMap((player) => playerFederationLines(this.map.grid, this.hex, this.player(player)));
}
get showPlanet(): boolean {
@ -386,12 +387,17 @@ export default class SpaceHex extends Vue {
get mapModeHighlight(): PlayerEnum | null {
if (this.planet === "e") {
const sec = this.playerMapMode(MapModeType.sectors);
if (sec && this.player(sec.player).data.occupied.some((hex) => hex.colonizedBy(sec.player) && hex.data.sector === this.hex.data.sector)) {
if (
sec &&
this.player(sec.player).data.occupied.some(
(hex) => hex.colonizedBy(sec.player) && hex.data.sector === this.hex.data.sector
)
) {
return sec.player;
}
const fed = this.playerMapMode(MapModeType.federations);
if (fed && this.hex.federations.some(f => f === fed.player)) {
if (fed && this.hex.federations.some((f) => f === fed.player)) {
return fed.player;
}
}
@ -416,7 +422,9 @@ export default class SpaceHex extends Vue {
private leechHighlightClass(mode: MapMode) {
const hex = this.hex;
const p = mode.player;
const maxLeech = max(leechPlanets(this.map, p, hex).map(lp => this.player(p).buildingValue(lp.hex, { building: lp.building })));
const maxLeech = max(
leechPlanets(this.map, p, hex).map((lp) => this.player(p).buildingValue(lp.hex, { building: lp.building }))
);
if (maxLeech) {
const otherPlayers = upgradableBuildingsOfOtherPlayers(this.engine, hex, p);
if (otherPlayers) {
@ -479,9 +487,9 @@ export default class SpaceHex extends Vue {
const messages: string[] = [];
const highlightHex = this.highlightedHexes?.get(hex);
if (c) {
messages.push(highlightHex?.building
? `Build ${buildingData[highlightHex.building].name} for ${c}`
: `Cost: ${c}`);
messages.push(
highlightHex?.building ? `Build ${buildingData[highlightHex.building].name} for ${c}` : `Cost: ${c}`
);
}
if (highlightHex?.tradeCost) {
messages.push(`Trade Cost: ${highlightHex.tradeCost}`);
@ -510,23 +518,19 @@ export default class SpaceHex extends Vue {
buildings.push(buildingLabel(this.player(data.additionalMine), BuildingEnum.Mine));
}
} else if (this.ships) {
ships = this.ships.map(s => {
ships = this.ships.map((s) => {
const faction = this.player(s.player).faction;
return (`${buildingName(s.type, faction)} (${factionName(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)}`));
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}`);
}
const coord = `Coordinates: ${hex}`;
return [coord, planet]
.concat(buildings)
.concat(ships)
.concat(messages)
.join(" ");
return [coord, planet].concat(buildings).concat(ships).concat(messages).join(" ");
}
}
</script>

View file

@ -47,15 +47,15 @@
</template>
<script lang="ts">
import Engine, { SpaceMap as SpaceMapData } from "@gaia-project/engine";
import { CubeCoordinates } from "hexagrid";
import Vue from "vue";
import { Component } from "vue-property-decorator";
import Engine, { SpaceMap as SpaceMapData } from "@gaia-project/engine";
import { hexCenter } from "../graphics/hex";
import Sector from "./Sector.vue";
import { CubeCoordinates } from "hexagrid";
import FactionWheel from "./FactionWheel.vue";
import Definitions from "./definitions/Definitions.vue";
import { MapMode, MapModeType } from "../data/actions";
import { hexCenter } from "../graphics/hex";
import FactionWheel from "./FactionWheel.vue";
import Sector from "./Sector.vue";
import Definitions from "./definitions/Definitions.vue";
@Component<SpaceMap>({
components: {
@ -102,8 +102,8 @@ export default class SpaceMap extends Vue {
}
get colorLegend(): { class: string; text: string }[] {
if (this.mapModes.find(m => m.type === MapModeType.leech || m.type == MapModeType.federations)) {
return [...Array(5).keys()].map(i => ({class: `power${i + 1}`, text: String(i + 1)}));
if (this.mapModes.find((m) => m.type === MapModeType.leech || m.type == MapModeType.federations)) {
return [...Array(5).keys()].map((i) => ({ class: `power${i + 1}`, text: String(i + 1) }));
}
return [];
}

View file

@ -26,12 +26,12 @@
</template>
<script lang="ts">
import Engine, { Event, Planet } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, { Event, Planet, Player } from "@gaia-project/engine";
import { ButtonData } from "../data";
import { specialActionButton } from "../logic/buttons/actions";
import { enabledButtonWarnings } from "../data/warnings";
import { specialActionButton } from "../logic/buttons/actions";
@Component
export default class SpecialAction extends Vue {
@ -66,7 +66,7 @@ export default class SpecialAction extends Vue {
}
techEvent(act: string): Event {
return new Event((this.board ? '' : '>') + act);
return new Event((this.board ? "" : ">") + act);
}
get gameData(): Engine {

View file

@ -43,23 +43,22 @@
</div>
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import Engine, { Player, PlayerEnum, PowerArea, Resource as ResourceEnum } from "@gaia-project/engine";
import { infoTables } from "../logic/table/info-table";
import { orderedPlayers } from "../data/player";
import { MapMode, MapModeType } from "../data/actions";
import { mapModeTypeOptions } from "../data/stats";
import { UiMode } from "../store";
import { rotate } from "../logic/utils";
import TableCell from "./TableCell.vue";
import { InfoTable } from "src/logic/table/types";
import { Component, Vue } from "vue-property-decorator";
import { MapMode, MapModeType } from "../data/actions";
import { orderedPlayers } from "../data/player";
import { mapModeTypeOptions } from "../data/stats";
import { infoTables } from "../logic/table/info-table";
import { rotate } from "../logic/utils";
import { UiMode } from "../store";
import TableCell from "./TableCell.vue";
@Component({
components: {
TableCell,
},
})
export default class Table extends Vue {
get engine(): Engine {
return this.$store.state.data;
@ -79,7 +78,7 @@ export default class Table extends Vue {
}
if (s && !passed(s)) {
return players.filter(p => !passed(p)).concat(...players.filter(p => passed(p)));
return players.filter((p) => !passed(p)).concat(...players.filter((p) => passed(p)));
}
return players;
}
@ -94,10 +93,9 @@ export default class Table extends Vue {
}
get infoTables(): InfoTable[] {
return infoTables(this.engine, this.orderedPlayers, this.uiMode,
{
convertTooltip: (resource, player) => this.convertTooltip(resource, player),
});
return infoTables(this.engine, this.orderedPlayers, this.uiMode, {
convertTooltip: (resource, player) => this.convertTooltip(resource, player),
});
}
get mapModeTypeOptions() {
@ -105,7 +103,7 @@ export default class Table extends Vue {
}
selectedMapMode(player: PlayerEnum): MapModeType {
return this.$store.getters.mapModes.find(m => m.player === player)?.type ?? MapModeType.default;
return this.$store.getters.mapModes.find((m) => m.player === player)?.type ?? MapModeType.default;
}
toggleMapMode(player: PlayerEnum, mode: MapModeType) {

View file

@ -15,12 +15,12 @@
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { PowerArea, Resource as ResourceEnum } from "@gaia-project/engine";
import { FastConversionEvent } from "../data/actions";
import RichTextView from "./Resources/RichTextView.vue";
import { UiMode } from "../store";
import { InfoTableCell } from "src/logic/table/types";
import { Component, Prop, Vue } from "vue-property-decorator";
import { FastConversionEvent } from "../data/actions";
import { UiMode } from "../store";
import RichTextView from "./Resources/RichTextView.vue";
@Component({
components: { RichTextView },
})

View file

@ -88,18 +88,18 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import {
Building as BuildingEnum,
Condition as ConditionEnum,
Event,
Operator as OperatorEnum,
Condition as ConditionEnum,
Building as BuildingEnum,
} from "@gaia-project/engine";
import Resource from "./Resource.vue";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Building from "./Building.vue";
import Condition from "./Condition.vue";
import Operator from "./Operator.vue";
import Resource from "./Resource.vue";
import SpecialAction from "./SpecialAction.vue";
@Component({

View file

@ -29,8 +29,6 @@
</template>
<script lang="ts">
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import Engine, {
AdvTechTile,
AdvTechTilePos,
@ -39,12 +37,14 @@ import Engine, {
TechTile as TechTileEnum,
TechTilePos,
} from "@gaia-project/engine";
import { eventDesc } from "../data/event";
import TechContent from "./TechContent.vue";
import { ButtonData } from "../data";
import { prependShortcut } from "../logic/buttons/shortcuts";
import { techTileData } from "../data/tech-tiles";
import { techTileEventWithSource } from "@gaia-project/engine/src/tiles/techs";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { ButtonData } from "../data";
import { eventDesc } from "../data/event";
import { techTileData } from "../data/tech-tiles";
import { prependShortcut } from "../logic/buttons/shortcuts";
import TechContent from "./TechContent.vue";
@Component({
components: {

View file

@ -5,9 +5,9 @@
</template>
<script lang="ts">
import { Faction } from "@gaia-project/engine";
import Vue from "vue";
import { Component, Prop } from "vue-property-decorator";
import { Faction } from "@gaia-project/engine";
import { planetClass } from "../graphics/utils";
@Component

View file

@ -21,10 +21,10 @@
</div>
</template>
<script lang="ts">
import Engine, { Phase, Player } from "@gaia-project/engine";
import { Component, Vue } from "vue-property-decorator";
import Engine, { Player, Phase } from "@gaia-project/engine";
import PlayerCircle from "./PlayerCircle.vue";
import { phaseBeforeSetupBuilding } from "../logic/utils";
import PlayerCircle from "./PlayerCircle.vue";
@Component({
components: { PlayerCircle },

View file

@ -53,8 +53,8 @@
</template>
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import Game from "./Game.vue";
import { LoadFromJson, LoadFromJsonType } from "../store";
import Game from "./Game.vue";
@Component({
components: { Game },
@ -70,7 +70,7 @@ export default class Wrapper extends Vue {
this.$store.dispatch("loadFromJSON", {
engineData: JSON.parse(this.text),
type: this.loadType,
stopMove: this.stopMove
stopMove: this.stopMove,
} as LoadFromJson);
}

Some files were not shown because too many files have changed in this diff Show more