🏗 Use pnpm / pnpm workspace

This commit is contained in:
coyotte508 2021-02-20 19:31:29 +01:00
parent e641474e9c
commit 5befa5440a
42 changed files with 12037 additions and 11306 deletions

View file

@ -25,7 +25,10 @@ jobs:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
registry-url: "https://registry.npmjs.org"
- run: yarn install
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
- run: pnpm install
- run: git config --global user.name github-actions
- run: git config --global user.email bot@github.com
- run: yarn version --${{ github.event.inputs.newversion }}

View file

@ -21,7 +21,10 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "12"
- run: yarn install
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
- run: pnpm install
- run: yarn build
- run: yarn lint
- run: yarn prettier-check

View file

@ -25,7 +25,10 @@ jobs:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
registry-url: "https://registry.npmjs.org"
- run: yarn install
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
- run: pnpm install
- run: git config --global user.name github-action
- run: git config --global user.email hello@github.com
- run: yarn version --${{ github.event.inputs.newversion }}

View file

@ -23,6 +23,9 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: "14"
- run: yarn install
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.1
- run: pnpm install
- run: yarn test
- run: yarn build

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules

1
.npmrc Normal file
View file

@ -0,0 +1 @@
shared-workspace-lockfile = false

View file

@ -11,14 +11,17 @@ Checkout their READMEs:
Check out [boardgamers.space](https://www.boardgamers.space)! Reach out to us if you want to contribute.
## Install
Do `pnpm install` in the main folder
## Test locally
You can run the viewer with:
After the installation step, you can run the viewer with:
```
cd viewer
yarn install
yarn serve
npm run serve
```
It will use the engine in its sibling folder

View file

@ -1 +1,2 @@
/dist
/dist
pnpm-lock.yaml

View file

@ -14,35 +14,9 @@ Have node 6+, hopefully 8+. Have npm 5+, and tsc.
### Dependencies
In the project's folder:
```
yarn
```
### Build
To compile Typescript into javascript:
```
yarn build
```
### Test
```
yarn test
```
### Usage as a dependency from another module
If you want to use your local copy of this module instead of the npm version, as a dependency of
another module, do this:
```
## In this folder
yarn link
## In the other project's folder
yarn link @gaia-project/engine
pnpm install
npm run test
```

1817
engine/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

3
pnpm-workspace.yaml Normal file
View file

@ -0,0 +1,3 @@
packages:
- "viewer"
- "engine"

View file

@ -8,11 +8,11 @@ Check out [boardgamers.space](https://www.boardgamers.space)!
## Build and Run
In the viewer's folder:
```bash
# install deps, do this everytime yarn.lock is modified
yarn install
# run
yarn serve
pnpm install
npm run serve
```
And open localhost:8080 in the browser.

View file

@ -30,7 +30,7 @@
"dependencies": {
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.12.0",
"@engine": "../engine",
"@engine": "workspace:../engine",
"lodash": "^4.17.15",
"vue": "^2.6.11",
"vuex": "^3.0.1"
@ -58,7 +58,8 @@
"popper.js": "^1.16.1",
"sass-loader": "^8.0.2",
"typescript": "^3.8.3",
"vue-property-decorator": "^8.4.1",
"vue-property-decorator": "^9.1.2",
"vue-class-component": "^7.2.6",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.16.1"
},

10054
viewer/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -17,18 +17,18 @@
<td v-else-if="event.entry.phase === 'roundGaia'" class="phase-change">Gaia phase</td>
<td v-else-if="event.entry.phase === 'endGame'" class="phase-change">End scoring</td>
<td v-else>{{ event.move || data.players[event.entry.player].faction }}</td>
<td style="width: 1px; white-space: nowrap;">
<td style="width: 1px; white-space: nowrap">
<div
v-for="(changes, source, i) in event.entry.changes"
v-html="source === 'undefined' ? '&nbsp;' : source"
:key="i"
/>
</td>
<td style="width: 1px; white-space: nowrap;">
<td style="width: 1px; white-space: nowrap">
<div v-for="(changes, source, i) in event.entry.changes" :key="i">
{{
Object.keys(changes)
.map(key => `${changes[key]}${key}`)
.map((key) => `${changes[key]}${key}`)
.join(", ")
}}
</div>

View file

@ -69,7 +69,7 @@ export default class BoardAction extends Vue {
get tooltip() {
const costDesc = "Spend " + this.cost + "\n";
return costDesc + boardActions[this.action].income.map(x => eventDesc(new Event(x))).join("\n");
return costDesc + boardActions[this.action].income.map((x) => eventDesc(new Event(x))).join("\n");
}
get faded() {
@ -81,12 +81,12 @@ export default class BoardAction extends Vue {
}
get rewards() {
return boardActions[this.action].income.map(x => new Reward(x));
return boardActions[this.action].income.map((x) => new Reward(x));
}
get income() {
return [].concat(
...boardActions[this.action].income.map(x => {
...boardActions[this.action].income.map((x) => {
if (x.includes("+")) {
return [x.slice(0, x.indexOf("+")), x.slice(x.indexOf("+"))];
}

View file

@ -246,7 +246,7 @@ export default class Commands extends Vue {
label: "Rotate sectors",
command: Command.RotateSectors,
hexes: new Map<GaiaHex, {}>(
this.map.configuration().centers.map(center => [this.engine.map.grid.get(center), {}] as [GaiaHex, {}])
this.map.configuration().centers.map((center) => [this.engine.map.grid.get(center), {}] as [GaiaHex, {}])
),
rotation: true,
});
@ -255,7 +255,7 @@ export default class Commands extends Vue {
}
case Command.Build: {
for (const building of Object.values(Building)) {
const coordinates = command.data.buildings.filter(bld => bld.building === building);
const coordinates = command.data.buildings.filter((bld) => bld.building === building);
if (coordinates.length > 0) {
let label = `Build a ${buildingName(building)}`;
@ -277,7 +277,7 @@ export default class Commands extends Vue {
command: `${Command.Build} ${building}`,
automatic: command.data.automatic,
hexes: new Map<GaiaHex, { cost?: string }>(
coordinates.map(coord => [this.engine.map.getS(coord.coordinates), coord])
coordinates.map((coord) => [this.engine.map.getS(coord.coordinates), coord])
),
});
}
@ -290,7 +290,7 @@ export default class Commands extends Vue {
ret.push({
label: "Swap Planetary Institute",
command: command.name,
hexes: new Map(command.data.buildings.map(coord => [this.engine.map.getS(coord.coordinates), coord])),
hexes: new Map(command.data.buildings.map((coord) => [this.engine.map.getS(coord.coordinates), coord])),
});
break;
}
@ -299,7 +299,7 @@ export default class Commands extends Vue {
ret.push({
label: "Place Lost Planet",
command: command.name,
hexes: new Map(command.data.spaces.map(coord => [this.engine.map.getS(coord.coordinates), coord])),
hexes: new Map(command.data.spaces.map((coord) => [this.engine.map.getS(coord.coordinates), coord])),
});
break;
}
@ -322,7 +322,7 @@ export default class Commands extends Vue {
label: `Booster ${i + 1}`,
booster,
needConfirm: true,
tooltip: tiles.boosters[booster].map(spec => eventDesc(new Event(spec))).join("\n"),
tooltip: tiles.boosters[booster].map((spec) => eventDesc(new Event(spec))).join("\n"),
warning,
});
}
@ -366,8 +366,8 @@ export default class Commands extends Vue {
label: "Advance research",
command: command.name,
// track.to contains actual level, to use when implementing research viewer
buttons: command.data.tracks.map(track => ({ command: track.field })),
researchTiles: command.data.tracks.map(track => track.field + "-" + track.to),
buttons: command.data.tracks.map((track) => ({ command: track.field })),
researchTiles: command.data.tracks.map((track) => track.field + "-" + track.to),
});
}
break;
@ -378,8 +378,8 @@ export default class Commands extends Vue {
ret.push({
label: command.name === Command.ChooseCoverTechTile ? "Pick tech tile to cover" : "Pick tech tile",
command: command.name,
techs: command.data.tiles.map(tile => tile.pos),
buttons: command.data.tiles.map(tile => ({ command: tile.pos, tech: tile.pos })),
techs: command.data.tiles.map((tile) => tile.pos),
buttons: command.data.tiles.map((tile) => ({ command: tile.pos, tech: tile.pos })),
});
break;
}
@ -418,7 +418,7 @@ export default class Commands extends Vue {
case Command.BrainStone: {
ret.push(
...command.data.sort().map(area => ({
...command.data.sort().map((area) => ({
label: `Brainstone ${area}`,
command: `${command.name} ${area}`,
}))
@ -430,7 +430,7 @@ export default class Commands extends Vue {
ret.push({
label: "Free action",
command: Command.Spend,
buttons: command.data.acts.map(act => ({
buttons: command.data.acts.map((act) => ({
label: `Spend ${act.cost} to gain ${act.income}`,
command: `${act.cost} for ${act.income}`,
times: act.range,
@ -443,8 +443,8 @@ export default class Commands extends Vue {
ret.push({
label: "Power/Q.I.C Action",
command: Command.Action,
actions: command.data.poweracts.map(act => act.name),
buttons: command.data.poweracts.map(act => ({
actions: command.data.poweracts.map((act) => act.name),
buttons: command.data.poweracts.map((act) => ({
command: act.name,
label: `Spend ${act.cost} for ${act.income.join(" / ")}`,
})),
@ -456,8 +456,8 @@ export default class Commands extends Vue {
ret.push({
label: "Special Action",
command: Command.Special,
actions: command.data.specialacts.map(act => act.income),
buttons: command.data.specialacts.map(act => ({ command: act.income })),
actions: command.data.specialacts.map((act) => act.income),
buttons: command.data.specialacts.map((act) => ({ command: act.income })),
});
break;
}
@ -466,7 +466,7 @@ export default class Commands extends Vue {
ret.push({
label: "Burn power",
command: Command.BurnPower,
buttons: command.data.map(val => ({ command: val })),
buttons: command.data.map((val) => ({ command: val })),
});
break;
}
@ -488,7 +488,7 @@ export default class Commands extends Vue {
case Command.ChooseIncome: {
ret.push(
...command.data.map(income => ({
...command.data.map((income) => ({
label: `Income ${income}`,
command: `${Command.ChooseIncome} ${income}`,
}))
@ -498,7 +498,7 @@ export default class Commands extends Vue {
case Command.Bid: {
ret.push(
...command.data.bids.map(pos => ({
...command.data.bids.map((pos) => ({
label: `Bid ${pos.bid[0]} for ${pos.faction}`,
command: `${Command.Bid} ${pos.faction} $times`,
times: pos.bid,
@ -509,7 +509,7 @@ export default class Commands extends Vue {
case Command.PickReward: {
ret.push(
...command.data.rewards.map(reward => ({
...command.data.rewards.map((reward) => ({
label: `Gain ${reward}`,
command: `${Command.PickReward} ${reward}`,
}))
@ -526,7 +526,7 @@ export default class Commands extends Vue {
const locationButtons = command.data.federations.map((fed, i) => ({
command: fed.hexes,
label: `Location ${i + 1}`,
hexes: new Map(fed.hexes.split(",").map(coord => [this.engine.map.getS(coord), { coordinates: coord }])),
hexes: new Map(fed.hexes.split(",").map((coord) => [this.engine.map.getS(coord), { coordinates: coord }])),
hover: true,
buttons: tilesButtons,
}));

View file

@ -4,10 +4,9 @@
<g
v-for="i in [0, 1, 2, 3, 4, 5, 6]"
:key="i"
:transform="
`translate(${r * Math.sin(((-180 + i * 51) * Math.PI) / 180)}, ${r *
Math.cos(((-180 + i * 51) * Math.PI) / 180)})`
"
:transform="`translate(${r * Math.sin(((-180 + i * 51) * Math.PI) / 180)}, ${
r * Math.cos(((-180 + i * 51) * Math.PI) / 180)
})`"
>
<circle :r="1" :class="['planet-fill', planet(i)]" :style="`stroke-width: ${strokeWidth(i)}`" />
<text
@ -43,13 +42,13 @@ export default class FactionWheel extends Vue {
}
remainingPlanets(planet: string) {
return Array.from(this.gameData.map.grid.values()).filter(hex => !hex.occupied() && hex.data.planet === planet)
return Array.from(this.gameData.map.grid.values()).filter((hex) => !hex.occupied() && hex.data.planet === planet)
.length;
}
strokeWidth(pos: number) {
const planet = this.planet(pos);
if (this.gameData.players.some(p => p.faction && factions[p.faction].planet === planet)) {
if (this.gameData.players.some((p) => p.faction && factions[p.faction].planet === planet)) {
return "0.2px; stroke-dasharray:.5 .2";
}

View file

@ -15,11 +15,9 @@
:key="i"
:count="reward.count"
:kind="reward.type"
:transform="
`translate(${i === 2 ? 0 : (i - Math.min(rewards.length - 1, 1) / 2) * 22}, ${
rewards.length === 1 ? 12.5 : i === 2 ? -7 : 10
})`
"
:transform="`translate(${i === 2 ? 0 : (i - Math.min(rewards.length - 1, 1) / 2) * 22}, ${
rewards.length === 1 ? 12.5 : i === 2 ? -7 : 10
})`"
/>
</g>
</g>

View file

@ -87,12 +87,10 @@
<feColorMatrix
type="matrix"
result="A"
:values="
`${r / x} 0 0 0 0
:values="`${r / x} 0 0 0 0
${g / x} 0 0 0 0
${b / x} 0 0 0 0
0 0 0 1 0`
"
0 0 0 1 0`"
/>
<feColorMatrix in="A" type="saturate" :values="s" />
</filter>
@ -101,12 +99,10 @@
<filter :id="`color-planet-${planet}`" :key="'pl-' + planet">
<feColorMatrix
type="matrix"
:values="
`${r / (3 * x)} ${r / (3 * x)} ${r / (3 * x)} 0 0
:values="`${r / (3 * x)} ${r / (3 * x)} ${r / (3 * x)} 0 0
${g / (3 * x)} ${g / (3 * x)} ${g / (3 * x)} 0 0
${b / (3 * x)} ${b / (3 * x)} ${b / (3 * x)} 0 0
0 0 0 1 0`
"
0 0 0 1 0`"
/>
</filter>
</template>
@ -136,7 +132,7 @@ function getDarkness(faction: string): number {
export default class Filters extends Vue {
get factionData() {
const factions = ["gen", "gaia", ...Object.values(Faction)];
return factions.map(faction => {
return factions.map((faction) => {
/* Gaia faction is used for gaia-colored gaia formers for Baltaks */
const color = faction === "gaia" ? planetColor(Planet.Gaia) : factionColor(faction as Faction);
const darkness = getDarkness(faction);
@ -154,8 +150,8 @@ export default class Filters extends Vue {
}
get planetData() {
const planets = Object.values(Planet).filter(pl => pl !== Planet.Empty);
return planets.map(planet => {
const planets = Object.values(Planet).filter((pl) => pl !== Planet.Empty);
return planets.map((planet) => {
const color = planetColor(planet);
const darkness = 1;

View file

@ -32,7 +32,7 @@ import Token from "./Token.vue";
const players = this.players;
return players
.map(pl => {
.map((pl) => {
const name = pl.faction === "automa" ? "Automa" : factions[pl.faction].name;
const points = this.progress(pl);
return `- ${name}: ${points}`;
@ -68,7 +68,7 @@ export default class FinalScoringTile extends Vue {
}
get players() {
const pls = this.$store.state.gaiaViewer.data.players.filter(player => !!player && player.faction);
const pls = this.$store.state.gaiaViewer.data.players.filter((player) => !!player && player.faction);
if (this.$store.state.gaiaViewer.data.players.length === 2) {
pls.push({ faction: "automa" });

View file

@ -28,7 +28,7 @@
<template v-else>
<PlayerInfo :player="sessionPlayer" class="col-md-6 order-3" />
<PlayerInfo
v-for="player in orderedPlayers.filter(pl => pl !== sessionPlayer)"
v-for="player in orderedPlayers.filter((pl) => pl !== sessionPlayer)"
:player="player"
:key="player.player"
class="col-md-6 order-6"
@ -177,7 +177,7 @@ export default class Game extends Vue {
// turnOrder = turnOrder.slice(turnOrder.indexOf(this.player)).concat(turnOrder.slice(0, turnOrder.indexOf(this.player)));
// }
return turnOrder.concat(engine.passedPlayers).map(player => engine.players[player]);
return turnOrder.concat(engine.passedPlayers).map((player) => engine.players[player]);
}
get canPlay() {

View file

@ -90,7 +90,7 @@ export default class MoveButton extends Vue {
}
subscribeFinal(action: string) {
this.subscribe(action, field => this.emitCommand(field, { final: true }));
this.subscribe(action, (field) => this.emitCommand(field, { final: true }));
this.emitCommand(null, { disappear: false });
}
@ -133,7 +133,7 @@ export default class MoveButton extends Vue {
this.emitCommand(hex.toString());
} else {
this.$store.commit("gaiaViewer/highlightHexes", this.button.hexes);
this.subscribe("hexClick", hex => this.emitCommand(hex.toString()));
this.subscribe("hexClick", (hex) => this.emitCommand(hex.toString()));
}
} else if (this.button.researchTiles) {
this.$store.commit("gaiaViewer/highlightResearchTiles", this.button.researchTiles);
@ -153,7 +153,7 @@ export default class MoveButton extends Vue {
// If already the active button, end the selection
if (this.isActiveButton) {
this.button.command = [...this.$store.state.gaiaViewer.context.highlighted.hexes.keys()]
.map(hex => hex.toString())
.map((hex) => hex.toString())
.join(",");
this.emitCommand();
return;
@ -163,7 +163,7 @@ export default class MoveButton extends Vue {
this.customLabel = "Custom location - End selection";
this.subscribe("hexClick", hex => {
this.subscribe("hexClick", (hex) => {
const highlighted = this.$store.state.gaiaViewer.context.highlighted.hexes;
if (highlighted.has(hex)) {
@ -173,7 +173,7 @@ export default class MoveButton extends Vue {
}
const keys: GaiaHex[] = [...highlighted.keys()];
this.$store.commit("gaiaViewer/highlightHexes", new Map([...keys.map(key => [key, null])] as any));
this.$store.commit("gaiaViewer/highlightHexes", new Map([...keys.map((key) => [key, null])] as any));
});
} else if (this.button.modal) {
this.modalShow = true;
@ -183,17 +183,17 @@ export default class MoveButton extends Vue {
for (const rotation of rotations) {
rotation[1] %= 6;
}
this.emitCommand([].concat(...rotations.filter(r => !!r[1])).join(" "));
this.emitCommand([].concat(...rotations.filter((r) => !!r[1])).join(" "));
return;
}
this.$store.commit("gaiaViewer/highlightHexes", this.button.hexes);
this.subscribe("hexClick", hex => this.$store.commit("gaiaViewer/rotate", hex));
this.subscribe("hexClick", (hex) => this.$store.commit("gaiaViewer/rotate", hex));
this.customLabel = "Sector rotations finished";
} else if (this.button.range) {
console.log("range click");
this.$store.commit("gaiaViewer/highlightHexes", this.button.hexes);
this.subscribe("hexClick", hex => {
this.subscribe("hexClick", (hex) => {
if (this.startingHex) {
this.emitCommand(`${this.startingHex} ${hex}`);
this.startingHex = undefined;
@ -253,12 +253,12 @@ export default class MoveButton extends Vue {
if (times && typeof times === "number") {
// the \b is necessary for things like '1t-a3', so the 3 is not caught
command = command.replace(/\b[0-9]+/g, x => "" + parseInt(x) * times);
command = command.replace(/\b[0-9]+/g, (x) => "" + parseInt(x) * times);
}
command = command.replace(/\$times\b/g, "" + (times ?? 0));
commandBody = [command, append].filter(x => !!x);
commandBody = [command, append].filter((x) => !!x);
}
this.$emit("trigger", commandBody.join(" "), this, final);

View file

@ -1,7 +1,7 @@
<template>
<g>
<circle :r="radius" :class="['planet-fill', planet]" style="pointer-events: none;" />
<circle :r="radius" :class="['planet-fill', 'faction-fill', fill]" v-if="faction" style="pointer-events: none;" />
<circle :r="radius" :class="['planet-fill', planet]" style="pointer-events: none" />
<circle :r="radius" :class="['planet-fill', 'faction-fill', fill]" v-if="faction" style="pointer-events: none" />
<circle :r="radius" :class="['planet', planet]" />
</g>
</template>

View file

@ -125,7 +125,7 @@ export default class BuildingGroup extends Vue {
tooltip(i: number) {
const b = this.board.buildings[this.building];
const cost = this.discount
? b.cost.map(c => `${c.count - this.discount}${c.type}`).join(", ")
? b.cost.map((c) => `${c.count - this.discount}${c.type}`).join(", ")
: b.cost.join(", ") || "~";
const isolatedCost = b.isolatedCost ? "\n Isolated cost: " + (b.isolatedCost.join(", ") || "~") : "";
const income = this.building === BuildingEnum.GaiaFormer ? "" : "\n " + (this.resources(i, true).join(", ") || "~");
@ -154,10 +154,10 @@ export default class BuildingGroup extends Vue {
get factionIncome(): Reward[] {
const income: Reward[] = [].concat(
...this.board.income.filter(ev => ev.operator === Operator.Income).map(ev => ev.rewards)
...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));
}
get flat() {
@ -192,7 +192,7 @@ export default class BuildingGroup extends Vue {
}
let incomeAdded = false;
const ret = this.board.buildings[building].income[i].map(ev => {
const ret = this.board.buildings[building].income[i].map((ev) => {
const rew = ev.rewards.toString();
const special = ev.operator === Operator.Activate && (rew === "1q" || rew === "4c");
@ -208,7 +208,7 @@ export default class BuildingGroup extends Vue {
return null;
});
return [].concat(...ret).filter(r => r != null);
return [].concat(...ret).filter((r) => r != null);
}
}
</script>

View file

@ -147,7 +147,7 @@ export default class BuildingGroup extends Vue {
}
get sectors(): number {
return uniq(this.data.occupied.filter(hex => hex.colonizedBy(this.player.player)).map(hex => hex.data.sector))
return uniq(this.data.occupied.filter((hex) => hex.colonizedBy(this.player.player)).map((hex) => hex.data.sector))
.length;
}
}

View file

@ -113,9 +113,9 @@
>
<circle :r="1" style="stroke-width: 0.06px !important" :class="['player-token', 'planet-fill', planet]" />
<text
:style="
`font-size: 1.4px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(planet)}`
"
:style="`font-size: 1.4px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(
planet
)}`"
>
{{ player.ownedPlanetsCount[planet] }}
</text>

View file

@ -27,7 +27,7 @@ import { Booster as BoosterEnum, Expansion } from "@gaia-project/engine";
@Component({
computed: {
boosters() {
return BoosterEnum.values(Expansion.All).filter(key => this.$store.state.gaiaViewer.data.tiles.boosters[key]);
return BoosterEnum.values(Expansion.All).filter((key) => this.$store.state.gaiaViewer.data.tiles.boosters[key]);
},
federations() {
return Object.entries(this.$store.state.gaiaViewer.data.tiles.federations).filter(([key, value]) => value > 0);

View file

@ -73,7 +73,7 @@ import Resource from "./Resource.vue";
computed: {
players(): Player[] {
return this.$store.state.gaiaViewer.data.players.filter(
player => player.faction && player.data.research[this.field] === this.level
(player) => player.faction && player.data.research[this.field] === this.level
);
},
tooltip() {
@ -144,7 +144,7 @@ export default class ResearchTile extends Vue {
}
get resources() {
const rewards = Reward.merge(...this.events.slice(0, 1).map(ev => ev.rewards));
const rewards = Reward.merge(...this.events.slice(0, 1).map((ev) => ev.rewards));
if (this.events[0] && this.events[0].operator === Operator.Income) {
rewards.unshift(new Reward("+", ResourceEnum.None));
@ -191,11 +191,11 @@ export default class ResearchTile extends Vue {
}
get events() {
return researchTracks[this.field][this.level].map(s => new Event(s));
return researchTracks[this.field][this.level].map((s) => new Event(s));
}
get techContent() {
return this.events.filter(event => event.condition !== Condition.None);
return this.events.filter((event) => event.condition !== Condition.None);
}
get highlighted(): boolean {

View file

@ -117,7 +117,7 @@
y="0"
v-if="
(count >= 0 && ['o', 'c', 'k', 'pw', 'pay-pw', 't', 'bowl-t', 'tg', 'vp', 'q', 'gf'].includes(kind)) ||
count === '+'
count === '+'
"
:class="{ plus: count === '+' }"
>{{ kind === "t" ? "+" : "" }}{{ count }}</text

View file

@ -6,13 +6,11 @@
<Resource :kind="reward.type" :count="reward.count" transform="translate(63.7, 13.1) scale(1.5)" />
<Condition
:condition="event.condition"
:transform="
`translate(${
event.condition === 'step' || event.condition === 'a' || event.condition === 'PA'
? 27 + (event.condition === 'PA' ? 8 : 0)
: 34
}, ${event.condition === 'step' ? 20 : 22}) scale(1.3)`
"
:transform="`translate(${
event.condition === 'step' || event.condition === 'a' || event.condition === 'PA'
? 27 + (event.condition === 'PA' ? 8 : 0)
: 34
}, ${event.condition === 'step' ? 20 : 22}) scale(1.3)`"
/>
<Operator :condition="event.condition" :operator="event.operator" transform="translate(28, 27) scale(1)" />
<rect x="1" y="1" width="75" height="40" rx="2" ry="2" class="contour" />
@ -39,7 +37,7 @@ export default class ScoringTile extends Vue {
@Prop()
round: number;
get tile(this: ScoringTile) {
get tile() {
return this.$store.state.gaiaViewer.data.tiles.scorings.round[this.round - 1];
}

View file

@ -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));
const ret = coords.map((coord) => this.map.grid.get(coord));
return ret;
}

View file

@ -6,7 +6,7 @@
}}{{ cost(hex) ? `&#10;Cost: ${cost(hex)}` : "" }}
</title>
<polygon
:points="hexCorners.map(p => `${p.x},${p.y}`).join(' ')"
:points="hexCorners.map((p) => `${p.x},${p.y}`).join(' ')"
:class="[
'spaceHex',
{
@ -23,7 +23,7 @@
}}</text>
<Planet v-if="hex.data.planet !== 'e'" :planet="hex.data.planet" :faction="faction(hex.data.player)" />
<Building
style="stroke-width: 10;"
style="stroke-width: 10"
v-if="hex.data.building"
:building="hex.data.building"
:faction="faction(hex.data.player)"
@ -32,7 +32,7 @@
transform="scale(0.1)"
/>
<Building
style="stroke-width: 10;"
style="stroke-width: 10"
v-if="hex.data.additionalMine !== undefined"
:faction="faction(hex.data.additionalMine)"
building="m"
@ -43,7 +43,7 @@
/>
<polygon
v-for="(player, index) in hex.data.federations || []"
:points="hexCorners.map(p => `${p.x * (1 - (index + 0.5) / 8)},${p.y * (1 - (index + 0.5) / 8)}`).join(' ')"
:points="hexCorners.map((p) => `${p.x * (1 - (index + 0.5) / 8)},${p.y * (1 - (index + 0.5) / 8)}`).join(' ')"
:class="['spaceHexFederation', 'planet', planet(player)]"
:key="`${player}-${index}`"
/>

View file

@ -5,11 +5,9 @@
v-for="center in this.sectors"
:center="center"
:key="`${center.q}x{center.r}`"
:style="
`transform: translate(${hexCenter(center).x * 1.01}px, ${hexCenter(center).y * 1.01}px) rotate(${rotation(
center
) * 60}deg);`
"
:style="`transform: translate(${hexCenter(center).x * 1.01}px, ${hexCenter(center).y * 1.01}px) rotate(${
rotation(center) * 60
}deg);`"
/>
<FactionWheel transform="translate(-10.5, -8.7) scale(0.5, 0.5)" />
</svg>

View file

@ -27,7 +27,15 @@
<text
x="-25"
y="0"
style="text-anchor: middle; dominant-baseline: central; font-size: 8px; fill: white !important; letter-spacing: 0px; writing-mode: vertical-rl; text-orientation: upright; "
style="
text-anchor: middle;
dominant-baseline: central;
font-size: 8px;
fill: white !important;
letter-spacing: 0px;
writing-mode: vertical-rl;
text-orientation: upright;
"
>PASS</text
>
</g>
@ -41,9 +49,9 @@
:count="res.count"
:kind="res.type"
:key="i"
:transform="
`translate(${centerRewards.length > 1 ? (i - 0.5) * 26 : 0}, 0) scale(${centerRewards.length === 1 ? 2 : 1.5})`
"
:transform="`translate(${centerRewards.length > 1 ? (i - 0.5) * 26 : 0}, 0) scale(${
centerRewards.length === 1 ? 2 : 1.5
})`"
/>
<Resource
v-for="(res, i) in rightRewards"
@ -69,7 +77,15 @@
<Operator :operator="event.operator" :condition="event.condition" transform="translate(2,5) scale(1.2)" />
</template>
<text
style="font-size: 40px; stroke: black; fill: white; dominant-baseline: central; text-anchor: middle; stroke-width: 1px; font-weight: bold;"
style="
font-size: 40px;
stroke: black;
fill: white;
dominant-baseline: central;
text-anchor: middle;
stroke-width: 1px;
font-weight: bold;
"
x="-14"
v-if="event.operator === '+'"
>+</text

View file

@ -23,7 +23,7 @@
filter="url(#shadow-1)"
/>
<!--<text class="title" x="-25" y="-18">{{title}}</text>-->
<TechContent :content="rawContent" style="pointer-events:none;" />
<TechContent :content="rawContent" style="pointer-events: none" />
</g>
</svg>
</template>

View file

@ -5,11 +5,9 @@
<g v-for="(player, index) in turnOrder" :key="index" :transform="`translate(${index * 2.5})`">
<circle :r="1" :style="stroke(player)" :class="['player-token', 'planet-fill', planet(player, index)]" />
<text
:style="
`font-size: 1.2px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(
planet(player, index)
)}`
"
:style="`font-size: 1.2px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(
planet(player, index)
)}`"
>
{{ initial(player, index) }}
</text>
@ -24,11 +22,9 @@
>
<circle :r="1" :style="stroke(player)" :class="['player-token', 'planet-fill', planet(player, index)]" />
<text
:style="
`font-size: 1.2px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(
planet(player, index)
)}`
"
:style="`font-size: 1.2px; text-anchor: middle; dominant-baseline: central; fill: ${planetFill(
planet(player, index)
)}`"
>
{{ initial(player, index) }}
</text>
@ -63,13 +59,13 @@ export default class TurnOrder extends Vue {
return data.players;
}
if (data.phase === Phase.SetupBuilding || data.phase === Phase.SetupBooster) {
return data.setup.map(faction => data.players.find(pl => pl.faction === faction));
return data.setup.map((faction) => data.players.find((pl) => pl.faction === faction));
}
return data.turnOrder.map(player => data.players[player]);
return data.turnOrder.map((player) => data.players[player]);
}
get passedPlayers(): Player[] {
return (this.gameData.passedPlayers ?? []).map(player => this.gameData.players[player]);
return (this.gameData.passedPlayers ?? []).map((player) => this.gameData.players[player]);
}
isCurrentPlayer(pl: Player) {
@ -129,7 +125,7 @@ export default class TurnOrder extends Vue {
name(player: Player, index: number) {
if (this.phaseBeforeSetupBuilding) {
if (this.gameData.phase === Phase.SetupAuction) {
player = this.gameData.players.find(pl => pl.faction === this.gameData.setup[index]);
player = this.gameData.players.find((pl) => pl.faction === this.gameData.setup[index]);
} else {
return "";
}

View file

@ -39,7 +39,7 @@ const operators = {
function rewardDesc(rewards: Reward[]) {
return rewards
.map(reward => {
.map((reward) => {
switch (reward.type) {
case Resource.TechTile:
return `gain ${reward.count} tech tile${reward.count > 1 ? "s" : ""}`;
@ -67,5 +67,5 @@ export function eventDesc(event: Event) {
: conditionsCount[event.condition] && "for each " + conditionsCount[event.condition] + ",";
const rewardString = event.rewards.length === 0 ? "" : rewardDesc(event.rewards);
return [operatorString, conditionString, rewardString].filter(x => !!x).join(" ");
return [operatorString, conditionString, rewardString].filter((x) => !!x).join(" ");
}

View file

@ -101,7 +101,7 @@ export function planetsWithSteps(planet: Planet, steps: number) {
list = list.slice(list.lastIndexOf(planet)).concat(list.slice(0, list.indexOf(planet)));
}
return list.filter(p => terraformingStepsRequired(planet, p) === steps);
return list.filter((p) => terraformingStepsRequired(planet, p) === steps);
}
export function factionDesc(faction: Faction) {
@ -111,9 +111,9 @@ export function factionDesc(faction: Faction) {
const buildingDesc =
"<ul>" +
Object.values(Building)
.filter(bld => bld !== Building.GaiaFormer && bld !== Building.SpaceStation)
.filter((bld) => bld !== Building.GaiaFormer && bld !== Building.SpaceStation)
.map(
bld =>
(bld) =>
"<li><b>" +
bld +
"</b> - " +
@ -124,8 +124,8 @@ export function factionDesc(faction: Faction) {
)
.join("\n") +
"</ul>";
const startingIncome = board.income.filter(ev => ev.operator === Operator.Once);
const roundIncome = board.income.filter(ev => ev.operator === Operator.Income);
const startingIncome = board.income.filter((ev) => ev.operator === Operator.Once);
const roundIncome = board.income.filter((ev) => ev.operator === Operator.Income);
return `
<div class='faction-desc'>
@ -138,10 +138,10 @@ export function factionDesc(faction: Faction) {
<b>Steps:</b>
${[0, 1, 2, 3]
.map(
i =>
(i) =>
`<span class="ml-2">${planetsWithSteps(p, i)
.map(
p =>
(p) =>
`<svg width="15" height="20" viewbox="0 0 15 15" >
<circle cx="7" cy="6" r="6" class="player-token planet-fill ${p}" />
</svg>`

View file

@ -6,9 +6,6 @@
"moduleResolution": "node",
"sourceMap": true,
"outDir": "./dist" /* Redirect output structure to the directory. */,
// "paths": {
// "@engine": ["../engine"]
// },
"baseUrl": ".",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

File diff suppressed because it is too large Load diff