Resultat impari sur D20 dans messages et corrections diverses

This commit is contained in:
2026-03-10 21:37:20 +01:00
parent e7a6c15bf7
commit 6b909b192b
42 changed files with 52 additions and 39 deletions

View File

@@ -18,6 +18,12 @@ export class MournbladeActor extends Actor {
// Calculate derived attributes
const data = this.system;
if (this.type == 'personnage') {
// Compute base health and max soul from attributes (derived, no DB write needed)
data.sante.base = data.sante.bonus + (data.attributs.pui.value + data.attributs.tre.value) * 2 + 5;
data.ame.fullmax = (data.attributs.cla.value + data.attributs.tre.value) * data.biodata.amemultiplier + 5;
}
// Calculate total health
data.sante.total = data.sante.base + data.sante.bonus;
@@ -32,7 +38,7 @@ export class MournbladeActor extends Actor {
}
prepareDerivedData() {
this.prepareData();
super.prepareDerivedData();
}
/* -------------------------------------------- */
@@ -299,25 +305,6 @@ export class MournbladeActor extends Actor {
return combat
}
/* -------------------------------------------- */
prepareDerivedData() {
if (this.type == 'personnage') {
let newSante = this.system.sante.bonus + (this.system.attributs.pui.value + this.system.attributs.tre.value) * 2 + 5
if (this.system.sante.base != newSante && this._id) {
// Only update if the actor already exists (has an _id)
this.update({ 'system.sante.base': newSante })
}
let newAme = (this.system.attributs.cla.value + this.system.attributs.tre.value) * this.system.biodata.amemultiplier + 5
if (this.system.ame.fullmax != newAme && this._id) {
// Only update if the actor already exists (has an _id)
this.update({ 'system.ame.fullmax': newAme })
}
}
super.prepareDerivedData()
}
/* -------------------------------------------- */
_preUpdate(changed, options, user) {
@@ -583,8 +570,8 @@ export class MournbladeActor extends Actor {
this.update({ 'system.ressources': ressources })
ChatMessage.create({
content: "L'utilisation de la capacité/arme a dépensé " + arme.system.nbressources + " ressources.",
whisper: game.user._id,
user: game.user._id
whisper: game.user.id,
user: game.user.id
});
} else {
ui.notifications.warn("Points de ressources insuffisants.")
@@ -735,7 +722,7 @@ export class MournbladeActor extends Actor {
let arme = this.items.get(armeId)
if (arme) {
MournbladeUtility.createChatWithRollMode("GM", {
content: await renderTemplate(`systems/fvtt-mournblade/templates/chat-display-description.hbs`, arme)
content: await foundry.applications.handlebars.renderTemplate(`systems/fvtt-mournblade/templates/chat-display-description.hbs`, arme)
}, arme)
this.depenseRessources(arme)
}
@@ -751,7 +738,7 @@ export class MournbladeActor extends Actor {
arme = this.prepareBouclier(arme)
}
//Unused rollData.degatsFormula = arme.system.totalDegats
let roll = await new Roll(arme.system.totalDegats).roll()
let roll = await new Roll(arme.system.totalDegats).evaluate()
await MournbladeUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"));
let rollData = {
degatsFormula:arme.system.totalDegats,