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>
This commit is contained in:
2026-03-29 17:03:23 +02:00
parent be323e6f68
commit 5a8b151451
11 changed files with 321 additions and 14 deletions

View File

@@ -1,3 +1,3 @@
export { default as CelestopolCharacterSheet } from "./sheets/character-sheet.mjs"
export { default as CelestopolNPCSheet } from "./sheets/npc-sheet.mjs"
export { CelestopolAnomalySheet, CelestopolAspectSheet, CelestopolEquipmentSheet } from "./sheets/item-sheets.mjs"
export { CelestopolAnomalySheet, CelestopolAspectSheet, CelestopolEquipmentSheet, CelestopolWeaponSheet, CelestopolArmureSheet } from "./sheets/item-sheets.mjs"

View File

@@ -69,3 +69,37 @@ export class CelestopolEquipmentSheet extends CelestopolItemSheet {
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
}
}

View File

@@ -140,6 +140,21 @@ export const EQUIPMENT_TYPES = {
vehicule: { id: "vehicule", label: "CELESTOPOL.Equipment.vehicule" },
}
/** Niveaux de dégâts des armes (règles p. ?). */
export const WEAPON_DAMAGE_TYPES = {
"0": { id: "0", label: "CELESTOPOL.Weapon.degats0", hint: "CELESTOPOL.Weapon.degats0Hint" },
"1": { id: "1", label: "CELESTOPOL.Weapon.degats1", hint: "CELESTOPOL.Weapon.degats1Hint" },
"2": { id: "2", label: "CELESTOPOL.Weapon.degats2", hint: "CELESTOPOL.Weapon.degats2Hint" },
"X": { id: "X", label: "CELESTOPOL.Weapon.degatsX", hint: "CELESTOPOL.Weapon.degatsXHint" },
}
/** Portées des armes. */
export const WEAPON_RANGE_TYPES = {
contact: { id: "contact", label: "CELESTOPOL.Weapon.rangeContact" },
courte: { id: "courte", label: "CELESTOPOL.Weapon.rangeCourte" },
longue: { id: "longue", label: "CELESTOPOL.Weapon.rangeLongue" },
}
export const SYSTEM = {
id: SYSTEM_ID,
ASCII,
@@ -154,4 +169,6 @@ export const SYSTEM = {
MOON_DIE_FACES,
MOON_RESULT_TYPES,
EQUIPMENT_TYPES,
WEAPON_DAMAGE_TYPES,
WEAPON_RANGE_TYPES,
}

View File

@@ -1,3 +1,3 @@
export { default as CelestopolCharacter } from "./character.mjs"
export { default as CelestopolNPC } from "./npc.mjs"
export { CelestopolAnomaly, CelestopolAspect, CelestopolEquipment } from "./items.mjs"
export { CelestopolAnomaly, CelestopolAspect, CelestopolEquipment, CelestopolWeapon, CelestopolArmure } from "./items.mjs"

View File

@@ -76,3 +76,29 @@ export class CelestopolEquipment extends foundry.abstract.TypeDataModel {
}
}
}
export class CelestopolWeapon extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true }
return {
degats: new fields.StringField({ required: true, nullable: false, initial: "0",
choices: Object.keys(SYSTEM.WEAPON_DAMAGE_TYPES) }),
portee: new fields.StringField({ required: true, nullable: false, initial: "contact",
choices: Object.keys(SYSTEM.WEAPON_RANGE_TYPES) }),
description: new fields.HTMLField({ required: true, textSearch: true }),
}
}
}
export class CelestopolArmure extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true }
return {
protection: new fields.NumberField({ ...reqInt, initial: 1, min: 1, max: 2 }),
malus: new fields.NumberField({ ...reqInt, initial: 0, min: 0, max: 2 }),
description: new fields.HTMLField({ required: true, textSearch: true }),
}
}
}