Group Sokko TCG's interface files by Guild quest and card rendering
The 48 files of the Daily Card, Expeditions, Daily Team and race, Broken Mirror and card rendering move to daily/, expeditions/, team/, mirror/ and rendering/ under website/src/features/cards, with every relative import rewritten. The root keeps the page, server calls, cache and the player sections outside the Guild. The cards README, the quest recipe and the current docs follow the new paths; dated audits and plans keep theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
863050437f
commit
88c7bf8317
74 changed files with 165 additions and 161 deletions
70
website/src/features/cards/rendering/holoFlares.js
Normal file
70
website/src/features/cards/rendering/holoFlares.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* @file Particules persistantes d'une variation mythique (distinctes des particules d'ouverture) côté
|
||||
* navigateur : réglages d'une édition (animation, motif, palette, zone, paliers) d'après les animations
|
||||
* déclarées par le catalogue (`flareEffects`, `flareScopes`), champs d'édition pour un aperçu et
|
||||
* comparaison de deux réglages. Les moteurs de rendu sont à part.
|
||||
*/
|
||||
|
||||
export const DEFAULT_FLARE_TUNING = 3;
|
||||
export const DEFAULT_FLARE_SCOPE = "art";
|
||||
export const MATCH_HOLO_FLARE_PALETTE = "match-holo";
|
||||
export const MATCH_HOLO_FLARE_LABEL = "Comme le holo";
|
||||
|
||||
export const NO_FLARE = { id: "", motifId: "", paletteId: MATCH_HOLO_FLARE_PALETTE, intensity: DEFAULT_FLARE_TUNING, level: DEFAULT_FLARE_TUNING, count: DEFAULT_FLARE_TUNING, scope: DEFAULT_FLARE_SCOPE };
|
||||
|
||||
const TUNING_FIELDS = { intensity: "flareIntensity", level: "flareLevel", count: "flareCount" };
|
||||
const effectOf = (catalog, id) => catalog?.flareEffects?.find((item) => item.id === id);
|
||||
// Motif retenu : celui choisi s'il appartient à l'animation, sinon le premier de sa liste ; aucun si elle n'a pas de motifs.
|
||||
export const flareMotifOf = (effect, motifId) => (effect?.motifs ? (effect.motifs.some((item) => item.id === motifId) ? motifId : effect.motifs[0].id) : null);
|
||||
|
||||
// Champs portés par l'édition, comme le serveur les publie : les paliers centraux, le motif par défaut, la palette héritée et
|
||||
// la zone par défaut ne sont pas transmis, ni les réglages que l'animation n'a pas.
|
||||
export function flareEditionFields(flare, catalog) {
|
||||
const effect = effectOf(catalog, flare?.id);
|
||||
if (!effect) return {};
|
||||
const motifId = flareMotifOf(effect, flare.motifId);
|
||||
return {
|
||||
flareId: effect.id,
|
||||
...(motifId && motifId !== effect.motifs[0].id ? { flareMotifId: motifId } : {}),
|
||||
...(flare.paletteId && flare.paletteId !== MATCH_HOLO_FLARE_PALETTE ? { flarePaletteId: flare.paletteId } : {}),
|
||||
...(flare.scope && flare.scope !== DEFAULT_FLARE_SCOPE ? { flareScope: flare.scope } : {}),
|
||||
...Object.fromEntries(effect.tunings.filter(({ key }) => flare[key] && flare[key] !== DEFAULT_FLARE_TUNING).map(({ key }) => [TUNING_FIELDS[key], flare[key]]))
|
||||
};
|
||||
}
|
||||
|
||||
// Réglages éditables d'une édition publiée (ou NO_FLARE), pour l'éditeur des variations.
|
||||
export function flareOfEdition(edition, catalog) {
|
||||
const effect = effectOf(catalog, edition?.flareId);
|
||||
if (!effect) return NO_FLARE;
|
||||
return {
|
||||
id: effect.id,
|
||||
motifId: flareMotifOf(effect, edition.flareMotifId) || "",
|
||||
paletteId: edition.flarePaletteId || MATCH_HOLO_FLARE_PALETTE,
|
||||
scope: edition.flareScope || DEFAULT_FLARE_SCOPE,
|
||||
intensity: edition.flareIntensity || DEFAULT_FLARE_TUNING,
|
||||
level: edition.flareLevel || DEFAULT_FLARE_TUNING,
|
||||
count: edition.flareCount || DEFAULT_FLARE_TUNING
|
||||
};
|
||||
}
|
||||
|
||||
// Deux réglages se valent s'ils publient les mêmes champs.
|
||||
export const sameFlare = (left, right, catalog) => JSON.stringify(flareEditionFields(left, catalog)) === JSON.stringify(flareEditionFields(right, catalog));
|
||||
|
||||
// Réglages affichés pour une édition, ou null : sans palette explicite, les particules prennent celle du holo.
|
||||
export function resolveFlare(edition, catalog, finishVisual) {
|
||||
const effect = effectOf(catalog, edition?.flareId);
|
||||
if (!effect || !finishVisual?.effectPreset) return null;
|
||||
const palette = edition.flarePaletteId ? catalog?.effectPalettes?.find((item) => item.id === edition.flarePaletteId) : finishVisual.palette;
|
||||
if (!palette) return null;
|
||||
const scope = catalog.flareScopes?.some((item) => item.id === edition.flareScope) ? edition.flareScope : DEFAULT_FLARE_SCOPE;
|
||||
return {
|
||||
effect,
|
||||
motifId: flareMotifOf(effect, edition.flareMotifId),
|
||||
colors: palette.colors,
|
||||
core: palette.highlight,
|
||||
intensity: edition.flareIntensity || DEFAULT_FLARE_TUNING,
|
||||
level: edition.flareLevel || DEFAULT_FLARE_TUNING,
|
||||
count: edition.flareCount || DEFAULT_FLARE_TUNING,
|
||||
scope
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue