Files
fvtt-celestopol/module/applications/sheets/item-sheets.mjs
LeRatierBretonnier 5a8b151451 Nouveaux items Arme et Armure (DataModel + feuille + CSS)
Items:
- CelestopolWeapon : degats (0/1/2/X), portee (contact/courte/longue), description
- CelestopolArmure : protection (1-2), malus (0-2), description

Config:
- WEAPON_DAMAGE_TYPES et WEAPON_RANGE_TYPES ajoutés dans system.mjs
- Enregistrement des DataModels, sheets et templates dans fvtt-celestopol.mjs
- system.json : types weapon et armure avec htmlFields

UI:
- weapon.hbs : badge de dégâts avec hint, sélecteurs portée/dégâts
- armure.hbs : blocs protection + malus art-déco
- items.less : styles .weapon et .armure

i18n: clés Weapon.*, Armure.*, Sheet.weapon, Sheet.armure

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-29 17:03:23 +02:00

106 lines
3.8 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: 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: 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 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
}
}
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.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
}
}