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

@@ -233,7 +233,10 @@
"portee": "Portée", "portee": "Portée",
"rangeContact": "Contact", "rangeContact": "Contact",
"rangeCourte": "Courte portée", "rangeCourte": "Courte portée",
"rangeLongue": "Longue portée" "rangeLongue": "Longue portée",
"type": "Type",
"typeMelee": "Mêlée",
"typeDistance": "Distance"
}, },
"Armure": { "Armure": {
"protection": "Protection", "protection": "Protection",

View File

@@ -82,6 +82,7 @@ export class CelestopolWeaponSheet extends CelestopolItemSheet {
const ctx = await super._prepareContext() const ctx = await super._prepareContext()
ctx.damageTypes = SYSTEM.WEAPON_DAMAGE_TYPES ctx.damageTypes = SYSTEM.WEAPON_DAMAGE_TYPES
ctx.rangeTypes = SYSTEM.WEAPON_RANGE_TYPES ctx.rangeTypes = SYSTEM.WEAPON_RANGE_TYPES
ctx.combatTypes = SYSTEM.WEAPON_COMBAT_TYPES
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true }) this.document.system.description, { async: true })
return ctx return ctx

View File

@@ -140,6 +140,12 @@ export const EQUIPMENT_TYPES = {
vehicule: { id: "vehicule", label: "CELESTOPOL.Equipment.vehicule" }, 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. ?). */ /** Niveaux de dégâts des armes (règles p. ?). */
export const WEAPON_DAMAGE_TYPES = { export const WEAPON_DAMAGE_TYPES = {
"0": { id: "0", label: "CELESTOPOL.Weapon.degats0", hint: "CELESTOPOL.Weapon.degats0Hint" }, "0": { id: "0", label: "CELESTOPOL.Weapon.degats0", hint: "CELESTOPOL.Weapon.degats0Hint" },
@@ -171,4 +177,5 @@ export const SYSTEM = {
EQUIPMENT_TYPES, EQUIPMENT_TYPES,
WEAPON_DAMAGE_TYPES, WEAPON_DAMAGE_TYPES,
WEAPON_RANGE_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 fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true } const reqInt = { required: true, nullable: false, integer: true }
return { 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", degats: new fields.StringField({ required: true, nullable: false, initial: "0",
choices: Object.keys(SYSTEM.WEAPON_DAMAGE_TYPES) }), choices: Object.keys(SYSTEM.WEAPON_DAMAGE_TYPES) }),
portee: new fields.StringField({ required: true, nullable: false, initial: "contact", portee: new fields.StringField({ required: true, nullable: false, initial: "contact",

View File

@@ -6,6 +6,16 @@
<div class="item-header-fields"> <div class="item-header-fields">
<input type="text" name="name" value="{{item.name}}" {{#unless isEditable}}disabled{{/unless}}> <input type="text" name="name" value="{{item.name}}" {{#unless isEditable}}disabled{{/unless}}>
<div class="item-meta weapon-meta"> <div class="item-meta weapon-meta">
<div class="form-group">
<label>{{localize "CELESTOPOL.Weapon.type"}}</label>
<select name="system.type" {{#unless isEditable}}disabled{{/unless}}>
{{#each combatTypes as |ctype key|}}
<option value="{{key}}" {{#if (eq key ../system.type)}}selected{{/if}}>
{{localize ctype.label}}
</option>
{{/each}}
</select>
</div>
<div class="form-group"> <div class="form-group">
<label>{{localize "CELESTOPOL.Weapon.degats"}}</label> <label>{{localize "CELESTOPOL.Weapon.degats"}}</label>
<select name="system.degats" {{#unless isEditable}}disabled{{/unless}}> <select name="system.degats" {{#unless isEditable}}disabled{{/unless}}>