Support des runes

This commit is contained in:
2022-06-26 18:52:31 +02:00
parent 3f91a161ab
commit 8d43ae6b6e
11 changed files with 174 additions and 14 deletions

View File

@ -56,6 +56,15 @@ export class MournbladeUtility {
return opt.concat("\n")
}
/* -------------------------------------------- */
static getPointAmeOptions() {
let opt = []
for (let i = 1; i <= 20; i++) {
opt.push(`<option value="${i}">${i}</option>`)
}
return opt.concat("\n")
}
/* -------------------------------------------- */
static getAttributs() {
return { adr: "Adresse", pui: "Puissance", cla: "Clairvoyance", pre: "Présence", tre: "Trempe" }
@ -318,10 +327,18 @@ export class MournbladeUtility {
} else {
rollData.diceFormula += `+${rollData.attr.value}*2+${rollData.modificateur}`
}
if (rollData.arme) {
rollData.diceFormula += `+${rollData.arme.data.bonusmaniementoff}`
}
if(rollData.rune) {
rollData.runeduree = Math.ceil((rollData.runeame+3) / 3)
if ( rollData.runemode == "inscrire") {
rollData.runeduree *= 2
}
}
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"));
rollData.roll = myRoll
@ -330,6 +347,14 @@ export class MournbladeUtility {
rollData.finalResult = myRoll.total
this.computeResult( rollData)
if (rollData.rune ) {
let subAme = rollData.runeame
if ( rollData.isEchec && !rollData.isDramatique) {
subAme = Math.ceil((subAme+1) / 2)
}
actor.subPointsAme(rollData.runemode, subAme)
}
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-mournblade/templates/chat-generic-result.html`, rollData)
}, rollData)
@ -440,6 +465,7 @@ export class MournbladeUtility {
rollId: randomID(16),
rollMode: game.settings.get("core", "rollMode"),
modificateursOptions: this.getModificateurOptions(),
pointAmeOptions: this.getPointAmeOptions(),
difficulte: 0,
modificateur: 0,
}