v11.2.0 - Les Terres médianes d'Akarlikarlikar #683

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2023-11-20 07:04:11 +01:00
Showing only changes of commit c1a5bd6eb3 - Show all commits

View File

@ -164,7 +164,7 @@ export class RdDDice {
if (options.showDice == HIDE_DICE || !game.modules.get("dice-so-nice")?.active || !game.dice3d) {
return;
}
let { whisper, blind } = RdDDice._getWhisperBlind(options);
if (options.forceDiceResult?.total) {
let terms = await RdDDice._getForcedTerms(options);
@ -197,48 +197,25 @@ export class RdDDice {
function terms1d100(total) {
const unites = total % 10;
const dizaines = Math.floor(total / 10);
return [{
resultLabel: dizaines * 10,
d100Result: total,
result: dizaines,
type: "d100",
vectors: [],
options: {}
},
{
resultLabel: unites,
d100Result: total,
result: unites,
type: "d10",
vectors: [],
options: {}
}];
return [
{ type: "d100", result: dizaines, resultLabel: dizaines * 10, vectors: [], options: {}, d100Result: total },
{ type: "d10", result: unites, resultLabel: unites, vectors: [], options: {}, d100Result: total }
];
}
async function terms2d10(total) {
if (total>20 || total<2) { return undefined }
let first = await RdDDice.d10();
let second = Math.min(total-first, 10);
first = Math.max(first, total-second);
return [{
resultLabel:first,
result: first,
type: "d10",
vectors: [],
options: {}
},
{
resultLabel: second,
result: second,
type: "d10",
vectors: [],
options: {}
}];
if (total > 20 || total < 2) { return undefined }
const first = await RdDDice.fakeD10(Math.min(10, total - 1));
const second = total - first;
return [
{ type: "d10", result: first, resultLabel: first, vectors: [], options: {} },
{ type: "d10", result: second, resultLabel: second, vectors: [], options: {} }
];
}
}
static async d10() {
let roll = new Roll('1d10');
static async fakeD10(faces) {
let roll = new Roll(`1d${faces}`);
await roll.evaluate({ async: true });
return roll.total;
}