This commit is contained in:
François-Xavier Guillois
2023-05-19 12:02:19 +02:00
parent 13e1892997
commit d8ab796808
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -52,9 +52,11 @@
form.serializeArray().map(item => { form.serializeArray().map(item => {
formData[item.name] = item.value; formData[item.name] = item.value;
}); });
console.log("roll form data", formData); // console.log("roll form data", formData);
let NoD = parseInt(formData.ability,10); let NoD = parseInt(formData.ability,10);
let Reroll = 0; let Reroll = 0;
// difficulty
data.difficulty = (formData.difficulty != undefined) ? formData.difficulty : 7;
// maîtrise bonus // maîtrise bonus
if (formData.skill > 0 && formData.skill < 3){ if (formData.skill > 0 && formData.skill < 3){
NoD += 1; NoD += 1;
+4 -4
View File
@@ -2,11 +2,11 @@ export class TotemRoll {
static roll(actorId, label, NoD, Reroll = 0, params = {}){ static roll(actorId, label, NoD, Reroll = 0, params = {}){
const actor = game.actors.get(actorId); const actor = game.actors.get(actorId);
let formula = '{' + NoD + "d10"; let formula = '' + (parseInt(NoD,10) + parseInt(Reroll,10)) + "d10";
if (Reroll > 0){ if (Reroll > 0 && params.difficulty != undefined){
formula += 'r' + Reroll; formula += 'kh' + (parseInt(NoD,10) -1);
} }
formula += (params.difficulty != undefined) ? "}cs>" + params.difficulty : "}cs>7"; formula += (params.difficulty != undefined) ? "cs>" + params.difficulty : "cs>7";
let roll = new Roll(formula, actor.getRollData()); let roll = new Roll(formula, actor.getRollData());
roll.toMessage({ roll.toMessage({
speaker: ChatMessage.getSpeaker({ actor: actor }), speaker: ChatMessage.getSpeaker({ actor: actor }),