deno fmt + added docs on cwod dice
This commit is contained in:
parent
f95d24375d
commit
ed0a12c3bc
|
@ -100,6 +100,10 @@ The Artificer comes with a few supplemental commands to the main rolling command
|
||||||
* `[[4d20r1!]]` will roll 4 d20 dice, rerolling any dice that land on 1, and repeatedly rolling a new d20 for any critical success rolled.
|
* `[[4d20r1!]]` will roll 4 d20 dice, rerolling any dice that land on 1, and repeatedly rolling a new d20 for any critical success rolled.
|
||||||
* `[[d20/40]]` will roll a d20 die and divide it by 40.
|
* `[[d20/40]]` will roll a d20 die and divide it by 40.
|
||||||
* `[[((d20+20) - 10) / 5]]` will roll a d20, add 20 to that roll, subtract off 10, and finally divide by 5.
|
* `[[((d20+20) - 10) / 5]]` will roll a d20, add 20 to that roll, subtract off 10, and finally divide by 5.
|
||||||
|
* This command can also handle some custom format dice:
|
||||||
|
* CWOD Dice - `[[xcwody]]`
|
||||||
|
* `x` - Number of CWOD dice to roll
|
||||||
|
* `y` - Difficulty to roll at
|
||||||
* This command also has some useful decorators that can used. These decorators simply need to be placed after all rolls in the message:
|
* This command also has some useful decorators that can used. These decorators simply need to be placed after all rolls in the message:
|
||||||
* `-c` - Count - Shows the Count Embed, containing the count of successful rolls, failed rolls, rerolls, drops, and explosions
|
* `-c` - Count - Shows the Count Embed, containing the count of successful rolls, failed rolls, rerolls, drops, and explosions
|
||||||
* `-nd` - No Details - Suppresses all details of the requested roll
|
* `-nd` - No Details - Suppresses all details of the requested roll
|
||||||
|
|
|
@ -14,13 +14,17 @@ export const rollHelp = (message: DiscordenoMessage) => {
|
||||||
message.send({
|
message.send({
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
color: infoColor2,
|
color: infoColor1,
|
||||||
title: 'The Artificer\'s Roll Command Details:',
|
title: 'The Artificer\'s Roll Command Details:',
|
||||||
description: `You can chain as many of these options as you want, as long as the option does not disallow it.
|
description: `You can chain as many of these options as you want, as long as the option does not disallow it.
|
||||||
|
|
||||||
This command also can fully solve math equations with parenthesis.
|
This command also can fully solve math equations with parenthesis.
|
||||||
|
|
||||||
The Artificer supports most of the [Roll20 formatting](https://artificer.eanm.dev/roll20). More details and examples can be found [here](https://artificer.eanm.dev/roll20).`,
|
The Artificer supports most of the [Roll20 formatting](https://artificer.eanm.dev/roll20). More details and examples can be found [here](https://artificer.eanm.dev/roll20).`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: infoColor2,
|
||||||
|
title: 'Roll20 Dice Options:',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`,
|
||||||
|
@ -165,6 +169,19 @@ export const rollHelp = (message: DiscordenoMessage) => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: infoColor1,
|
color: infoColor1,
|
||||||
|
title: 'Custom Dice Options',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: 'CWOD Rolling',
|
||||||
|
value: `\`${config.prefix}xcwody${config.postfix}\`
|
||||||
|
\`x\` - Number of CWOD dice to roll
|
||||||
|
\`y\` - Difficulty to roll at`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: infoColor2,
|
||||||
title: 'Roll Command Decorators:',
|
title: 'Roll Command Decorators:',
|
||||||
description: `This command also has some useful decorators that can used. These decorators simply need to be placed after all rolls in the message.
|
description: `This command also has some useful decorators that can used. These decorators simply need to be placed after all rolls in the message.
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const formatRoll = (rollConf: string, maximiseRoll: boolean, nominalRoll:
|
||||||
|
|
||||||
if (!e.dropped && !e.rerolled) {
|
if (!e.dropped && !e.rerolled) {
|
||||||
// If the roll was not dropped or rerolled, add it to the stepTotal and flag the critHit/critFail
|
// If the roll was not dropped or rerolled, add it to the stepTotal and flag the critHit/critFail
|
||||||
switch(e.type) {
|
switch (e.type) {
|
||||||
case 'ova':
|
case 'ova':
|
||||||
case 'roll20':
|
case 'roll20':
|
||||||
tempTotal += e.roll;
|
tempTotal += e.roll;
|
||||||
|
@ -67,7 +67,7 @@ export const formatRoll = (rollConf: string, maximiseRoll: boolean, nominalRoll:
|
||||||
// After the looping is done, remove the extra " + " from the details and cap it with the closing ]
|
// After the looping is done, remove the extra " + " from the details and cap it with the closing ]
|
||||||
tempDetails = tempDetails.substring(0, tempDetails.length - 3);
|
tempDetails = tempDetails.substring(0, tempDetails.length - 3);
|
||||||
if (tempRollSet[0]?.type === 'cwod') {
|
if (tempRollSet[0]?.type === 'cwod') {
|
||||||
tempDetails += `, ${tempRollSet.filter(e => e.critHit).length} Successes, ${tempRollSet.filter(e => e.critFail).length} Fails`;
|
tempDetails += `, ${tempRollSet.filter((e) => e.critHit).length} Successes, ${tempRollSet.filter((e) => e.critFail).length} Fails`;
|
||||||
}
|
}
|
||||||
tempDetails += ']';
|
tempDetails += ']';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
LT,
|
LT,
|
||||||
} from '../../deps.ts';
|
} from '../../deps.ts';
|
||||||
|
|
||||||
import { RollSet, RollConf, RollType } from './solver.d.ts';
|
import { RollConf, RollSet, RollType } from './solver.d.ts';
|
||||||
import { compareOrigidx, compareRolls, genRoll, loggingEnabled } from './rollUtils.ts';
|
import { compareOrigidx, compareRolls, genRoll, loggingEnabled } from './rollUtils.ts';
|
||||||
|
|
||||||
// roll(rollStr, maximiseRoll, nominalRoll) returns RollSet
|
// roll(rollStr, maximiseRoll, nominalRoll) returns RollSet
|
||||||
|
@ -104,7 +104,7 @@ export const roll = (rollStr: string, maximiseRoll: boolean, nominalRoll: boolea
|
||||||
|
|
||||||
// Use critScore to set the difficulty
|
// Use critScore to set the difficulty
|
||||||
rollConf.critScore.on = true;
|
rollConf.critScore.on = true;
|
||||||
const difficulty = parseInt(cwodParts[1] || '10')
|
const difficulty = parseInt(cwodParts[1] || '10');
|
||||||
for (let i = difficulty; i <= rollConf.dieSize; i++) {
|
for (let i = difficulty; i <= rollConf.dieSize; i++) {
|
||||||
loggingEnabled && log(LT.LOG, `handling cwod ${rollStr} | Parsing difficulty ${i}`);
|
loggingEnabled && log(LT.LOG, `handling cwod ${rollStr} | Parsing difficulty ${i}`);
|
||||||
rollConf.critScore.range.push(i);
|
rollConf.critScore.range.push(i);
|
||||||
|
|
|
@ -97,4 +97,4 @@ export type RollConf = {
|
||||||
once: boolean;
|
once: boolean;
|
||||||
nums: number[];
|
nums: number[];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in New Issue