roll fix
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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 }),
|
||||||
|
|||||||
Reference in New Issue
Block a user