Add a macro for the horror rolling
This commit is contained in:
parent
992201262f
commit
5efb080966
1 changed files with 46 additions and 0 deletions
46
Axolotl-with-a-Gun/the-horrors.mjs
Normal file
46
Axolotl-with-a-Gun/the-horrors.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
const diceCount = await DialogManager.ask({
|
||||
id: `horrors-dice-pool`,
|
||||
inputs: [
|
||||
{
|
||||
key: `diceCount`,
|
||||
inputType: `number`,
|
||||
label: `Dice Count`,
|
||||
autofocus: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
let rollMode = game.settings.get(`core`, `rollMode`);
|
||||
|
||||
let r = new Roll(`${diceCount}d6cs<4`);
|
||||
await r.evaluate();
|
||||
const successes = r.total;
|
||||
|
||||
const privacy = stats.utils.determinePrivacyFromRollMode(rollMode);
|
||||
await CONFIG.stats.db.createRows(
|
||||
`Dice/d6`,
|
||||
game.user.id,
|
||||
r.dice[0].results.map(d => ({ value: d.result, privacy })),
|
||||
{ rerender: false },
|
||||
);
|
||||
await CONFIG.stats.db.createRow(
|
||||
`AwaG/Count of Successes`,
|
||||
game.user.id,
|
||||
{ value: successes, privacy },
|
||||
{ rerender: false },
|
||||
);
|
||||
await CONFIG.stats.db.createRow(
|
||||
`AwaG/Amount of Dice Rolled`,
|
||||
game.user.id,
|
||||
{ value: diceCount, privacy },
|
||||
{ rerender: false },
|
||||
);
|
||||
CONFIG.stats.db.render();
|
||||
|
||||
const chatData = ChatMessage.applyRollMode(
|
||||
{ rolls: [r], },
|
||||
rollMode,
|
||||
);
|
||||
await ChatMessage.implementation.create(chatData);
|
||||
|
||||
const clock = window.clockDatabase.getName(`Attacking Dice`);
|
||||
window.clockDatabase.update({ id: clock.id, value: successes });
|
||||
Loading…
Add table
Add a link
Reference in a new issue