- DataModel : renommage value→level (1-4), ajout usesRemaining (0-4), suppression scores/notes - Config : ajout ANOMALY_DEFINITIONS avec compétences applicables par type (8 anomalies) - Fiche item anomalie : header avec level/uses visuels (dots), barre de compétences applicables, 2 onglets Description + Technique/Narratif (suppression onglet Scores) - Fiche PJ onglet Domaines : bloc anomalie proéminent unique avec: - Nom + sous-type + icône - Dots niveau (●●○○) - Dots usages + bouton Utiliser + bouton Réinitialiser - Chips des domaines applicables - Actions : useAnomaly (décrémente usesRemaining), resetAnomalyUses (reset au niveau) - Contrainte : max 1 anomalie par personnage (drop + createAnomaly) - Helpers HBS : lte, gte, lt ajoutés - i18n : nouvelles clés Anomaly.* (level, usesRemaining, use, resetUses, etc.) - CSS : .anomaly-block sur fiche PJ, dots animés, .anomaly-uses-row sur fiche item Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
93 lines
3.6 KiB
JavaScript
93 lines
3.6 KiB
JavaScript
import CelestopolItemSheet from "./base-item-sheet.mjs"
|
|
import { SYSTEM } from "../../config/system.mjs"
|
|
|
|
export class CelestopolAnomalySheet extends CelestopolItemSheet {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ["anomaly"],
|
|
position: { width: 560, height: 460 },
|
|
}
|
|
static PARTS = {
|
|
main: { template: "systems/fvtt-celestopol/templates/anomaly.hbs" },
|
|
}
|
|
async _prepareContext() {
|
|
const ctx = await super._prepareContext()
|
|
ctx.anomalyTypes = SYSTEM.ANOMALY_TYPES
|
|
|
|
const def = SYSTEM.ANOMALY_DEFINITIONS[ctx.system.subtype] ?? SYSTEM.ANOMALY_DEFINITIONS.none
|
|
ctx.applicableSkillLabels = def.technicalSkills.map(key => {
|
|
if (key === "lune") return game.i18n.localize("CELESTOPOL.Anomaly.moonDie")
|
|
for (const skills of Object.values(SYSTEM.SKILLS)) {
|
|
if (skills[key]) return game.i18n.localize(skills[key].label)
|
|
}
|
|
return key
|
|
})
|
|
|
|
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.description, { async: true })
|
|
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.technique, { async: true })
|
|
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.narratif, { async: true })
|
|
return ctx
|
|
}
|
|
}
|
|
|
|
export class CelestopolAspectSheet extends CelestopolItemSheet {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ["aspect"],
|
|
position: { width: 620, height: 520 },
|
|
}
|
|
static PARTS = {
|
|
main: { template: "systems/fvtt-celestopol/templates/aspect.hbs" },
|
|
}
|
|
async _prepareContext() {
|
|
const ctx = await super._prepareContext()
|
|
ctx.skills = SYSTEM.SKILLS
|
|
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.description, { async: true })
|
|
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.technique, { async: true })
|
|
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.narratif, { async: true })
|
|
return ctx
|
|
}
|
|
}
|
|
|
|
export class CelestopolAttributeSheet extends CelestopolItemSheet {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ["attribute"],
|
|
position: { width: 620, height: 520 },
|
|
}
|
|
static PARTS = {
|
|
main: { template: "systems/fvtt-celestopol/templates/attribute.hbs" },
|
|
}
|
|
async _prepareContext() {
|
|
const ctx = await super._prepareContext()
|
|
ctx.skills = SYSTEM.SKILLS
|
|
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.description, { async: true })
|
|
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.technique, { async: true })
|
|
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.narratif, { async: true })
|
|
return ctx
|
|
}
|
|
}
|
|
|
|
export class CelestopolEquipmentSheet extends CelestopolItemSheet {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ["equipment"],
|
|
position: { width: 540, height: 420 },
|
|
}
|
|
static PARTS = {
|
|
main: { template: "systems/fvtt-celestopol/templates/equipment.hbs" },
|
|
}
|
|
async _prepareContext() {
|
|
const ctx = await super._prepareContext()
|
|
ctx.equipmentTypes = SYSTEM.EQUIPMENT_TYPES
|
|
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
|
this.document.system.description, { async: true })
|
|
return ctx
|
|
}
|
|
}
|