Add solo Expeditions, the second Guilde des Veilleurs quest of Sokko TCG
- Every catalog card carries expedition tags and every collection a stat profile, validated at load; twelve destinations live server-side so hidden ones stay secret. - Pure rules compute card power, per-slot requirements, roles, dangers, the long-trip malus, the score (one more star never raises it) and loot proportional to the chosen duration. - A simulator script and a balance test guard the design thresholds; agent docs and a new-card skill explain how to tag new cards. - Migration 8 adds Éclats d'étoile, expedition settings stored as one validated JSON, daily destinations, expeditions, members and slots, and rebuilds gift_packs so a pack can come from an expedition. - Players launch a solo expedition from the Guild, see an exact preview, and claim their loot when it returns; the card sheet shows cards away on an expedition. - Administration › Guilde tunes every value with server-side bounds, toggles destinations and cancels running expeditions; expeditions stay closed until an administrator opens them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ef213cf4f
commit
8bb1d53d70
46 changed files with 4752 additions and 213 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : valide l'ouverture, la reprise, l'album et l'administration de Sokko TCG.
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
|
@ -1822,3 +1822,79 @@ test("a player finds the daily card with hints and copies the result", async ({
|
|||
await expect(quest.locator(".nebula-quest-media .nds-badge")).toHaveText("Série : 1 jour");
|
||||
await expect(quest.getByRole("link", { name: "Voir le résultat", exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
// Dernier parcours : il ouvre les Expéditions et décale l'horloge du serveur, deux réglages globaux qu'il remet en place à la fin.
|
||||
test("an administrator opens expeditions and a player sends a team, then claims its loot", async ({ browser, page }) => {
|
||||
const clockFile = join(tmpdir(), "sokkog-cards-e2e-clock.json");
|
||||
const setServerClock = (offsetMs) => writeFile(clockFile, JSON.stringify({ offsetMs }));
|
||||
await setServerClock(0);
|
||||
await page.goto("/#/cards");
|
||||
await page.getByRole("button", { name: "Version développement", exact: true }).click();
|
||||
await page.goto("/#/cards/admin/guild");
|
||||
const general = page.getByRole("region", { name: "Général", exact: true });
|
||||
const openToggle = general.getByRole("button", { name: "Expéditions ouvertes aux joueurs", exact: true });
|
||||
await expect(openToggle).toHaveAttribute("aria-pressed", "false");
|
||||
await openToggle.click();
|
||||
await general.getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await expect(general.getByRole("button", { name: "Expéditions ouvertes aux joueurs", exact: true })).toHaveAttribute("aria-pressed", "true");
|
||||
await expect(page.getByRole("region", { name: "Destinations", exact: true }).getByRole("listitem")).toHaveCount(12);
|
||||
|
||||
// Le partenaire possède deux légendaires distinctes : de quoi partir en solo.
|
||||
const { token } = JSON.parse(await readFile(join(tmpdir(), "sokkog-cards-e2e-partner.json"), "utf8"));
|
||||
const partnerContext = await browser.newContext({ baseURL: "http://127.0.0.1:4180", viewport: { width: 1280, height: 900 } });
|
||||
await partnerContext.addCookies([{ name: "__Host-sokkog_cards_session", value: token, domain: "127.0.0.1", path: "/", secure: true, httpOnly: true, sameSite: "Lax" }]);
|
||||
const partner = await partnerContext.newPage();
|
||||
await partner.goto("/#/cards/guild");
|
||||
const quest = partner.getByRole("article", { name: "Expéditions" });
|
||||
await expect(quest).toContainText("De nouvelles destinations vous attendent.");
|
||||
await quest.getByRole("link", { name: "Préparer", exact: true }).click();
|
||||
await expect(partner).toHaveURL(/#\/cards\/expeditions$/);
|
||||
await expect(partner.getByRole("navigation", { name: "Sections de Sokko TCG" }).getByRole("link", { name: /^Guilde/ })).toHaveAttribute("aria-current", "page");
|
||||
|
||||
const destinations = partner.getByRole("region", { name: "1. Destination du jour" }).getByRole("button");
|
||||
await expect(destinations).toHaveCount(4);
|
||||
await expect(destinations.first()).toHaveAttribute("aria-pressed", "true");
|
||||
const settings = partner.getByRole("region", { name: "2. Difficulté et durée" });
|
||||
await settings.getByRole("button", { name: "★", exact: true }).click();
|
||||
await settings.getByRole("button", { name: "2 h", exact: true }).click();
|
||||
const team = partner.getByRole("region", { name: "3. Équipe" });
|
||||
await team.getByRole("button", { name: /^Placer Loup des Aurores en / }).click();
|
||||
await team.getByRole("button", { name: /^Placer Dragon du Néant Étoilé en / }).first().click();
|
||||
const preview = partner.getByRole("region", { name: "4. Aperçu" });
|
||||
await expect(preview).toContainText(/Butin attendu : environ [\d,]+ Éclats/);
|
||||
await expect(preview.locator(".nebula-expedition-preview .nds-badge").first()).toHaveText(/^(Retour difficile|Réussite|Triomphe)$/);
|
||||
await preview.getByRole("button", { name: "Partir en expédition", exact: true }).click();
|
||||
await expect(partner.getByRole("status").filter({ hasText: "Expédition lancée !" })).toBeVisible();
|
||||
const report = partner.locator(".nebula-expedition-report").first();
|
||||
await expect(report).toContainText(/En route, retour dans (1 h|2 h)/);
|
||||
await expect(partner.getByText("Récupérez le butin de votre expédition avant d’en lancer une autre.")).toBeVisible();
|
||||
|
||||
// En demi-écran, la page reste sans défilement horizontal.
|
||||
await partner.setViewportSize({ width: 768, height: 900 });
|
||||
expect(await partner.locator(".nebula-expeditions").evaluate((element) => element.scrollWidth - element.clientWidth)).toBe(0);
|
||||
await partner.setViewportSize({ width: 1280, height: 900 });
|
||||
|
||||
// Trois heures plus tard pour le serveur : l'expédition est revenue, son butin se récupère une fois.
|
||||
await setServerClock(3 * 3_600_000);
|
||||
await partner.reload();
|
||||
await expect(report).toContainText("De retour ! Le butin vous attend.");
|
||||
await report.getByRole("button", { name: "Récupérer le butin", exact: true }).click();
|
||||
await expect(partner.getByRole("status").filter({ hasText: "Butin récupéré !" })).toBeVisible();
|
||||
await expect(report).toContainText("Butin récupéré.");
|
||||
await expect(report.locator(".nebula-expedition-rewards .nds-badge").filter({ hasText: /^\+[\d\s]+ Éclats$/ })).toBeVisible();
|
||||
await expect(partner.locator(".nebula-expeditions .nds-section-heading .nds-badge")).not.toHaveText("0 Éclats d’étoile");
|
||||
await partner.getByRole("navigation", { name: "Sections de Sokko TCG" }).getByRole("link", { name: "Historique", exact: true }).click();
|
||||
await expect(partner.locator(".nebula-history-list li").filter({ hasText: "Expédition terminée" })).toContainText("★ · 2 h");
|
||||
await partnerContext.close();
|
||||
|
||||
// L'historique d'administration détaille le réglage ; on referme les Expéditions et on remet l'horloge.
|
||||
await page.goto("/#/cards/admin/history");
|
||||
await expect(page.locator(".nds-list-row").filter({ hasText: "Expéditions modifiées" }).first()).toContainText("Expéditions ouvertes aux joueurs : non → oui");
|
||||
await page.goto("/#/cards/admin/guild");
|
||||
await general.getByRole("button", { name: "Expéditions ouvertes aux joueurs", exact: true }).click();
|
||||
await general.getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Appliquer", exact: true }).click();
|
||||
await expect(general.getByRole("button", { name: "Expéditions ouvertes aux joueurs", exact: true })).toHaveAttribute("aria-pressed", "false");
|
||||
await setServerClock(0);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue