Give each pack collection its own power common, fix redundant commons and spell out powers in the interface
The Nebula, the Long Night, the Dream Arcade and the Crimson Procession now each have two power commons: Adaptation and one of their own (Étude, Givre d'étoiles, Trouvaille, Chance de l'aube). Eight other commons change stats and four gain a tag, so that no common is dominated by another with the same effect and Bravoure can be equipped like the other stats. Commons that became power commons are taken off the cards that carried them. Card sheets, the equipment window, placed commons and the departure preview show every power's gains and costs with their figures, and the preview says when a power has no effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f949801c62
commit
9739189f0c
31 changed files with 422 additions and 145 deletions
|
|
@ -505,6 +505,12 @@ export const MIGRATIONS = [
|
|||
ALTER TABLE mythic_variations ADD COLUMN flare_intensity INTEGER NOT NULL DEFAULT 3 CHECK (flare_intensity BETWEEN 1 AND 5);
|
||||
ALTER TABLE mythic_variations ADD COLUMN flare_level INTEGER NOT NULL DEFAULT 3 CHECK (flare_level BETWEEN 1 AND 5);
|
||||
ALTER TABLE mythic_variations ADD COLUMN flare_count INTEGER NOT NULL DEFAULT 3 CHECK (flare_count BETWEEN 1 AND 5);
|
||||
`,
|
||||
// Cinq communes à stats portent désormais un pouvoir : elles sont retirées des cartes qui les portaient. Leur effet n'a plus rien
|
||||
// à voir avec celui que le joueur avait choisi, et une carte déjà porteuse d'un pouvoir en aurait eu deux.
|
||||
`
|
||||
DELETE FROM card_equipment WHERE equipment_edition_id IN (
|
||||
'astronomers-notebook-standard', 'starry-snowflake-standard', 'clearing-chest-standard', 'red-moon-comb-standard', 'first-visitor-mask-standard');
|
||||
`
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { randomUUID } from "node:crypto";
|
|||
import { dailyDayKey } from "./daily.js";
|
||||
import {
|
||||
cardExpeditionData, cohesionPct, MAX_ACTIVE_EXPEDITIONS, dangerCount, editionExpeditionData, evaluateTeam, expectedLoot, groupLootPct, hasCondition,
|
||||
requirementsFor, rollRequirementFactor, teamPowers, teamSynergy, TEST_TRIP_MS, travelHours
|
||||
requirementsFor, rollRequirementFactor, teamPowers, teamSynergy, TEST_TRIP_MS, tierLootPct, travelHours
|
||||
} from "./expedition-rules.js";
|
||||
|
||||
const HOUR_MS = 3_600_000;
|
||||
|
|
@ -79,7 +79,9 @@ export const groupMethods = {
|
|||
projectedView(setup, playerSlots, settings) {
|
||||
const { evaluation, cohesion, synergy, powers } = this.evaluateGroup(setup, playerSlots, settings);
|
||||
const team = { players: playerSlots.length, cohesionPct: cohesion, lootPct: groupLootPct(playerSlots.length, settings), powers };
|
||||
return powers.includes("madCompass") ? { hiddenRequirements: true, ...team } : this.resultView(evaluation, team, synergy);
|
||||
// `tierLootPct` : effet du palier prévu sur le butin, Chance de l'aube comprise.
|
||||
const lootOfTier = tierLootPct(evaluation.tier, setup.stars, powers, settings);
|
||||
return powers.includes("madCompass") ? { hiddenRequirements: true, ...team } : this.resultView(evaluation, { ...team, tierLootPct: lootOfTier }, synergy);
|
||||
},
|
||||
|
||||
// Validation de l'ouverture d'une expédition (et de son aperçu) : destination, étoiles et durée, carte du créateur.
|
||||
|
|
@ -94,7 +96,7 @@ export const groupMethods = {
|
|||
if (testTrip) setup.testTrip = true;
|
||||
const { evaluation, cohesion, synergy, powers } = this.evaluateGroup(setup, [slot], settings);
|
||||
const expected = this.teamExpected(setup, evaluation, 1, powers, resolved.destination, settings);
|
||||
return { day, resolved, stars, durationIndex, hours, slot, setup, evaluation, cohesion, synergy, powers, expected };
|
||||
return { day, resolved, stars, durationIndex, hours, slot, setup, evaluation, cohesion, synergy, powers, expected, tierLootPct: tierLootPct(evaluation.tier, stars, powers, settings) };
|
||||
},
|
||||
|
||||
groupSetup({ destination, entry }, stars, hours, settings) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Rôle : améliorations des cartes Sokko TCG pour les Expéditions : niveaux par Éclats ou doublon, Éveil aux paliers, expérience de terrain, plans de progression
|
||||
// (vocation ou points libres, changés avec un Parchemin d'oubli), pont depuis la poussière et achat des objets de la boutique.
|
||||
// Ces méthodes s'ajoutent à ExpeditionService (Object.assign sur son prototype) et utilisent `this` comme lui.
|
||||
import { allocationError, awakeningPower, awakeningsAhead, cardExpeditionData, clampAllocation, editionExpeditionData, gainProgress, levelPoints, maxLevel, maxStatPoints, PLAN_IDS, planStats, SHOP_ITEM_PRICES, splitPower, STAT_IDS, upgradeCost, VOCATION_IDS } from "./expedition-rules.js";
|
||||
import { allocationError, awakeningPower, awakeningsAhead, cardExpeditionData, clampAllocation, editionExpeditionData, fieldXpPct, gainProgress, levelPoints, maxLevel, maxStatPoints, PLAN_IDS, planStats, SHOP_ITEM_PRICES, splitPower, STAT_IDS, upgradeCost, VOCATION_IDS } from "./expedition-rules.js";
|
||||
|
||||
function fail(status, code, message) {
|
||||
throw Object.assign(new Error(message), { status, code });
|
||||
|
|
@ -237,10 +237,11 @@ export const progressMethods = {
|
|||
},
|
||||
|
||||
// Expérience de terrain : chaque carte du joueur revenue d'expédition gagne une part de niveau, proportionnelle à la durée choisie
|
||||
// (`fieldXpPct` par tranche de `fieldXpHours` heures ; une expédition sans durée connue compte une tranche).
|
||||
gainFieldXpInTx(playerId, editionIds, settings, hours = null) {
|
||||
// (`fieldXpPct` par tranche de `fieldXpHours` heures ; une expédition sans durée connue compte une tranche). `powers` : pouvoirs
|
||||
// de l'équipe à son départ (Étude).
|
||||
gainFieldXpInTx(playerId, editionIds, settings, hours = null, powers = []) {
|
||||
if (!settings.progression.fieldXpPct) return;
|
||||
const xpPct = Math.round(settings.progression.fieldXpPct * (Number(hours) > 0 ? hours / settings.progression.fieldXpHours : 1));
|
||||
const xpPct = fieldXpPct(Number(hours) > 0 ? hours : settings.progression.fieldXpHours, powers, settings);
|
||||
for (const editionId of editionIds) {
|
||||
const data = editionExpeditionData(this.cards.catalog, editionId, 0, settings);
|
||||
if (!data || !this.cards.quantityOf(playerId, editionId)) continue;
|
||||
|
|
|
|||
|
|
@ -319,6 +319,21 @@ export function specialtyPcts(count, settings) {
|
|||
return count === 2 ? { boostPct: specialty.pairBoostPct, otherPct: specialty.pairOtherPct } : { boostPct: specialty.boostPct, otherPct: specialty.otherPct };
|
||||
}
|
||||
|
||||
// Effet d'un palier sur le butin, en %. Chance de l'aube : à partir de `dawnLuckMinStars` étoiles, un Triomphe rapporte plus et une
|
||||
// Réussite moins ; aux étoiles faciles, où le Triomphe est acquis, elle ne change rien.
|
||||
export function tierLootPct(tier, stars, powers, settings) {
|
||||
const base = settings.loot.tierPct[TIER_IDS.indexOf(tier)];
|
||||
if (!powers.includes("dawnLuck") || stars < settings.powers.dawnLuckMinStars) return base;
|
||||
const changePct = { triumph: settings.powers.dawnLuckTriumphPct, success: -settings.powers.dawnLuckSuccessPct }[tier] ?? 0;
|
||||
return base * (1 + changePct / 100);
|
||||
}
|
||||
|
||||
// Expérience de terrain d'une expédition, en % d'un niveau, proportionnelle à la durée choisie (Étude : une part en plus).
|
||||
export function fieldXpPct(hours, powers, settings) {
|
||||
const study = powers.includes("study") ? 1 + settings.powers.studyXpPct / 100 : 1;
|
||||
return Math.round(settings.progression.fieldXpPct * (hours / settings.progression.fieldXpHours) * study);
|
||||
}
|
||||
|
||||
// Tranches de durée d'une expédition pour ses plafonds de butin : une par `loot.capHours` heures choisies, au moins une.
|
||||
export const capSlices = (hours, settings) => Math.max(1, Math.floor(hours / settings.loot.capHours));
|
||||
|
||||
|
|
@ -330,7 +345,14 @@ export function expectedLoot({ hours, stars, tier, fortune, slotCount, bonusSlot
|
|||
const cardFactor = powers.includes("longsight") ? 1 + settings.powers.longsightPackPct / 100 : 1;
|
||||
// Longue-vue : plus de chance de carte, et une carte de plus au plafond (utile sur les longs voyages).
|
||||
const cardCap = loot.maxCards * capSlices(hours, settings) + (powers.includes("longsight") ? settings.powers.longsightExtraCards : 0);
|
||||
const base = hours * (loot.difficultyPct[stars - 1] / 100) * (loot.tierPct[TIER_IDS.indexOf(tier)] / 100) * bonus;
|
||||
const base = hours * (loot.difficultyPct[stars - 1] / 100) * (tierLootPct(tier, stars, powers, settings) / 100) * bonus;
|
||||
// Givre d'étoiles et Trouvaille : plus d'une récompense, moins d'Éclats (la Trouvaille relève aussi le plafond d'objets).
|
||||
const frost = powers.includes("starFrost");
|
||||
const findings = powers.includes("findings");
|
||||
const eclatsFactor = (frost ? 1 - settings.powers.starFrostEclatsPct / 100 : 1) * (findings ? 1 - settings.powers.findingsEclatsPct / 100 : 1);
|
||||
const stardustFactor = frost ? 1 + settings.powers.starFrostStardustPct / 100 : 1;
|
||||
const objectFactor = findings ? 1 + settings.powers.findingsObjectsPct / 100 : 1;
|
||||
const objectCap = settings.items.maxPerExpedition * capSlices(hours, settings) + (findings ? settings.powers.findingsExtraObjects : 0);
|
||||
const fortuneBonusPct = Math.min(loot.fortuneCapPct, (fortune / Math.max(1, slotCount)) * loot.fortunePerPointPct);
|
||||
// Spécialité : une récompense favorisée ×boostPct (les trois autres ×otherPct), ou deux ×pairBoostPct (les deux autres
|
||||
// ×pairOtherPct) ; sans spécialité, tout reste neutre.
|
||||
|
|
@ -338,11 +360,12 @@ export function expectedLoot({ hours, stars, tier, fortune, slotCount, bonusSlot
|
|||
const pcts = specialtyPcts(boosted.size, settings);
|
||||
const factor = (key) => (!boosted.size ? 1 : boosted.has(key) ? pcts.boostPct / 100 : pcts.otherPct / 100);
|
||||
return {
|
||||
eclats: base * (loot.eclatsPerHourCents / 100) * factor("eclats"),
|
||||
stardust: base * (loot.stardustPerHourCents / 100) * factor("stardust"),
|
||||
eclats: base * (loot.eclatsPerHourCents / 100) * factor("eclats") * eclatsFactor,
|
||||
stardust: base * (loot.stardustPerHourCents / 100) * factor("stardust") * stardustFactor,
|
||||
cards: Math.min(cardCap, base * (loot.cardPerHourPermille / 1000) * (1 + fortuneBonusPct / 100) * cardFactor * factor("cards")),
|
||||
cardCap,
|
||||
objects: Math.min(settings.items.maxPerExpedition * capSlices(hours, settings), base * (settings.items.chancePerHourPermille / 1000) * factor("objects")),
|
||||
objects: Math.min(objectCap, base * (settings.items.chancePerHourPermille / 1000) * factor("objects") * objectFactor),
|
||||
xpPct: fieldXpPct(hours, powers, settings),
|
||||
fortuneBonusPct,
|
||||
hours
|
||||
};
|
||||
|
|
@ -624,15 +647,16 @@ export function pickItems(count, { orientationPerSlot, excluded = [] }, settings
|
|||
return items;
|
||||
}
|
||||
|
||||
export const POWER_IDS = Object.freeze(["longsight", "rations", "treasureMap", "talisman", "madCompass", "starNet", "stormLantern", "fogBell", "attunement"]);
|
||||
export const POWER_IDS = Object.freeze(["longsight", "rations", "treasureMap", "talisman", "madCompass", "starNet", "stormLantern", "fogBell", "attunement",
|
||||
"study", "starFrost", "findings", "dawnLuck"]);
|
||||
|
||||
// Pouvoirs d'une équipe : chacun ne compte qu'une fois, quel que soit le nombre de cartes qui le portent.
|
||||
export function teamPowers(slots) {
|
||||
return [...new Set(slots.flatMap((slot) => slot.powers || []))].filter((power) => POWER_IDS.includes(power));
|
||||
}
|
||||
|
||||
// Multiplicateur de butin des pouvoirs : les Provisions en retirent une part, la Boussole folle en ajoute,
|
||||
// la Cloche de brume en retire une part en solo.
|
||||
// Multiplicateur de butin des pouvoirs : les Provisions et le Carnet de l'Astronome en retirent une part, la Boussole folle en
|
||||
// ajoute, la Cloche de brume en retire une part en solo.
|
||||
// Coup de folie : multiplicateur des exigences réelles, tiré au départ entre `madCompassMinPct` et `madCompassMaxPct` (100 sans le
|
||||
// pouvoir).
|
||||
export function rollRequirementFactor(powers, settings, random) {
|
||||
|
|
@ -646,6 +670,7 @@ export function powerLootFactor(powers, settings, { group = false } = {}) {
|
|||
if (powers.includes("rations")) factor *= 1 - settings.powers.rationsLootPct / 100;
|
||||
if (powers.includes("madCompass")) factor *= 1 + settings.powers.madCompassLootPct / 100;
|
||||
if (powers.includes("fogBell") && !group) factor *= 1 - settings.powers.fogBellSoloLootPct / 100;
|
||||
if (powers.includes("study")) factor *= 1 - settings.powers.studyLootPct / 100;
|
||||
return factor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ export class ExpeditionService {
|
|||
}
|
||||
|
||||
expectedView(expected) {
|
||||
return { eclats: round1(expected.eclats), stardust: round1(expected.stardust), cardChancePct: round1(Math.min(1, expected.cards) * 100), fortuneBonusPct: round1(expected.fortuneBonusPct) };
|
||||
return { eclats: round1(expected.eclats), stardust: round1(expected.stardust), objects: round1(expected.objects), xpPct: expected.xpPct, cardChancePct: round1(Math.min(1, expected.cards) * 100), fortuneBonusPct: round1(expected.fortuneBonusPct) };
|
||||
}
|
||||
|
||||
// Aperçu exact de l'expédition que le joueur ouvrirait, si elle partait seule.
|
||||
|
|
@ -388,7 +388,7 @@ export class ExpeditionService {
|
|||
const requirementRange = { min: settings.powers.madCompassMinPct, max: settings.powers.madCompassMaxPct };
|
||||
return { preview: { hiddenRequirements: true, requirementRange, powers: plan.powers, travelHours: travel, expected: this.expectedView(plan.expected) } };
|
||||
}
|
||||
return { preview: { ...this.resultView(plan.evaluation, { ...(plan.cohesion != null ? { cohesionPct: plan.cohesion } : {}), powers: plan.powers }, plan.synergy), travelHours: travel, expected: this.expectedView(plan.expected) } };
|
||||
return { preview: { ...this.resultView(plan.evaluation, { ...(plan.cohesion != null ? { cohesionPct: plan.cohesion } : {}), powers: plan.powers, tierLootPct: plan.tierLootPct }, plan.synergy), travelHours: travel, expected: this.expectedView(plan.expected) } };
|
||||
}
|
||||
|
||||
// Vue d'une expédition pour un participant : le résultat et le butin n'apparaissent qu'au retour.
|
||||
|
|
@ -500,7 +500,7 @@ export class ExpeditionService {
|
|||
const waiting = this.db.prepare("SELECT COUNT(*) AS count FROM expedition_members WHERE expedition_id = ? AND claimed_at IS NULL").get(row.id).count;
|
||||
if (!waiting) this.db.prepare("UPDATE expeditions SET status = 'completed', completed_at = ? WHERE id = ?").run(now, row.id);
|
||||
const editionIds = this.db.prepare("SELECT edition_id FROM expedition_slots WHERE expedition_id = ? AND player_id = ? ORDER BY position").all(row.id, playerId).map((slot) => slot.edition_id);
|
||||
this.gainFieldXpInTx(playerId, editionIds, this.settings, setup.hours);
|
||||
this.gainFieldXpInTx(playerId, editionIds, this.settings, setup.hours, result.powers);
|
||||
this.cards.audit(playerId, "expedition_completed", row.id, {
|
||||
destinationId: setup.destination.id, destinationName: setup.destination.name, difficulty: row.difficulty, hours: setup.hours,
|
||||
mode: row.mode, players: result.players ?? 1, tier: result.tier, scorePct: result.scorePct, eclats: reward.eclats, stardust: reward.stardust, packs: reward.packs.length, items: reward.items || [], cards: reward.cards || [], editionIds
|
||||
|
|
|
|||
|
|
@ -41,9 +41,13 @@ export const DEFAULT_EXPEDITION_SETTINGS = Object.freeze({
|
|||
// qui ouvre la partie cachée (fragments, burins, plans), fragments pour une carte au trésor, butin des destinations cachées et poids de tirage.
|
||||
// Pouvoirs des communes : avantage et contrepartie de chacun, les durées en plus en % de la durée choisie, la chance du Filet par
|
||||
// heure choisie, sa Fortune en moins par place. Talisman : score minimal qui change un Retour difficile en
|
||||
// Réussite (jamais de Triomphe). Adaptation : points ajoutés à la stat exigée la plus faible de sa carte.
|
||||
// Réussite (jamais de Triomphe). Adaptation : points ajoutés à la stat exigée la plus faible de sa carte. Étude : expérience en
|
||||
// plus, butin en moins. Givre d'étoiles : poussière en plus, Éclats en moins. Trouvaille : objets en plus (chance et plafond),
|
||||
// Éclats en moins. Chance de l'aube : étoiles à partir desquelles elle agit, butin d'un Triomphe en plus, d'une Réussite en moins.
|
||||
powers: { longsightPackPct: 40, longsightExtraPct: 25, longsightExtraCards: 1, rationsTimePct: 25, rationsLootPct: 25, treasureMapScorePct: 10, madCompassLootPct: 30, madCompassMinPct: 80, madCompassMaxPct: 130, starNetCardPctPerHour: 5, starNetFortune: 2,
|
||||
stormLanternDangerPct: 50, stormLanternExtraPct: 10, fogBellSynergyPct: 10, fogBellSoloLootPct: 20, talismanFloorPct: 60, attunementPoints: 4 },
|
||||
stormLanternDangerPct: 50, stormLanternExtraPct: 10, fogBellSynergyPct: 10, fogBellSoloLootPct: 20, talismanFloorPct: 60, attunementPoints: 4,
|
||||
studyXpPct: 50, studyLootPct: 15, starFrostStardustPct: 150, starFrostEclatsPct: 15, findingsObjectsPct: 50, findingsExtraObjects: 1, findingsEclatsPct: 15,
|
||||
dawnLuckMinStars: 4, dawnLuckTriumphPct: 35, dawnLuckSuccessPct: 15 },
|
||||
// Cartes des Carnets des Veilleurs rapportées d'expédition (chance par heure, multipliée comme le butin) et au plus par expédition.
|
||||
// Cartes de destination : chance d'en rapporter une que le joueur n'a pas (Carnets des Veilleurs), et chance d'obtenir la carte
|
||||
// de la destination d'un groupe rejoint sans l'avoir. Une carte de destination de départ est offerte une fois.
|
||||
|
|
@ -154,6 +158,16 @@ export const EXPEDITION_SETTINGS_SCHEMA = Object.freeze([
|
|||
int("powers.fogBellSoloLootPct", 0, 90),
|
||||
int("powers.talismanFloorPct", 0, 300),
|
||||
int("powers.attunementPoints", 0, 20),
|
||||
int("powers.studyXpPct", 0, 500),
|
||||
int("powers.studyLootPct", 0, 90),
|
||||
int("powers.starFrostStardustPct", 0, 500),
|
||||
int("powers.starFrostEclatsPct", 0, 90),
|
||||
int("powers.findingsObjectsPct", 0, 500),
|
||||
int("powers.findingsExtraObjects", 0, 3),
|
||||
int("powers.findingsEclatsPct", 0, 90),
|
||||
int("powers.dawnLuckMinStars", 1, 5),
|
||||
int("powers.dawnLuckTriumphPct", 0, 500),
|
||||
int("powers.dawnLuckSuccessPct", 0, 90),
|
||||
int("destinationCards.dropPct", 0, 100),
|
||||
int("destinationCards.groupJoinPct", 0, 100),
|
||||
int("specialty.boostPct", 100, 300),
|
||||
|
|
|
|||
|
|
@ -669,6 +669,8 @@ export class CardsService {
|
|||
expeditions: this.expeditions.summary(playerId),
|
||||
cardProgress: this.expeditions.cardProgressView(playerId),
|
||||
equipment: this.expeditions.equipmentChoices(playerId),
|
||||
// Valeurs des effets d'une commune (ses pouvoirs, les points d'une synergie), pour sa fiche dans la collection.
|
||||
equipmentValues: { ...this.expeditions.settings.powers, synergyBonus: this.expeditions.settings.equipment.synergyBonus },
|
||||
alerts: this.expeditions.alertPreferences(playerId),
|
||||
items: this.expeditions.itemsOf(playerId),
|
||||
recycling: { count: recycling.count, stardust: recycling.stardust, byRarity: recycling.byRarity },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue