mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Forcing string evaluation for testing
This commit is contained in:
parent
9c273d8a40
commit
87e402af91
1 changed files with 9 additions and 8 deletions
|
|
@ -306,6 +306,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
let DieTerm=foundry.dice.terms.Die;
|
let DieTerm=foundry.dice.terms.Die;
|
||||||
let dicetype = event.target.value;
|
let dicetype = event.target.value;
|
||||||
let originalRoll_parsed=message.rolls.map(roll => JSON.parse(roll))[0];
|
let originalRoll_parsed=message.rolls.map(roll => JSON.parse(roll))[0];
|
||||||
|
console.log("Parsed Map:",originalRoll_parsed);
|
||||||
let originalRoll=Roll.fromData(originalRoll_parsed);
|
let originalRoll=Roll.fromData(originalRoll_parsed);
|
||||||
let diceIndex;
|
let diceIndex;
|
||||||
console.log("Dice to reroll is:",dicetype,", and the message id is:",message._id,originalRoll_parsed);
|
console.log("Dice to reroll is:",dicetype,", and the message id is:",message._id,originalRoll_parsed);
|
||||||
|
|
@ -323,24 +324,24 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
ui.notifications.warn("Invalid Dice type selected.");
|
ui.notifications.warn("Invalid Dice type selected.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rollClone=originalRoll.clone();
|
let rollClone=originalRoll.clone();
|
||||||
let rerolledTerm=rollClone.terms[diceIndex];
|
let rerolledTerm=originalRoll.terms[diceIndex];
|
||||||
console.log("originalRoll:",originalRoll,"rollClone:",rollClone,"rerolledTerm",rerolledTerm);
|
console.log("originalRoll:",originalRoll,"rerolledTerm",rerolledTerm);
|
||||||
if (!(rerolledTerm instanceof DieTerm)) {
|
if (!(rerolledTerm instanceof DieTerm)) {
|
||||||
ui.notifications.error("Selected term is not a die.");
|
ui.notifications.error("Selected term is not a die.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await rollClone.reroll()[diceIndex];
|
await rollClone.reroll({allowStrings:true})[diceIndex];
|
||||||
await rollClone.evaluate();
|
console.log(rollClone);
|
||||||
|
await rollClone.evaluate({allowStrings:true});
|
||||||
console.log(rollClone.result);
|
console.log(rollClone.result);
|
||||||
|
/*
|
||||||
const confirm = await foundry.applications.api.DialogV2.confirm({
|
const confirm = await foundry.applications.api.DialogV2.confirm({
|
||||||
window: { title: 'Confirm Reroll' },
|
window: { title: 'Confirm Reroll' },
|
||||||
content: `<p>You have rerolled your <strong>${dicetype}</strong> die to <strong>${rerolledTerm.results[0].result}</strong>.</p><p>Apply this new roll?</p>`
|
content: `<p>You have rerolled your <strong>${dicetype}</strong> die to <strong>${rollClone.result}</strong>.</p><p>Apply this new roll?</p>`
|
||||||
});
|
});
|
||||||
if (!confirm) return;
|
if (!confirm) return;
|
||||||
rollClone.toMessage({flavor: 'Selective reroll applied for ${dicetype}.'});
|
rollClone.toMessage({flavor: 'Selective reroll applied for ${dicetype}.'});
|
||||||
console.log("Updated Roll",rollClone);
|
console.log("Updated Roll",rollClone);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue