/** * Célestopol 1922 — Système FoundryVTT * * Célestopol 1922 est un jeu de rôle édité par Antre-Monde Éditions. * Ce système FoundryVTT est une implémentation indépendante et n'est pas * affilié à Antre-Monde Éditions, * mais a été réalisé avec l'autorisation d'Antre-Monde Éditions. * * @author LeRatierBretonnien * @copyright 2025–2026 LeRatierBretonnien * @license CC BY-NC-SA 4.0 – https://creativecommons.org/licenses/by-nc-sa/4.0/ */ 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: 560 }, } 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.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 }) ctx.enrichedExemples = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.document.system.exemples, { async: true }) return ctx } } export class CelestopolAspectSheet extends CelestopolItemSheet { static DEFAULT_OPTIONS = { classes: ["aspect"], position: { width: 480, height: 360 }, } static PARTS = { main: { template: "systems/fvtt-celestopol/templates/aspect.hbs" }, } async _prepareContext() { const ctx = await super._prepareContext() ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.document.system.description, { 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.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.document.system.description, { async: true }) return ctx } } export class CelestopolWeaponSheet extends CelestopolItemSheet { static DEFAULT_OPTIONS = { classes: ["weapon"], position: { width: 480, height: 460 }, } static PARTS = { main: { template: "systems/fvtt-celestopol/templates/weapon.hbs" }, } async _prepareContext() { const ctx = await super._prepareContext() ctx.damageTypes = SYSTEM.WEAPON_DAMAGE_TYPES ctx.rangeTypes = SYSTEM.WEAPON_RANGE_TYPES ctx.combatTypes = SYSTEM.WEAPON_COMBAT_TYPES ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.document.system.description, { async: true }) return ctx } } export class CelestopolArmureSheet extends CelestopolItemSheet { static DEFAULT_OPTIONS = { classes: ["armure"], position: { width: 440, height: 380 }, } static PARTS = { main: { template: "systems/fvtt-celestopol/templates/armure.hbs" }, } async _prepareContext() { const ctx = await super._prepareContext() ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.document.system.description, { async: true }) return ctx } _onRender(context, options) { super._onRender(context, options) const protectionInput = this.element.querySelector('[name="system.protection"]') const malusInput = this.element.querySelector('[name="system.malus"]') const malusValue = this.element.querySelector('[data-armure-malus-value]') if (!protectionInput || !malusInput || !malusValue) return const syncMalus = () => { malusInput.value = protectionInput.value malusValue.textContent = protectionInput.value } syncMalus() protectionInput.addEventListener("input", syncMalus) protectionInput.addEventListener("change", syncMalus) } }