Files
foundryvtt-reve-de-dragon/module/models/competence.mjs
T
fabres 4a6913a2ba fix: XP compétences négatives (base de catégorie)
Le champ base (INTEGER, min 0) rejetait les bases négatives
(-4/-6/-8/-11) : toute compétence voyait sa base forcée à 0, d'où un
total d'XP compétences fortement négatif (ex. -5790 sur un personnage
neuf).
- competence.mjs : base en INTEGER_SIGNED
- item-competence.js : _preCreate affecte la base de la catégorie
- migrations.js : migration 14.0.3 corrige les compétences existantes
- compendiums repackés (bases de catégorie présentes dans les packs)
2026-08-06 14:27:39 +02:00

23 lines
1.2 KiB
JavaScript

import { TEMPLATE_DESCRIPTION } from "../common/_module.mjs";
import { INTEGER, INTEGER_SIGNED, STRING } from "../common/field-types.mjs";
const fields = foundry.data.fields;
export default class RdDModelCompetence extends foundry.abstract.TypeDataModel {
static defineSchema() {
return Object.assign({},
TEMPLATE_DESCRIPTION.fields(),
{
niveau: new fields.NumberField({ label: "Niveau", initial: 0, ...INTEGER_SIGNED, min: -11 }),
default_diffLibre: new fields.NumberField({ label: "Difficulté libre par défaut", initial: 0, ...INTEGER_SIGNED, min: -10, max: 0 }),
base: new fields.NumberField({ label: "Base", initial: 0, ...INTEGER_SIGNED }),
categorie: new fields.StringField({ label: "Catégorie", initial: "", ...STRING }),
xp: new fields.NumberField({ label: "XP", initial: 0, ...INTEGER }),
defaut_carac: new fields.StringField({ label: "Caractéristique par défaut", initial: "", ...STRING }),
niveau_archetype: new fields.NumberField({ label: "Niveau d'archétype", initial: 0, ...INTEGER }),
xp_sort: new fields.NumberField({ label: "XP de sort", initial: 0, ...INTEGER }),
}
)
}
}