Lint project
This commit is contained in:
parent
89f214e248
commit
cc1e507b2b
48 changed files with 1511 additions and 669 deletions
5
.editorconfig
Normal file
5
.editorconfig
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
28
.eslintrc.js
Normal file
28
.eslintrc.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/essential',
|
||||
'@vue/standard',
|
||||
'@vue/typescript/recommended'
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020
|
||||
},
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
semi: ['error', 'always'],
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/consistent-type-assertions': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'no-return-assign': 'off',
|
||||
'no-lone-blocks': 'off',
|
||||
'no-unmodified-loop-condition': 'off',
|
||||
quotes: 'off'
|
||||
}
|
||||
};
|
||||
18
package.json
18
package.json
|
|
@ -4,14 +4,14 @@
|
|||
"description": "Functions to visualize the map and boards for gaia project inside html canvas",
|
||||
"author": "coyotte508, rzulian",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --port 8080",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint",
|
||||
"package": "vue-cli-service build --target lib src/wrapper.ts",
|
||||
"prepublishOnly": "npm run package",
|
||||
"serve": "vue-cli-service serve --port 8080",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"unpkg": "dist/package/viewer.umd.min.js",
|
||||
"source": "index.ts",
|
||||
"files": [
|
||||
"index.ts",
|
||||
"tsconfig.json",
|
||||
|
|
@ -31,8 +31,19 @@
|
|||
"devDependencies": {
|
||||
"@types/jquery": "^3.3.1",
|
||||
"@types/node": "^10.5.2",
|
||||
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
||||
"@typescript-eslint/parser": "^2.26.0",
|
||||
"@vue/cli-plugin-eslint": "~4.3.0",
|
||||
"@vue/cli-plugin-typescript": "~4.2.3",
|
||||
"@vue/cli-service": "~4.2.3",
|
||||
"@vue/eslint-config-standard": "^5.1.2",
|
||||
"@vue/eslint-config-typescript": "^5.0.2",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.0",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"hexagrid": "^2.0.1",
|
||||
"node-sass": "^4.7.2",
|
||||
"popper": "^1.0.1",
|
||||
|
|
@ -60,5 +71,6 @@
|
|||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/donkeytech/gaia-viewer.git"
|
||||
}
|
||||
},
|
||||
"source": "index.ts"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
</thead> -->
|
||||
<tbody>
|
||||
<tr class="major-event" v-if="data.phase === 'endGame'"><td colspan=3>Game Ended</td></tr>
|
||||
<tr v-for="event in history">
|
||||
<tr v-for="(event, i) in history" :key=history.length-i>
|
||||
<td v-if="event.entry.round" class="major-event">Round {{event.entry.round}}</td>
|
||||
<td v-else-if="event.entry.phase==='roundIncome'" class="phase-change">Income phase</td>
|
||||
<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;">
|
||||
<div v-for="(changes, source) in event.entry.changes" v-html="source === 'undefined' ? ' ' : source" />
|
||||
<div v-for="(changes, source, i) in event.entry.changes" v-html="source === 'undefined' ? ' ' : source" :key=i />
|
||||
</td>
|
||||
<td style="width: 1px; white-space: nowrap;">
|
||||
<div v-for="(changes, source) in event.entry.changes">
|
||||
<div v-for="(changes, source, i) in event.entry.changes" :key=i>
|
||||
{{Object.keys(changes).map(key => `${changes[key]}${key}`).join(', ')}}
|
||||
</div>
|
||||
</td>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
</template>
|
||||
<script lang="ts">
|
||||
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import Engine, { LogEntry } from '@gaia-project/engine';
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ import Engine, {LogEntry} from '@gaia-project/engine';
|
|||
data () {
|
||||
return this.$store.state.gaiaViewer.data;
|
||||
},
|
||||
history(): Array<{move: string, entry: LogEntry}> {
|
||||
history (): Array<{move: string; entry: LogEntry}> {
|
||||
const ret = [];
|
||||
let advancedLogIndex = 0;
|
||||
let nextLogEntry = this.data.advancedLog[advancedLogIndex];
|
||||
|
|
@ -48,7 +48,7 @@ import Engine, {LogEntry} from '@gaia-project/engine';
|
|||
const bumpLog = () => {
|
||||
advancedLogIndex += 1;
|
||||
nextLogEntry = this.data.advancedLog[advancedLogIndex];
|
||||
}
|
||||
};
|
||||
|
||||
this.data.moveHistory.forEach((move, i) => {
|
||||
while (nextLogEntry && (nextLogEntry.move === undefined || nextLogEntry.move < i)) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event, BoardAction as BoardActionEnum, boardActions } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
|
@ -23,10 +23,6 @@ import { eventDesc } from '../data/event';
|
|||
return costDesc + boardActions[this.action].income.map(x => eventDesc(new Event(x))).join('\n');
|
||||
},
|
||||
|
||||
highlighted() {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.actions.has(this.action);
|
||||
},
|
||||
|
||||
faded () {
|
||||
return !this.$store.state.gaiaViewer.data.boardActions[this.action];
|
||||
},
|
||||
|
|
@ -62,9 +58,10 @@ export default class BoardAction extends Vue {
|
|||
}
|
||||
this.$store.dispatch("gaiaViewer/actionClick", this.action);
|
||||
}
|
||||
|
||||
get highlighted () {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.actions.has(this.action);
|
||||
}
|
||||
export default interface BoardAction {
|
||||
highlighted: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
|
@ -33,10 +33,6 @@ import { eventDesc } from '../data/event';
|
|||
|
||||
tooltip () {
|
||||
return `- ${eventDesc(new Event(this.event1))}\n- ${eventDesc(new Event(this.event2))}`;
|
||||
},
|
||||
|
||||
highlighted() {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.boosters.has(this.booster);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -52,11 +48,11 @@ export default class Booster extends Vue {
|
|||
this.$store.dispatch("gaiaViewer/boosterClick", this.booster);
|
||||
}
|
||||
}
|
||||
}
|
||||
export default interface TechTile {
|
||||
highlighted: boolean;
|
||||
}
|
||||
|
||||
get highlighted () {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.boosters.has(this.booster);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ export default class Building extends Vue {
|
|||
return [{ x: -0.5, y: Math.sqrt(3) / 4 }, { x: 0.5, y: Math.sqrt(3) / 4 }, { x: 0, y: -Math.sqrt(3) / 4 }].map(({ x, y }) => `${x * 0.5},${y * 0.5}`).join(" ");
|
||||
}
|
||||
|
||||
get mine() { return this.building === BuildingEnum.Mine }
|
||||
get tradingStation() {return this.building === BuildingEnum.TradingStation }
|
||||
get planetaryInstitute() {return this.building === BuildingEnum.PlanetaryInstitute}
|
||||
get lab() {return this.building === BuildingEnum.ResearchLab}
|
||||
get academy() {return this.building === BuildingEnum.Academy1 || this.building === BuildingEnum.Academy2}
|
||||
get gaiaFormer() {return this.building === BuildingEnum.GaiaFormer}
|
||||
get spaceStation() { return this.building === BuildingEnum.SpaceStation }
|
||||
get mine () { return this.building === BuildingEnum.Mine; }
|
||||
get tradingStation () { return this.building === BuildingEnum.TradingStation; }
|
||||
get planetaryInstitute () { return this.building === BuildingEnum.PlanetaryInstitute; }
|
||||
get lab () { return this.building === BuildingEnum.ResearchLab; }
|
||||
get academy () { return this.building === BuildingEnum.Academy1 || this.building === BuildingEnum.Academy2; }
|
||||
get gaiaFormer () { return this.building === BuildingEnum.GaiaFormer; }
|
||||
get spaceStation () { return this.building === BuildingEnum.SpaceStation; }
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import Engine, { AvailableCommand, Command, factions, Building, GaiaHex, Booster, tiles, Event, Federation, Faction, SpaceMap, Expansion } from '@gaia-project/engine';
|
||||
import MoveButton from './MoveButton.vue';
|
||||
|
|
@ -62,7 +62,7 @@ import { BIconDash } from 'bootstrap-vue';
|
|||
label: "Random",
|
||||
modal: this.tooltip(faction),
|
||||
title: factions[faction].name
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
@ -73,7 +73,7 @@ export default class Commands extends Vue {
|
|||
@Prop({ default: '' })
|
||||
remainingTime: string;
|
||||
|
||||
updater: number = 0;
|
||||
updater = 0;
|
||||
|
||||
loadCommands (val: AvailableCommand[]) {
|
||||
this.commandTitles = [];
|
||||
|
|
@ -281,7 +281,7 @@ export default class Commands extends Vue {
|
|||
hexes: new Map(command.data.ships.map(coord => [this.engine.map.grid.getS(coord.coordinates), coord])),
|
||||
range: command.data.range,
|
||||
costs: command.data.costs
|
||||
})
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,6 @@ export default class Commands extends Vue {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
@ -335,7 +334,7 @@ export default class Commands extends Vue {
|
|||
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),
|
||||
researchTiles: command.data.tracks.map(track => track.field + "-" + track.to)
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
@ -455,7 +454,6 @@ export default class Commands extends Vue {
|
|||
}
|
||||
|
||||
case Command.Bid: {
|
||||
|
||||
ret.push(...command.data.bids.map(pos => ({
|
||||
label: `Bid ${pos.bid[0]} for ${pos.faction}`,
|
||||
command: `${Command.Bid} ${pos.faction} $times`,
|
||||
|
|
|
|||
|
|
@ -16,17 +16,13 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event, Federation as FederationEnum, PlayerEnum } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
||||
@Component<FederationTile>({
|
||||
computed: {
|
||||
highlighted() {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.federations.has(this.federation);
|
||||
},
|
||||
|
||||
income () {
|
||||
const [first, ...others] = tiles.federations[this.federation].split(",");
|
||||
return others.length > 0 ? [first, others.join(", ")] : first.split("-");
|
||||
|
|
@ -53,9 +49,10 @@ export default class FederationTile extends Vue {
|
|||
}
|
||||
this.$store.dispatch("gaiaViewer/federationClick", this.federation);
|
||||
}
|
||||
|
||||
get highlighted () {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.federations.has(this.federation);
|
||||
}
|
||||
export default interface Federation {
|
||||
highlighted: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -10,31 +10,13 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event, factions, FinalTile, Phase, Player, finalScorings, Faction } from '@gaia-project/engine';
|
||||
import Token from "./Token.vue";
|
||||
|
||||
@Component<FinalScoringTile>({
|
||||
computed: {
|
||||
tile() {
|
||||
return this.$store.state.gaiaViewer.data.tiles.scorings.final[this.index];
|
||||
},
|
||||
|
||||
content() {
|
||||
return this.tile;
|
||||
},
|
||||
|
||||
players() {
|
||||
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"});
|
||||
}
|
||||
|
||||
return pls;
|
||||
},
|
||||
|
||||
tooltip () {
|
||||
const tile = this.tile;
|
||||
const players = this.players;
|
||||
|
|
@ -63,6 +45,24 @@ export default class FinalScoringTile extends Vue {
|
|||
return (player.faction as Faction | "automa") === "automa" ? finalScorings[this.tile].neutralPlayer : player.progress(this.tile);
|
||||
}
|
||||
|
||||
get tile () {
|
||||
return this.$store.state.gaiaViewer.data.tiles.scorings.final[this.index];
|
||||
}
|
||||
|
||||
get content () {
|
||||
return this.tile;
|
||||
}
|
||||
|
||||
get players () {
|
||||
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" });
|
||||
}
|
||||
|
||||
return pls;
|
||||
}
|
||||
|
||||
tokenX (index: number) {
|
||||
return (index % 2) * 30 + 23;
|
||||
}
|
||||
|
|
@ -71,10 +71,6 @@ export default class FinalScoringTile extends Vue {
|
|||
return 25 + (index > 1 ? 17 : 0);
|
||||
}
|
||||
}
|
||||
export default interface FinalScoringTile {
|
||||
tile: FinalTile;
|
||||
players: Player[];
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import Engine, { Command, Phase, factions, Player, EngineOptions, Expansion } from '@gaia-project/engine';
|
||||
|
||||
|
|
@ -40,52 +40,6 @@ import SpaceMap from './SpaceMap.vue';
|
|||
import TurnOrder from './TurnOrder.vue';
|
||||
|
||||
@Component<Game>({
|
||||
computed: {
|
||||
data() {
|
||||
return this.$store.state.gaiaViewer.data;
|
||||
},
|
||||
ended() {
|
||||
return this.data.phase === Phase.EndGame;
|
||||
},
|
||||
scoringX() {
|
||||
return this.data.expansions ? 505 : 385;
|
||||
},
|
||||
orderedPlayers() {
|
||||
const data = this.data;
|
||||
|
||||
if (!data.round || !data.turnOrder) {
|
||||
return data.players;
|
||||
}
|
||||
let turnOrder = data.turnOrder;
|
||||
|
||||
// Do not switch boards anymore now that there's two in a row
|
||||
// if (data.turnOrder.indexOf(this.player) !== -1) {
|
||||
// turnOrder = turnOrder.slice(turnOrder.indexOf(this.player)).concat(turnOrder.slice(0, turnOrder.indexOf(this.player)));
|
||||
// }
|
||||
|
||||
return turnOrder.concat(data.passedPlayers).map(player => data.players[player]);
|
||||
},
|
||||
canPlay() {
|
||||
return !this.ended && (!this.$store.state.gaiaViewer.player || this.sessionPlayer === this.data.players[this.player]);
|
||||
},
|
||||
hasMap() {
|
||||
return !!this.$store.state.gaiaViewer.data.map;
|
||||
},
|
||||
player() {
|
||||
return this.data.availableCommands?.[0]?.player;
|
||||
},
|
||||
sessionPlayer() {
|
||||
const player = this.$store.state.gaiaViewer.player;
|
||||
if (player) {
|
||||
if (player.index !== undefined) {
|
||||
return this.data.players[player.index];
|
||||
}
|
||||
if (player.auth) {
|
||||
return this.data.players.find(pl => pl.auth === player.auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created (this: Game) {
|
||||
const unsub = this.$store.subscribeAction(({ type, payload }) => {
|
||||
if (type === "gaiaViewer/externalData") {
|
||||
|
|
@ -103,7 +57,7 @@ import TurnOrder from './TurnOrder.vue';
|
|||
ResearchBoard,
|
||||
ScoringBoard,
|
||||
SpaceMap,
|
||||
TurnOrder,
|
||||
TurnOrder
|
||||
}
|
||||
})
|
||||
export default class Game extends Vue {
|
||||
|
|
@ -115,6 +69,58 @@ export default class Game extends Vue {
|
|||
@Prop()
|
||||
options: EngineOptions;
|
||||
|
||||
get data () {
|
||||
return this.$store.state.gaiaViewer.data;
|
||||
}
|
||||
|
||||
get ended () {
|
||||
return this.data.phase === Phase.EndGame;
|
||||
}
|
||||
|
||||
get scoringX () {
|
||||
return this.data.expansions ? 505 : 385;
|
||||
}
|
||||
|
||||
get orderedPlayers () {
|
||||
const data = this.data;
|
||||
|
||||
if (!data.round || !data.turnOrder) {
|
||||
return data.players;
|
||||
}
|
||||
const turnOrder = data.turnOrder;
|
||||
|
||||
// Do not switch boards anymore now that there's two in a row
|
||||
// if (data.turnOrder.indexOf(this.player) !== -1) {
|
||||
// turnOrder = turnOrder.slice(turnOrder.indexOf(this.player)).concat(turnOrder.slice(0, turnOrder.indexOf(this.player)));
|
||||
// }
|
||||
|
||||
return turnOrder.concat(data.passedPlayers).map(player => data.players[player]);
|
||||
}
|
||||
|
||||
get canPlay () {
|
||||
return !this.ended && (!this.$store.state.gaiaViewer.player || this.sessionPlayer === this.data.players[this.player]);
|
||||
}
|
||||
|
||||
get hasMap () {
|
||||
return !!this.$store.state.gaiaViewer.data.map;
|
||||
}
|
||||
|
||||
get player () {
|
||||
return this.data.availableCommands?.[0]?.player;
|
||||
}
|
||||
|
||||
get sessionPlayer () {
|
||||
const player = this.$store.state.gaiaViewer.player;
|
||||
if (player) {
|
||||
if (player.index !== undefined) {
|
||||
return this.data.players[player.index];
|
||||
}
|
||||
if (player.auth) {
|
||||
return this.data.players.find(pl => pl.auth === player.auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleData (data: Engine, keepMoveHistory?: boolean) {
|
||||
console.log("handle data", keepMoveHistory);
|
||||
|
||||
|
|
@ -174,7 +180,7 @@ export default class Game extends Vue {
|
|||
this.$store.dispatch("gaiaViewer/move", command);
|
||||
}
|
||||
|
||||
parseMove(command: string): {player: string, command: string, args: string[]} {
|
||||
parseMove (command: string): {player: string; command: string; args: string[]} {
|
||||
command = command.trim();
|
||||
|
||||
if (command.includes('.')) {
|
||||
|
|
@ -190,15 +196,6 @@ export default class Game extends Vue {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Used for type augmentation from computed properties
|
||||
export default interface Game {
|
||||
data: Engine;
|
||||
player: number;
|
||||
|
||||
canPlay: boolean;
|
||||
ended: boolean;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -12,17 +12,12 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { GaiaHex, TechTilePos, AdvTechTilePos, Booster, Command, SpaceMap } from '@gaia-project/engine';
|
||||
import { HighlightHexData, ButtonData } from '../data';
|
||||
|
||||
@Component({
|
||||
computed: {
|
||||
isActiveButton() {
|
||||
return this.$store.state.gaiaViewer.context.activeButton && this.$store.state.gaiaViewer.context.activeButton.label === this.button.label;
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
this.unsubscribe();
|
||||
}
|
||||
|
|
@ -33,7 +28,7 @@ export default class MoveButton extends Vue {
|
|||
public button: ButtonData;
|
||||
|
||||
private subscription: () => {} = null;
|
||||
private modalShow: boolean = false;
|
||||
private modalShow = false;
|
||||
private customLabel = '';
|
||||
private startingHex = null; // For range command
|
||||
|
||||
|
|
@ -140,7 +135,7 @@ export default class MoveButton extends Vue {
|
|||
|
||||
this.$store.commit("gaiaViewer/highlightHexes", this.button.hexes);
|
||||
this.subscribe('hexClick', hex => this.$store.commit("gaiaViewer/rotate", hex));
|
||||
this.customLabel = "Sector rotations finished"
|
||||
this.customLabel = "Sector rotations finished";
|
||||
} else if (this.button.range) {
|
||||
console.log("range click");
|
||||
this.$store.commit("gaiaViewer/highlightHexes", this.button.hexes);
|
||||
|
|
@ -181,10 +176,10 @@ export default class MoveButton extends Vue {
|
|||
this.emitCommand();
|
||||
}
|
||||
|
||||
emitCommand(append?: string, params?: {disappear?: boolean, final?: boolean, times?: number}) {
|
||||
emitCommand (append?: string, params?: {disappear?: boolean; final?: boolean; times?: number}) {
|
||||
console.log("emit command", this.button.command, append);
|
||||
|
||||
params = Object.assign({}, {disappear: true, final: false, times: 1}, params)
|
||||
params = Object.assign({}, { disappear: true, final: false, times: 1 }, params);
|
||||
const { disappear, final, times } = params;
|
||||
|
||||
if (disappear) {
|
||||
|
|
@ -230,9 +225,10 @@ export default class MoveButton extends Vue {
|
|||
|
||||
this.$store.commit("gaiaViewer/clearContext");
|
||||
}
|
||||
|
||||
get isActiveButton () {
|
||||
return this.$store.state.gaiaViewer.context.activeButton && this.$store.state.gaiaViewer.context.activeButton.label === this.button.label;
|
||||
}
|
||||
export default interface MoveButton {
|
||||
isActiveButton: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { Planet as PlanetEnum, factions, Faction } from '@gaia-project/engine';
|
|||
export default class Planet extends Vue {
|
||||
@Prop()
|
||||
planet: PlanetEnum;
|
||||
|
||||
@Prop()
|
||||
faction: Faction;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,16 +32,22 @@ import {Building as BuildingEnum, Faction, Reward, FactionBoard, factionBoard, O
|
|||
export default class BuildingGroup extends Vue {
|
||||
@Prop()
|
||||
nBuildings: number;
|
||||
|
||||
@Prop()
|
||||
building: BuildingEnum;
|
||||
|
||||
@Prop()
|
||||
faction: Faction;
|
||||
|
||||
@Prop()
|
||||
placed: number;
|
||||
|
||||
@Prop()
|
||||
resource: ResourceEnum[];
|
||||
|
||||
@Prop({ default: false })
|
||||
ac1: boolean;
|
||||
|
||||
@Prop({ default: false })
|
||||
ac2: boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -78,8 +78,10 @@ import {Building as BuildingEnum, Faction, Reward, Operator, Resource as Resourc
|
|||
export default class BuildingGroup extends Vue {
|
||||
@Prop()
|
||||
faction: Faction;
|
||||
|
||||
@Prop()
|
||||
data: PlayerData;
|
||||
|
||||
@Prop()
|
||||
player: Player;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@ import {Faction, Reward, FactionBoard, Operator, Resource as ResourceEnum, facti
|
|||
export default class BuildingGroup extends Vue {
|
||||
@Prop()
|
||||
faction: Faction;
|
||||
|
||||
@Prop()
|
||||
data: PlayerData;
|
||||
|
||||
@Prop()
|
||||
player: Player;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { Player, factions, tiles, PlayerData, Planet, Federation, terraformingStepsRequired, Building, Condition } from '@gaia-project/engine';
|
||||
import { factionColor } from '../graphics/utils';
|
||||
|
|
@ -68,11 +68,6 @@ import PowerBowls from './PlayerBoard/PowerBowls.vue';
|
|||
import { factionDesc, planetsWithSteps } from '../data/factions';
|
||||
|
||||
@Component({
|
||||
computed: {
|
||||
data() {
|
||||
return this.player ? this.player.data : null;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
TechTile,
|
||||
Booster,
|
||||
|
|
@ -87,6 +82,10 @@ export default class PlayerInfo extends Vue {
|
|||
@Prop()
|
||||
player: Player;
|
||||
|
||||
get data () {
|
||||
return this.player ? this.player.data : null;
|
||||
}
|
||||
|
||||
playerClick (player: Player) {
|
||||
this.$store.dispatch("gaiaViewer/playerClick", player);
|
||||
}
|
||||
|
|
@ -137,10 +136,6 @@ export default class PlayerInfo extends Vue {
|
|||
return this.player.ownedPlanets.length > 0;
|
||||
}
|
||||
}
|
||||
export default interface PlayerInfo {
|
||||
data: PlayerData;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
<div class="container-fluid">
|
||||
<div class="pool pb-0 mb-1 row no-gutters" v-if="$store.state.gaiaViewer.data.tiles && $store.state.gaiaViewer.data.tiles.techs['gaia']">
|
||||
<Booster v-for="booster in boosters" :key="booster" :booster="booster" class="mb-2 mr-1" />
|
||||
<FederationTile v-for="(numTiles, tile, i) in federations" :key="`${tile}-${i}`" :federation="tile" :numTiles="numTiles" v-if="numTiles" class="mb-2 mr-1" />
|
||||
<FederationTile v-for="([tile, numTiles], i) in federations" :key="`${tile}-${i}`" :federation="tile" :numTiles="numTiles" class="mb-2 mr-1" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import Booster from './Booster.vue';
|
||||
import FederationTile from "./FederationTile.vue";
|
||||
|
|
@ -20,7 +20,7 @@ import { Booster as BoosterEnum, Expansion } from '@gaia-project/engine';
|
|||
return BoosterEnum.values(Expansion.All).filter(key => this.$store.state.gaiaViewer.data.tiles.boosters[key]);
|
||||
},
|
||||
federations () {
|
||||
return this.$store.state.gaiaViewer.data.tiles.federations;
|
||||
return Object.entries(this.$store.state.gaiaViewer.data.tiles.federations).filter(([key, value]) => value > 0);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { ResearchField, BoardAction as BoardActionEnum } from '@gaia-project/engine';
|
||||
import ResearchTrack from './ResearchTrack.vue';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { ResearchField, Player, Federation, Resource as ResourceEnum, researchTracks, Event, Reward, Operator, Planet as PlanetEnum } from '@gaia-project/engine';
|
||||
import { descriptions } from '../data/research';
|
||||
|
|
@ -22,19 +22,16 @@ import Resource from './Resource.vue';
|
|||
@Component<ResearchTile>({
|
||||
computed: {
|
||||
players (): Player[] {
|
||||
return this.$store.state.gaiaViewer.data.players.filter(player => player.faction && player.data.research[this.field] == this.level);
|
||||
return this.$store.state.gaiaViewer.data.players.filter(player => player.faction && player.data.research[this.field] === this.level);
|
||||
},
|
||||
tooltip () {
|
||||
return `<b>Level ${this.level}:</b> ${descriptions[this.field][this.level]}`;
|
||||
},
|
||||
highlighted(): boolean {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.researchTiles.has(this.field + "-" + this.level)
|
||||
},
|
||||
height () {
|
||||
return (this.level == 0 || this.level == 5) ? 46 : 36
|
||||
return (this.level === 0 || this.level === 5) ? 46 : 36;
|
||||
},
|
||||
federation (): Federation {
|
||||
if (this.level == 5) {
|
||||
if (this.level === 5) {
|
||||
if (this.field === ResearchField.Terraforming) {
|
||||
return this.$store.state.gaiaViewer.data.terraformingFederation;
|
||||
} else if (this.field === ResearchField.TradingVolume && this.players.length === 0) {
|
||||
|
|
@ -43,9 +40,9 @@ import Resource from './Resource.vue';
|
|||
}
|
||||
},
|
||||
lostPlanet (): PlanetEnum {
|
||||
if (this.level == 5 && this.field === ResearchField.Navigation) {
|
||||
if (this.level === 5 && this.field === ResearchField.Navigation) {
|
||||
for (const pl of this.players) {
|
||||
if ( pl.data.lostPlanet ) { return undefined }
|
||||
if (pl.data.lostPlanet) { return undefined; }
|
||||
}
|
||||
return PlanetEnum.Lost;
|
||||
}
|
||||
|
|
@ -61,8 +58,10 @@ import Resource from './Resource.vue';
|
|||
export default class ResearchTile extends Vue {
|
||||
@Prop()
|
||||
field: ResearchField;
|
||||
|
||||
@Prop()
|
||||
y: number;
|
||||
|
||||
@Prop()
|
||||
level: number;
|
||||
|
||||
|
|
@ -71,7 +70,7 @@ export default class ResearchTile extends Vue {
|
|||
const l = res.length;
|
||||
const sep = l <= 2 ? 7 : 6;
|
||||
|
||||
return - 6 * (l - 1) + index * 2 * sep - (res[0].count as any === '+' ? 2 : 0)
|
||||
return -6 * (l - 1) + index * 2 * sep - (res[0].count as any === '+' ? 2 : 0);
|
||||
}
|
||||
|
||||
tokenX (index: number) {
|
||||
|
|
@ -84,20 +83,19 @@ export default class ResearchTile extends Vue {
|
|||
|
||||
onClick () {
|
||||
if (this.highlighted) {
|
||||
this.$store.dispatch('gaiaViewer/researchClick', this.field)
|
||||
this.$store.dispatch('gaiaViewer/researchClick', this.field);
|
||||
}
|
||||
}
|
||||
|
||||
label () {
|
||||
|
||||
if (this.field == ResearchField.Terraforming) {
|
||||
return this.level == 0 ? "cost 3" : this.level == 2 ? "cost 2" : this.level == 3 ? "cost 1" : "";
|
||||
if (this.field === ResearchField.Terraforming) {
|
||||
return this.level === 0 ? "cost 3" : this.level === 2 ? "cost 2" : this.level === 3 ? "cost 1" : "";
|
||||
};
|
||||
if (this.field == ResearchField.Navigation) {
|
||||
return this.level == 0 ? "nav 1" : this.level == 2 ? "nav 2" : this.level == 4 ? "nav 3" : this.level == 5 ? "nav 4" : "";
|
||||
if (this.field === ResearchField.Navigation) {
|
||||
return this.level === 0 ? "nav 1" : this.level === 2 ? "nav 2" : this.level === 4 ? "nav 3" : this.level === 5 ? "nav 4" : "";
|
||||
};
|
||||
if (this.field == ResearchField.GaiaProject) {
|
||||
return this.level == 5 ? '4vp, g>vp' : "";
|
||||
if (this.field === ResearchField.GaiaProject) {
|
||||
return this.level === 5 ? '4vp, g>vp' : "";
|
||||
};
|
||||
|
||||
return '';
|
||||
|
|
@ -106,7 +104,7 @@ export default class ResearchTile extends Vue {
|
|||
get resources () {
|
||||
const events = researchTracks[this.field][this.level].map(s => new Event(s)).slice(0, 1);
|
||||
|
||||
const rewards = Reward.merge(...events.map(ev => ev.rewards), this.level == 37 ? [new Reward('-3pw')] : []);
|
||||
const rewards = Reward.merge(...events.map(ev => ev.rewards), this.level === 3 ? [new Reward('-3pw')] : []);
|
||||
|
||||
if (events[0] && events[0].operator === Operator.Income) {
|
||||
rewards.unshift(new Reward('+', ResourceEnum.None));
|
||||
|
|
@ -115,9 +113,10 @@ export default class ResearchTile extends Vue {
|
|||
|
||||
return rewards;
|
||||
}
|
||||
|
||||
get highlighted (): boolean {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.researchTiles.has(this.field + "-" + this.level);
|
||||
}
|
||||
export default interface ResearchTile {
|
||||
highlighted: boolean;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -165,13 +164,11 @@ svg {
|
|||
|
||||
}
|
||||
|
||||
|
||||
text {
|
||||
font-family: arial;
|
||||
font-size: 10px;
|
||||
fill: black;
|
||||
|
||||
|
||||
&.levDesc {
|
||||
dominant-baseline: central;
|
||||
text-anchor: middle;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { ResearchField } from '@gaia-project/engine';
|
||||
import ResearchTile from './ResearchTile.vue';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { Resource as ResourceEnum } from '@gaia-project/engine';
|
||||
import Building from './Building.vue';
|
||||
|
|
@ -33,7 +33,6 @@ export default class Resource extends Vue {
|
|||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
@import '../stylesheets/planets.scss';
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component } from 'vue-property-decorator';
|
||||
import ScoringTile from './ScoringTile.vue';
|
||||
import FinalScoringTile from './FinalScoringTile.vue';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event, Phase } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { MapData, HighlightHexData } from '../data';
|
||||
import { GaiaHex, GaiaHexData } from '@gaia-project/engine';
|
||||
|
|
@ -34,7 +34,7 @@ export default class Sector extends Vue {
|
|||
}
|
||||
|
||||
get map () {
|
||||
return this.$store.state.gaiaViewer.data.map
|
||||
return this.$store.state.gaiaViewer.data.map;
|
||||
}
|
||||
|
||||
get sector (): GaiaHex[] {
|
||||
|
|
|
|||
|
|
@ -26,14 +26,6 @@ import { planetNames } from '../data/planets';
|
|||
import { Direction } from 'hexagrid';
|
||||
|
||||
@Component<SpaceHex>({
|
||||
computed: {
|
||||
highlightedHexes(): Set<GaiaHex> {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.hexes;
|
||||
},
|
||||
toSelect() {
|
||||
return !!this.$store.state.gaiaViewer.context.hexSelection;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Planet,
|
||||
Building,
|
||||
|
|
@ -43,6 +35,7 @@ import { Direction } from 'hexagrid';
|
|||
export default class SpaceHex extends Vue {
|
||||
@Prop()
|
||||
hex: GaiaHex;
|
||||
|
||||
@Prop()
|
||||
isCenter: boolean;
|
||||
|
||||
|
|
@ -89,20 +82,28 @@ export default class SpaceHex extends Vue {
|
|||
return planetNames[planet];
|
||||
}
|
||||
|
||||
get highlightedHexes (): Map<GaiaHex, any> {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.hexes;
|
||||
}
|
||||
|
||||
get toSelect () {
|
||||
return !!this.$store.state.gaiaViewer.context.hexSelection;
|
||||
}
|
||||
|
||||
shipX (index) {
|
||||
return SpaceHex.shipXs[index % 7]
|
||||
return SpaceHex.shipXs[index % 7];
|
||||
}
|
||||
|
||||
shipY (index) {
|
||||
return SpaceHex.shipYs[index % 7]
|
||||
return SpaceHex.shipYs[index % 7];
|
||||
}
|
||||
|
||||
tradeX (index) {
|
||||
return SpaceHex.tradeXs[index]
|
||||
return SpaceHex.tradeXs[index];
|
||||
}
|
||||
|
||||
tradeY (index) {
|
||||
return SpaceHex.tradeYs[index]
|
||||
return SpaceHex.tradeYs[index];
|
||||
}
|
||||
|
||||
static shipXs = [-0.5, 0.5, -1.3, 1.3, -0.5, 0.5, 0];
|
||||
|
|
@ -111,11 +112,6 @@ export default class SpaceHex extends Vue {
|
|||
static tradeXs = [-0.5, 0.5, -0.9, 0, 0.9, -0.5, 0.5];
|
||||
static tradeYs = [-0.9, -0.9, 0, 0, 0, 0.9, 0.9];
|
||||
}
|
||||
export default interface SpaceMap {
|
||||
highlightedHexes: HighlightHexData;
|
||||
toSelect: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component } from 'vue-property-decorator';
|
||||
import { GaiaHex, SpaceMap as SpaceMapData } from '@gaia-project/engine';
|
||||
import { hexCenter } from "../graphics/hex";
|
||||
|
|
@ -14,9 +14,6 @@ import { CubeCoordinates } from 'hexagrid';
|
|||
|
||||
@Component<SpaceMap>({
|
||||
computed: {
|
||||
map(this: SpaceMap): SpaceMapData {
|
||||
return this.$store.state.gaiaViewer.data.map
|
||||
},
|
||||
right () {
|
||||
return (this.$store.state.gaiaViewer.data.players || []).length > 2 ? 33.5 : 26;
|
||||
}
|
||||
|
|
@ -37,9 +34,10 @@ export default class SpaceMap extends Vue {
|
|||
rotation (center: CubeCoordinates) {
|
||||
return this.$store.state.gaiaViewer.context.rotation.get(`${center.q}x${center.r}`) || 0;
|
||||
}
|
||||
|
||||
get map (this: SpaceMap): SpaceMapData {
|
||||
return this.$store.state.gaiaViewer.data.map;
|
||||
}
|
||||
export default interface SpaceMap {
|
||||
map: SpaceMapData
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
</g>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { factions, Faction, Planet } from '@gaia-project/engine';
|
||||
|
||||
|
|
@ -13,10 +13,13 @@ import { factions, Faction, Planet } from '@gaia-project/engine';
|
|||
export default class Ship extends Vue {
|
||||
@Prop({ default: 'automa' })
|
||||
faction: Faction | 'automa';
|
||||
|
||||
@Prop({ default: 1 })
|
||||
scale: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
x: number;
|
||||
|
||||
@Prop({ default: 0 })
|
||||
y: number;
|
||||
|
||||
|
|
@ -49,4 +52,3 @@ export default class Ship extends Vue {
|
|||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,13 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, Event } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
||||
@Component<SpecialAction>({
|
||||
computed: {
|
||||
highlighted() {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.actions.has(this.action);
|
||||
},
|
||||
|
||||
income () {
|
||||
return this.action.includes(',') ? this.action.split(',') : this.action.split('-');
|
||||
}
|
||||
|
|
@ -41,9 +37,10 @@ export default class SpecialAction extends Vue {
|
|||
}
|
||||
this.$store.dispatch("gaiaViewer/actionClick", this.action);
|
||||
}
|
||||
|
||||
get highlighted () {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.actions.has(this.action);
|
||||
}
|
||||
export default interface SpecialAction {
|
||||
highlighted: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { tiles, PlayerEnum, Event, TechTilePos, AdvTechTilePos } from '@gaia-project/engine';
|
||||
import { eventDesc } from '../data/event';
|
||||
|
|
@ -50,10 +50,6 @@ import { eventDesc } from '../data/event';
|
|||
|
||||
tooltip () {
|
||||
return eventDesc(new Event(this.rawContent));
|
||||
},
|
||||
|
||||
highlighted() {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.techs.has(this.pos);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -72,9 +68,10 @@ export default class TechTile extends Vue {
|
|||
this.$store.dispatch("gaiaViewer/techClick", this.pos);
|
||||
}
|
||||
}
|
||||
|
||||
get highlighted () {
|
||||
return this.$store.state.gaiaViewer.context.highlighted.techs.has(this.pos);
|
||||
}
|
||||
export default interface TechTile {
|
||||
highlighted: boolean;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
import { Component, Prop } from 'vue-property-decorator';
|
||||
import { factions, Faction, Planet } from '@gaia-project/engine';
|
||||
|
||||
|
|
@ -13,8 +13,10 @@ import { factions, Faction, Planet } from '@gaia-project/engine';
|
|||
export default class PlayerToken extends Vue {
|
||||
@Prop()
|
||||
faction: Faction | 'automa';
|
||||
|
||||
@Prop()
|
||||
scale: number;
|
||||
|
||||
@Prop()
|
||||
planet: Planet;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
|
||||
import Engine, { factions, Player, Planet, Phase } from "@gaia-project/engine";
|
||||
import { isNull } from "util";
|
||||
|
||||
@Component
|
||||
export default class TurnOrder extends Vue {
|
||||
|
|
@ -29,7 +28,7 @@ export default class TurnOrder extends Vue {
|
|||
|
||||
get phaseBeforeSetupBuilding (): boolean {
|
||||
const data = this.gameData;
|
||||
return ( data.phase == Phase.SetupInit || data.phase == Phase.SetupBoard || data.phase == Phase.SetupFaction || data.phase == Phase.SetupAuction);
|
||||
return (data.phase === Phase.SetupInit || data.phase === Phase.SetupBoard || data.phase === Phase.SetupFaction || data.phase === Phase.SetupAuction);
|
||||
}
|
||||
|
||||
get turnOrder (): Player[] {
|
||||
|
|
@ -37,8 +36,8 @@ export default class TurnOrder extends Vue {
|
|||
if (this.phaseBeforeSetupBuilding) {
|
||||
return data.players;
|
||||
}
|
||||
if ( data.phase == Phase.SetupBuilding || data.phase == Phase.SetupBooster || data.phase == Phase.SetupShip) {
|
||||
return data.setup.map(faction => data.players.find( pl => pl.faction == faction));
|
||||
if (data.phase === Phase.SetupBuilding || data.phase === Phase.SetupBooster || data.phase === Phase.SetupShip) {
|
||||
return data.setup.map(faction => data.players.find(pl => pl.faction === faction));
|
||||
}
|
||||
return data.turnOrder.map(player => data.players[player]);
|
||||
}
|
||||
|
|
@ -79,7 +78,7 @@ export default class TurnOrder extends Vue {
|
|||
return factions.planet(this.gameData.setup[index]);
|
||||
}
|
||||
|
||||
if (player.faction) { return factions.planet(player.faction) };
|
||||
if (player.faction) { return factions.planet(player.faction); };
|
||||
|
||||
return Planet.Lost;
|
||||
}
|
||||
|
|
@ -97,12 +96,11 @@ 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 ""
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const conditionsCount = {
|
|||
[Condition.Trade]: "trade token",
|
||||
[Condition.AdvanceResearch]: "level reached in any research track",
|
||||
[Condition.PlanetsWithTradeToken]: "planet with a trade token (max 8)"
|
||||
}
|
||||
};
|
||||
|
||||
const conditionsTrigger = {
|
||||
[Condition.Mine]: "building a mine",
|
||||
|
|
@ -28,7 +28,7 @@ const conditionsTrigger = {
|
|||
[Condition.AdvanceResearch]: "advancing a level in research",
|
||||
[Condition.TerraformStep]: "terraforming a planet one step",
|
||||
[Condition.Trade]: "delivering trade"
|
||||
}
|
||||
};
|
||||
|
||||
const operators = {
|
||||
[Operator.Pass]: "After passing,",
|
||||
|
|
@ -38,7 +38,7 @@ const operators = {
|
|||
[Operator.Trigger]: "When ",
|
||||
[Operator.Special]: "Planetary institutes and academies have a power value of 4, when building federations and charging power.",
|
||||
[Operator.AdvShip4]: "Gain two spaceships. Move them with a bonus range of 4 in addition to their normal range."
|
||||
}
|
||||
};
|
||||
|
||||
function rewardDesc (rewards: Reward[]) {
|
||||
return rewards.map(reward => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { Faction, Operator, Building, Planet, factions, terraformingStepsRequired } from "@gaia-project/engine";
|
||||
import {factionBoard} from '@gaia-project/engine';
|
||||
import { Faction, Operator, Building, Planet, factions, terraformingStepsRequired, factionBoard } from "@gaia-project/engine";
|
||||
|
||||
const factionData: { [faction in Faction]: { ability: string, PI: string}} = {
|
||||
const factionData: { [faction in Faction]: { ability: string; PI: string}} = {
|
||||
[Faction.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."
|
||||
|
|
@ -67,7 +66,7 @@ const factionData: { [faction in Faction]: { ability: string, PI: string}} = {
|
|||
[Faction.Itars]: {
|
||||
ability: "Each time you discard a power token from area II of your power cycle to move another power token to area III, place the discarded power token in your Gaia area instead of returning it to the supply.",
|
||||
PI: `During the Gaia phase, you can discard 4 power tokens from your Gaia area to immediately gain a tech tile. You may do this as many times as you can afford to.`
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export function planetsWithSteps (planet: Planet, steps: number) {
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ export type HighlightHexData = Map<GaiaHex, {cost?: string}>;
|
|||
|
||||
export interface GameContext {
|
||||
highlighted: {
|
||||
hexes: HighlightHexData,
|
||||
researchTiles: Set<string>,
|
||||
techs: Set<TechTilePos | AdvTechTilePos>,
|
||||
boosters: Set<Booster>,
|
||||
actions: Set<string>,
|
||||
federations: Set<Federation>
|
||||
hexes: HighlightHexData;
|
||||
researchTiles: Set<string>;
|
||||
techs: Set<TechTilePos | AdvTechTilePos>;
|
||||
boosters: Set<Booster>;
|
||||
actions: Set<string>;
|
||||
federations: Set<Federation>;
|
||||
};
|
||||
|
||||
rotation: Map<string, number>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ResearchField } from "@gaia-project/engine"
|
||||
import { ResearchField } from "@gaia-project/engine";
|
||||
|
||||
export const descriptions = {
|
||||
[ResearchField.Economy]: [
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ import { CubeCoordinatesPartial } from "hexagrid/src/cubecoordinates";
|
|||
|
||||
const vSpacing = Math.sqrt(3) / 2;
|
||||
|
||||
export function hexCenter(hex: CubeCoordinatesPartial, radius: number = 1) {
|
||||
export function hexCenter (hex: CubeCoordinatesPartial, radius = 1) {
|
||||
return {
|
||||
x: hex.r * 1.5 * radius,
|
||||
y: -(2 * hex.q + hex.r) * vSpacing * radius
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function corners(radius: number = 1) {
|
||||
export function corners (radius = 1) {
|
||||
return [
|
||||
{ x: -radius, y: 0 },
|
||||
{ x: -radius / 2, y: -vSpacing * radius },
|
||||
|
|
@ -17,5 +17,5 @@ export function corners(radius: number = 1) {
|
|||
{ x: radius, y: 0 },
|
||||
{ x: radius / 2, y: vSpacing * radius },
|
||||
{ x: -radius / 2, y: vSpacing * radius }
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
@ -14,10 +14,10 @@ function launch(selector: string, component: VueConstructor<Vue> = Game) {
|
|||
|
||||
const app = new Vue({
|
||||
store,
|
||||
render: (h) => h("div", {class: "container-fluid py-2"}, [h(component)]),
|
||||
render: (h) => h("div", { class: "container-fluid py-2" }, [h(component)])
|
||||
}).$mount(selector);
|
||||
|
||||
const item: EventEmitter & {store?: Store<unknown>, app?: Vue} = new EventEmitter();
|
||||
const item: EventEmitter & {store?: Store<unknown>; app?: Vue} = new EventEmitter();
|
||||
|
||||
item.addListener("state:updated", data => store.dispatch("gaiaViewer/externalData", data));
|
||||
item.addListener("preferences", data => store.commit("gaiaViewer/preferences", data));
|
||||
|
|
@ -39,7 +39,7 @@ function launch(selector: string, component: VueConstructor<Vue> = Game) {
|
|||
const unsub2 = store.subscribe(({ type, payload }) => {
|
||||
// console.log("spy mutation", type, payload);
|
||||
|
||||
if (type == "info" || type == "error") {
|
||||
if (type === "info" || type === "error") {
|
||||
item.emit(type, payload);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ console.log(process.env);
|
|||
|
||||
if (process.env.VUE_APP_BGIO) {
|
||||
launch("#app");
|
||||
} else if (process.env.VUE_APP_SelfContained || 1) {
|
||||
} else /* if (process.env.VUE_APP_SelfContained || 1) */ {
|
||||
launchSelfContained();
|
||||
} /* else {
|
||||
launch("#app");
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const gaiaViewer = {
|
|||
preferences: {
|
||||
noFactionFill: false
|
||||
},
|
||||
player: null as {index?: number, auth?: string} | null
|
||||
player: null as {index?: number; auth?: string} | null
|
||||
},
|
||||
mutations: {
|
||||
receiveData (state, data: Engine) {
|
||||
|
|
@ -112,7 +112,7 @@ const gaiaViewer = {
|
|||
},
|
||||
getters: {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function makeStore () {
|
||||
return new Vuex.Store({
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
const path = require("path");
|
||||
|
||||
if (process.argv.includes("lib")) {
|
||||
|
|
@ -8,12 +9,12 @@ if (process.argv.includes("lib")) {
|
|||
chainWebpack: config => {
|
||||
config.externals({
|
||||
'bootstrap-vue': 'BootstrapVue'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
} else {
|
||||
module.exports = {
|
||||
lintOnSave: false,
|
||||
outputDir: path.join(__dirname, "dist/app"),
|
||||
}
|
||||
outputDir: path.join(__dirname, "dist/app")
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue