Preliminary rolls

This commit is contained in:
2021-11-01 22:23:43 +01:00
parent 4452f3826a
commit ea034953a6
15 changed files with 331 additions and 133 deletions

View File

@ -117,6 +117,15 @@ export class BoLUtility {
this.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
}
/* -------------------------------------------- */
static getTarget() {
if (game.user.targets && game.user.targets.size == 1) {
for (let target of game.user.targets) {
return target;
}
}
return undefined;
}
/* -------------------------------------------- */
static async rollBoL( rollData ) {
@ -136,9 +145,19 @@ export class BoLUtility {
nbDice += d6BM;
// Final modifier
let modifier = Number(rollData.attributes[rollData.rollAttribute].value) + Number(rollData.career.data.rank) + Number(rollData.bonusMalus);
let modifier = Number(rollData.bonusMalus);
if ( rollData.mode == 'career') {
modifier += Number(rollData.attributes[rollData.rollAttribute].value) + Number(rollData.career.data.rank);
} else if ( rollData.mode == 'attribute' ) {
modifier += rollData.attribute.value;
} else if ( rollData.mode == 'weapon') {
modifier += Number(rollData.attributes[rollData.rollAttribute].value) + Number(rollData.aptitude.value) + Number(rollData.rangeModifier);
modifier -= rollData.defender.aptitudes.def.value;
}
let formula = nbDice+"d6"+mode+"+"+modifier;
console.log("Goigin to roll ", formula, rollData.attributes, rollData.rollAttribute);
console.log("Going to roll ", formula, rollData.attributes, rollData.rollAttribute);
let myRoll = new Roll(formula).roll( { async: false});
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode") );
rollData.roll = myRoll;
@ -152,7 +171,6 @@ export class BoLUtility {
this.createChatWithRollMode( rollData.alias, {
content: await renderTemplate(`systems/bol/templates/roll/chat-generic-result.hbs`, rollData)
});
// TODO
}
/* -------------------------------------------- */

View File

@ -18,12 +18,12 @@ export class BoLRollDialog extends Dialog {
buttons: {
roll: {
icon: '<i class="fas fa-check"></i>',
label: "Roll !",
label: game.i18n.localize("Roll"),
callback: () => { this.roll() }
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
label: game.i18n.localize("Cancel"),
callback: () => { this.close() }
} },
default: "roll",