An expedition now opens with a single card. Its creator leaves alone right away, or opens it to the Guild board with an invite link and launches it whenever they want; at the end of recruitment it leaves by itself, alone or as a group, and is never dissolved for lack of players. Stars no longer depend on the number of players, a player has one expedition at a time, and roles are gone: each card brings its stats and a team adds them up, so every requirement is its per-slot share times the number of slots. The page follows the player's path: the offered destination card is revealed once in a modal, then Préparer shows the destinations (stat requirements, condition and dangers coloured for the chosen card, loot effects), a frame with the sent card in large size, its equipment slots and stats, and the duration and departure. Cards and commons are chosen in modals with sorts and highlighted current picks; tags get matching colours on the card and on equipment synergies. Once gone, the trip is shown with a progress bar and moving cards, the loot opens in a modal, and finished expeditions move to a Journal tab with the Grimoire. Power commons get short power names of their own and show their exact effects on hover, a card holds one power at a time, and Coup de folie now draws the real requirements between 80 % and 130 % of the shown ones, revealed on return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
89 lines
4.9 KiB
JavaScript
89 lines
4.9 KiB
JavaScript
// Rôle : simule les Expéditions Sokko TCG sur toutes les équipes possibles pour vérifier l'équilibre (script et test d'équilibrage).
|
|
// Module pur : il appelle les mêmes règles que le serveur, sans base ni hasard.
|
|
import { cardRarity } from "./daily.js";
|
|
import {
|
|
cardExpeditionData, cardPower, evaluateTeam, EXPEDITION_RARITIES, expectedLoot, maxLevel, MAX_STARS, planStats, ROLE_BY_STAT, splitPower, TIER_IDS
|
|
} from "./expedition-rules.js";
|
|
|
|
// Cartes jouables : chaque carte rare ou mieux à sa rareté, plus une mythique virtuelle pour chaque légendaire.
|
|
export function simulationCards(catalog) {
|
|
const cards = [];
|
|
for (const card of catalog.cards) {
|
|
const rarity = cardRarity(catalog, card.id);
|
|
const data = cardExpeditionData(catalog, card.id);
|
|
if (!EXPEDITION_RARITIES.includes(rarity) || !data) continue;
|
|
cards.push({ ...data, rarity });
|
|
if (rarity === "legendary") cards.push({ ...data, rarity: "mythic" });
|
|
}
|
|
return cards;
|
|
}
|
|
|
|
const atLevel = (card, level, settings) => {
|
|
const power = cardPower(card.rarity, level, settings);
|
|
return { ...card, level, power, stats: splitPower(power, card.profile) };
|
|
};
|
|
|
|
const entryFor = (destination) => ({ condition: destination.conditions[0], dangers: destination.dangers.slice(0, 2) });
|
|
|
|
// Carte construite pour une destination : ses points de niveau suivent la vocation de sa stat principale.
|
|
const builtFor = (card, destination, settings) => ({ ...card, stats: planStats(card.rarity, card.level, card.profile, { plan: ROLE_BY_STAT[destination.stats[0]] }, settings) });
|
|
|
|
// Score d'une carte partie seule sur une destination. `built` : la carte a la vocation de la stat principale de la destination.
|
|
export function bestSoloScore(card, destination, stars, durationIndex, settings, built = false) {
|
|
return evaluateTeam({ destination, entry: entryFor(destination), stars, durationIndex, slots: [built ? builtFor(card, destination, settings) : card] }, settings);
|
|
}
|
|
|
|
// Rapport complet, pour des cartes parties seules : meilleur score de chaque carte en 2 ★, extrêmes par rareté et étoiles, butin par
|
|
// heure, écart rare / mythique au plafond.
|
|
export function simulate(catalog, destinations, settings) {
|
|
const visible = destinations.filter((destination) => !destination.hidden);
|
|
const base = simulationCards(catalog);
|
|
const atZero = base.map((card) => atLevel(card, 0, settings));
|
|
const atMax = base.map((card) => atLevel(card, maxLevel(card.rarity, settings), settings));
|
|
|
|
// 1. Chaque carte doit atteindre Réussite en 2 ★ quelque part, seule, au niveau 0.
|
|
const cardBest = atZero.map((card) => {
|
|
let best = { scorePct: 0, destinationId: null };
|
|
for (const destination of visible) {
|
|
const result = bestSoloScore(card, destination, 2, 0, settings);
|
|
if (result.scorePct > best.scorePct) best = { scorePct: result.scorePct, destinationId: destination.id };
|
|
}
|
|
return { cardId: card.cardId, rarity: card.rarity, ...best };
|
|
});
|
|
|
|
// 2. Score par rareté, étoiles et niveau : minimum, médiane et maximum sur toutes les cartes et destinations.
|
|
const byRarity = [];
|
|
// « max+vocat. » : les mêmes cartes, chacune avec la vocation de la stat principale de la destination (plans de progression).
|
|
for (const [label, cards, built] of [["niveau 0", atZero, false], ["niveau max", atMax, false], ["max+vocat.", atMax, true]]) {
|
|
for (const rarity of EXPEDITION_RARITIES) {
|
|
const ofRarity = cards.filter((card) => card.rarity === rarity);
|
|
for (let stars = 1; stars <= MAX_STARS; stars += 1) {
|
|
const scores = [];
|
|
for (const card of ofRarity) for (const destination of visible) scores.push(bestSoloScore(card, destination, stars, 0, settings, built).scorePct);
|
|
scores.sort((x, y) => x - y);
|
|
byRarity.push({ level: label, rarity, stars, min: scores[0] ?? 0, median: scores[Math.floor(scores.length / 2)] ?? 0, max: scores.at(-1) ?? 0 });
|
|
}
|
|
}
|
|
}
|
|
|
|
// 3. Triomphe en 4 ★ au niveau maximum : part des destinations où au moins une rare au plafond triomphe seule.
|
|
const maxRares = atMax.filter((card) => card.rarity === "rare");
|
|
const triumphDestinations = visible.filter((destination) => maxRares.some((card) => bestSoloScore(card, destination, 4, 0, settings).tier === "triumph")).length;
|
|
|
|
// 4. Butin espéré par heure, pour chaque durée, étoile et palier.
|
|
const lootPerHour = [];
|
|
for (let stars = 1; stars <= MAX_STARS; stars += 1) {
|
|
for (const tier of TIER_IDS) {
|
|
const perHour = settings.durations.hours.map((hours) => expectedLoot({ hours, stars, tier, fortune: 0, slotCount: 1 }, settings).eclats / hours);
|
|
lootPerHour.push({ stars, tier, perHour });
|
|
}
|
|
}
|
|
|
|
return {
|
|
cardBest,
|
|
byRarity,
|
|
triumphShareAt4: visible.length ? triumphDestinations / visible.length : 0,
|
|
lootPerHour,
|
|
rareVsMythicAtMax: { rare: cardPower("rare", maxLevel("rare", settings), settings), mythic: cardPower("mythic", maxLevel("mythic", settings), settings) }
|
|
};
|
|
}
|