feat(viewer): ship Lost Fleet insignia and compact player counters
This commit is contained in:
parent
b2286fa32e
commit
8558786fc8
37 changed files with 859 additions and 80 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/old-ui",
|
||||
"version": "1.2.26",
|
||||
"version": "1.2.27",
|
||||
"scripts": {
|
||||
"serve": "vite --port 5193",
|
||||
"build": "vite build",
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
:faction="player.faction"
|
||||
:data="playerData"
|
||||
:height="height"
|
||||
:reference-engine="engine"
|
||||
/>
|
||||
<BuildingGroup
|
||||
:transform="player.faction !== 'bescods' ? 'translate(2.2, 10)' : 'translate(12, 10)'"
|
||||
|
|
@ -88,7 +89,7 @@
|
|||
<line x1="10.4" x2="11" y1="13.0" y2="13.0" stroke="black" stroke-width="0.06" />
|
||||
<BuildingGroup
|
||||
v-if="!player.isAutoma"
|
||||
transform="translate(21,1.2)"
|
||||
:transform="`translate(${isLostFleet ? 20 : 21}, 1.2)`"
|
||||
:nBuildings="playerData.gaiaformers"
|
||||
building="gf"
|
||||
:gaia="playerData.gaiaformersInGaia"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/viewer",
|
||||
"version": "5.22.26",
|
||||
"version": "5.22.27",
|
||||
"description": "Functions to visualize the map and boards for gaia project inside html canvas",
|
||||
"contributors": [
|
||||
"coyotte508",
|
||||
|
|
|
|||
|
|
@ -240,9 +240,10 @@ describe("LostFleetShips", () => {
|
|||
for (let i = 1; i < sortedXs.length; i++) {
|
||||
expect(sortedXs[i] - sortedXs[i - 1]).to.equal(17);
|
||||
}
|
||||
// the ship name is spelled out in the left tab: a first-letter hex badge + the rest of the name
|
||||
expect(twilight.querySelector(".lost-fleet-ship__name-letter").textContent).to.equal("T");
|
||||
expect(twilight.querySelector(".lost-fleet-ship__name-rest").textContent).to.equal("WILIGHT");
|
||||
// The insignia is separate from the FULL name, never a replacement for its first letter.
|
||||
expect(twilight.querySelector(".lost-fleet-ship__name-letter")).to.equal(null);
|
||||
expect(twilight.querySelector(".spaceship-emblem").getAttribute("aria-label")).to.contain("Twilight");
|
||||
expect(twilight.querySelector(".lost-fleet-ship__name-rest").textContent).to.equal("TWILIGHT");
|
||||
slots.forEach((slot) => {
|
||||
expect(slot.querySelector(".lost-fleet-ship__slot-ordinal")).to.equal(null);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -164,14 +164,12 @@
|
|||
</g>
|
||||
|
||||
<!-- Left tab: the ship name, sitting like a folder tab on the card's top-left border, filled in
|
||||
the ship color. The first letter sits in a white hexagon badge (echoing the map hex) so it
|
||||
reads as the ship's identity even on the colored tab; the rest of the name follows in dark
|
||||
text (dark reads better than white on the lighter ship colors). -->
|
||||
the ship color. The insignia precedes the FULL name: replacing the old initial must not
|
||||
remove the first letter from the visible title. The alternate UI owns its own template. -->
|
||||
<g class="lost-fleet-ship__tab" v-b-tooltip.nofade="tooltipTriggerConfig()" :title="shipLabel(ship)">
|
||||
<path :d="nameTabPath(ship)" :style="{ fill: shipColor(ship) }" class="lost-fleet-ship__tab-shape" />
|
||||
<polygon :points="nameHexPoints" class="lost-fleet-ship__name-hex" />
|
||||
<text x="15" y="-10" dy="3.8" class="lost-fleet-ship__name-letter">{{ shipFirstLetter(ship) }}</text>
|
||||
<text x="25" y="-10" dy="3.8" class="lost-fleet-ship__name-rest">{{ shipNameRest(ship) }}</text>
|
||||
<SpaceshipEmblem :ship="ship" transform="translate(15, -10) scale(0.75)" />
|
||||
<text x="25" y="-10" dy="3.8" class="lost-fleet-ship__name-rest">{{ shipHeaderName(ship) }}</text>
|
||||
</g>
|
||||
|
||||
<!-- Right tab: the 4 exploration/player slots, its negative space filled in the ship color and
|
||||
|
|
@ -238,6 +236,7 @@ import {
|
|||
spaceshipColors,
|
||||
spaceshipDisplayNames,
|
||||
spaceshipLabels,
|
||||
spaceshipNames,
|
||||
} from "../data/spaceships";
|
||||
import { corners } from "../graphics/hex";
|
||||
import { factionPiecePlanet } from "../graphics/utils";
|
||||
|
|
@ -248,6 +247,7 @@ import Building from "./Building.vue";
|
|||
import Condition from "./Condition.vue";
|
||||
import FederationTile from "./FederationTile.vue";
|
||||
import Resource from "./Resource.vue";
|
||||
import SpaceshipEmblem from "./SpaceshipEmblem.vue";
|
||||
import SpecialAction from "./SpecialAction.vue";
|
||||
import TechTile from "./TechTile.vue";
|
||||
import Token from "./Token.vue";
|
||||
|
|
@ -320,6 +320,7 @@ export const SHIP_BOARD_VIEWBOX_WIDTH = 291 - ACTION_COMPRESSION;
|
|||
FederationTile,
|
||||
Resource,
|
||||
SpecialAction,
|
||||
SpaceshipEmblem,
|
||||
TechTile,
|
||||
Token,
|
||||
UsedActionMark,
|
||||
|
|
@ -423,6 +424,11 @@ export default class LostFleetShips extends Vue {
|
|||
return spaceshipDisplayNames[ship].toUpperCase();
|
||||
}
|
||||
|
||||
/** Primary headers retain the complete printed ship name beside the insignia. */
|
||||
shipHeaderName(ship: Spaceship): string {
|
||||
return spaceshipNames[ship].toUpperCase();
|
||||
}
|
||||
|
||||
/** First letter of the name (drawn inside the white hex badge in the left tab). */
|
||||
shipFirstLetter(ship: Spaceship): string {
|
||||
return this.shipFullName(ship).charAt(0);
|
||||
|
|
@ -458,7 +464,7 @@ export default class LostFleetShips extends Vue {
|
|||
* never born too narrow and clipping the name. Same height as the slots tab (tabPath default top). */
|
||||
nameTabPath(ship: Spaceship): string {
|
||||
const measuredRight = this.nameTabRights[ship];
|
||||
const textRight = measuredRight ?? 25 + this.shipNameRest(ship).length * 7.6;
|
||||
const textRight = measuredRight ?? 25 + this.shipHeaderName(ship).length * 7.6;
|
||||
return this.tabPath(NAME_TAB_X0, textRight + NAME_TAB_PAD);
|
||||
}
|
||||
|
||||
|
|
|
|||
87
viewer/src/components/PlayerBoard/ExplorationSupply.spec.ts
Normal file
87
viewer/src/components/PlayerBoard/ExplorationSupply.spec.ts
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import Engine, { Expansion, Faction, Spaceship } from "@gaia-project/engine";
|
||||
import { render } from "@testing-library/vue";
|
||||
import BootstrapVue from "bootstrap-vue";
|
||||
import { expect } from "chai";
|
||||
import Vue from "vue";
|
||||
import { effectivePreviewPlayer, factionPreviewEngine } from "../../data/faction-preview";
|
||||
import ExplorationSupply from "./ExplorationSupply.vue";
|
||||
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
describe("ExplorationSupply local proposal", () => {
|
||||
function setup(count = 2, faction = Faction.Terrans) {
|
||||
const engine = factionPreviewEngine(faction);
|
||||
// Supply depends only on seat count, not on faction-preview engine's two seats.
|
||||
while (engine.players.length < count) engine.players.push(engine.players[1]);
|
||||
return { engine, data: engine.players[0].data };
|
||||
}
|
||||
|
||||
for (const count of [2, 4]) {
|
||||
it(`starts with ${count === 2 ? 2 : 3} shuttles in a ${count}-player game`, () => {
|
||||
const props = setup(count);
|
||||
const { container } = render(ExplorationSupply, { props });
|
||||
expect(container.querySelector("text").textContent).to.equal(count === 2 ? "2" : "3");
|
||||
});
|
||||
}
|
||||
|
||||
it("prints one black lander and one count, with no track or individual pieces", () => {
|
||||
for (const faction of [Faction.Terrans, Faction.Moweyds]) {
|
||||
const { container } = render(ExplorationSupply, { props: setup(4, faction) });
|
||||
expect(container.querySelectorAll("path")).to.have.length(1);
|
||||
const symbol = container.querySelector(".shuttle-symbol");
|
||||
expect(symbol.getAttribute("fill")).to.equal("black");
|
||||
expect(symbol.getAttribute("opacity")).to.equal("0.8");
|
||||
expect(symbol.getAttribute("transform")).to.equal("scale(0.04)");
|
||||
// One silhouette with an actual transparent cockpit cutout, not a white/shaded overlay.
|
||||
expect(symbol.getAttribute("fill-rule")).to.equal("evenodd");
|
||||
expect(symbol.getAttribute("d").match(/M/g)).to.have.length(2);
|
||||
expect(container.querySelectorAll("text")).to.have.length(1);
|
||||
expect(container.querySelector(".remaining-count").getAttribute("fill")).to.equal("black");
|
||||
expect(
|
||||
container.querySelector("rect, circle, .planet-fill, .shuttle-slot, .shuttle-token, .shuttle-consumed-mark")
|
||||
).to.equal(null);
|
||||
}
|
||||
});
|
||||
|
||||
it("counts occupied ships, not the numeric slot indices", async () => {
|
||||
const props = setup(4);
|
||||
props.data.explorationShips[Spaceship.TFMars] = 4;
|
||||
const { container, updateProps } = render(ExplorationSupply, { props });
|
||||
expect(container.querySelector("text").textContent).to.equal("2");
|
||||
const next = setup(4).data;
|
||||
for (const ship of Spaceship.values(Expansion.LostFleet).slice(0, 3)) next.explorationShips[ship] = 2;
|
||||
await updateProps({ data: next });
|
||||
expect(container.querySelector("text").textContent).to.equal("0");
|
||||
expect(container.querySelector(".exploration-supply--empty")).not.to.equal(null);
|
||||
expect(container.querySelector("g").getAttribute("aria-label")).to.equal("Exploration shuttles remaining: 0 of 3");
|
||||
});
|
||||
|
||||
it("includes the Moweyds starting shuttle", () => {
|
||||
const props = setup(4, Faction.Moweyds);
|
||||
expect(props.data.exploredShipsCount()).to.equal(1);
|
||||
const { container } = render(ExplorationSupply, { props });
|
||||
expect(container.querySelector("text").textContent).to.equal("2");
|
||||
});
|
||||
|
||||
it("hides the supply in the base game and for Automa", async () => {
|
||||
const props = setup();
|
||||
const { container, updateProps } = render(ExplorationSupply, { props: { ...props, automa: true } });
|
||||
expect(container.querySelector(".exploration-supply")).to.equal(null);
|
||||
const engine = new Engine(["init 2 shuttle-base", "p1 faction terrans", "p2 faction xenos"]);
|
||||
expect(engine.expansions).not.to.equal(Expansion.LostFleet);
|
||||
await updateProps({ engine, automa: false });
|
||||
expect(container.querySelector(".exploration-supply")).to.equal(null);
|
||||
});
|
||||
|
||||
it("reads effective preview data rather than the uninitialized seat", () => {
|
||||
const props = setup(4, Faction.Moweyds);
|
||||
const seat = props.engine.players[0];
|
||||
seat.board = undefined;
|
||||
seat.data.explorationShips = {};
|
||||
const data = effectivePreviewPlayer(seat).data;
|
||||
const { container } = render(ExplorationSupply, {
|
||||
props: { engine: props.engine, data },
|
||||
});
|
||||
expect(container.querySelector("text").textContent).to.equal("2");
|
||||
});
|
||||
});
|
||||
74
viewer/src/components/PlayerBoard/ExplorationSupply.vue
Normal file
74
viewer/src/components/PlayerBoard/ExplorationSupply.vue
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<template>
|
||||
<!-- A non-renewable supply, printed like the satellite counter: one black symbol and a number. -->
|
||||
<g
|
||||
v-if="visible"
|
||||
class="exploration-supply"
|
||||
:class="{ 'exploration-supply--empty': remaining === 0 }"
|
||||
role="img"
|
||||
tabindex="0"
|
||||
:aria-label="label"
|
||||
v-b-tooltip.hover.focus.click
|
||||
:title="label"
|
||||
>
|
||||
<title>{{ label }}</title>
|
||||
<path
|
||||
class="shuttle-symbol"
|
||||
transform="scale(0.04)"
|
||||
fill="black"
|
||||
opacity="0.8"
|
||||
fill-rule="evenodd"
|
||||
d="M-9 -7 Q-9 -11 -5 -11 H5 Q9 -11 9 -7 V0 L13 10 Q13 12 11 12 H7 L4 5 Q2 2 2 6 V12 H-3 V6 Q-3 2 -5 5 L-8 12 H-12 Q-14 12 -13 9 L-9 0Z M-6 -7 Q-6 -8 -5 -8 H5 Q6 -8 6 -7 V-3 Q6 -2 5 -2 H-5 Q-6 -2 -6 -3Z"
|
||||
/>
|
||||
<text class="board-text remaining-count" transform="translate(0.95,-0.05) scale(0.8)" fill="black">{{
|
||||
remaining
|
||||
}}</text>
|
||||
</g>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import type Engine from "@gaia-project/engine";
|
||||
import type { PlayerData } from "@gaia-project/engine";
|
||||
import { Expansion, hasExpansion } from "@gaia-project/engine";
|
||||
import { maxExplorationShuttles } from "@gaia-project/engine/src/exploration";
|
||||
import Vue from "vue";
|
||||
import { Component, Prop } from "vue-property-decorator";
|
||||
|
||||
@Component
|
||||
export default class ExplorationSupply extends Vue {
|
||||
@Prop({ required: true }) data: PlayerData;
|
||||
@Prop({ required: true }) engine: Engine;
|
||||
@Prop({ default: false }) automa: boolean;
|
||||
|
||||
get visible() {
|
||||
return !this.automa && hasExpansion(this.engine.expansions, Expansion.LostFleet);
|
||||
}
|
||||
|
||||
get total() {
|
||||
return maxExplorationShuttles(this.engine.players.length);
|
||||
}
|
||||
|
||||
get remaining() {
|
||||
return Math.max(0, this.total - this.data.exploredShipsCount());
|
||||
}
|
||||
|
||||
get label() {
|
||||
// The localization adapter translates both the tooltip and accessible label, including counts.
|
||||
return `Exploration shuttles remaining: ${this.remaining} of ${this.total}`;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.exploration-supply {
|
||||
cursor: help;
|
||||
}
|
||||
/* Use the scaled silhouette for keyboard focus: browser CSS outlines are rounded to whole
|
||||
pixels, which become enormous in this board's SVG user units. */
|
||||
.exploration-supply:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
.exploration-supply:focus-visible .shuttle-symbol {
|
||||
stroke: var(--ui-focus, black);
|
||||
stroke-width: 1.3;
|
||||
}
|
||||
</style>
|
||||
119
viewer/src/components/PlayerBoard/Info.spec.ts
Normal file
119
viewer/src/components/PlayerBoard/Info.spec.ts
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
import Engine, { Building, Faction, GaiaHex, Planet } from "@gaia-project/engine";
|
||||
import { fireEvent, render } from "@testing-library/vue";
|
||||
import BootstrapVue from "bootstrap-vue";
|
||||
import { expect } from "chai";
|
||||
import Vue from "vue";
|
||||
import { MapModeType } from "../../data/actions";
|
||||
import { makeStore } from "../../store";
|
||||
import PlayerBoardInfo from "./Info.vue";
|
||||
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
function setup(lostFleet = true, faction = Faction.Terrans) {
|
||||
const engine = new Engine(["init 2 compact-board-stats", `p1 faction ${faction}`, "p2 faction xenos"], { lostFleet });
|
||||
const player = engine.players[0];
|
||||
const store = makeStore();
|
||||
store.commit("receiveData", engine);
|
||||
return { engine, player, store, props: { player, faction: player.faction, data: player.data, height: 21.4 } };
|
||||
}
|
||||
|
||||
function colony(sector: string, q: number) {
|
||||
return new GaiaHex(q, 0, { sector, planet: Planet.Terra, player: 0, building: Building.Mine });
|
||||
}
|
||||
|
||||
describe("PlayerBoardInfo Lost Fleet stats", () => {
|
||||
it("preserves the base-game positions, sizes and comma spacing", () => {
|
||||
const { props, store } = setup(false);
|
||||
const { container } = render(PlayerBoardInfo, { props, store });
|
||||
expect(container.querySelector(".exploration-supply")).to.equal(null);
|
||||
expect(container.querySelector('[data-board-stat="deep-space-sectors"]')).to.equal(null);
|
||||
const satellites = container.querySelector('[data-board-stat="satellites"]');
|
||||
const federations = container.querySelector('[data-board-stat="federations"]');
|
||||
expect(satellites.getAttribute("transform")).to.equal("translate(15.2, 1.4)");
|
||||
expect(satellites.querySelector("text").textContent.trim()).to.equal("0, 25");
|
||||
expect(federations.getAttribute("transform")).to.equal("translate(15.2, 3.5)");
|
||||
expect(federations.querySelector("image").getAttribute("transform")).to.equal("scale(0.1)");
|
||||
expect(federations.querySelector("text").textContent.trim()).to.equal("0, 0");
|
||||
expect(container.querySelector('[data-board-stat="sectors"]').getAttribute("transform")).to.equal(
|
||||
"translate(12.4, 3.5)"
|
||||
);
|
||||
expect(container.querySelectorAll(".research-counter")[5].getAttribute("transform")).to.equal(
|
||||
"translate(10.6,3.5) scale(1)"
|
||||
);
|
||||
});
|
||||
|
||||
it("outlines research counters on Lost Fleet Lantids boards without changing base-game counters", () => {
|
||||
for (const lostFleet of [false, true]) {
|
||||
const { props, store } = setup(lostFleet, Faction.Lantids);
|
||||
const { container } = render(PlayerBoardInfo, { props, store });
|
||||
const counters = container.querySelectorAll(".research-counter .research-tile");
|
||||
expect(counters).to.have.length(6);
|
||||
for (const counter of Array.from(counters)) {
|
||||
expect(counter.classList.contains("research-tile--outlined")).to.equal(lostFleet);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("stacks shuttles above satellites and federations without an extra board row", () => {
|
||||
const { props, store } = setup();
|
||||
const { container } = render(PlayerBoardInfo, { props, store });
|
||||
expect(container.querySelector(".exploration-supply").getAttribute("transform")).to.equal("translate(15.5, 0.65)");
|
||||
const satellites = container.querySelector('[data-board-stat="satellites"]');
|
||||
const federations = container.querySelector('[data-board-stat="federations"]');
|
||||
expect(satellites.getAttribute("transform")).to.equal("translate(15.5, 2.05)");
|
||||
expect(federations.getAttribute("transform")).to.equal("translate(15.5, 3.5)");
|
||||
expect(satellites.querySelector("text").textContent.trim()).to.equal("0,25");
|
||||
expect(federations.querySelector("text").textContent.trim()).to.equal("0,0");
|
||||
expect(federations.querySelector("image").getAttribute("transform")).to.equal("scale(0.075)");
|
||||
expect(container.querySelectorAll(".research-counter")[5].getAttribute("transform")).to.equal(
|
||||
"translate(8.75,3.5) scale(1)"
|
||||
);
|
||||
expect(container.querySelector(".board-info > rect").getAttribute("height")).to.equal("8");
|
||||
});
|
||||
|
||||
it("shows separate ordinary and Deep Space tile counts and keeps the combined sector shortcut", async () => {
|
||||
const { props, store, player } = setup();
|
||||
player.data.occupied.push(colony("s1", 1), colony("s2", 2), ...[0, 1, 2].map((i) => colony(`DS11_${i}`, 3 + i)));
|
||||
const { container } = render(PlayerBoardInfo, { props, store });
|
||||
const normal = container.querySelector('[data-board-stat="sectors"]');
|
||||
const deep = container.querySelector('[data-board-stat="deep-space-sectors"]');
|
||||
expect(normal.querySelector("text").textContent.trim()).to.equal("2");
|
||||
expect(deep.querySelector("text").textContent.trim()).to.equal("1");
|
||||
expect(deep.getAttribute("title")).to.contain("Deep Space sectors with a colonized planet");
|
||||
expect(deep.querySelectorAll("polygon")).to.have.length(3);
|
||||
expect(deep.querySelector(".deep-space-sector--white")).not.to.equal(null);
|
||||
await fireEvent.click(deep.querySelector("polygon"));
|
||||
expect(store.getters.mapModes).to.deep.equal([{ type: MapModeType.sectors, player: 0 }]);
|
||||
player.data.occupied.push(colony("DS12_0", 6));
|
||||
await Vue.nextTick();
|
||||
expect(deep.querySelector("text").textContent.trim()).to.equal("2");
|
||||
expect(normal.querySelector("text").textContent.trim()).to.equal("2");
|
||||
});
|
||||
|
||||
it("keeps a zero Deep Space count visible", () => {
|
||||
const { props, store } = setup();
|
||||
const { container } = render(PlayerBoardInfo, { props, store });
|
||||
expect(container.querySelector('[data-board-stat="deep-space-sectors"] text').textContent.trim()).to.equal("0");
|
||||
});
|
||||
|
||||
it("uses the displayed reference engine for expansion visibility and shuttle limits", () => {
|
||||
const { store } = setup(false);
|
||||
const referenceEngine = new Engine(
|
||||
[
|
||||
"init 4 info-reference",
|
||||
"p1 faction terrans",
|
||||
"p2 faction xenos",
|
||||
"p3 faction firaks",
|
||||
"p4 faction hadsch-hallas",
|
||||
],
|
||||
{ lostFleet: true }
|
||||
);
|
||||
const player = referenceEngine.players[0];
|
||||
const { container } = render(PlayerBoardInfo, {
|
||||
props: { player, faction: player.faction, data: player.data, referenceEngine, preview: true, height: 21.4 },
|
||||
store,
|
||||
});
|
||||
expect(container.querySelector(".remaining-count").textContent.trim()).to.equal("3");
|
||||
expect(container.querySelector('[data-board-stat="deep-space-sectors"]')).not.to.equal(null);
|
||||
});
|
||||
});
|
||||
|
|
@ -79,7 +79,13 @@
|
|||
<text class="board-text" transform="scale(4)">+{{ income("vp") }}</text>
|
||||
</g>
|
||||
</g>
|
||||
<g transform="translate(15.2, 1.4)" v-b-tooltip title="Satellites and space stations, satellites left ">
|
||||
<ExplorationSupply transform="translate(15.5, 0.65)" :data="data" :engine="engine" :automa="player.isAutoma" />
|
||||
<g
|
||||
data-board-stat="satellites"
|
||||
:transform="isLostFleet ? 'translate(15.5, 2.05)' : '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"
|
||||
|
|
@ -88,26 +94,56 @@
|
|||
y="-8"
|
||||
transform="scale(0.07)"
|
||||
/>
|
||||
<text class="board-text" transform="translate(1,0) scale(0.8)"
|
||||
>{{ data.satellites + data.buildings.sp }}, {{ satellitesLeft }}
|
||||
<text class="board-text" :transform="`translate(${isLostFleet ? 0.95 : 1},0) scale(0.8)`">
|
||||
{{ statPair(data.satellites + data.buildings.sp, satellitesLeft) }}
|
||||
</text>
|
||||
</g>
|
||||
<g transform="translate(12.4, 3.5)" v-b-tooltip title="Sectors with a colonized planet">
|
||||
<g
|
||||
data-board-stat="sectors"
|
||||
:transform="isLostFleet ? 'translate(10.35, 3.5)' : 'translate(12.4, 3.5)'"
|
||||
v-b-tooltip
|
||||
:title="
|
||||
isLostFleet
|
||||
? 'Space sectors with a colonized planet. Click to highlight all colonized sectors.'
|
||||
: '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)"
|
||||
:height="isLostFleet ? (458 / 430) * 18 : (155 / 211) * 22"
|
||||
:width="isLostFleet ? 18 : 22"
|
||||
:x="isLostFleet ? -9 : -11"
|
||||
:y="isLostFleet ? (-458 / 430) * 9 : -8"
|
||||
:transform="isLostFleet ? 'scale(0.075)' : '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>
|
||||
<text
|
||||
class="board-text"
|
||||
:transform="`translate(${isLostFleet ? 0.9 : 1.4},-.1) scale(0.8)`"
|
||||
:text-anchor="isLostFleet ? 'start' : 'middle'"
|
||||
>{{ sectors }}</text
|
||||
>
|
||||
</g>
|
||||
<g
|
||||
v-if="isLostFleet"
|
||||
data-board-stat="deep-space-sectors"
|
||||
transform="translate(13, 3.5)"
|
||||
v-b-tooltip
|
||||
title="Deep Space sectors with a colonized planet. Click to highlight all colonized sectors."
|
||||
>
|
||||
<DeepSpaceSector
|
||||
:white="true"
|
||||
transform="scale(0.065)"
|
||||
@click.native="toggleMapMode('sectors')"
|
||||
style="cursor: pointer"
|
||||
/>
|
||||
<text class="board-text" transform="translate(0.9,-.1) scale(0.8)">{{ deepSpaceSectors }}</text>
|
||||
</g>
|
||||
<g
|
||||
v-if="!player.isAutoma"
|
||||
transform="translate(15.2, 3.5)"
|
||||
data-board-stat="federations"
|
||||
:transform="isLostFleet ? 'translate(15.5, 3.5)' : 'translate(15.2, 3.5)'"
|
||||
v-b-tooltip.hover
|
||||
title="Power value of structures in federations, outside of federations"
|
||||
>
|
||||
|
|
@ -117,12 +153,12 @@
|
|||
width="22"
|
||||
x="-11"
|
||||
y="-8"
|
||||
transform="scale(0.1)"
|
||||
:transform="isLostFleet ? 'scale(0.075)' : '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 class="board-text" :transform="`translate(${isLostFleet ? 0.95 : 1},-.1) scale(0.8)`">
|
||||
{{ statPair(player.fedValue, player.structureValue - player.fedValue) }}
|
||||
</text>
|
||||
</g>
|
||||
<g v-if="!player.isAutoma">
|
||||
|
|
@ -158,14 +194,15 @@
|
|||
<g
|
||||
v-for="i in researchFields"
|
||||
:key="i"
|
||||
:transform="`translate(${(i * 2 + -1.4) * 1},3.5) scale(1)`"
|
||||
class="research-counter"
|
||||
:transform="`translate(${isLostFleet ? (i - 1) * 1.65 + 0.5 : i * 2 - 1.4},3.5) scale(1)`"
|
||||
v-b-tooltip.hover
|
||||
:title="researchTooltip(i - 1)"
|
||||
>
|
||||
<polygon
|
||||
points="-7.5,3 -3,7.5 3,7.5 7.5,3 7.5,-3 3,-7.5 -3,-7.5 -7.5,-3"
|
||||
:transform="`scale(0.1)`"
|
||||
:class="['board-info', 'research-tile', researchClass(i - 1)]"
|
||||
:class="['board-info', 'research-tile', { 'research-tile--outlined': isLostFleet }, researchClass(i - 1)]"
|
||||
:style="`fill: ${researchStyle(i - 1).backgroundColor}`"
|
||||
/>
|
||||
<text class="board-text" transform="scale(0.8)" x="-.35" y="-.15" :style="`fill: ${researchStyle(i - 1).color}`"
|
||||
|
|
@ -178,7 +215,9 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Engine, {
|
||||
Expansion,
|
||||
Faction,
|
||||
hasExpansion,
|
||||
MAX_SATELLITES,
|
||||
Player,
|
||||
PlayerData,
|
||||
|
|
@ -193,14 +232,18 @@ import { effectivePreviewPlayer } from "../../data/faction-preview";
|
|||
import { factionName } from "../../data/factions";
|
||||
import { researchColor, researchData } from "../../data/research";
|
||||
import { showIncome } from "../../data/resources";
|
||||
import { leechNetwork, sectors } from "../../data/stats";
|
||||
import { deepSpaceSectors, leechNetwork, sectors } from "../../data/stats";
|
||||
import type { CellStyle } from "../../graphics/colors";
|
||||
import DeepSpaceSector from "../Conditions/DeepSpaceSector.vue";
|
||||
import Resource from "../Resource.vue";
|
||||
import Undo from "../Resources/Undo.vue";
|
||||
import VictoryPoint from "../Resources/VictoryPoint.vue";
|
||||
import ExplorationSupply from "./ExplorationSupply.vue";
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
DeepSpaceSector,
|
||||
ExplorationSupply,
|
||||
Resource,
|
||||
VictoryPoint,
|
||||
Undo,
|
||||
|
|
@ -224,8 +267,19 @@ export default class PlayerBoardInfo extends Vue {
|
|||
@Prop({ default: false })
|
||||
preview: boolean;
|
||||
|
||||
@Prop()
|
||||
referenceEngine: Engine;
|
||||
|
||||
get engine(): Engine {
|
||||
return this.$store.state.data;
|
||||
return this.referenceEngine ?? this.$store.state.data;
|
||||
}
|
||||
|
||||
get isLostFleet(): boolean {
|
||||
return hasExpansion(this.engine.expansions, Expansion.LostFleet);
|
||||
}
|
||||
|
||||
statPair(first: number, second: number): string {
|
||||
return `${first},${this.isLostFleet ? "" : " "}${second}`;
|
||||
}
|
||||
|
||||
get researchFields(): number {
|
||||
|
|
@ -305,6 +359,10 @@ export default class PlayerBoardInfo extends Vue {
|
|||
return sectors(this.player);
|
||||
}
|
||||
|
||||
get deepSpaceSectors(): number {
|
||||
return deepSpaceSectors(this.player);
|
||||
}
|
||||
|
||||
get satellitesLeft(): number {
|
||||
return MAX_SATELLITES - this.data.satellites;
|
||||
}
|
||||
|
|
@ -332,6 +390,14 @@ export default class PlayerBoardInfo extends Vue {
|
|||
text-anchor: middle;
|
||||
}
|
||||
|
||||
/* A thin edge separates matching track/faction colors (notably Science on Lantids).
|
||||
Recent/current-round strokes below keep their stronger highlight styling. */
|
||||
.board-info.research-tile--outlined {
|
||||
stroke: rgba(0, 0, 0, 0.45);
|
||||
stroke-width: 0.6;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.board-info.research-tile.recent {
|
||||
stroke-width: 2;
|
||||
stroke: var(--recent);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,25 @@ import { makeStore } from "../store";
|
|||
import PlayerInfo from "./PlayerInfo.vue";
|
||||
|
||||
for (const component of [PlayerInfo, AlternatePlayerInfo]) {
|
||||
it("fits Lost Fleet supplies and sector stats in the info panel without adding a row or moving actions", () => {
|
||||
const engine = new Engine(["init 2 shuttle-layout", "p1 faction terrans", "p2 faction xenos"], { lostFleet: true });
|
||||
engine.players[0].data.gaiaformers = 3;
|
||||
for (let i = 0; i < 7; i++) engine.players[0].loadEvent(new Event("=> 1q"), "test");
|
||||
const store = makeStore();
|
||||
store.commit("receiveData", engine);
|
||||
const { container } = render(component, { props: { player: engine.players[0] }, store });
|
||||
const groups = container.querySelectorAll(".building-group");
|
||||
expect(groups[groups.length - 1].getAttribute("transform")).to.equal("translate(20, 1.2)");
|
||||
const supply = container.querySelector(".exploration-supply");
|
||||
expect(supply.getAttribute("transform")).to.equal("translate(15.5, 0.65)");
|
||||
expect(supply.closest(".board-info")).not.to.equal(null);
|
||||
expect(container.querySelector('[data-board-stat="deep-space-sectors"]')).not.to.equal(null);
|
||||
expect(supply.querySelector("rect, circle")).to.equal(null);
|
||||
expect(supply.querySelectorAll(".shuttle-symbol")).to.have.length(1);
|
||||
expect(supply.querySelectorAll(".remaining-count")).to.have.length(1);
|
||||
expect(container.querySelector("[data-player-action]").getAttribute("y")).to.equal("17.4");
|
||||
expect(container.querySelector(".player-board").getAttribute("viewBox")).to.equal("-0.2 -0.5 38.5 24.7");
|
||||
});
|
||||
it("shows the Automa faction board and always-visible cards without a human economy", () => {
|
||||
const engine = new Engine(["init 1 automa-panel", "p1 faction terrans", "p2 faction taklons"], {
|
||||
automaSeed: "test",
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
:faction="player.faction"
|
||||
:data="playerData"
|
||||
:height="height"
|
||||
:reference-engine="engine"
|
||||
:preview="preview"
|
||||
/>
|
||||
<g transform="translate(4.4, 0)">
|
||||
|
|
@ -143,7 +144,7 @@
|
|||
|
||||
<BuildingGroup
|
||||
v-if="!player.isAutoma"
|
||||
transform="translate(21, 1.2)"
|
||||
:transform="`translate(${isLostFleet ? 20 : 21}, 1.2)`"
|
||||
:nBuildings="playerData.gaiaformers"
|
||||
building="gf"
|
||||
:gaia="playerData.gaiaformersInGaia"
|
||||
|
|
|
|||
|
|
@ -55,17 +55,6 @@
|
|||
sectorMapMode ? 'space-hex-sector-highlight' : 'space-hex-federation planet',
|
||||
]"
|
||||
/>
|
||||
<!-- Lost Fleet spaceship hex: fill the entire hex with the ship's identity color (rulebook
|
||||
page 7 - Twilight purple / Rebellion brown / T F Mars grey / Eclipse yellow). Drawn here,
|
||||
outside the `contentRotation` counter-rotation below, so the hexagon stays aligned to the
|
||||
cell's own outline; the upright letter lives in the counter-rotated group instead. -->
|
||||
<use
|
||||
v-if="lostFleetSpaceship"
|
||||
xlink:href="#space-hex"
|
||||
class="lost-fleet-spaceship__hex"
|
||||
:data-ship="lostFleetSpaceship"
|
||||
:style="{ fill: lostFleetSpaceshipColor }"
|
||||
/>
|
||||
<!-- Content that must stay upright regardless of the whole-board `contentRotation` screen-fit
|
||||
rotation (numbers, labels, buildings, gaiaformers, ships) - counter-rotated here so it
|
||||
doesn't inherit that purely-cosmetic tilt. This deliberately does NOT cancel out any
|
||||
|
|
@ -86,12 +75,10 @@
|
|||
<text class="sector-name" v-if="isCenter" x="0" y="0" dy="0.35">
|
||||
{{ hex.data.sector[0] === "s" ? parseInt(hex.data.sector.slice(1)) : parseInt(hex.data.sector) }}
|
||||
</text>
|
||||
<g v-if="lostFleetSpaceship" class="lost-fleet-spaceship">
|
||||
<!-- y=0 + a plain-number dy (user units, ≈0.35 * font-size) centers the uppercase glyph the
|
||||
same in every browser. This deliberately avoids `dy="…em"` (mobile WebKit drops the em
|
||||
unit, leaving the letter on the baseline / high in the hex) and `dominant-baseline`
|
||||
(iOS Safari renders it off) - the same proven mechanism the `.sector-name` labels use. -->
|
||||
<text class="lost-fleet-spaceship__label" y="0" dy="0.315">{{ lostFleetSpaceshipLabel }}</text>
|
||||
<g v-if="lostFleetSpaceship" class="lost-fleet-spaceship" :data-ship="lostFleetSpaceship">
|
||||
<!-- Fill most of the ship hex with its upright insignia. Explorer tokens are painted
|
||||
afterwards at their normal size, intentionally overlapping the emblem. -->
|
||||
<SpaceshipEmblem :ship="lostFleetSpaceship" transform="scale(0.08)" />
|
||||
<g
|
||||
v-for="(explorer, index) in explorers"
|
||||
:key="explorer.player"
|
||||
|
|
@ -182,12 +169,14 @@ import { hexMoveLabel } from "../logic/recent";
|
|||
import { leechPlanets, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
|
||||
import Building from "./Building.vue";
|
||||
import Planet from "./Planet.vue";
|
||||
import SpaceshipEmblem from "./SpaceshipEmblem.vue";
|
||||
|
||||
type BuildingOverride = { building: BuildingEnum; player: PlayerEnum };
|
||||
@Component<SpaceHex>({
|
||||
components: {
|
||||
Planet,
|
||||
Building,
|
||||
SpaceshipEmblem,
|
||||
},
|
||||
})
|
||||
export default class SpaceHex extends Vue {
|
||||
|
|
@ -768,7 +757,7 @@ svg {
|
|||
}
|
||||
}
|
||||
|
||||
// The whole-hex ship-color fill (see template). `fill` is set per-ship inline via
|
||||
// The alternate UI keeps whole-hex ship colors behind its initials. `fill` comes from
|
||||
// spaceshipColors; pointer-events off so it never intercepts the hex's own click.
|
||||
.lost-fleet-spaceship__hex {
|
||||
stroke: #172e62;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ describe("SpaceMap", () => {
|
|||
store.commit("player", { index: 0 });
|
||||
store.commit("receiveData", engine);
|
||||
const { container } = render(SpaceMap, { store });
|
||||
const ship = (name: Spaceship) => container.querySelector(`[data-ship="${name}"]`).parentElement;
|
||||
const ship = (name: Spaceship) => container.querySelector(`[data-ship="${name}"]`).closest(".space-hex-cell");
|
||||
const markers = Array.from(ship(Spaceship.Twilight).querySelectorAll(".lost-fleet-spaceship__explorer"));
|
||||
expect(markers.map((marker) => marker.getAttribute("data-player"))).to.deep.equal(["3", "2", "1", "0"]);
|
||||
expect(markers[1].querySelector(".planet-fill.p")).not.to.equal(null);
|
||||
|
|
@ -271,18 +271,18 @@ describe("SpaceMap", () => {
|
|||
});
|
||||
expect(container.querySelectorAll("g.space-hex-cell .lost-fleet-spaceship").length).to.equal(spaceshipHexCount);
|
||||
// per-hex ship marker fills the whole hex with the ship's identity color (rulebook page 7:
|
||||
// Twilight purple / Rebellion brown / T F Mars grey / Eclipse yellow) plus a single bold,
|
||||
// centered letter - no separate orbit ring or "Ship" caption pill on top of it
|
||||
// Twilight purple / Rebellion brown / T F Mars grey / Eclipse yellow) plus an upright
|
||||
// insignia - no separate orbit ring or "Ship" caption pill on top of it
|
||||
const mapShipMarker = container.querySelector("g.space-hex-cell .lost-fleet-spaceship");
|
||||
if (mapShipMarker) {
|
||||
expect(mapShipMarker.querySelector(".lost-fleet-spaceship__orbit")).to.equal(null);
|
||||
expect(mapShipMarker.querySelector(".lost-fleet-spaceship__pill")).to.equal(null);
|
||||
expect(mapShipMarker.querySelectorAll("text").length).to.equal(1);
|
||||
expect(mapShipMarker.querySelector("text").textContent).to.match(/^[TRME]$/);
|
||||
// the ship color fills the whole hex via a hex-shaped <use>, not a small circle
|
||||
expect(mapShipMarker.querySelectorAll(".spaceship-emblem").length).to.equal(1);
|
||||
expect(mapShipMarker.querySelector(".spaceship-emblem").getAttribute("aria-label")).to.contain("Twilight");
|
||||
// The large medallion identifies the ship; the underlying space hex has no identity-color fill.
|
||||
const cell = mapShipMarker.closest("g.space-hex-cell");
|
||||
expect(cell.querySelector(".lost-fleet-spaceship__hex")).to.not.equal(null);
|
||||
expect(cell.querySelectorAll(".lost-fleet-spaceship circle").length).to.equal(0);
|
||||
expect(cell.querySelector(".lost-fleet-spaceship__hex")).to.equal(null);
|
||||
expect(cell.querySelector(".spaceship-emblem > circle")).to.not.equal(null);
|
||||
}
|
||||
|
||||
// the Lost Fleet legend (Interspace/Deep Space/Ship swatches) was removed entirely
|
||||
|
|
|
|||
14
viewer/src/components/SpaceshipEmblem.reference.md
Normal file
14
viewer/src/components/SpaceshipEmblem.reference.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Lost Fleet insignia
|
||||
|
||||
`SpaceshipEmblem.vue` contains hand-drawn SVG interpretations, **not original publisher vector assets**.
|
||||
|
||||
Reference: official **Gaia Project: The Lost Fleet rulebook v1.0, page 7**, the four individually named ship boards. The checked-in copy is `docs/lost-fleet/rulebook-v1.0.pdf`. Also checked the [Capstone Games publisher download](https://capstone-games.com/cdn/shop/files/GP_Exp_Rule_EN_V1_Web.pdf?v=6134275372584409409). Both embed the boards at only about 250×77 pixels; enlargement does not recover the fine detail. Page 2 also shows the purple insignia on a ship tile. The owner's tabletop photograph supplies the same high-level shapes and colors.
|
||||
|
||||
- **Twilight / Nautilaks:** white segmented nautilus spiral, purple disc. Supported motif; simplified spiral chambers, not an exact tracing.
|
||||
- **Eclipse / Eridani Empire:** dark planet/orbital ellipse on gold. Supported motif; simplified orbit intersection.
|
||||
- **T F Mars / Gaia Federation:** two dark, rising diagonal leaf/slash shapes on pale silver. Supported motif; simplified silhouettes.
|
||||
- **Rebellion / Vo'Kron:** the owner's subsequent close-up resolves the long tapered U/claw, inner crown and lower angular divisions. The SVG interprets those dark shapes on a pale silver/ivory medallion, with light gaps between the divisions. It replaces the provisional R; the ship-board header retains the ship's brown identity color.
|
||||
|
||||
Primary map and board headers use the same component. Headers keep their full names independently of the symbol (including T F MARS). The primary map no longer fills the underlying ship hex with an identity color. The alternate map keeps E/T/R/M on colored hexes and its board has its own unchanged template; no CSS hiding or shared-template mode is needed. Generic spacecraft controls and action-effect symbols are intentionally untouched.
|
||||
|
||||
The map insignia inherits the existing upright counter-rotation and now fills most of its hex (radius 0.8, up from 0.33 in the first proposal). Explorer tokens retain their original size and positions; they are painted after the emblem and intentionally overlap it. Tooltips and accessible names retain the ship and its faction identity.
|
||||
81
viewer/src/components/SpaceshipEmblem.spec.ts
Normal file
81
viewer/src/components/SpaceshipEmblem.spec.ts
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import Engine, { Spaceship } from "@gaia-project/engine";
|
||||
import { render } from "@testing-library/vue";
|
||||
import { expect } from "chai";
|
||||
import AlternateShips from "../../../old-ui/src/components/LostFleetShips.vue";
|
||||
import AlternateHex from "../../../old-ui/src/components/SpaceHex.vue";
|
||||
import { spaceshipColors, spaceshipNames } from "../data/spaceships";
|
||||
import { makeStore } from "../store";
|
||||
import SpaceHex from "./SpaceHex.vue";
|
||||
import SpaceshipEmblem from "./SpaceshipEmblem.vue";
|
||||
|
||||
// The alternate UI inherits ship-board methods but owns its template. Exercise that real template,
|
||||
// not a CSS-hidden variant, to protect its initial markers and unchanged headings.
|
||||
describe("Spaceship insignia proposal", () => {
|
||||
it("gives every insignia a graphic and its full accessible ship name, including Rebellion", () => {
|
||||
for (const ship of [Spaceship.Twilight, Spaceship.Rebellion, Spaceship.TFMars, Spaceship.Eclipse]) {
|
||||
const { container } = render(SpaceshipEmblem, { props: { ship } });
|
||||
expect(container.querySelector('[role="img"]').getAttribute("aria-label")).to.contain(spaceshipNames[ship]);
|
||||
expect(container.querySelector("text, [data-emblem-pending]")).to.equal(null);
|
||||
expect(container.querySelector("path")).not.to.equal(null);
|
||||
}
|
||||
});
|
||||
|
||||
it("enlarges upright primary map emblems behind full-size explorers and keeps alternate initials", () => {
|
||||
const engine = new Engine(
|
||||
["init 4 emblem-map", "p1 faction terrans", "p2 faction hadsch-hallas", "p3 faction moweyds", "p4 faction xenos"],
|
||||
{ lostFleet: true }
|
||||
);
|
||||
const store = makeStore();
|
||||
store.commit("receiveData", engine);
|
||||
for (const ship of [Spaceship.Twilight, Spaceship.Rebellion, Spaceship.TFMars, Spaceship.Eclipse]) {
|
||||
engine.players.forEach((player, i) => {
|
||||
player.data.explorationShips[ship] = i + 1;
|
||||
});
|
||||
const hex = Array.from(engine.map.grid.values()).find((hex) => hex.data.spaceship === ship);
|
||||
const props = { hex, contentRotation: 30 };
|
||||
const { container } = render(SpaceHex, { store, props });
|
||||
const emblem = container.querySelector(".spaceship-emblem");
|
||||
expect(emblem.parentElement.parentElement.getAttribute("transform")).to.equal("rotate(-30)");
|
||||
expect(container.querySelector(".lost-fleet-spaceship__hex")).to.equal(null);
|
||||
expect(container.querySelector("title").textContent).to.contain(spaceshipNames[ship]);
|
||||
expect(emblem.getAttribute("transform")).to.equal("scale(0.08)");
|
||||
const layers = Array.from(emblem.parentElement.children);
|
||||
const explorers = Array.from(container.querySelectorAll(".lost-fleet-spaceship__explorer"));
|
||||
expect(explorers).to.have.length(4);
|
||||
for (const explorer of explorers) {
|
||||
const [x, y] = explorer
|
||||
.getAttribute("transform")
|
||||
.match(/-?[\d.]+/g)
|
||||
.map(Number);
|
||||
// Overlap is intentional; the original full-size tokens remain above the large insignia.
|
||||
expect(Math.hypot(x, y)).to.be.lessThan(10 * 0.08 + 0.3);
|
||||
expect(layers.indexOf(explorer)).to.be.greaterThan(layers.indexOf(emblem));
|
||||
expect(explorer.querySelector(".lost-fleet-spaceship__explorer-outline").getAttribute("r")).to.equal("0.3");
|
||||
expect(explorer.querySelector(".planet-fill").getAttribute("r")).to.equal("0.25");
|
||||
}
|
||||
const { container: alternate } = render(AlternateHex, { store, props });
|
||||
expect(alternate.querySelector(".spaceship-emblem")).to.equal(null);
|
||||
const color = document.createElement("span");
|
||||
color.style.fill = spaceshipColors[ship];
|
||||
expect((alternate.querySelector(".lost-fleet-spaceship__hex") as SVGElement).style.fill).to.equal(
|
||||
color.style.fill
|
||||
);
|
||||
expect(alternate.querySelector(".lost-fleet-spaceship__label").textContent).to.equal(
|
||||
{ twilight: "T", rebellion: "R", tfmars: "M", eclipse: "E" }[ship]
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("leaves the alternate board template and complete legacy names unchanged", () => {
|
||||
const store = makeStore();
|
||||
store.commit("receiveData", new Engine(["init 4 emblem-alternate"], { lostFleet: true }));
|
||||
const { container } = render(AlternateShips, { store });
|
||||
expect(container.querySelector(".spaceship-emblem")).to.equal(null);
|
||||
expect(Array.from(container.querySelectorAll("header strong")).map((node) => node.textContent)).to.have.members([
|
||||
"TWILIGHT",
|
||||
"REBELLION",
|
||||
"MARS",
|
||||
"ECLIPSE",
|
||||
]);
|
||||
});
|
||||
});
|
||||
61
viewer/src/components/SpaceshipEmblem.vue
Normal file
61
viewer/src/components/SpaceshipEmblem.vue
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<template>
|
||||
<g class="spaceship-emblem" :data-emblem="ship" role="img" :aria-label="label" pointer-events="none">
|
||||
<title>{{ label }}</title>
|
||||
<circle r="10" :fill="background" stroke="#eee7d3" stroke-width="0.6" />
|
||||
<!-- Vector interpretations of the printed insignia, not spacecraft silhouettes.
|
||||
The rulebook and supplied tabletop-photo references are documented alongside. -->
|
||||
<g v-if="ship === ships.Twilight" fill="none" stroke="#fff9ff" stroke-linecap="round">
|
||||
<path
|
||||
d="M -7,5 C -9,-1 -5,-8 1,-8 C 7,-8 9,-2 7,3 C 5,8 -1,8 -4,4 C -7,0 -3,-5 1,-5 C 5,-5 7,-1 5,2 C 3,5 -1,5 -2,2 C -4,-1 -1,-3 1,-2 C 3,-1 2,2 0,1"
|
||||
stroke-width="1.25"
|
||||
/>
|
||||
<path
|
||||
d="M -7,5 L -4,2 M -8,1 L -5,0 M -7,-3 L -4,-2 M -4,-6 L -2,-4 M 0,-8 L 1,-5 M 4,-7 L 3,-4 M 7,-4 L 5,-2 M 8,0 L 6,0 M 6,5 L 4,3 M 2,7 L 1,4 M -2,6 L -1,3"
|
||||
stroke-width="0.75"
|
||||
/>
|
||||
</g>
|
||||
<g v-else-if="ship === ships.Eclipse" fill="#493619" transform="rotate(-35)">
|
||||
<circle r="4.6" />
|
||||
<ellipse rx="8" ry="2.8" fill="none" stroke="#493619" stroke-width="1.35" />
|
||||
<path d="M -7,0 Q 0,3.5 7,0" fill="none" :stroke="background" stroke-width="0.9" />
|
||||
</g>
|
||||
<g v-else-if="ship === ships.TFMars" fill="#294947">
|
||||
<path d="M -7,5 C -6,-1 -1,-4 7,-7 C 3,-2 0,1 -7,5 Z" />
|
||||
<path d="M -5,7 C -4,3 0,1 6,-2 C 3,3 0,6 -5,7 Z" />
|
||||
</g>
|
||||
<!-- Rebellion's tapered outer prongs and divided inner crest, from the supplied close-up. -->
|
||||
<g v-else-if="ship === ships.Rebellion" fill="#302c2a">
|
||||
<path
|
||||
d="M -3.1,-8.5 Q -4.4,-8.1 -4.8,-6.5 L -6,4.7 L -3,7.4 L 0,8.4 L 3,7.4 L 6,4.7 L 4.8,-6.5 Q 4.4,-8.1 3.1,-8.5 L 3.6,-3.9 L 4.2,3.6 L 2,5.8 L 0,6.5 L -2,5.8 L -4.2,3.6 L -3.6,-3.9 Z"
|
||||
/>
|
||||
<path d="M -2.4,-4.6 L -3.2,-0.8 L -1.8,0.7 H 1.8 L 3.2,-0.8 L 2.4,-4.6 L 1.4,-2.5 L 0,-1.6 L -1.4,-2.5 Z" />
|
||||
<path d="M -3.4,0.3 L -1.8,1.8 H 1.8 L 3.4,0.3 L 3.6,3.4 L 1.6,5 H -1.6 L -3.6,3.4 Z" />
|
||||
<path d="M 0,6.3 V 8.5" fill="none" :stroke="background" stroke-width="0.6" />
|
||||
</g>
|
||||
</g>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Spaceship } from "@gaia-project/engine";
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { spaceshipLabels, spaceshipNames } from "../data/spaceships";
|
||||
|
||||
@Component
|
||||
export default class SpaceshipEmblem extends Vue {
|
||||
@Prop({ required: true }) ship: Spaceship;
|
||||
ships = Spaceship;
|
||||
|
||||
get label(): string {
|
||||
return `${spaceshipNames[this.ship]} — ${spaceshipLabels[this.ship]}`;
|
||||
}
|
||||
|
||||
get background(): string {
|
||||
return {
|
||||
[Spaceship.Twilight]: "#723875",
|
||||
[Spaceship.Eclipse]: "#dfbd58",
|
||||
[Spaceship.TFMars]: "#cedbd8",
|
||||
[Spaceship.Rebellion]: "#d8d1c5",
|
||||
}[this.ship];
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -1,6 +1,15 @@
|
|||
import { Building, Expansion, Faction, GaiaHex, Planet, Player, PlayerEnum } from "@gaia-project/engine";
|
||||
import { expect } from "chai";
|
||||
import { sectors } from "./stats";
|
||||
import { deepSpaceSectors, sectors } from "./stats";
|
||||
|
||||
function mine(sector: string, q = 0): GaiaHex {
|
||||
return new GaiaHex(q, -q, {
|
||||
sector,
|
||||
planet: sector.startsWith("DS") ? Planet.Protoplanet : Planet.Terra,
|
||||
player: PlayerEnum.Player1,
|
||||
building: Building.Mine,
|
||||
});
|
||||
}
|
||||
|
||||
describe("stats", () => {
|
||||
describe("sectors", () => {
|
||||
|
|
@ -19,6 +28,102 @@ describe("stats", () => {
|
|||
);
|
||||
|
||||
expect(sectors(player)).to.equal(1);
|
||||
expect(deepSpaceSectors(player)).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("deepSpaceSectors", () => {
|
||||
let player: Player;
|
||||
|
||||
beforeEach(() => {
|
||||
player = new Player(Expansion.LostFleet, PlayerEnum.Player1);
|
||||
player.faction = Faction.Terrans;
|
||||
});
|
||||
|
||||
it("keeps ordinary sector counts separate from Deep Space counts", () => {
|
||||
player.data.occupied.push(mine("s1"), mine("s1", 1), mine("s2", 2));
|
||||
|
||||
expect(sectors(player)).to.equal(2);
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
|
||||
player.data.occupied.push(mine("DS11_0", 3));
|
||||
|
||||
expect(sectors(player)).to.equal(2);
|
||||
expect(deepSpaceSectors(player)).to.equal(1);
|
||||
});
|
||||
|
||||
it("counts DSx_0, DSx_1 and DSx_2 as one physical Deep Space tile", () => {
|
||||
player.data.occupied.push(...[0, 1, 2].map((index) => mine(`DS11_${index}`, index)));
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(1);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
|
||||
it("counts distinct Deep Space tiles separately", () => {
|
||||
player.data.occupied.push(mine("DS11_0"), mine("DS12_1", 1), mine("DS13_2", 2));
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(3);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
|
||||
it("does not count Interspace hexes as either kind of sector", () => {
|
||||
player.data.occupied.push(mine("IS1"), mine("IS2", 1));
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
|
||||
for (const [label, building, planet] of [
|
||||
["Gaiaformers", Building.GaiaFormer, Planet.Transdim],
|
||||
["space stations", Building.SpaceStation, Planet.Empty],
|
||||
] as const) {
|
||||
it(`does not count ${label} as colonizing a sector`, () => {
|
||||
for (const [index, sector] of ["s1", "DS11_0"].entries()) {
|
||||
const hex = mine(sector, index);
|
||||
hex.data.building = building;
|
||||
hex.data.planet = planet;
|
||||
player.data.occupied.push(hex);
|
||||
}
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
}
|
||||
|
||||
it("does not count an opponent's colonies in the occupied list", () => {
|
||||
for (const [index, sector] of ["s1", "DS11_0"].entries()) {
|
||||
const hex = mine(sector, index);
|
||||
hex.data.player = PlayerEnum.Player2;
|
||||
player.data.occupied.push(hex);
|
||||
}
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
|
||||
it("counts Lantids shared mines for the guest, deduplicating Deep Space tiles", () => {
|
||||
player.faction = Faction.Lantids;
|
||||
for (const [index, sector] of ["s1", "DS11_0", "DS11_1"].entries()) {
|
||||
const hex = mine(sector, index);
|
||||
hex.data.player = PlayerEnum.Player2;
|
||||
hex.data.additionalMine = player.player;
|
||||
player.data.occupied.push(hex);
|
||||
}
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(1);
|
||||
expect(sectors(player)).to.equal(1);
|
||||
|
||||
for (const hex of player.data.occupied) {
|
||||
delete hex.data.additionalMine;
|
||||
}
|
||||
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
|
||||
it("returns zero for a player with no occupied hexes", () => {
|
||||
expect(deepSpaceSectors(player)).to.equal(0);
|
||||
expect(sectors(player)).to.equal(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import Engine, { Condition, GaiaHex, Player, PlayerEnum } from "@gaia-project/engine";
|
||||
import type Engine from "@gaia-project/engine";
|
||||
import type { GaiaHex, Player, PlayerEnum } from "@gaia-project/engine";
|
||||
import { Condition } from "@gaia-project/engine";
|
||||
import { sum } from "../logic/lodash-utils";
|
||||
import { leechPlanets, upgradableBuildingsOfOtherPlayers } from "../logic/utils";
|
||||
import { MapModeType } from "./actions";
|
||||
|
|
@ -10,6 +12,11 @@ export function sectors(player: Player): number {
|
|||
return player.eventConditionCount(Condition.Sector);
|
||||
}
|
||||
|
||||
/** Counts colonized physical Deep Space tiles using the engine's scoring rules. */
|
||||
export function deepSpaceSectors(player: Player): number {
|
||||
return player.eventConditionCount(Condition.DeepSpaceSector);
|
||||
}
|
||||
|
||||
export function leechNetwork(engine: Engine, player: PlayerEnum): number {
|
||||
const map = engine.map;
|
||||
const hexes: GaiaHex[] = Array.from(map.grid.values());
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Forrige planlagte træk",
|
||||
"Next planned move": "Næste planlagte træk",
|
||||
"Edit this move": "Rediger dette træk",
|
||||
"Return to end": "Tilbage til slutningen"
|
||||
"Return to end": "Tilbage til slutningen",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Resterende udforskningsfærger: {p0} af {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Rumsektorer med en koloniseret planet. Klik for at fremhæve alle koloniserede sektorer.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Dybrumssektorer med en koloniseret planet. Klik for at fremhæve alle koloniserede sektorer.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilakker",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Gaia Føderation",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Eridani-imperiet"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Vorheriger geplanter Zug",
|
||||
"Next planned move": "Nächster geplanter Zug",
|
||||
"Edit this move": "Diesen Zug bearbeiten",
|
||||
"Return to end": "Zum Ende zurückkehren"
|
||||
"Return to end": "Zum Ende zurückkehren",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Verbleibende Erkundungsshuttles: {p0} von {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Weltraumsektoren mit einem kolonisierten Planeten. Klicken, um alle kolonisierten Sektoren hervorzuheben.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Deep-Space-Sektoren mit einem kolonisierten Planeten. Klicken, um alle kolonisierten Sektoren hervorzuheben.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Gaia-Föderation",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Eridani-Imperium"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Προηγούμενη προγραμματισμένη κίνηση",
|
||||
"Next planned move": "Επόμενη προγραμματισμένη κίνηση",
|
||||
"Edit this move": "Επεξεργασία αυτής της κίνησης",
|
||||
"Return to end": "Επιστροφή στο τέλος"
|
||||
"Return to end": "Επιστροφή στο τέλος",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Εναπομείναντα σκάφη εξερεύνησης: {p0} από {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Διαστημικοί τομείς με αποικισμένο πλανήτη. Κάντε κλικ για να επισημάνετε όλους τους αποικισμένους τομείς.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Τομείς βαθέος διαστήματος με αποικισμένο πλανήτη. Κάντε κλικ για να επισημάνετε όλους τους αποικισμένους τομείς.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Ομοσπονδία Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Eridani Empire"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Previous planned move",
|
||||
"Next planned move": "Next planned move",
|
||||
"Edit this move": "Edit this move",
|
||||
"Return to end": "Return to end"
|
||||
"Return to end": "Return to end",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Exploration shuttles remaining: {p0} of {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Space sectors with a colonized planet. Click to highlight all colonized sectors.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Gaia Federation",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Eridani Empire"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "حرکت برنامهریزیشدهٔ قبلی",
|
||||
"Next planned move": "حرکت برنامهریزیشدهٔ بعدی",
|
||||
"Edit this move": "ویرایش این حرکت",
|
||||
"Return to end": "بازگشت به پایان"
|
||||
"Return to end": "بازگشت به پایان",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "شاتلهای اکتشافی باقیمانده: {p0} از {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "بخشهای فضایی دارای سیارهٔ مستعمرهشده. برای برجستهکردن همهٔ بخشهای مستعمرهشده کلیک کنید.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "بخشهای فضای عمیق دارای سیارهٔ مستعمرهشده. برای برجستهکردن همهٔ بخشهای مستعمرهشده کلیک کنید.",
|
||||
"Twilight — Nautilaks": "Twilight — نوتیلاک",
|
||||
"Rebellion — Vo'Kron": "Rebellion — وُکرون",
|
||||
"T F Mars — Gaia Federation": "T F Mars — فدراسیون گایا",
|
||||
"Eclipse — Eridani Empire": "Eclipse — امپراتوری اریدانی"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Coup planifié précédent",
|
||||
"Next planned move": "Coup planifié suivant",
|
||||
"Edit this move": "Modifier ce coup",
|
||||
"Return to end": "Revenir à la fin"
|
||||
"Return to end": "Revenir à la fin",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Navettes d’exploration restantes : {p0} sur {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Secteurs spatiaux avec une planète colonisée. Cliquez pour mettre en évidence tous les secteurs colonisés.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Secteurs de l’espace profond avec une planète colonisée. Cliquez pour mettre en évidence tous les secteurs colonisés.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Alliance Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Empire éridanien"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "पिछली नियोजित चाल",
|
||||
"Next planned move": "अगली नियोजित चाल",
|
||||
"Edit this move": "इस चाल को संपादित करें",
|
||||
"Return to end": "अंत पर लौटें"
|
||||
"Return to end": "अंत पर लौटें",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "शेष अन्वेषण शटल: {p1} में से {p0}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "उपनिवेशित ग्रह वाले अंतरिक्ष क्षेत्र। सभी उपनिवेशित क्षेत्रों को हाइलाइट करने के लिए क्लिक करें।",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "उपनिवेशित ग्रह वाले गहरे अंतरिक्ष क्षेत्र। सभी उपनिवेशित क्षेत्रों को हाइलाइट करने के लिए क्लिक करें।",
|
||||
"Twilight — Nautilaks": "Twilight — नॉटिलैक्स",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — गैया महासंघ",
|
||||
"Eclipse — Eridani Empire": "Eclipse — एरिडानी साम्राज्य"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Mossa pianificata precedente",
|
||||
"Next planned move": "Mossa pianificata successiva",
|
||||
"Edit this move": "Modifica questa mossa",
|
||||
"Return to end": "Torna alla fine"
|
||||
"Return to end": "Torna alla fine",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Navette di esplorazione rimanenti: {p0} su {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Settori spaziali con un pianeta colonizzato. Clicca per evidenziare tutti i settori colonizzati.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Settori dello spazio profondo con un pianeta colonizzato. Clicca per evidenziare tutti i settori colonizzati.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Federazione Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Impero Eridani"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "이전 계획된 수",
|
||||
"Next planned move": "다음 계획된 수",
|
||||
"Edit this move": "이 수 수정",
|
||||
"Return to end": "끝으로 돌아가기"
|
||||
"Return to end": "끝으로 돌아가기",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "남은 탐사 셔틀: {p1}개 중 {p0}개",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "식민지가 있는 우주 구역. 클릭하면 식민지가 있는 모든 구역이 강조 표시됩니다.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "식민지가 있는 심우주 구역. 클릭하면 식민지가 있는 모든 구역이 강조 표시됩니다.",
|
||||
"Twilight — Nautilaks": "Twilight — 노틸락",
|
||||
"Rebellion — Vo'Kron": "Rebellion — 보크론",
|
||||
"T F Mars — Gaia Federation": "T F Mars — 가이아 연방",
|
||||
"Eclipse — Eridani Empire": "Eclipse — 에리다니 제국"
|
||||
}
|
||||
|
|
|
|||
29
viewer/src/localization/lost-fleet-stats.spec.ts
Normal file
29
viewer/src/localization/lost-fleet-stats.spec.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { createTranslator } from "./runtime.js";
|
||||
|
||||
const modules = import.meta.glob("./*.json", { eager: true, import: "default" });
|
||||
const catalogs = Object.fromEntries(Object.entries(modules).map(([path, catalog]) => [path.slice(2, -5), catalog]));
|
||||
|
||||
describe("Lost Fleet counter localization", () => {
|
||||
for (const locale of Object.keys(catalogs).filter((locale) => locale !== "en")) {
|
||||
it(`translates dynamic shuttle counts and sector tooltips in ${locale}`, () => {
|
||||
const translator = createTranslator(catalogs, locale);
|
||||
for (const remaining of [0, 1, 2, 3]) {
|
||||
const source = `Exploration shuttles remaining: ${remaining} of 3`;
|
||||
const translated = translator.translate(source);
|
||||
expect(translated).not.toBe(source);
|
||||
expect(translated).not.toMatch(/\{p\d\}/);
|
||||
}
|
||||
for (const source of [
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.",
|
||||
]) {
|
||||
expect(translator.translate(source)).not.toBe(source);
|
||||
}
|
||||
});
|
||||
}
|
||||
it("translates emblem affiliations while retaining ship identities", () => {
|
||||
const translator = createTranslator(catalogs, "fr");
|
||||
expect(translator.translate("T F Mars — Gaia Federation")).toBe("T F Mars — Alliance Gaia");
|
||||
});
|
||||
});
|
||||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Vorige geplande zet",
|
||||
"Next planned move": "Volgende geplande zet",
|
||||
"Edit this move": "Deze zet bewerken",
|
||||
"Return to end": "Terug naar het einde"
|
||||
"Return to end": "Terug naar het einde",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Resterende verkenningsshuttles: {p0} van {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Ruimtesectoren met een gekoloniseerde planeet. Klik om alle gekoloniseerde sectoren te markeren.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Dieperuimtesectoren met een gekoloniseerde planeet. Klik om alle gekoloniseerde sectoren te markeren.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Gaia-federatie",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Eridani Empire"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Poprzedni zaplanowany ruch",
|
||||
"Next planned move": "Następny zaplanowany ruch",
|
||||
"Edit this move": "Edytuj ten ruch",
|
||||
"Return to end": "Wróć na koniec"
|
||||
"Return to end": "Wróć na koniec",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Pozostałe wahadłowce eksploracyjne: {p0} z {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Sektory kosmiczne ze skolonizowaną planetą. Kliknij, aby podświetlić wszystkie skolonizowane sektory.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Sektory głębokiej przestrzeni ze skolonizowaną planetą. Kliknij, aby podświetlić wszystkie skolonizowane sektory.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Federacja Gaja",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Imperium Eridanów"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Jogada planejada anterior",
|
||||
"Next planned move": "Próxima jogada planejada",
|
||||
"Edit this move": "Editar esta jogada",
|
||||
"Return to end": "Voltar ao final"
|
||||
"Return to end": "Voltar ao final",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Naves de exploração restantes: {p0} de {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Setores espaciais com um planeta colonizado. Clique para destacar todos os setores colonizados.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Setores do espaço profundo com um planeta colonizado. Clique para destacar todos os setores colonizados.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Federação Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Império Eridani"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Mutarea planificată anterioară",
|
||||
"Next planned move": "Următoarea mutare planificată",
|
||||
"Edit this move": "Editează această mutare",
|
||||
"Return to end": "Revino la final"
|
||||
"Return to end": "Revino la final",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Navete de explorare rămase: {p0} din {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Sectoare spațiale cu o planetă colonizată. Clic pentru a evidenția toate sectoarele colonizate.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Sectoare de spațiu îndepărtat cu o planetă colonizată. Clic pentru a evidenția toate sectoarele colonizate.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Federația Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Imperiul Eridani"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Предыдущий запланированный ход",
|
||||
"Next planned move": "Следующий запланированный ход",
|
||||
"Edit this move": "Изменить этот ход",
|
||||
"Return to end": "Вернуться в конец"
|
||||
"Return to end": "Вернуться в конец",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Осталось исследовательских шаттлов: {p0} из {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Космические секторы с колонизированной планетой. Нажмите, чтобы выделить все колонизированные секторы.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Секторы дальнего космоса с колонизированной планетой. Нажмите, чтобы выделить все колонизированные секторы.",
|
||||
"Twilight — Nautilaks": "Twilight — Наутилаки",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Во'Крон",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Федерация Геи",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Империя Эридана"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "Nước đi đã lên kế hoạch trước",
|
||||
"Next planned move": "Nước đi đã lên kế hoạch tiếp theo",
|
||||
"Edit this move": "Chỉnh sửa nước đi này",
|
||||
"Return to end": "Trở về cuối"
|
||||
"Return to end": "Trở về cuối",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "Tàu con thoi thám hiểm còn lại: {p0} trên {p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Các khu vực không gian có hành tinh đã thuộc địa hóa. Nhấp để làm nổi bật tất cả khu vực đã thuộc địa hóa.",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "Các khu vực không gian sâu có hành tinh đã thuộc địa hóa. Nhấp để làm nổi bật tất cả khu vực đã thuộc địa hóa.",
|
||||
"Twilight — Nautilaks": "Twilight — Nautilaks",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Liên bang Gaia",
|
||||
"Eclipse — Eridani Empire": "Eclipse — Đế chế Eridani"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "上一个计划行动",
|
||||
"Next planned move": "下一个计划行动",
|
||||
"Edit this move": "编辑此行动",
|
||||
"Return to end": "返回末尾"
|
||||
"Return to end": "返回末尾",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "剩余探索穿梭机:{p0}/{p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "有殖民星球的太空星区。点击以标示所有已殖民星区。",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "有殖民星球的深空星区。点击以标示所有已殖民星区。",
|
||||
"Twilight — Nautilaks": "Twilight — 鹦鹉螺星人",
|
||||
"Rebellion — Vo'Kron": "Rebellion — 沃克隆族",
|
||||
"T F Mars — Gaia Federation": "T F Mars — 盖亚星际联邦",
|
||||
"Eclipse — Eridani Empire": "Eclipse — 艾瑞达尼帝国"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4149,5 +4149,12 @@
|
|||
"Previous planned move": "上一個計畫行動",
|
||||
"Next planned move": "下一個計畫行動",
|
||||
"Edit this move": "編輯此行動",
|
||||
"Return to end": "返回末尾"
|
||||
"Return to end": "返回末尾",
|
||||
"Exploration shuttles remaining: {p0} of {p1}": "剩餘探索穿梭機:{p0}/{p1}",
|
||||
"Space sectors with a colonized planet. Click to highlight all colonized sectors.": "有殖民星球的太空星區。點擊以標示所有已殖民星區。",
|
||||
"Deep Space sectors with a colonized planet. Click to highlight all colonized sectors.": "有殖民星球的深空星區。點擊以標示所有已殖民星區。",
|
||||
"Twilight — Nautilaks": "Twilight — 諾提拉斯",
|
||||
"Rebellion — Vo'Kron": "Rebellion — Vo'Kron",
|
||||
"T F Mars — Gaia Federation": "T F Mars — Gaia 聯邦",
|
||||
"Eclipse — Eridani Empire": "Eclipse — 波江座帝國"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ export default defineConfig({
|
|||
exclude: ["src/testing/stack-traces.spec.ts"],
|
||||
globals: true,
|
||||
setupFiles: ["./vitest.setup.ts"],
|
||||
// The suite is big (800+ specs); run all files in ONE forked process sequentially like
|
||||
// mocha did (avoids 800 module-graph re-instantiations; memory is bounded by one process).
|
||||
// Bound memory to one worker. Vitest 4 no longer recognizes singleFork; without
|
||||
// maxWorkers it launches parallel forks and can exhaust memory on the full suite.
|
||||
pool: "forks",
|
||||
singleFork: true,
|
||||
maxWorkers: 1,
|
||||
testTimeout: 15000,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue