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
27
scripts/simulate-expeditions.mjs
Normal file
27
scripts/simulate-expeditions.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Rôle : affiche le rapport d'équilibrage des Expéditions Sokko TCG (réglages par défaut, catalogue et destinations du dépôt).
|
||||
// Usage : node scripts/simulate-expeditions.mjs. À relancer après l'ajout de cartes, d'étiquettes, de destinations ou un changement de réglages.
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { loadCardsCatalog } from "../services/cards/catalog.js";
|
||||
import { loadExpeditionDestinations } from "../services/cards/expedition-content.js";
|
||||
import { DEFAULT_EXPEDITION_SETTINGS, mergeExpeditionSettings } from "../services/cards/expedition-settings.js";
|
||||
import { simulate } from "../services/cards/expedition-simulation.js";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const catalog = loadCardsCatalog(`${root}website/public/data/cards/catalog.json`);
|
||||
const destinations = loadExpeditionDestinations(`${root}services/cards/content/expedition-destinations.json`, catalog);
|
||||
const settings = mergeExpeditionSettings(DEFAULT_EXPEDITION_SETTINGS, destinations.map((destination) => destination.id));
|
||||
const report = simulate(catalog, destinations, settings);
|
||||
const pct = (value) => `${value.toFixed(0).padStart(3)} %`;
|
||||
|
||||
console.log(`Paliers : Réussite à ${settings.score.successPct} %, Triomphe à ${settings.score.triumphPct} %.\n`);
|
||||
console.log("Score des paires de même rareté (minimum / médiane / maximum sur les destinations, 2 h) :");
|
||||
for (const row of report.byRarity) {
|
||||
console.log(` ${row.level.padEnd(10)} ${row.rarity.padEnd(9)} ${row.stars} ★ ${pct(row.min)} / ${pct(row.median)} / ${pct(row.max)}`);
|
||||
}
|
||||
const weakest = [...report.cardBest].sort((a, b) => a.scorePct - b.scorePct).slice(0, 10);
|
||||
console.log("\nCartes au meilleur score le plus bas en 2 ★ (niveau 0, partenaire de même rareté) :");
|
||||
for (const card of weakest) console.log(` ${pct(card.scorePct)} ${card.cardId} (${card.rarity}) à ${card.destinationId} avec ${card.partnerId}`);
|
||||
console.log(`\nDestinations où une paire de rares au plafond triomphe en 4 ★ : ${(report.triumphShareAt4 * 100).toFixed(0)} %`);
|
||||
console.log(`Puissance au plafond : rare ${report.rareVsMythicAtMax.rare}, mythique ${report.rareVsMythicAtMax.mythic}`);
|
||||
console.log("\nÉclats espérés par heure (durées " + settings.durations.hours.join(" / ") + " h) :");
|
||||
for (const row of report.lootPerHour) console.log(` ${row.stars} ★ ${row.tier.padEnd(9)} ${row.perHour.map((value) => value.toFixed(2)).join(" / ")}`);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : démarre le build avec une base Sokko TCG temporaire pour les parcours Playwright.
|
||||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
|
|
@ -34,11 +34,30 @@ insertVariation.run("mythic-card-pull-spectral-prism-solar", "mythic-card-pull",
|
|||
seedService.addCard(partner.id, "starvoid-dragon-spectral-prism-aurora");
|
||||
seedDatabase.close();
|
||||
|
||||
// Horloge du serveur décalable par les parcours (retour d'une expédition sans attendre des heures) : le décalage, en millisecondes,
|
||||
// est lu dans ce fichier, relu au plus toutes les 200 ms. Il repart de zéro à chaque démarrage.
|
||||
const clockFile = join(tmpdir(), "sokkog-cards-e2e-clock.json");
|
||||
writeFileSync(clockFile, JSON.stringify({ offsetMs: 0 }));
|
||||
let clockOffset = 0;
|
||||
let clockReadAt = 0;
|
||||
function now() {
|
||||
const real = Date.now();
|
||||
if (real - clockReadAt > 200) {
|
||||
clockReadAt = real;
|
||||
try {
|
||||
clockOffset = Number(JSON.parse(readFileSync(clockFile, "utf8")).offsetMs) || 0;
|
||||
} catch {
|
||||
clockOffset = 0;
|
||||
}
|
||||
}
|
||||
return real + clockOffset;
|
||||
}
|
||||
|
||||
const { startServer } = await import("../server.mjs");
|
||||
const draws = [0.999, 0, 0.999, 0.999, 0.999, 0];
|
||||
let drawIndex = 0;
|
||||
// Tous les parcours et leurs deux comptes partagent la même adresse IP : la limite par minute les ferait échouer au hasard.
|
||||
const server = startServer({ cardsApiOptions: { allowProductionDevAuth: true, apiRateLimit: 100_000, random: (max) => Math.min(max - 1, Math.floor(draws[drawIndex++ % draws.length] * max)) } });
|
||||
const server = startServer({ cardsApiOptions: { allowProductionDevAuth: true, apiRateLimit: 100_000, now, random: (max) => Math.min(max - 1, Math.floor(draws[drawIndex++ % draws.length] * max)) } });
|
||||
let stopping = false;
|
||||
|
||||
function stop() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue