feat(creature): ajustements manuels des valeurs calculées

Permet les disparités entre créatures de même Gabarit/Taille (ex. un
sanglier avec une Protection supérieure à celle d'un chien, un loup plus
vigoureux). Champ system.adjustments (9 stats) : valeur finale = base
dérivée + ajustement (jamais négative), persisté indépendamment des
niveaux. Section « Ajustements » éditable dans l'onglet Stats de la
fiche (mode édition).
This commit is contained in:
2026-08-09 20:33:35 +02:00
parent be43913ae3
commit d63eeda299
5 changed files with 127 additions and 0 deletions
+28
View File
@@ -65,6 +65,22 @@ export default class VermineCreatureData extends foundry.abstract.TypeDataModel
protection: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 1 })
}),
// Ajustements manuels des valeurs calculées : permettent les disparités
// entre créatures de même Gabarit/Taille (ex. un sanglier avec une
// Protection supérieure à celle d'un chien, un loup plus vigoureux).
// Base dérivée + ajustement = valeur finale (jamais négative).
adjustments: new fields.SchemaField({
attack: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
damage: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
vigor: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
reaction: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
reactionBonus: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
pools: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
gear: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
gearHindrance: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 }),
protection: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 })
}),
// Équipement
equipment: equipmentSchema()
}
@@ -145,6 +161,18 @@ export default class VermineCreatureData extends foundry.abstract.TypeDataModel
// Protection
this.computed.protection = roleConfig.protection || 1
// Ajustements manuels (base + modificateur), plancher à 0.
const adj = this.adjustments ?? {}
this.computed.attack = Math.max(0, this.computed.attack + (adj.attack ?? 0))
this.computed.damage = Math.max(0, this.computed.damage + (adj.damage ?? 0))
this.computed.vigor = Math.max(0, this.computed.vigor + (adj.vigor ?? 0))
this.computed.reaction = Math.max(0, this.computed.reaction + (adj.reaction ?? 0))
this.computed.reactionBonus = Math.max(0, this.computed.reactionBonus + (adj.reactionBonus ?? 0))
this.computed.pools = Math.max(0, this.computed.pools + (adj.pools ?? 0))
this.computed.gear = Math.max(0, this.computed.gear + (adj.gear ?? 0))
this.computed.gearHindrance = Math.max(0, this.computed.gearHindrance + (adj.gearHindrance ?? 0))
this.computed.protection = Math.max(0, this.computed.protection + (adj.protection ?? 0))
}
/**