Arme : ajout du champ Type (Mêlée / Distance)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-29 17:05:28 +02:00
parent 5a8b151451
commit eceac4c122
5 changed files with 24 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ export class CelestopolWeaponSheet extends CelestopolItemSheet {
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

View File

@@ -140,6 +140,12 @@ export const EQUIPMENT_TYPES = {
vehicule: { id: "vehicule", label: "CELESTOPOL.Equipment.vehicule" },
}
/** Types d'armes (mêlée / distance). */
export const WEAPON_COMBAT_TYPES = {
melee: { id: "melee", label: "CELESTOPOL.Weapon.typeMelee" },
distance: { id: "distance", label: "CELESTOPOL.Weapon.typeDistance" },
}
/** 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" },
@@ -171,4 +177,5 @@ export const SYSTEM = {
EQUIPMENT_TYPES,
WEAPON_DAMAGE_TYPES,
WEAPON_RANGE_TYPES,
WEAPON_COMBAT_TYPES,
}

View File

@@ -82,6 +82,8 @@ export class CelestopolWeapon extends foundry.abstract.TypeDataModel {
const fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true }
return {
type: new fields.StringField({ required: true, nullable: false, initial: "melee",
choices: Object.keys(SYSTEM.WEAPON_COMBAT_TYPES) }),
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",