- DataModel : renommage value→level (1-4), ajout usesRemaining (0-4), suppression scores/notes - Config : ajout ANOMALY_DEFINITIONS avec compétences applicables par type (8 anomalies) - Fiche item anomalie : header avec level/uses visuels (dots), barre de compétences applicables, 2 onglets Description + Technique/Narratif (suppression onglet Scores) - Fiche PJ onglet Domaines : bloc anomalie proéminent unique avec: - Nom + sous-type + icône - Dots niveau (●●○○) - Dots usages + bouton Utiliser + bouton Réinitialiser - Chips des domaines applicables - Actions : useAnomaly (décrémente usesRemaining), resetAnomalyUses (reset au niveau) - Contrainte : max 1 anomalie par personnage (drop + createAnomaly) - Helpers HBS : lte, gte, lt ajoutés - i18n : nouvelles clés Anomaly.* (level, usesRemaining, use, resetUses, etc.) - CSS : .anomaly-block sur fiche PJ, dots animés, .anomaly-uses-row sur fiche item Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
98 lines
4.5 KiB
JavaScript
98 lines
4.5 KiB
JavaScript
import { SYSTEM } from "../config/system.mjs"
|
|
|
|
/** Schéma partagé pour les bonus/malus par domaine (utilisé dans anomaly/aspect/attribute). */
|
|
function skillScoresSchema() {
|
|
const fields = foundry.data.fields
|
|
const reqInt = { required: true, nullable: false, integer: true }
|
|
const scoreField = () => new fields.SchemaField({
|
|
bonus: new fields.NumberField({ ...reqInt, initial: 0 }),
|
|
malus: new fields.NumberField({ ...reqInt, initial: 0 }),
|
|
})
|
|
|
|
const statGroup = (statId) => {
|
|
const skills = SYSTEM.SKILLS[statId]
|
|
const schema = {}
|
|
for (const key of Object.keys(skills)) {
|
|
schema[key] = scoreField()
|
|
}
|
|
return new fields.SchemaField(schema)
|
|
}
|
|
|
|
return new fields.SchemaField({
|
|
ame: statGroup("ame"),
|
|
corps: statGroup("corps"),
|
|
coeur: statGroup("coeur"),
|
|
esprit: statGroup("esprit"),
|
|
})
|
|
}
|
|
|
|
export class CelestopolAnomaly extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const reqInt = { required: true, nullable: false, integer: true }
|
|
return {
|
|
subtype: new fields.StringField({ required: true, nullable: false, initial: "none",
|
|
choices: Object.keys(SYSTEM.ANOMALY_TYPES) }),
|
|
level: new fields.NumberField({ ...reqInt, initial: 2, min: 1, max: 4 }),
|
|
usesRemaining: new fields.NumberField({ ...reqInt, initial: 2, min: 0, max: 4 }),
|
|
reference: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
description: new fields.HTMLField({ required: true, textSearch: true }),
|
|
technique: new fields.HTMLField({ required: true, textSearch: true }),
|
|
narratif: new fields.HTMLField({ required: true, textSearch: true }),
|
|
}
|
|
}
|
|
}
|
|
|
|
export class CelestopolAspect extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const reqInt = { required: true, nullable: false, integer: true }
|
|
return {
|
|
value: new fields.NumberField({ ...reqInt, initial: 0, min: 0, max: 8 }),
|
|
reference: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
scores: skillScoresSchema(),
|
|
description: new fields.HTMLField({ required: true, textSearch: true }),
|
|
technique: new fields.HTMLField({ required: true, textSearch: true }),
|
|
narratif: new fields.HTMLField({ required: true, textSearch: true }),
|
|
notes: new fields.HTMLField({ required: true, textSearch: true }),
|
|
}
|
|
}
|
|
}
|
|
|
|
export class CelestopolAttribute extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const reqInt = { required: true, nullable: false, integer: true }
|
|
return {
|
|
value: new fields.NumberField({ ...reqInt, initial: 0, min: 0, max: 8 }),
|
|
reference: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
scores: skillScoresSchema(),
|
|
description: new fields.HTMLField({ required: true, textSearch: true }),
|
|
technique: new fields.HTMLField({ required: true, textSearch: true }),
|
|
narratif: new fields.HTMLField({ required: true, textSearch: true }),
|
|
notes: new fields.HTMLField({ required: true, textSearch: true }),
|
|
}
|
|
}
|
|
}
|
|
|
|
export class CelestopolEquipment extends foundry.abstract.TypeDataModel {
|
|
static defineSchema() {
|
|
const fields = foundry.data.fields
|
|
const reqInt = { required: true, nullable: false, integer: true }
|
|
return {
|
|
subtype: new fields.StringField({ required: true, nullable: false, initial: "autre",
|
|
choices: Object.keys(SYSTEM.EQUIPMENT_TYPES) }),
|
|
reference: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
quantity: new fields.NumberField({ ...reqInt, initial: 1, min: 0 }),
|
|
weight: new fields.NumberField({ required: true, nullable: false, initial: 0, min: 0 }),
|
|
damage: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
range: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
speed: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
protection: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
crew: new fields.StringField({ required: true, nullable: false, initial: "" }),
|
|
description:new fields.HTMLField({ required: true, textSearch: true }),
|
|
notes: new fields.HTMLField({ required: true, textSearch: true }),
|
|
}
|
|
}
|
|
}
|