Add the shattered ice effect and five-step tunings for mythic variations
« Glace brisée » joins the holographic effects: a seamless shard mosaic in four facet groups that each light up near their own tilt, with glinting cracks; in the standard layout it covers the frame and text and stays under the artwork. Its masks come from scripts/generate-shattered-ice-textures.mjs. Each mythic variation now tunes its palette intensity and, when the effect declares one, its own level (prism speed, parallax amplitude, shard size), from 1 to 5 with 3 as the reference render. Tunings are stored on mythic_variations, set with range sliders when a variation is created or later in the mythic editor, logged in the history and previewed in the Visual Lab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
efdb5c558c
commit
808adadc0c
23 changed files with 463 additions and 31 deletions
|
|
@ -449,3 +449,5 @@
|
|||
{"id":"int-0d747b5002f3c0ea920420c0a0a2a252","kind":"field_change","created_at":"2026-11-21T16:17:50.491271549Z","actor":"Shinuwa","issue_id":"sokko-g-lzov","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Sokko TCG and Expeditions styles load with the cards route (cards-route.scss, imported by CardsPage) and re-emit the three late sheets so the cascade is unchanged (verified byte for byte against the previous build). Common CSS 94 243 → 69 413 o gzip, budget lowered to 75 000; cold home 1 557 424 o."}}
|
||||
{"id":"int-dee60321fbd2d9574fb5bac63bf0be2d","kind":"field_change","created_at":"2026-11-21T16:49:09.73375071Z","actor":"Shinuwa","issue_id":"sokko-g-t8ig","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Finition modifiable depuis l'admin (crayon), id conservé ; tests unitaires, API et e2e ajoutés"}}
|
||||
{"id":"int-2bbd2c76193c4fb098ea70a32ad248c6","kind":"field_change","created_at":"2026-11-21T17:30:59.206437281Z","actor":"Shinuwa","issue_id":"sokko-g-4bnb","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Prototype Parallaxe prismatique disponible dans l’Atelier visuel, comparaison avec l’Écrin actuel ajoutée, prompts et setup de couches documentés, check:full validé."}}
|
||||
{"id":"int-2b918586f7e3fb55443858e1948ac365","kind":"field_change","created_at":"2026-11-21T21:31:58.383758099Z","actor":"Shinuwa","issue_id":"sokko-g-qp2y","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Glace brisée ajoutée au catalogue comme quatrième effet holographique (finitions générées, palier de taille des éclats), validée par l'utilisateur le 2026-11-21."}}
|
||||
{"id":"int-44cf17594a942cc45489c59af8598230","kind":"field_change","created_at":"2026-11-21T21:32:10.26683769Z","actor":"Shinuwa","issue_id":"sokko-g-i9j6","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Paliers de 1 à 5 réglés au curseur (intensité de la palette, palier propre à l'effet), enregistrés par variation mythique, réglables dès la création d'une variation et essayables dans l'Atelier."}}
|
||||
|
|
|
|||
|
|
@ -1328,7 +1328,8 @@ L'Atelier visuel regroupe deux bancs d'essai distincts. La section « Effets
|
|||
holographiques mythiques », en premier, affiche une carte `lg` (300 x 420 px) de « La Pioche
|
||||
Mythique » par effet holographique, y compris ceux qu'aucune édition n'utilise
|
||||
encore, avec le menu de palette de sept couleurs et un menu « Particules au
|
||||
survol » désactivé, réservé au réglage à venir. La section « Effets d'ouverture » suit avec
|
||||
survol » désactivé, réservé au réglage à venir, ainsi que les curseurs des paliers
|
||||
(intensité de la palette et palier propre à l'effet). La section « Effets d'ouverture » suit avec
|
||||
une carte face cachée par rareté, la Mythique en tête : seule sur sa ligne,
|
||||
limitée à 760 px et centrée, aperçu à gauche et menus de forme puis de palette
|
||||
de particules empilés (dont « Comme la palette holo »), puis Rare, Épique et Légendaire partagent une ligne de trois colonnes à
|
||||
|
|
@ -1443,6 +1444,29 @@ rythmes différents ; la silhouette du héros se frange enfin de deux couleurs
|
|||
opposées de la palette, décalées en sens inverse. Sans plaque de décor, le
|
||||
composite la remplace ; sans héros détouré, l'illustration reste un seul plan
|
||||
immobile qui garde le prisme. Le mouvement réduit fige les calques.
|
||||
Le preset **Glace brisée** (`shattered-ice`) couvre la carte d'une mosaïque d'éclats
|
||||
en quatre groupes de facettes : chaque groupe ne s'allume que lorsque l'inclinaison
|
||||
approche de sa propre orientation, si bien que les éclats scintillent par groupes,
|
||||
dans les couleurs de la palette, au lieu d'une bande qui glisse ; les fissures
|
||||
accrochent une lumière blanche. En format standard, elle couvre le cadre et le
|
||||
texte et passe sous l'illustration, qui reste intacte ; en pleine illustration,
|
||||
elle passe devant, plus discrète. Ses masques, raccordables, sont générés par
|
||||
`scripts/generate-shattered-ice-textures.mjs` ; l'effet ne demande aucun fichier
|
||||
par carte.
|
||||
Chaque variation mythique règle deux **paliers**, de 1 à 5 avec un curseur
|
||||
`nds-range` dont le libellé affiche le cran ; le niveau 3 reproduit le rendu de
|
||||
référence et n'ajoute aucun attribut. L'**intensité de la palette** (`effectIntensity`,
|
||||
de Très douce à Très intense), commune à tous les effets, multiplie l'opacité de
|
||||
leurs calques de couleur (`data-holo-intensity`, `--holo-intensity` de 0,5 à 1,5) ;
|
||||
le **palier propre à l'effet**, quand le catalogue lui en déclare un
|
||||
(`effectPresets[].level`), règle la vitesse du Prisme spectral (9 à 3 s),
|
||||
l'amplitude de la Parallaxe prismatique (`--parallax-reach` de 0,025 à 0,065) ou
|
||||
la taille des éclats de la Glace brisée (×0,6 à ×1,5), via `data-holo-level`. Le
|
||||
Reflet diffractif n'a que l'intensité. Dans l'éditeur mythique, les curseurs se
|
||||
règlent dès la création d'une variation, puis sur chaque variation enregistrée :
|
||||
l'aperçu suit le curseur aussitôt et l'enregistrement part quand le réglage se
|
||||
pose, visible par les joueurs qui la possèdent. L'Atelier visuel propose les
|
||||
mêmes curseurs en aperçu.
|
||||
Le gradient surdimensionné se déplace uniquement de `0 %` à `100 %`, sans
|
||||
répétition visible. Les couleurs de la palette sont répétées et espacées
|
||||
automatiquement, sans paliers explicites, afin de conserver des bandes régulières
|
||||
|
|
|
|||
|
|
@ -698,6 +698,21 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await solarVariation.getByRole("button", { name: "Valider la nouvelle finition de Prisme spectral — Solaire" }).click();
|
||||
await page.getByRole("dialog", { name: "Changer la finition de Prisme spectral — Solaire ?" }).getByRole("button", { name: "Changer la finition" }).click();
|
||||
await expect(dragonVariations.locator("strong")).toHaveText(["Aurore", "Cosmique"]);
|
||||
// Les paliers d'une variation, de 1 à 5 : l'aperçu suit le curseur, l'enregistrement suit quand le réglage se pose.
|
||||
const tunedVariation = mythicEditorPanel.getByRole("group", { name: "Prisme spectral — Aurore" });
|
||||
const tunedCard = tunedVariation.locator('.nebula-card[data-card-size="sm"]');
|
||||
await tunedVariation.getByRole("slider", { name: "Intensité" }).fill("5");
|
||||
await expect(tunedCard).toHaveAttribute("data-holo-intensity", "5");
|
||||
await tunedVariation.getByRole("slider", { name: "Vitesse" }).fill("1");
|
||||
await expect(tunedCard).toHaveAttribute("data-holo-level", "1");
|
||||
const tunedEdition = async () => (await page.evaluate(() => globalThis.fetch("/api/cards/config").then((response) => response.json()))).catalog.editions.find((edition) => edition.id === "starvoid-dragon-spectral-prism-aurora");
|
||||
await expect.poll(async () => { const edition = await tunedEdition(); return [edition.holoIntensity, edition.holoLevel]; }).toEqual([5, 1]);
|
||||
// Retour aux paliers centraux : la variation retrouve son rendu de référence, sans attribut.
|
||||
await tunedVariation.getByRole("slider", { name: "Intensité" }).fill("3");
|
||||
await tunedVariation.getByRole("slider", { name: "Vitesse" }).fill("3");
|
||||
await expect.poll(async () => { const edition = await tunedEdition(); return [edition.holoIntensity, edition.holoLevel]; }).toEqual([undefined, undefined]);
|
||||
await expect(tunedCard).not.toHaveAttribute("data-holo-level");
|
||||
await expect(tunedCard).not.toHaveAttribute("data-holo-intensity");
|
||||
await mythicEditorPanel.getByRole("button", { name: "Fermer" }).click();
|
||||
await expect(mythicEditorPanel).toHaveCount(0);
|
||||
await expect(dragonTileButton).toHaveAttribute("aria-pressed", "false");
|
||||
|
|
@ -814,6 +829,10 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await expect(editorSurface).toHaveAttribute("data-particle-shape", "snowflakes");
|
||||
await expect(editorSurface).toHaveAttribute("data-particle-palette", "match-holo");
|
||||
await expect(editorSurface).toHaveCSS("--opening-aura", "#ff0000");
|
||||
// Les paliers se règlent dès la création : ils s'enregistrent avec la nouvelle variation.
|
||||
const draftVariation = editor.locator(".nebula-admin-mythic-variation[data-new]");
|
||||
await draftVariation.getByRole("slider", { name: "Intensité" }).fill("4");
|
||||
await expect(draftVariation.locator('.nebula-card[data-card-size="sm"]')).toHaveAttribute("data-holo-intensity", "4");
|
||||
await editor.getByRole("button", { name: "Valider la nouvelle variation" }).click();
|
||||
await expect(editor.locator(".nebula-admin-mythic-variation[data-new]")).toHaveCount(0);
|
||||
await expect(editor.locator(".nebula-admin-mythic-variation")).toHaveCount(2);
|
||||
|
|
@ -824,7 +843,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await noOverflow();
|
||||
|
||||
const config = await page.evaluate(() => globalThis.fetch("/api/cards/config").then((response) => response.json()));
|
||||
expect(config.catalog.editions.some((edition) => edition.id === "mythic-card-pull-spectral-prism-rainbow")).toBe(true);
|
||||
expect(config.catalog.editions.find((edition) => edition.id === "mythic-card-pull-spectral-prism-rainbow")?.holoIntensity).toBe(4);
|
||||
expect(config.catalog.mythicOpeningSettings).toEqual(expect.arrayContaining([
|
||||
{ scope: "card", targetId: "mythic-card-pull", particleShapeId: null, particlePaletteId: "match-holo" },
|
||||
{ scope: "collection", targetId: "astral-genesis", particleShapeId: "snowflakes", particlePaletteId: null }
|
||||
|
|
@ -869,7 +888,12 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
expect(Math.abs((mythicBox.x - gridBox.x) - (gridBox.x + gridBox.width - mythicBox.x - mythicBox.width))).toBeLessThanOrEqual(1);
|
||||
|
||||
const effectStyles = page.locator(".nebula-admin-effect-grid .nebula-admin-style-card");
|
||||
await expect(effectStyles.locator("h4")).toHaveText(["Prisme spectral", "Reflet diffractif", "Parallaxe prismatique"]);
|
||||
await expect(effectStyles.locator("h4")).toHaveText(["Prisme spectral", "Reflet diffractif", "Parallaxe prismatique", "Glace brisée"]);
|
||||
const iceCard = effectStyles.filter({ has: page.getByRole("heading", { name: /Glace brisée/ }) }).locator('.nebula-card[data-holo-effect="shattered-ice"]');
|
||||
await expect(iceCard.locator(".nebula-card-holo-shards > i")).toHaveCount(4);
|
||||
await expect(iceCard.locator('.nebula-card-holo-shards > [data-facet="0"]')).toHaveCSS("mask-image", /shattered-ice-facet-0\.webp/);
|
||||
// En format standard, la glace passe sous l'illustration, qui reste intacte.
|
||||
expect(await iceCard.evaluate((element) => { const view = element.ownerDocument.defaultView; return Number(view.getComputedStyle(element.querySelector(".nebula-card-art")).zIndex) > Number(view.getComputedStyle(element.querySelector(".nebula-card-holo-shards")).zIndex); })).toBe(true);
|
||||
// La Parallaxe prismatique pose le héros détouré de la carte sur son décor sans lui, puis les décale selon leur profondeur.
|
||||
const parallaxStyle = effectStyles.filter({ has: page.getByRole("heading", { name: "Parallaxe prismatique", exact: true }) });
|
||||
const parallaxCard = parallaxStyle.locator('.nebula-card[data-holo-effect="prismatic-backdrop"]');
|
||||
|
|
@ -891,6 +915,18 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await expect(parallaxCard.locator('[data-depth-layer="backdrop"] img[src$="/mythic_card_pull__full__backdrop.webp"]')).toBeVisible();
|
||||
await expect(parallaxCard.locator('[data-depth-layer="subject"] img[src$="/mythic_card_pull__full__cutout.webp"]')).toBeVisible();
|
||||
await chooseOption(parallaxStyle, "Format", "Standard");
|
||||
// Les paliers, de 1 à 5, s'essaient sur l'aperçu : intensité de la palette pour tous les effets, amplitude pour la parallaxe.
|
||||
const parallaxIntensity = parallaxStyle.getByRole("slider", { name: "Intensité" });
|
||||
await expect(parallaxIntensity).toHaveValue("3");
|
||||
await expect(parallaxCard).not.toHaveAttribute("data-holo-intensity");
|
||||
await parallaxIntensity.fill("5");
|
||||
await expect(parallaxCard).toHaveAttribute("data-holo-intensity", "5");
|
||||
await expect(parallaxStyle.locator(".nebula-admin-tuning-range").first()).toContainText("Très intense");
|
||||
await parallaxStyle.getByRole("slider", { name: "Amplitude" }).fill("1");
|
||||
await expect(parallaxCard).toHaveAttribute("data-holo-level", "1");
|
||||
// Le Reflet diffractif n'a que l'intensité ; la Glace brisée règle la taille de ses éclats.
|
||||
await expect(effectStyles.filter({ has: page.getByRole("heading", { name: "Reflet diffractif", exact: true }) }).getByRole("slider")).toHaveCount(1);
|
||||
await expect(effectStyles.filter({ has: page.getByRole("heading", { name: "Glace brisée", exact: true }) }).getByRole("slider", { name: "Taille des éclats" })).toBeVisible();
|
||||
const spectralStyle = effectStyles.filter({ has: page.getByRole("heading", { name: "Prisme spectral", exact: true }) });
|
||||
// Les aperçus holographiques gardent le vrai format `lg`, 300 x 420 px.
|
||||
const holoPreviewBox = await spectralStyle.locator(".nebula-admin-style-preview > .nebula-card").boundingBox();
|
||||
|
|
|
|||
78
scripts/generate-shattered-ice-textures.mjs
Normal file
78
scripts/generate-shattered-ice-textures.mjs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// Rôle : génère les masques de l'effet holographique « Glace brisée » : une mosaïque d'éclats raccordable sur ses bords,
|
||||
// répartie en quatre groupes de facettes (un masque par groupe), plus le masque des fissures qui les séparent.
|
||||
// Usage : node scripts/generate-shattered-ice-textures.mjs
|
||||
import { mkdir } from "node:fs/promises";
|
||||
import sharp from "sharp";
|
||||
|
||||
const SIZE = 512;
|
||||
const GRID = 7; // 7 x 7 germes décalés : environ 49 éclats de tailles voisines par tuile.
|
||||
const GROUPS = 4;
|
||||
const OUT = "website/public/static/img/cards/effects";
|
||||
|
||||
// Générateur pseudo-aléatoire déterministe : la même commande redonne exactement les mêmes textures.
|
||||
let seed = 20261121;
|
||||
const random = () => {
|
||||
seed = (seed * 1664525 + 1013904223) >>> 0;
|
||||
return seed / 2 ** 32;
|
||||
};
|
||||
|
||||
const cells = [];
|
||||
for (let row = 0; row < GRID; row++) {
|
||||
for (let column = 0; column < GRID; column++) {
|
||||
const angle = random() * Math.PI * 2;
|
||||
cells.push({
|
||||
x: ((column + 0.15 + random() * 0.7) / GRID) * SIZE,
|
||||
y: ((row + 0.15 + random() * 0.7) / GRID) * SIZE,
|
||||
group: Math.floor(random() * GROUPS),
|
||||
// Chaque éclat reçoit un dégradé interne propre : il paraît incliné, comme un vrai fragment de glace.
|
||||
shadeX: Math.cos(angle),
|
||||
shadeY: Math.sin(angle),
|
||||
shadeMin: 0.45 + random() * 0.3
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Distance sur un tore : la tuile se raccorde à elle-même dans les deux directions.
|
||||
const wrapped = (delta) => {
|
||||
const value = Math.abs(delta) % SIZE;
|
||||
return Math.min(value, SIZE - value);
|
||||
};
|
||||
|
||||
const facets = Array.from({ length: GROUPS }, () => Buffer.alloc(SIZE * SIZE * 2));
|
||||
const cracks = Buffer.alloc(SIZE * SIZE * 2);
|
||||
for (let y = 0; y < SIZE; y++) {
|
||||
for (let x = 0; x < SIZE; x++) {
|
||||
let first = Infinity;
|
||||
let second = Infinity;
|
||||
let owner = null;
|
||||
for (const cell of cells) {
|
||||
const distance = Math.hypot(wrapped(x - cell.x), wrapped(y - cell.y));
|
||||
if (distance < first) {
|
||||
second = first;
|
||||
first = distance;
|
||||
owner = cell;
|
||||
} else if (distance < second) {
|
||||
second = distance;
|
||||
}
|
||||
}
|
||||
// Près de la médiatrice entre deux germes, l'écart entre les deux distances s'annule : c'est la fissure.
|
||||
const crack = Math.max(0, Math.min(1, 1 - (second - first - 1.2) / 1.6));
|
||||
const offset = (y * SIZE + x) * 2;
|
||||
cracks[offset] = 255;
|
||||
cracks[offset + 1] = Math.round(crack * 255);
|
||||
const dx = (x - owner.x) / (SIZE / GRID);
|
||||
const dy = (y - owner.y) / (SIZE / GRID);
|
||||
const shade = owner.shadeMin + (1 - owner.shadeMin) * Math.max(0, Math.min(1, 0.5 + (dx * owner.shadeX + dy * owner.shadeY)));
|
||||
const facet = facets[owner.group];
|
||||
facet[offset] = 255;
|
||||
facet[offset + 1] = Math.round((1 - crack) * shade * 255);
|
||||
}
|
||||
}
|
||||
|
||||
await mkdir(OUT, { recursive: true });
|
||||
const write = (buffer, name) => sharp(buffer, { raw: { width: SIZE, height: SIZE, channels: 2 } }).webp({ lossless: true }).toFile(`${OUT}/${name}`);
|
||||
await Promise.all([
|
||||
...facets.map((buffer, index) => write(buffer, `shattered-ice-facet-${index}.webp`)),
|
||||
write(cracks, "shattered-ice-cracks.webp")
|
||||
]);
|
||||
console.log(`${GROUPS} masques de facettes et un masque de fissures écrits dans ${OUT}.`);
|
||||
|
|
@ -492,6 +492,12 @@ export function createCardsApiHandler({
|
|||
json(res, 200, service.setCardMythicConfig(session.player.id, cardMythic[0], { finishIds: body.finishIds, opening: { particleShapeId: body.opening?.particleShapeId ?? null, particlePaletteId: body.opening?.particlePaletteId ?? null } }));
|
||||
return true;
|
||||
}
|
||||
const mythicTuning = routeMatch(url.pathname, /^\/api\/cards\/admin\/catalog\/mythics\/([^/]+)\/tuning$/);
|
||||
if (req.method === "PUT" && mythicTuning) {
|
||||
const body = await readBody(req);
|
||||
json(res, 200, service.setMythicTuning(session.player.id, mythicTuning[0], { intensity: body.intensity, level: body.level }));
|
||||
return true;
|
||||
}
|
||||
const mythicFinish = routeMatch(url.pathname, /^\/api\/cards\/admin\/catalog\/mythics\/([^/]+)\/finish$/);
|
||||
if (req.method === "PUT" && mythicFinish) {
|
||||
json(res, 200, service.setMythicFinish(session.player.id, mythicFinish[0], (await readBody(req)).finishId));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,13 @@ const STANDARD_FORMAT = "standard";
|
|||
export const FULL_ART_FORMAT = "full-art";
|
||||
// Palette d'ouverture spéciale : reprend les couleurs de la palette holographique de la variation.
|
||||
export const MATCH_HOLO_PALETTE_ID = "match-holo";
|
||||
// Paliers d'une variation mythique, de 1 à 5 : l'intensité de la palette, commune à tous les effets, et le palier propre à
|
||||
// l'effet (vitesse, amplitude…) quand il en déclare un. Le palier central, 3, est la valeur par défaut et le rendu de référence.
|
||||
export const EFFECT_TUNING_STEPS = 5;
|
||||
export const DEFAULT_EFFECT_TUNING = 3;
|
||||
export const isEffectTuning = (value) => Number.isInteger(value) && value >= 1 && value <= EFFECT_TUNING_STEPS;
|
||||
const validTuningScale = (scale) => typeof scale?.label === "string" && scale.label.length > 0 && Array.isArray(scale.levels)
|
||||
&& scale.levels.length === EFFECT_TUNING_STEPS && scale.levels.every((label) => typeof label === "string" && label.length > 0);
|
||||
const CARD_IMAGE_PATTERN = /^\/static\/img\/cards\/[a-z0-9-]+\/(?:common|rare|epic|legendary)\/[a-z0-9_]+\.webp$/;
|
||||
const PACK_BACK_IMAGE_PATTERN = /^\/static\/img\/cards\/[a-z0-9-]+\/back\.webp$/;
|
||||
// Étiquettes d'expédition : vocabulaire fermé, par famille (personnage, lieu, thème, objet).
|
||||
|
|
@ -127,7 +134,9 @@ export function validateCardsCatalog(catalog) {
|
|||
|
||||
for (const preset of catalog.effectPresets) {
|
||||
if (!preset.label || preset.kind !== "holographic") throw new TypeError(`Invalid holographic effect preset ${preset.id}.`);
|
||||
if (preset.level != null && !validTuningScale(preset.level)) throw new TypeError(`Holographic effect preset ${preset.id} level needs a label and ${EFFECT_TUNING_STEPS} level labels.`);
|
||||
}
|
||||
if (!validTuningScale(catalog.effectIntensity)) throw new TypeError(`Cards catalog effectIntensity needs a label and ${EFFECT_TUNING_STEPS} level labels.`);
|
||||
if (catalog.cardFormats?.[0]?.id !== STANDARD_FORMAT || catalog.cardFormats.some((format) => !format.label) || !catalog.cardFormats.some((format) => format.id === FULL_ART_FORMAT)) {
|
||||
throw new TypeError("Cards catalog must declare the standard and full-art formats.");
|
||||
}
|
||||
|
|
@ -237,6 +246,12 @@ export function validateCardsCatalog(catalog) {
|
|||
if (!RARITY_IDS.has(edition.rarity)) throw new TypeError(`Unknown rarity for edition ${edition.id}.`);
|
||||
if (!Array.isArray(edition.finishIds) || edition.finishIds.some((id) => !finishIds.has(id))) throw new TypeError(`Unknown finish for edition ${edition.id}.`);
|
||||
if (edition.retired != null && typeof edition.retired !== "boolean") throw new TypeError(`Edition ${edition.id} retired flag must be a boolean.`);
|
||||
if (edition.holoIntensity != null || edition.holoLevel != null) {
|
||||
const preset = catalog.effectPresets.find((item) => item.id === catalog.finishes.find((finish) => finish.id === edition.finishIds[0])?.effectPresetId);
|
||||
if (!preset) throw new TypeError(`Edition ${edition.id} can only be tuned with a holographic finish.`);
|
||||
if (edition.holoIntensity != null && !isEffectTuning(edition.holoIntensity)) throw new TypeError(`Edition ${edition.id} has an unknown holographic intensity.`);
|
||||
if (edition.holoLevel != null && (!preset.level || !isEffectTuning(edition.holoLevel))) throw new TypeError(`Edition ${edition.id} has a level its effect does not declare.`);
|
||||
}
|
||||
if (destinationCards.some((card) => card.id === edition.cardId) && edition.rarity !== "rare") throw new TypeError(`Destination card edition ${edition.id} must be rare.`);
|
||||
if (edition.promotional && edition.legendaryEditionId) throw new TypeError(`Promotional edition ${edition.id} cannot require a legendary parent.`);
|
||||
if (edition.rarity === "mythic" && !edition.promotional) {
|
||||
|
|
@ -394,7 +409,8 @@ export function isMythicEditionIdOf(editionId, cardId) {
|
|||
}
|
||||
|
||||
// Construit le catalogue publié : catalogue versionné + variations mythiques et réglages d'ouverture enregistrés en base.
|
||||
// `variations` : [{ editionId, cardId, finishId, status: "active" | "retired" }]
|
||||
// `variations` : [{ editionId, cardId, finishId, status: "active" | "retired", intensity?, level? }] ; un palier central ou absent
|
||||
// n'est pas publié, et le palier d'effet seulement si l'effet de la finition en déclare un.
|
||||
// `openingSettings` : [{ scope: "collection" | "card", targetId, particleShapeId | null, particlePaletteId | null }]
|
||||
// `collectionStates` : [{ collectionId, active }] ; une collection sans état est inactive.
|
||||
// `dropRates` : [{ collectionId, rarityWeights }] ; publiés sur chaque collection dans `dropWeights`.
|
||||
|
|
@ -410,6 +426,7 @@ export function buildPublishedCatalog(versionedCatalog, { variations = [], openi
|
|||
if (!collection.dropWeights) throw new TypeError(`Active collection ${collection.id} needs drop rates.`);
|
||||
}
|
||||
const holographic = holographicFinishIds(catalog);
|
||||
const effectOf = (finishId) => catalog.effectPresets.find((preset) => preset.id === catalog.finishes.find((finish) => finish.id === finishId)?.effectPresetId);
|
||||
const knownIds = new Set(catalog.editions.map((edition) => edition.id));
|
||||
const cardFinishes = new Set();
|
||||
const mythics = variations.map((variation) => {
|
||||
|
|
@ -428,7 +445,9 @@ export function buildPublishedCatalog(versionedCatalog, { variations = [], openi
|
|||
finishIds: [variation.finishId],
|
||||
promotional: false,
|
||||
legendaryEditionId: parent.id,
|
||||
...(variation.status === "retired" ? { retired: true } : {})
|
||||
...(variation.status === "retired" ? { retired: true } : {}),
|
||||
...(isEffectTuning(variation.intensity) && variation.intensity !== DEFAULT_EFFECT_TUNING ? { holoIntensity: variation.intensity } : {}),
|
||||
...(isEffectTuning(variation.level) && variation.level !== DEFAULT_EFFECT_TUNING && effectOf(variation.finishId)?.level ? { holoLevel: variation.level } : {})
|
||||
};
|
||||
});
|
||||
// Chaque variation suit sa carte légendaire, dans l'ordre des finitions.
|
||||
|
|
|
|||
|
|
@ -487,6 +487,12 @@ export const MIGRATIONS = [
|
|||
// l'identifiant ne garantit donc plus qu'une carte a une seule variation par finition, cet index le fait.
|
||||
`
|
||||
CREATE UNIQUE INDEX mythic_variations_card_finish_idx ON mythic_variations(card_id, finish_id);
|
||||
`,
|
||||
// Paliers d'une variation mythique, de 1 à 5 : intensité de la palette et palier propre à l'effet (vitesse, amplitude…). Le
|
||||
// palier central, 3, ne change rien au rendu : les variations existantes gardent exactement leur apparence.
|
||||
`
|
||||
ALTER TABLE mythic_variations ADD COLUMN holo_intensity INTEGER NOT NULL DEFAULT 3 CHECK (holo_intensity BETWEEN 1 AND 5);
|
||||
ALTER TABLE mythic_variations ADD COLUMN holo_level INTEGER NOT NULL DEFAULT 3 CHECK (holo_level BETWEEN 1 AND 5);
|
||||
`
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
|
||||
import { normalizeReward } from "./rewards.js";
|
||||
import { MASS_RECYCLE_RARITIES, planRecycling, spareQuantity, validateShopSetting } from "./stardust.js";
|
||||
import { FULL_ART_FORMAT, buildPublishedCatalog, collectionDrawableEditions, createCatalogIndex, holographicFinishIds, isMythicEditionIdOf, legendaryParentEdition, MATCH_HOLO_PALETTE_ID, mythicEditionId, publicCatalog, validateRarityWeights } from "./catalog.js";
|
||||
import { DEFAULT_EFFECT_TUNING, FULL_ART_FORMAT, isEffectTuning, buildPublishedCatalog, collectionDrawableEditions, createCatalogIndex, holographicFinishIds, isMythicEditionIdOf, legendaryParentEdition, MATCH_HOLO_PALETTE_ID, mythicEditionId, publicCatalog, validateRarityWeights } from "./catalog.js";
|
||||
import { computeStreak, DAILY_REPEAT_WINDOW_DAYS, dailyCandidates, dailyDayKey, dailyZoom, drawDailyPuzzle, guessHint, isDayKey, MAX_DAILY_GUESSES, nextDailyAt, shiftDayKey } from "./daily.js";
|
||||
import { calculateRecharge, pinnedRecharge, drawPack, drawShopPack, MAX_RECHARGE_INTERVAL_MS, MAX_RESERVE_OPENINGS, MIN_RECHARGE_INTERVAL_MS, spendOpening } from "./game-rules.js";
|
||||
import { DEFAULT_DESTINATIONS_PATH, loadExpeditionDestinations } from "./expedition-content.js";
|
||||
|
|
@ -153,8 +153,8 @@ export class CardsService {
|
|||
const collectionIds = new Set(versioned.collections.map((collection) => collection.id));
|
||||
const shapeIds = new Set(versioned.particleShapes.map((shape) => shape.id));
|
||||
const paletteIds = new Set([...versioned.particlePalettes.map((palette) => palette.id), MATCH_HOLO_PALETTE_ID]);
|
||||
const variations = this.db.prepare("SELECT edition_id, card_id, finish_id, status FROM mythic_variations").all()
|
||||
.map((row) => ({ editionId: row.edition_id, cardId: row.card_id, finishId: row.finish_id, status: row.status }))
|
||||
const variations = this.db.prepare("SELECT edition_id, card_id, finish_id, status, holo_intensity, holo_level FROM mythic_variations").all()
|
||||
.map((row) => ({ editionId: row.edition_id, cardId: row.card_id, finishId: row.finish_id, status: row.status, intensity: row.holo_intensity, level: row.holo_level }))
|
||||
.filter((row) => holographic.has(row.finishId) && legendaryParentEdition(versioned, row.cardId) && isMythicEditionIdOf(row.editionId, row.cardId));
|
||||
const openingSettings = this.db.prepare("SELECT scope, target_id, particle_shape_id, particle_palette_id FROM mythic_opening_settings ORDER BY scope, target_id").all()
|
||||
.map((row) => ({
|
||||
|
|
@ -305,6 +305,26 @@ export class CardsService {
|
|||
return { catalog: publicCatalog(this.catalog) };
|
||||
}
|
||||
|
||||
// Règle les paliers d'une variation : intensité de la palette et palier propre à son effet, s'il en déclare un. Les joueurs qui
|
||||
// la possèdent voient aussitôt le nouveau réglage, sans autre changement.
|
||||
setMythicTuning(playerId, editionId, { intensity, level } = {}) {
|
||||
this.requireAdmin(playerId);
|
||||
const versioned = this.versionedCatalog;
|
||||
const row = this.db.prepare("SELECT card_id, finish_id, holo_intensity, holo_level FROM mythic_variations WHERE edition_id = ?").get(editionId);
|
||||
if (!row || !versioned.cards.some((item) => item.id === row.card_id)) fail(404, "MYTHIC_NOT_FOUND", "Variation mythique introuvable.");
|
||||
const preset = versioned.effectPresets.find((item) => item.id === versioned.finishes.find((finish) => finish.id === row.finish_id)?.effectPresetId);
|
||||
if (!isEffectTuning(intensity)) fail(400, "INTENSITY_INVALID", "Choisissez une intensité de palette entre 1 et 5.");
|
||||
if (!isEffectTuning(level)) fail(400, "LEVEL_INVALID", "Choisissez un palier d’effet entre 1 et 5.");
|
||||
if (!preset?.level && level !== DEFAULT_EFFECT_TUNING) fail(400, "LEVEL_UNAVAILABLE", "Cet effet n’a pas de palier réglable.");
|
||||
if (row.holo_intensity === intensity && row.holo_level === level) fail(400, "TUNING_UNCHANGED", "La variation a déjà ces réglages.");
|
||||
this.database.transaction(() => {
|
||||
this.db.prepare("UPDATE mythic_variations SET holo_intensity = ?, holo_level = ?, updated_at = ?, updated_by = ? WHERE edition_id = ?").run(intensity, level, this.now(), playerId, editionId);
|
||||
this.audit(playerId, "catalog_mythic_tuning_changed", row.card_id, { editionId, intensity, level });
|
||||
this.reloadCatalog();
|
||||
});
|
||||
return { catalog: publicCatalog(this.catalog) };
|
||||
}
|
||||
|
||||
requireCollection(collectionId) {
|
||||
if (!this.versionedCatalog.collections.some((collection) => collection.id === collectionId)) fail(404, "COLLECTION_NOT_FOUND", "Collection introuvable.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ test("finishes are generated: standard plus one per holographic effect and seven
|
|||
assert.equal("finishes" in rawCatalog, false);
|
||||
const preset = catalog.effectPresets.find((effect) => effect.id === "spectral-prism");
|
||||
assert.equal(preset.kind, "holographic");
|
||||
assert.deepEqual(catalog.finishes.map((finish) => finish.id), ["standard", ...["", "full-art-"].flatMap((format) => ["spectral-prism", "diffraction-sheen", "prismatic-backdrop"].flatMap((effect) => ["rainbow", "solar", "dusk", "crimson", "nature", "aurora", "winter", "cosmic", "darkness"].map((palette) => `${format}${effect}-${palette}`)))]);
|
||||
assert.deepEqual(catalog.finishes.map((finish) => finish.id), ["standard", ...["", "full-art-"].flatMap((format) => ["spectral-prism", "diffraction-sheen", "prismatic-backdrop", "shattered-ice"].flatMap((effect) => ["rainbow", "solar", "dusk", "crimson", "nature", "aurora", "winter", "cosmic", "darkness"].map((palette) => `${format}${effect}-${palette}`)))]);
|
||||
assert.deepEqual(catalog.finishes[0], { id: "standard", label: "Standard", effectPresetId: null, paletteId: null, formatId: "standard" });
|
||||
assert.ok(catalog.finishes.every((finish) => !("particlePresetId" in finish)));
|
||||
assert.ok(catalog.effectPalettes.every((palette) => palette.colors.length === 7 && new Set(palette.colors).size === 7));
|
||||
|
|
@ -273,7 +273,7 @@ test("finishes are generated: standard plus one per holographic effect and seven
|
|||
withNewEffect.effectPresets.push({ id: "effect-x", kind: "holographic", label: "Effet X" });
|
||||
withNewEffect.effectPalettes.push({ id: "ember", label: "Braise", colors: ["#7f1d1d", "#b91c1c", "#ef4444", "#f97316", "#fb923c", "#fdba74", "#fff7ed"], highlight: "#ffffff" });
|
||||
const generated = prepareVersionedCatalog(withNewEffect).finishes;
|
||||
assert.equal(generated.length, 1 + 2 * 4 * 10);
|
||||
assert.equal(generated.length, 1 + 2 * 5 * 10);
|
||||
assert.deepEqual(generated.find((finish) => finish.id === "effect-x-ember"), { id: "effect-x-ember", label: "Effet X — Braise", effectPresetId: "effect-x", paletteId: "ember", formatId: "standard" });
|
||||
|
||||
const invalidPalette = structuredClone(rawCatalog);
|
||||
|
|
@ -1205,6 +1205,65 @@ test("changing a mythic finish keeps its id, the players' copies and their exped
|
|||
database.close();
|
||||
});
|
||||
|
||||
test("a mythic variation tunes its palette intensity and its effect level, kept across finish changes", () => {
|
||||
const now = 1_800_000_000_000;
|
||||
const database = new CardsDatabase(":memory:");
|
||||
const service = new CardsService({ database, catalog: baseCatalog, now: () => now, random: () => 0 });
|
||||
const admin = service.upsertPlayer({ discordId: "tuning-admin", displayName: "Admin", isAdmin: true });
|
||||
const player = service.upsertPlayer({ discordId: "tuning-player", displayName: "Player" });
|
||||
service.setCardMythicConfig(admin.id, "mythic-card-pull", { finishIds: ["prismatic-backdrop-solar", "diffraction-sheen-solar"] });
|
||||
const parallax = "mythic-card-pull-prismatic-backdrop-solar";
|
||||
const diffraction = "mythic-card-pull-diffraction-sheen-solar";
|
||||
const editionOf = (catalog, id) => catalog.editions.find((edition) => edition.id === id);
|
||||
// Une variation neuve garde le palier central, 3 : rien n'est publié, le rendu de référence s'applique.
|
||||
assert.deepEqual([editionOf(service.catalog, parallax).holoIntensity, editionOf(service.catalog, parallax).holoLevel], [undefined, undefined]);
|
||||
|
||||
assert.throws(() => service.setMythicTuning(player.id, parallax, { intensity: 5, level: 5 }), /administrateur/);
|
||||
assert.throws(() => service.setMythicTuning(admin.id, "unknown-mythic", { intensity: 5, level: 5 }), /introuvable/);
|
||||
assert.throws(() => service.setMythicTuning(admin.id, parallax, { intensity: 6, level: 5 }), /intensité/);
|
||||
assert.throws(() => service.setMythicTuning(admin.id, parallax, { intensity: "5", level: 5 }), /intensité/);
|
||||
assert.throws(() => service.setMythicTuning(admin.id, parallax, { intensity: 5, level: 0 }), /palier/);
|
||||
// Le Reflet diffractif ne déclare pas de palier propre : seule son intensité se règle.
|
||||
assert.throws(() => service.setMythicTuning(admin.id, diffraction, { intensity: 5, level: 1 }), /pas de palier/);
|
||||
assert.throws(() => service.setMythicTuning(admin.id, parallax, { intensity: 3, level: 3 }), /déjà ces réglages/);
|
||||
|
||||
const tuned = editionOf(service.setMythicTuning(admin.id, parallax, { intensity: 1, level: 5 }).catalog, parallax);
|
||||
assert.deepEqual([tuned.holoIntensity, tuned.holoLevel], [1, 5]);
|
||||
assert.equal(editionOf(service.setMythicTuning(admin.id, diffraction, { intensity: 4, level: 3 }).catalog, diffraction).holoIntensity, 4);
|
||||
const audit = database.db.prepare("SELECT entity_id, details_json FROM audit_log WHERE event_type = 'catalog_mythic_tuning_changed' ORDER BY rowid").get();
|
||||
assert.deepEqual([audit.entity_id, JSON.parse(audit.details_json)], ["mythic-card-pull", { editionId: parallax, intensity: 1, level: 5 }]);
|
||||
|
||||
// Vers un effet sans palier propre, l'intensité reste et le palier n'est plus publié ; il revient avec un effet qui en a un.
|
||||
service.setMythicFinish(admin.id, parallax, "diffraction-sheen-cosmic");
|
||||
assert.deepEqual([editionOf(service.catalog, parallax).holoIntensity, editionOf(service.catalog, parallax).holoLevel], [1, undefined]);
|
||||
service.setMythicFinish(admin.id, parallax, "shattered-ice-cosmic");
|
||||
assert.equal(editionOf(service.catalog, parallax).holoLevel, 5);
|
||||
// Les réglages survivent au redémarrage ; la base refuse un palier hors de 1 à 5.
|
||||
const reloaded = new CardsService({ database, catalog: baseCatalog, now: () => now });
|
||||
assert.deepEqual([editionOf(reloaded.catalog, parallax).holoIntensity, editionOf(reloaded.catalog, parallax).holoLevel], [1, 5]);
|
||||
assert.throws(() => database.db.prepare("UPDATE mythic_variations SET holo_level = 6 WHERE edition_id = ?").run(parallax), /CHECK/);
|
||||
database.close();
|
||||
});
|
||||
|
||||
test("holographic effect levels and intensities are declared by the catalog and checked on editions", () => {
|
||||
assert.deepEqual(rawCatalog.effectIntensity.levels, ["Très douce", "Douce", "Normale", "Intense", "Très intense"]);
|
||||
assert.deepEqual(rawCatalog.effectPresets.filter((preset) => preset.level).map((preset) => preset.id), ["spectral-prism", "prismatic-backdrop", "shattered-ice"]);
|
||||
const withoutIntensity = structuredClone(rawCatalog);
|
||||
delete withoutIntensity.effectIntensity;
|
||||
assert.throws(() => prepareVersionedCatalog(withoutIntensity), /effectIntensity/);
|
||||
const brokenLevel = structuredClone(rawCatalog);
|
||||
brokenLevel.effectPresets.find((preset) => preset.id === "prismatic-backdrop").level.levels.pop();
|
||||
assert.throws(() => prepareVersionedCatalog(brokenLevel), /level needs a label/);
|
||||
const variation = (extra) => ({ editionId: "mythic-card-pull-x", cardId: "mythic-card-pull", finishId: "diffraction-sheen-solar", status: "active", ...extra });
|
||||
// Un palier d'effet n'est publié que si l'effet de la finition en déclare un.
|
||||
const published = buildPublishedCatalog(baseCatalog, { variations: [variation({ intensity: 5, level: 1 })] });
|
||||
const edition = published.editions.find((item) => item.id === "mythic-card-pull-x");
|
||||
assert.deepEqual([edition.holoIntensity, edition.holoLevel], [5, undefined]);
|
||||
const tunedEdition = structuredClone(published);
|
||||
tunedEdition.editions.find((item) => item.id === "mythic-card-pull-x").holoLevel = 1;
|
||||
assert.throws(() => validateCardsCatalog(tunedEdition), /level its effect does not declare/);
|
||||
});
|
||||
|
||||
test("pack availability and drop rates live in the database and apply immediately", () => {
|
||||
assert.equal("dropTables" in rawCatalog, false);
|
||||
assert.ok(rawCatalog.collections.every((collection) => !("active" in collection) && !("dropWeights" in collection)));
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@
|
|||
{
|
||||
"id": "spectral-prism",
|
||||
"kind": "holographic",
|
||||
"label": "Prisme spectral"
|
||||
"label": "Prisme spectral",
|
||||
"level": { "label": "Vitesse", "levels": ["Très lente", "Lente", "Normale", "Rapide", "Très rapide"] }
|
||||
},
|
||||
{
|
||||
"id": "diffraction-sheen",
|
||||
|
|
@ -51,9 +52,17 @@
|
|||
{
|
||||
"id": "prismatic-backdrop",
|
||||
"kind": "holographic",
|
||||
"label": "Parallaxe prismatique"
|
||||
"label": "Parallaxe prismatique",
|
||||
"level": { "label": "Amplitude", "levels": ["Très douce", "Douce", "Moyenne", "Forte", "Très forte"] }
|
||||
},
|
||||
{
|
||||
"id": "shattered-ice",
|
||||
"kind": "holographic",
|
||||
"label": "Glace brisée",
|
||||
"level": { "label": "Taille des éclats", "levels": ["Très fins", "Fins", "Moyens", "Gros", "Très gros"] }
|
||||
}
|
||||
],
|
||||
"effectIntensity": { "label": "Intensité", "levels": ["Très douce", "Douce", "Normale", "Intense", "Très intense"] },
|
||||
"cardFormats": [
|
||||
{
|
||||
"id": "standard",
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
|
|
@ -6,6 +6,9 @@ import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, resolveMythicOpeningSt
|
|||
const STANDARD_CARD_LAYOUT = "standard";
|
||||
// Effets holographiques qui découpent l'illustration en calques de parallaxe (décor, puis héros détouré).
|
||||
const PARALLAX_EFFECTS = new Set(["prismatic-backdrop"]);
|
||||
// Effets holographiques à facettes : chaque groupe d'éclats de la mosaïque capte la lumière sous un angle qui lui est propre.
|
||||
const SHARD_EFFECTS = new Set(["shattered-ice"]);
|
||||
const SHARD_FACETS = [0, 1, 2, 3];
|
||||
|
||||
function useCardTilt() {
|
||||
const cardRef = useRef(null);
|
||||
|
|
@ -249,6 +252,9 @@ function CardFace({ entry, quantity, visual, size }) {
|
|||
{visual.effectPreset && <>
|
||||
<span className="nebula-card-holo-layer nebula-card-holo-primary" aria-hidden="true" />
|
||||
<span className="nebula-card-holo-layer nebula-card-holo-secondary" aria-hidden="true" />
|
||||
{SHARD_EFFECTS.has(visual.effectPreset.id) && <span className="nebula-card-holo-layer nebula-card-holo-shards" aria-hidden="true">
|
||||
{SHARD_FACETS.map((facet) => <i key={facet} data-facet={facet} />)}
|
||||
</span>}
|
||||
</>}
|
||||
<span className="nebula-card-glare" aria-hidden="true" />
|
||||
</div>;
|
||||
|
|
@ -275,6 +281,9 @@ export function NebulaCard({ catalog, entry, quantity = 0, size = "lg", faceUp =
|
|||
const visualAttributes = {
|
||||
"data-holo-effect": visual.effectPreset?.id,
|
||||
"data-holo-palette": visual.palette?.id,
|
||||
// Paliers de la variation (intensité de la palette, palier propre à l'effet) : le palier central n'a pas d'attribut.
|
||||
"data-holo-intensity": visual.effectPreset ? entry.edition?.holoIntensity : undefined,
|
||||
"data-holo-level": visual.effectPreset?.level ? entry.edition?.holoLevel : undefined,
|
||||
"data-particle-preset": displayedParticlePreset?.id,
|
||||
"data-particle-shape": displayedParticleShape?.id,
|
||||
"data-particle-palette": displayedParticlePalette?.id,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const EVENT_LABELS = {
|
|||
shop_updated: "Boutique modifiée",
|
||||
catalog_card_mythic_updated: "Variations mythiques modifiées",
|
||||
catalog_mythic_finish_changed: "Finition mythique changée",
|
||||
catalog_mythic_tuning_changed: "Réglages mythiques changés",
|
||||
catalog_collection_opening_updated: "Effets d’ouverture modifiés",
|
||||
collection_opened: "Collection ouverte aux joueurs",
|
||||
collection_closed: "Collection fermée aux joueurs",
|
||||
|
|
@ -48,6 +49,16 @@ function mythicFinishDetail(entry, catalog) {
|
|||
return `${card} · ${label(entry.details.previousFinishId)} → ${label(entry.details.finishId)}`;
|
||||
}
|
||||
|
||||
// Paliers d'une variation : intensité de la palette, puis palier de son effet s'il en déclare un.
|
||||
function mythicTuningDetail(entry, catalog) {
|
||||
const card = catalog.cards.find((item) => item.id === entry.entityId)?.name || entry.entityId;
|
||||
const edition = catalog.editions.find((item) => item.id === entry.details.editionId);
|
||||
const finish = catalog.finishes.find((item) => item.id === edition?.finishIds[0]);
|
||||
const level = catalog.effectPresets.find((item) => item.id === finish?.effectPresetId)?.level;
|
||||
const step = (scale, value) => `${scale.label.toLowerCase()} ${(scale.levels[value - 1] || value).toLowerCase()} (${value}/${scale.levels.length})`;
|
||||
return [`${card} · ${finish?.label || entry.details.editionId}`, catalog.effectIntensity && step(catalog.effectIntensity, entry.details.intensity), level && step(level, entry.details.level)].filter(Boolean).join(" · ");
|
||||
}
|
||||
|
||||
function eventDetail(entry, catalog) {
|
||||
const { details, campaignName } = entry;
|
||||
switch (entry.type) {
|
||||
|
|
@ -59,6 +70,7 @@ function eventDetail(entry, catalog) {
|
|||
case "shop_updated": return shopChanges(details, catalog).filter(Boolean).join(" · ");
|
||||
case "catalog_card_mythic_updated": return mythicDetail(entry, catalog);
|
||||
case "catalog_mythic_finish_changed": return mythicFinishDetail(entry, catalog);
|
||||
case "catalog_mythic_tuning_changed": return mythicTuningDetail(entry, catalog);
|
||||
case "catalog_collection_opening_updated":
|
||||
case "collection_opened":
|
||||
case "collection_closed": return collectionName(entry, catalog);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { SelectDropdown } from "../../../components/SelectDropdown.jsx";
|
|||
import { useState } from "react";
|
||||
import { NebulaCard } from "../NebulaCard.jsx";
|
||||
import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, withCardOpeningSetting } from "../openingEffects.js";
|
||||
import { EffectTuningFields } from "./EffectTuningFields.jsx";
|
||||
import { tuningEditionFields } from "./effectTuning.js";
|
||||
import { SwatchDropdown } from "./SwatchDropdown.jsx";
|
||||
|
||||
const OPENING_EFFECT_DESCRIPTIONS = {
|
||||
|
|
@ -52,11 +54,13 @@ function OpeningEffectPreview({ catalog, lookup, effect }) {
|
|||
function HolographicEffectPreview({ catalog, effect, editions, previewCard }) {
|
||||
const finishes = catalog.finishes.filter((finish) => finish.effectPresetId === effect.id);
|
||||
const [paletteId, setPaletteId] = useState(finishes[0]?.paletteId || catalog.effectPalettes[0]?.id || "");
|
||||
// Paliers essayés sur l'aperçu, comme ceux qu'une variation mythique enregistre ; le palier central n'est pas transmis.
|
||||
const [tuning, setTuning] = useState({});
|
||||
// La parallaxe s'ouvre en pleine illustration quand la carte n'a de héros détouré que dans ce format.
|
||||
const [formatId, setFormatId] = useState(effect.id === "prismatic-backdrop" && previewCard.fullCutoutImage && !previewCard.cutoutImage ? "full-art" : "standard");
|
||||
// Chaque combinaison format × effet × palette existe déjà comme finition générée.
|
||||
const finishId = finishes.find((finish) => finish.paletteId === paletteId && finish.formatId === formatId)?.id || finishes[0]?.id;
|
||||
const edition = { id: `admin-effect-preview-${effect.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finishId], promotional: false };
|
||||
const edition = { id: `admin-effect-preview-${effect.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finishId], promotional: false, ...tuningEditionFields(effect, tuning) };
|
||||
|
||||
return <article className="nds-card nebula-admin-style-card" aria-labelledby={`nebula-admin-effect-${effect.id}`}>
|
||||
<div className="nebula-admin-style-preview"><NebulaCard catalog={catalog} entry={{ edition, card: previewCard }} size="lg" /><span>Aperçu · {previewCard.name}</span></div>
|
||||
|
|
@ -68,6 +72,7 @@ function HolographicEffectPreview({ catalog, effect, editions, previewCard }) {
|
|||
<div className="nebula-admin-effect-list">
|
||||
{previewCard.fullImage && <div><SelectDropdown label="Format" value={formatId} options={catalog.cardFormats.map((item) => ({ value: item.id, label: item.label }))} onChange={setFormatId} /></div>}
|
||||
<div><SwatchDropdown label="Palette de couleurs" value={paletteId} options={catalog.effectPalettes} onChange={setPaletteId} /></div>
|
||||
<div><EffectTuningFields catalog={catalog} effect={effect} value={tuning} onChange={setTuning} /></div>
|
||||
<div><SelectDropdown className="nebula-admin-disabled-field" label="Particules au survol" disabled value="" options={[{ value: "", label: "À venir" }]} onChange={() => {}} /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
40
website/src/features/cards/admin/EffectTuningFields.jsx
Normal file
40
website/src/features/cards/admin/EffectTuningFields.jsx
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// Rôle : curseurs des paliers d'une variation mythique, de 1 à 5 : l'intensité de la palette, puis le palier propre à l'effet
|
||||
// (vitesse, amplitude, taille des éclats) quand le catalogue lui en déclare un. Le niveau 3 est le rendu de référence.
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { DEFAULT_TUNING } from "./effectTuning.js";
|
||||
|
||||
function TuningRange({ scale, value, disabled, onChange }) {
|
||||
const valueLabel = scale.levels[value - 1];
|
||||
return <label className="nebula-admin-tuning-range">
|
||||
<span>{scale.label}<span className="nebula-admin-tuning-value">{valueLabel}</span></span>
|
||||
<input className="nds-range" data-size="sm" type="range" min="1" max={scale.levels.length} step="1" value={value} disabled={disabled} aria-label={scale.label} aria-valuetext={valueLabel} onChange={(event) => onChange(Number(event.target.value))} />
|
||||
</label>;
|
||||
}
|
||||
|
||||
export function EffectTuningFields({ catalog, effect, value, disabled = false, onChange }) {
|
||||
const intensity = value.intensity ?? DEFAULT_TUNING;
|
||||
const level = value.level ?? DEFAULT_TUNING;
|
||||
return <div className="nebula-admin-tuning">
|
||||
<TuningRange scale={catalog.effectIntensity} value={intensity} disabled={disabled} onChange={(next) => onChange({ intensity: next, level })} />
|
||||
{effect?.level && <TuningRange scale={effect.level} value={level} disabled={disabled} onChange={(next) => onChange({ intensity, level: next })} />}
|
||||
</div>;
|
||||
}
|
||||
|
||||
// Curseurs d'une variation enregistrée : l'aperçu suit le curseur aussitôt, l'enregistrement attend que le réglage se pose,
|
||||
// pour ne pas envoyer une requête par cran pendant un glissement. Le parent le remonte (`key`) quand les paliers enregistrés
|
||||
// changent : il repart alors de ces valeurs.
|
||||
export function SavedEffectTuningFields({ catalog, effect, edition, disabled, onPreview, onSave }) {
|
||||
const saved = { intensity: edition.holoIntensity ?? DEFAULT_TUNING, level: edition.holoLevel ?? DEFAULT_TUNING };
|
||||
const [draft, setDraft] = useState(saved);
|
||||
const timer = useRef(null);
|
||||
useEffect(() => () => clearTimeout(timer.current), []);
|
||||
const change = (next) => {
|
||||
setDraft(next);
|
||||
onPreview?.(next);
|
||||
clearTimeout(timer.current);
|
||||
timer.current = setTimeout(() => {
|
||||
if (next.intensity !== saved.intensity || (effect?.level && next.level !== saved.level)) onSave(next);
|
||||
}, 450);
|
||||
};
|
||||
return <EffectTuningFields catalog={catalog} effect={effect} value={draft} disabled={disabled} onChange={change} />;
|
||||
}
|
||||
|
|
@ -4,10 +4,12 @@ import { Tooltip } from "../../../components/Tooltip.jsx";
|
|||
import { SelectDropdown } from "../../../components/SelectDropdown.jsx";
|
||||
import { useState } from "react";
|
||||
import { ConfirmModal } from "../../../components/ToolboxModals.jsx";
|
||||
import { updateCardMythic, updateMythicFinish } from "../cardsApi.js";
|
||||
import { updateCardMythic, updateMythicFinish, updateMythicTuning } from "../cardsApi.js";
|
||||
import { NebulaCard } from "../NebulaCard.jsx";
|
||||
import { resolveMythicOpeningStyle, withCardOpeningSetting } from "../openingEffects.js";
|
||||
import { openingSettingFor, withoutOpeningSetting } from "./catalogSettings.js";
|
||||
import { EffectTuningFields, SavedEffectTuningFields } from "./EffectTuningFields.jsx";
|
||||
import { DEFAULT_TUNING, tuningEditionFields } from "./effectTuning.js";
|
||||
import { MythicOpeningFields } from "./MythicOpeningFields.jsx";
|
||||
import { PaletteSwatches, SwatchDropdown } from "./SwatchDropdown.jsx";
|
||||
|
||||
|
|
@ -41,6 +43,8 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
// Variation dont la finition est en cours de changement : { editionId, effectPresetId, paletteId, formatId }.
|
||||
const [editing, setEditing] = useState(null);
|
||||
const [pendingFinishChange, setPendingFinishChange] = useState(null);
|
||||
// Paliers en cours de glissement sur une variation enregistrée, appliqués à l'aperçu avant leur enregistrement.
|
||||
const [tuningPreview, setTuningPreview] = useState({});
|
||||
const [revealed, setRevealed] = useState(false);
|
||||
const [replayKey, setReplayKey] = useState(0);
|
||||
|
||||
|
|
@ -52,7 +56,15 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
// Une finition déjà portée par une autre variation de la carte, même retirée, ne peut pas être reprise.
|
||||
const editingDuplicated = Boolean(editingFinish && mythics.some((edition) => edition.id !== editing.editionId && edition.finishIds[0] === editingFinish.id));
|
||||
const editingUnchanged = Boolean(editingFinish && editingEdition?.finishIds[0] === editingFinish.id);
|
||||
const withEditedFinish = (edition) => (editingFinish && editing?.editionId === edition.id ? { ...edition, finishIds: [editingFinish.id] } : edition);
|
||||
const effectOfFinish = (finishId) => catalog.effectPresets.find((item) => item.id === lookup.finishes.get(finishId)?.effectPresetId);
|
||||
// Aperçu d'une variation : sa finition en cours de changement et ses paliers en cours de glissement.
|
||||
const withEditedFinish = (edition) => {
|
||||
const finished = editingFinish && editing?.editionId === edition.id ? { ...edition, finishIds: [editingFinish.id] } : edition;
|
||||
const preview = tuningPreview[edition.id];
|
||||
if (!preview) return finished;
|
||||
const { holoIntensity: _intensity, holoLevel: _level, ...base } = finished;
|
||||
return { ...base, ...tuningEditionFields(effectOfFinish(finished.finishIds[0]), preview) };
|
||||
};
|
||||
// Sans image au bon format, le choix du format n'existe pas pour cette carte.
|
||||
const unusedFinish = lookup.holographicFinishes.find((finish) => !savedFinishIds.includes(finish.id) && (card.fullImage || finish.formatId === "standard"));
|
||||
const collection = lookup.collections.get(card.collectionId);
|
||||
|
|
@ -63,11 +75,14 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
const save = (finishIds, nextOpening = opening) => mutateCatalog(() => updateCardMythic(card.id, { finishIds, opening: nextOpening }));
|
||||
|
||||
async function validateDraft() {
|
||||
const tuning = { intensity: draft.intensity, level: effectOfFinish(draftFinish.id)?.level ? draft.level : DEFAULT_TUNING };
|
||||
const result = await save([...savedFinishIds, draftFinish.id]);
|
||||
if (result?.catalog) {
|
||||
setDraft(null);
|
||||
// L'identifiant d'une nouvelle variation peut être suffixé : il se lit dans le catalogue renvoyé.
|
||||
const created = result.catalog.editions.find((edition) => edition.cardId === card.id && edition.rarity === "mythic" && !edition.retired && edition.finishIds[0] === draftFinish.id);
|
||||
// Les paliers choisis à la création s'enregistrent sur la variation qui vient d'être créée.
|
||||
if (created && (tuning.intensity !== DEFAULT_TUNING || tuning.level !== DEFAULT_TUNING)) await mutateCatalog(() => updateMythicTuning(created.id, tuning));
|
||||
select(created?.id || null);
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +94,13 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
select(edition.id);
|
||||
}
|
||||
|
||||
async function changeTuning(edition, { intensity, level }) {
|
||||
const tuning = { intensity, level: effectOfFinish(edition.finishIds[0])?.level ? level : DEFAULT_TUNING };
|
||||
const result = await mutateCatalog(() => updateMythicTuning(edition.id, tuning));
|
||||
setTuningPreview(({ [edition.id]: _done, ...others }) => others);
|
||||
if (result?.catalog) setPreviewKey(edition.id);
|
||||
}
|
||||
|
||||
async function changeFinish(editionId, finishId) {
|
||||
const result = await mutateCatalog(() => updateMythicFinish(editionId, finishId));
|
||||
if (result?.catalog) {
|
||||
|
|
@ -97,7 +119,7 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
if (result?.catalog && previewKey === edition.id) setPreviewKey(null);
|
||||
}
|
||||
|
||||
const draftEdition = draft && { id: `admin-preview-${card.id}-${draftFinish?.id || "draft"}`, cardId: card.id, rarity: "mythic", finishIds: draftFinish ? [draftFinish.id] : [], promotional: false };
|
||||
const draftEdition = draft && { id: `admin-preview-${card.id}-${draftFinish?.id || "draft"}`, cardId: card.id, rarity: "mythic", finishIds: draftFinish ? [draftFinish.id] : [], promotional: false, ...(draftFinish ? tuningEditionFields(effectOfFinish(draftFinish.id), draft) : {}) };
|
||||
const previewMythic = activeMythics.find((edition) => edition.id === previewKey) || activeMythics[0];
|
||||
const previewEdition = (previewKey === DRAFT_KEY && draftEdition) || (previewMythic && withEditedFinish(previewMythic)) || draftEdition
|
||||
|| { id: `admin-preview-${card.id}`, cardId: card.id, rarity: "mythic", finishIds: [lookup.holographicFinishes[0]?.id], promotional: false };
|
||||
|
|
@ -154,6 +176,7 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
<div><dt>Effet</dt><dd>{effect?.label}</dd></div>
|
||||
<div><dt>Particules</dt><dd>À venir</dd></div>
|
||||
</dl>
|
||||
<SavedEffectTuningFields key={`${edition.id}-${edition.holoIntensity ?? DEFAULT_TUNING}-${edition.holoLevel ?? DEFAULT_TUNING}-${finish.id}`} catalog={catalog} effect={effect} edition={edition} disabled={busy || Boolean(editing)} onPreview={(next) => { setTuningPreview((previews) => ({ ...previews, [edition.id]: next })); setPreviewKey(edition.id); }} onSave={(next) => changeTuning(edition, next)} />
|
||||
</>}
|
||||
<span className="nebula-admin-mythic-status">
|
||||
<span className="nds-badge" data-variant="success">Tirable</span>
|
||||
|
|
@ -176,10 +199,11 @@ export function MythicEditor({ catalog, lookup, card, dashboard, mutateCatalog,
|
|||
</span>
|
||||
</div>
|
||||
<FinishFields catalog={catalog} card={card} value={draft} busy={busy} duplicated={draftDuplicated} onChange={(next) => { setDraft(next); select(DRAFT_KEY); }} />
|
||||
<EffectTuningFields catalog={catalog} effect={draftFinish && effectOfFinish(draftFinish.id)} value={draft} disabled={busy} onChange={(tuning) => { setDraft({ ...draft, ...tuning }); setPreviewKey(DRAFT_KEY); }} />
|
||||
</div>
|
||||
</div>
|
||||
</article>}
|
||||
{!draft && <button className="nds-button nebula-admin-mythic-add" data-variant="dashed" type="button" disabled={busy || Boolean(editing) || !unusedFinish} onClick={() => { setDraft({ effectPresetId: unusedFinish.effectPresetId, paletteId: unusedFinish.paletteId, formatId: unusedFinish.formatId }); select(DRAFT_KEY); }}><span aria-hidden="true">+</span>Ajouter une variation{!unusedFinish && <small>Toutes les combinaisons effet × palette existent déjà.</small>}</button>}
|
||||
{!draft && <button className="nds-button nebula-admin-mythic-add" data-variant="dashed" type="button" disabled={busy || Boolean(editing) || !unusedFinish} onClick={() => { setDraft({ effectPresetId: unusedFinish.effectPresetId, paletteId: unusedFinish.paletteId, formatId: unusedFinish.formatId, intensity: DEFAULT_TUNING, level: DEFAULT_TUNING }); select(DRAFT_KEY); }}><span aria-hidden="true">+</span>Ajouter une variation{!unusedFinish && <small>Toutes les combinaisons effet × palette existent déjà.</small>}</button>}
|
||||
</div>
|
||||
{retiredMythics.length > 0 && <div className="nds-toolbar nebula-admin-actions">
|
||||
{retiredMythics.map((edition) => <button key={edition.id} className="nds-button" data-size="sm" data-variant="secondary" type="button" disabled={busy || Boolean(editing)} onClick={() => save([...savedFinishIds, edition.finishIds[0]])}>Réactiver {finishOf(edition).label}</button>)}
|
||||
|
|
|
|||
10
website/src/features/cards/admin/effectTuning.js
Normal file
10
website/src/features/cards/admin/effectTuning.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Rôle : valeurs communes des paliers d'une variation mythique (intensité de la palette, palier propre à l'effet), de 1 à 5.
|
||||
export const DEFAULT_TUNING = 3;
|
||||
|
||||
// Un palier central n'est pas transmis : la carte garde son rendu de référence, sans attribut.
|
||||
export function tuningEditionFields(effect, { intensity = DEFAULT_TUNING, level = DEFAULT_TUNING } = {}) {
|
||||
return {
|
||||
...(intensity !== DEFAULT_TUNING ? { holoIntensity: intensity } : {}),
|
||||
...(effect?.level && level !== DEFAULT_TUNING ? { holoLevel: level } : {})
|
||||
};
|
||||
}
|
||||
|
|
@ -147,6 +147,10 @@ export function updateMythicFinish(editionId, finishId) {
|
|||
return request(`/admin/catalog/mythics/${encodeURIComponent(editionId)}/finish`, { method: "PUT", body: JSON.stringify({ finishId }) });
|
||||
}
|
||||
|
||||
export function updateMythicTuning(editionId, { intensity, level }) {
|
||||
return request(`/admin/catalog/mythics/${encodeURIComponent(editionId)}/tuning`, { method: "PUT", body: JSON.stringify({ intensity, level }) });
|
||||
}
|
||||
|
||||
export function updateCollectionMythicOpening(collectionId, { particleShapeId, particlePaletteId }) {
|
||||
return request(`/admin/catalog/collections/${encodeURIComponent(collectionId)}/mythic-opening`, { method: "PUT", body: JSON.stringify({ particleShapeId, particlePaletteId }) });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@
|
|||
.nebula-opening-odds :is(h3, p) { margin: 0; }
|
||||
.nebula-opening-odds h3 { font-size: var(--font-size-sm); }
|
||||
|
||||
.nebula-card { --card-tilt-x: 0deg; --card-tilt-y: 0deg; --card-pointer-x: 50%; --card-pointer-y: 35%; --card-lift: 0px; --card-tilt-energy: 0; --card-tilt-nx: 0; --card-tilt-ny: 0; position: relative; isolation: isolate; display: block; width: 100%; max-width: 300px; aspect-ratio: 5 / 7; padding: 0; border: 0; border-radius: 16px; background: transparent; color: inherit; text-align: left; perspective: 1200px; }
|
||||
.nebula-card { --card-tilt-x: 0deg; --card-tilt-y: 0deg; --card-pointer-x: 50%; --card-pointer-y: 35%; --card-lift: 0px; --card-tilt-energy: 0; --card-tilt-nx: 0; --card-tilt-ny: 0; --holo-intensity: 1; position: relative; isolation: isolate; display: block; width: 100%; max-width: 300px; aspect-ratio: 5 / 7; padding: 0; border: 0; border-radius: 16px; background: transparent; color: inherit; text-align: left; perspective: 1200px; }
|
||||
.nebula-card[data-card-size="sm"] { max-width: 118px; }
|
||||
.nebula-card[data-card-size="md"] { max-width: 180px; }
|
||||
.nebula-card::before { position: absolute; inset: -8px; content: ""; border-radius: 22px; }
|
||||
|
|
@ -348,15 +348,15 @@ button.nebula-card { cursor: pointer; }
|
|||
.nebula-card-glare, .nebula-card-holo-layer { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; transition: opacity 220ms var(--ease-standard); }
|
||||
.nebula-card-glare { z-index: 6; background: radial-gradient(circle at var(--card-pointer-x) var(--card-pointer-y), rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.08) 14%, transparent 38%); mix-blend-mode: screen; }
|
||||
.nebula-card-holo-layer { z-index: 2; opacity: 0; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"] .nebula-card-holo-primary { opacity: 0.05; background-image: var(--holo-gradient); background-repeat: no-repeat; background-size: 200% 200%; background-position: 50% 50%; mix-blend-mode: color-dodge; filter: saturate(1.05) contrast(1.03) brightness(0.92); }
|
||||
.nebula-card[data-holo-effect="spectral-prism"] .nebula-card-holo-primary { opacity: calc(0.05 * var(--holo-intensity)); background-image: var(--holo-gradient); background-repeat: no-repeat; background-size: 200% 200%; background-position: 50% 50%; mix-blend-mode: color-dodge; filter: saturate(1.05) contrast(1.03) brightness(0.92); }
|
||||
/* Ténèbres assombrit la carte : `color-dodge` n'a aucun effet avec des teintes presque noires. */
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-palette="darkness"] .nebula-card-holo-primary { mix-blend-mode: hard-light; filter: none; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"] .nebula-card-holo-secondary { opacity: 0.04; background-image: repeating-linear-gradient(0deg, transparent 0 3px, color-mix(in srgb, var(--holo-highlight) 12%, transparent) 3px 4px), repeating-linear-gradient(90deg, transparent 0 3px, color-mix(in srgb, var(--holo-highlight) 10%, transparent) 3px 4px); background-position: var(--card-pointer-x) var(--card-pointer-y); mix-blend-mode: screen; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"] .nebula-card-holo-secondary { opacity: calc(0.04 * var(--holo-intensity)); background-image: repeating-linear-gradient(0deg, transparent 0 3px, color-mix(in srgb, var(--holo-highlight) 12%, transparent) 3px 4px), repeating-linear-gradient(90deg, transparent 0 3px, color-mix(in srgb, var(--holo-highlight) 10%, transparent) 3px 4px); background-position: var(--card-pointer-x) var(--card-pointer-y); mix-blend-mode: screen; }
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.nebula-card:hover .nebula-card-glare, .nebula-card:focus-visible .nebula-card-glare { opacity: 0.58; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"]:hover .nebula-card-holo-primary, .nebula-card[data-holo-effect="spectral-prism"]:focus-visible .nebula-card-holo-primary { opacity: 0.46; animation: nebula-spectral-prism 5s ease-in-out infinite; will-change: background-position; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-palette="darkness"]:hover .nebula-card-holo-primary, .nebula-card[data-holo-effect="spectral-prism"][data-holo-palette="darkness"]:focus-visible .nebula-card-holo-primary { opacity: 0.62; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"]:hover .nebula-card-holo-secondary, .nebula-card[data-holo-effect="spectral-prism"]:focus-visible .nebula-card-holo-secondary { opacity: 0.28; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"]:hover .nebula-card-holo-primary, .nebula-card[data-holo-effect="spectral-prism"]:focus-visible .nebula-card-holo-primary { opacity: calc(0.46 * var(--holo-intensity)); animation: nebula-spectral-prism var(--spectral-duration, 5s) ease-in-out infinite; will-change: background-position; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-palette="darkness"]:hover .nebula-card-holo-primary, .nebula-card[data-holo-effect="spectral-prism"][data-holo-palette="darkness"]:focus-visible .nebula-card-holo-primary { opacity: calc(0.62 * var(--holo-intensity)); }
|
||||
.nebula-card[data-holo-effect="spectral-prism"]:hover .nebula-card-holo-secondary, .nebula-card[data-holo-effect="spectral-prism"]:focus-visible .nebula-card-holo-secondary { opacity: calc(0.28 * var(--holo-intensity)); }
|
||||
.nebula-card[data-holo-effect="spectral-prism"]:hover .nebula-card-face, .nebula-card[data-holo-effect="spectral-prism"]:focus-visible .nebula-card-face { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 38px color-mix(in srgb, var(--holo-4) 16%, transparent), var(--shadow-md); }
|
||||
}
|
||||
@keyframes nebula-spectral-prism {
|
||||
|
|
@ -372,12 +372,12 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
.nebula-card[data-holo-effect="diffraction-sheen"] { --diffraction-rest: 0.05; --diffraction-angle: calc(112deg + var(--card-tilt-y) * 3 - var(--card-tilt-x) * 2); --diffraction-band: calc(16% + var(--card-pointer-x) * 0.44 + var(--card-pointer-y) * 0.24); }
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"] .nebula-card-holo-layer { transition: none; }
|
||||
// Bande irisée : la teinte dépend de l'angle (le dégradé glisse à l'inverse du pointeur), resserrée autour de la lumière.
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"] .nebula-card-holo-primary { opacity: calc(var(--diffraction-rest) + var(--card-tilt-energy) * 1.1); background-image: linear-gradient(var(--diffraction-angle), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-6), var(--holo-7), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-6), var(--holo-7)); background-repeat: no-repeat; background-size: 320% 320%; background-position: calc(100% - var(--card-pointer-x)) calc(100% - var(--card-pointer-y)); filter: saturate(1.9) contrast(1.08); mix-blend-mode: overlay; mask-image: linear-gradient(var(--diffraction-angle), transparent calc(var(--diffraction-band) - 38%), black calc(var(--diffraction-band) - 12%), black calc(var(--diffraction-band) + 12%), transparent calc(var(--diffraction-band) + 38%)); -webkit-mask-image: linear-gradient(var(--diffraction-angle), transparent calc(var(--diffraction-band) - 38%), black calc(var(--diffraction-band) - 12%), black calc(var(--diffraction-band) + 12%), transparent calc(var(--diffraction-band) + 38%)); }
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"] .nebula-card-holo-primary { opacity: calc((var(--diffraction-rest) + var(--card-tilt-energy) * 1.1) * var(--holo-intensity)); background-image: linear-gradient(var(--diffraction-angle), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-6), var(--holo-7), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-6), var(--holo-7)); background-repeat: no-repeat; background-size: 320% 320%; background-position: calc(100% - var(--card-pointer-x)) calc(100% - var(--card-pointer-y)); filter: saturate(1.9) contrast(1.08); mix-blend-mode: overlay; mask-image: linear-gradient(var(--diffraction-angle), transparent calc(var(--diffraction-band) - 38%), black calc(var(--diffraction-band) - 12%), black calc(var(--diffraction-band) + 12%), transparent calc(var(--diffraction-band) + 38%)); -webkit-mask-image: linear-gradient(var(--diffraction-angle), transparent calc(var(--diffraction-band) - 38%), black calc(var(--diffraction-band) - 12%), black calc(var(--diffraction-band) + 12%), transparent calc(var(--diffraction-band) + 38%)); }
|
||||
/* Ténèbres assombrit la carte : `overlay` ne marque presque pas l'illustration avec des teintes presque noires. */
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"][data-holo-palette="darkness"] .nebula-card-holo-primary { mix-blend-mode: hard-light; opacity: calc(var(--diffraction-rest) + var(--card-tilt-energy) * 0.82); }
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"][data-holo-palette="darkness"] .nebula-card-holo-primary { mix-blend-mode: hard-light; opacity: calc((var(--diffraction-rest) + var(--card-tilt-energy) * 0.82) * var(--holo-intensity)); }
|
||||
// Lumière en `color-dodge` sur fond noir neutre : teinte de palette éclaircie vers sa couleur de reflet (multiply), trait spéculaire et rayons (screen), paillettes.
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"] .nebula-card-holo-secondary {
|
||||
opacity: calc(var(--card-tilt-energy) * 1.1);
|
||||
opacity: calc(var(--card-tilt-energy) * 1.1 * var(--holo-intensity));
|
||||
background-image:
|
||||
linear-gradient(var(--diffraction-angle), color-mix(in srgb, var(--holo-2) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-4) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-6) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-1) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-3) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-5) 50%, var(--holo-highlight)), color-mix(in srgb, var(--holo-7) 50%, var(--holo-highlight))),
|
||||
linear-gradient(var(--diffraction-angle), transparent calc(var(--diffraction-band) - 11%), color-mix(in srgb, var(--holo-highlight) 62%, transparent) var(--diffraction-band), transparent calc(var(--diffraction-band) + 11%)),
|
||||
|
|
@ -401,6 +401,25 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
@media (hover: hover) and (pointer: fine) {
|
||||
.nebula-card[data-holo-effect="diffraction-sheen"]:hover .nebula-card-face, .nebula-card[data-holo-effect="diffraction-sheen"]:focus-visible .nebula-card-face { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 38px color-mix(in srgb, var(--holo-4) 16%, transparent), var(--shadow-md); }
|
||||
}
|
||||
/* Paliers d'une variation mythique, de 1 à 5. L'intensité multiplie l'opacité des calques de couleur de chaque effet ; le palier
|
||||
propre à l'effet règle la vitesse du Prisme spectral, l'amplitude de la Parallaxe prismatique ou la taille des éclats de la
|
||||
Glace brisée. Le palier central, 3 (sans attribut), garde le rendu de référence. */
|
||||
.nebula-card[data-holo-intensity="1"] { --holo-intensity: 0.5; }
|
||||
.nebula-card[data-holo-intensity="2"] { --holo-intensity: 0.75; }
|
||||
.nebula-card[data-holo-intensity="4"] { --holo-intensity: 1.25; }
|
||||
.nebula-card[data-holo-intensity="5"] { --holo-intensity: 1.5; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-level="1"] { --spectral-duration: 9s; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-level="2"] { --spectral-duration: 7s; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-level="4"] { --spectral-duration: 4s; }
|
||||
.nebula-card[data-holo-effect="spectral-prism"][data-holo-level="5"] { --spectral-duration: 3s; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"][data-holo-level="1"] { --parallax-reach: 0.025; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"][data-holo-level="2"] { --parallax-reach: 0.035; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"][data-holo-level="4"] { --parallax-reach: 0.055; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"][data-holo-level="5"] { --parallax-reach: 0.065; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"][data-holo-level="1"] { --shard-scale: 0.6; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"][data-holo-level="2"] { --shard-scale: 0.8; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"][data-holo-level="4"] { --shard-scale: 1.25; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"][data-holo-level="5"] { --shard-scale: 1.5; }
|
||||
/* Parallaxe prismatique (`prismatic-backdrop`) : l'illustration empile au plus deux calques, le décor sans le héros puis le héros
|
||||
détouré, chacun décalé au tilt selon sa profondeur (`--layer-depth` : 1 au fond, 0 au plan de la carte, négatif devant).
|
||||
`--parallax-reach` est la course du calque le plus lointain, en fraction de sa largeur ; l'agrandissement de chaque calque
|
||||
|
|
@ -424,7 +443,7 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-layer { transition: none; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-primary { opacity: 0; }
|
||||
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-secondary {
|
||||
opacity: calc(var(--card-tilt-energy) * 0.22);
|
||||
opacity: calc(var(--card-tilt-energy) * 0.22 * var(--holo-intensity));
|
||||
background: radial-gradient(circle at var(--card-pointer-x) var(--card-pointer-y), color-mix(in srgb, var(--holo-highlight) 62%, white), transparent 30%);
|
||||
mix-blend-mode: soft-light;
|
||||
}
|
||||
|
|
@ -433,7 +452,7 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
background-size: 260% 260%;
|
||||
background-position: calc(50% + var(--card-tilt-nx) * 40%) calc(50% + var(--card-tilt-ny) * 30%);
|
||||
mix-blend-mode: overlay;
|
||||
opacity: calc(0.5 + var(--card-tilt-energy) * 0.4);
|
||||
opacity: calc((0.5 + var(--card-tilt-energy) * 0.4) * var(--holo-intensity));
|
||||
}
|
||||
.nebula-card-depth-foil {
|
||||
background-image: repeating-linear-gradient(var(--prism-angle), var(--holo-1) 0%, var(--holo-2) 5%, var(--holo-3) 10%, var(--holo-4) 15%, var(--holo-5) 20%, var(--holo-6) 25%, var(--holo-7) 30%, var(--holo-1) 35%);
|
||||
|
|
@ -441,13 +460,13 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
background-position: calc(50% + var(--layer-index) * 17% + var(--card-tilt-nx) * var(--layer-depth) * 55%) calc(50% + var(--card-tilt-ny) * var(--layer-depth) * 40%);
|
||||
mask: var(--layer-image) center / cover no-repeat;
|
||||
mix-blend-mode: color-dodge;
|
||||
opacity: calc(0.1 + var(--card-tilt-energy) * 0.38);
|
||||
opacity: calc((0.1 + var(--card-tilt-energy) * 0.38) * var(--holo-intensity));
|
||||
}
|
||||
/* Le décor est déjà teinté : son reflet reste léger, sinon les couleurs claires d'une palette y tracent des traits trop nets. */
|
||||
[data-depth-role="backdrop"] > .nebula-card-depth-foil { opacity: calc(0.04 + var(--card-tilt-energy) * 0.16); }
|
||||
[data-depth-role="backdrop"] > .nebula-card-depth-foil { opacity: calc((0.04 + var(--card-tilt-energy) * 0.16) * var(--holo-intensity)); }
|
||||
[data-depth-role="subject"] > .nebula-card-depth-foil {
|
||||
background-position: calc(50% + var(--layer-index) * 17% + var(--card-tilt-nx) * 30%) calc(50% + var(--card-tilt-ny) * 22%);
|
||||
opacity: calc(0.04 + var(--card-tilt-energy) * 0.24);
|
||||
opacity: calc((0.04 + var(--card-tilt-energy) * 0.24) * var(--holo-intensity));
|
||||
}
|
||||
[data-depth-role="subject"] > img {
|
||||
filter:
|
||||
|
|
@ -461,6 +480,52 @@ $diffraction-glitter-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/
|
|||
@media (prefers-reduced-motion: reduce) {
|
||||
.nebula-card-depth-layer { transform: none; will-change: auto; }
|
||||
}
|
||||
/* Glace brisée (`shattered-ice`) : une mosaïque d'éclats couvre la carte, en quatre groupes de
|
||||
facettes. Chaque groupe a sa propre orientation (`--facet-x`, `--facet-y`, dans l'espace du tilt normalisé) et ne s'allume
|
||||
que lorsque l'inclinaison s'en approche : les éclats scintillent par groupes, dans les couleurs de la palette, au lieu
|
||||
d'une bande qui glisse. Les fissures accrochent une lumière blanche. Masques générés par
|
||||
`scripts/generate-shattered-ice-textures.mjs`. */
|
||||
.nebula-card[data-holo-effect="shattered-ice"] { --shard-size: calc(150px * var(--shard-scale, 1)); --shard-angle: calc(115deg + var(--card-tilt-nx) * 30deg - var(--card-tilt-ny) * 18deg); --shard-rest: 0.08; --shard-strength: 0.75; }
|
||||
.nebula-card[data-card-size="md"][data-holo-effect="shattered-ice"] { --shard-size: calc(100px * var(--shard-scale, 1)); }
|
||||
.nebula-card[data-card-size="sm"][data-holo-effect="shattered-ice"] { --shard-size: calc(72px * var(--shard-scale, 1)); }
|
||||
/* Format standard : comme les cartes « cracked ice », la glace couvre le cadre et le texte et passe sous l'illustration, qui reste
|
||||
intacte. En pleine illustration, il n'y a plus de cadre : la glace passe devant l'image, plus discrète. */
|
||||
.nebula-card[data-holo-effect="shattered-ice"] .nebula-card-face[data-card-layout="standard"] .nebula-card-art { z-index: 1; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"] .nebula-card-face[data-card-layout="standard"] :is(.nebula-card-holo-primary, .nebula-card-holo-shards) { z-index: 0; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"][data-card-layout="full-art"] { --shard-rest: 0.04; --shard-strength: 0.45; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"] .nebula-card-holo-layer { transition: none; }
|
||||
.nebula-card[data-holo-effect="shattered-ice"] .nebula-card-holo-primary {
|
||||
opacity: calc((0.1 + var(--card-tilt-energy) * 0.45) * var(--holo-intensity));
|
||||
background: linear-gradient(var(--shard-angle), var(--holo-highlight), color-mix(in srgb, var(--holo-highlight) 25%, transparent) 45%, var(--holo-highlight));
|
||||
background-size: 200% 200%;
|
||||
background-position: var(--card-pointer-x) var(--card-pointer-y);
|
||||
mask: url("/static/img/cards/effects/shattered-ice-cracks.webp") 0 0 / var(--shard-size) repeat;
|
||||
mix-blend-mode: screen;
|
||||
}
|
||||
.nebula-card[data-holo-effect="shattered-ice"] .nebula-card-holo-secondary { opacity: 0; }
|
||||
.nebula-card-holo-shards { opacity: 1; }
|
||||
.nebula-card-holo-shards > i {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
/* Intensité en losange autour de l'orientation du groupe : pleine quand le tilt la vise, nulle au-delà de 0,9 d'écart. */
|
||||
--facet-light: clamp(0, 1 - (max(var(--card-tilt-nx) - var(--facet-x), var(--facet-x) - var(--card-tilt-nx)) + max(var(--card-tilt-ny) - var(--facet-y), var(--facet-y) - var(--card-tilt-ny))) / 0.9, 1);
|
||||
background-image: linear-gradient(var(--shard-angle), var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-5), var(--holo-6), var(--holo-7), var(--holo-1));
|
||||
background-size: 250% 250%;
|
||||
background-position: calc(50% + var(--facet-phase) + var(--card-tilt-nx) * 45%) calc(50% + var(--card-tilt-ny) * 35%);
|
||||
mix-blend-mode: color-dodge;
|
||||
opacity: calc((var(--shard-rest) + var(--card-tilt-energy) * (0.1 + var(--facet-light) * var(--shard-strength))) * var(--holo-intensity));
|
||||
}
|
||||
.nebula-card-holo-shards > [data-facet="0"] { --facet-x: -0.55; --facet-y: -0.55; --facet-phase: 0%; mask: url("/static/img/cards/effects/shattered-ice-facet-0.webp") 0 0 / var(--shard-size) repeat; }
|
||||
.nebula-card-holo-shards > [data-facet="1"] { --facet-x: 0.55; --facet-y: -0.55; --facet-phase: 22%; mask: url("/static/img/cards/effects/shattered-ice-facet-1.webp") 0 0 / var(--shard-size) repeat; }
|
||||
.nebula-card-holo-shards > [data-facet="2"] { --facet-x: -0.55; --facet-y: 0.55; --facet-phase: 44%; mask: url("/static/img/cards/effects/shattered-ice-facet-2.webp") 0 0 / var(--shard-size) repeat; }
|
||||
.nebula-card-holo-shards > [data-facet="3"] { --facet-x: 0.55; --facet-y: 0.55; --facet-phase: 66%; mask: url("/static/img/cards/effects/shattered-ice-facet-3.webp") 0 0 / var(--shard-size) repeat; }
|
||||
.nebula-card[data-holo-palette="darkness"] .nebula-card-holo-shards > i { mix-blend-mode: hard-light; }
|
||||
/* Les éclats clairs passent sous le texte de la description : une ombre sombre le garde lisible, comme pour le Reflet diffractif. */
|
||||
.nebula-card[data-holo-effect="shattered-ice"] :is(.nebula-card-copy p, .nebula-card-finish) { text-shadow: 0 0 3px rgba(5, 7, 17, 0.9), 0 1px 2px rgba(5, 7, 17, 0.9); }
|
||||
/* Sans tilt (tactile, mouvement réduit), la mosaïque reste visible, figée. */
|
||||
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
|
||||
.nebula-card[data-holo-effect="shattered-ice"] { --shard-rest: 0.2; }
|
||||
}
|
||||
.nebula-card-reveal:focus-visible, .nebula-card-select:focus-visible { outline: 3px solid var(--color-accent-gold); outline-offset: 5px; }
|
||||
.nebula-card-particles { position: absolute; inset: 50%; z-index: 8; color: var(--opening-aura, var(--card-rarity, var(--color-primary))); pointer-events: none; }
|
||||
.nebula-card-reveal[data-reveal-phase="revealed"] .nebula-card-particles { display: none; }
|
||||
|
|
@ -832,6 +897,10 @@ main:has(.nebula-dashboard) { overflow-x: clip; }
|
|||
.nebula-admin-mythic-variation-specs { display: grid; gap: var(--space-1); margin: 0; }
|
||||
.nebula-admin-mythic-variation-specs > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-mythic-variation-specs dt { color: var(--color-text-muted); }
|
||||
.nebula-admin-tuning { display: grid; gap: var(--space-2); min-width: 0; }
|
||||
.nebula-admin-tuning-range { display: grid; gap: var(--space-1); min-width: 0; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
.nebula-admin-tuning-range > span { display: flex; justify-content: space-between; gap: var(--space-2); }
|
||||
.nebula-admin-tuning-value { color: var(--color-text-primary); font-weight: 600; }
|
||||
.nebula-admin-mythic-variation-specs dd { margin: 0; color: var(--color-text-secondary); }
|
||||
/* Menus d'une nouvelle variation : intitulé court et champ sur la même ligne. */
|
||||
.nebula-admin-mythic-variation-copy .nebula-admin-inline-field { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--space-2); align-items: center; min-width: 0; color: var(--color-text-secondary); font-size: var(--font-size-sm); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue