|
|
@ -26,11 +26,10 @@ export class M5Roll {
|
|||
.map((rollName, index) => {
|
||||
indexMap.set(index, rollName);
|
||||
const formula = this.data.rolls[rollName];
|
||||
formula.formula = index === 0 ? formula.formula.replace(/(\d*d\d*)/, `{$1 + ${this.data.b.modifier}}`) : formula.formula;
|
||||
formula.formula = index === 0 && this.id !== "-1" ? formula.formula.replace(/(\d*d\d*)/, `{$1 + ${this.data.b.modifier}}`) : formula.formula;
|
||||
const roll = new Roll(formula.formula, this.data);
|
||||
return roll;
|
||||
});
|
||||
console.log(rolls);
|
||||
this.pool = PoolTerm.fromRolls(rolls);
|
||||
console.log("evaluate", this._evaluated, this.pool);
|
||||
return this.pool.evaluate({ async: true }).then((results) => {
|
||||
|
|
@ -89,7 +88,6 @@ export class M5Roll {
|
|||
});
|
||||
|
||||
this.data.res.label = this.label;
|
||||
console.log(this.data);
|
||||
if ((game as Game).settings.get("midgard5", "automatedPP") && this.data.iType !== null) {
|
||||
if ((this.data.i.type === "language" || this.data.i.type === "general") && this.data.rolls[0].dice[0] >= 16) {
|
||||
this.actor.items.get(this.id).update({
|
||||
|
|
|
|||
|
|
@ -4,11 +4,9 @@ import { M5Roll } from "./M5Roll";
|
|||
export const reroll = async (roll) => {
|
||||
const message = (game as Game).messages.get(roll.attr("data-message-id"));
|
||||
const actor = (game as Game).actors.get(message["speaker"].actor);
|
||||
// const die
|
||||
|
||||
const template = "systems/midgard5/templates/chat/reroll-dialog.hbs";
|
||||
const html = await renderTemplate(template, { sg: actor.system.sg, gp: actor.system.gp });
|
||||
console.log(message["flags"].faces[0]);
|
||||
// Button defining
|
||||
let buttons = {};
|
||||
buttons = {
|
||||
|
|
@ -51,6 +49,7 @@ export const reroll = async (roll) => {
|
|||
// Update the "content" field
|
||||
let rollData = actor.getRollData() as M5RollData;
|
||||
const flagData = message["flags"].data;
|
||||
rollData.c = flagData.c;
|
||||
rollData.i = flagData.i;
|
||||
rollData.b = flagData.b;
|
||||
rollData.iType = flagData.iType;
|
||||
|
|
@ -92,7 +91,7 @@ export const reroll = async (roll) => {
|
|||
}
|
||||
}
|
||||
|
||||
const newRoll = new M5Roll(rollData, actor, rollData.res.label);
|
||||
const newRoll = new M5Roll(rollData, actor, rollData.res.label, "-1");
|
||||
if (!newRoll._evaluated) await newRoll.evaluate();
|
||||
|
||||
const chatData = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue