added random. Use Embed messages for Help and Skill list

This commit is contained in:
Marcus Netz
2020-11-26 21:40:23 +01:00
parent 33a998a680
commit 9f7f87ee07
11 changed files with 133 additions and 71 deletions

View File

@ -1,4 +1,5 @@
const globals = require('../globals');
const Random = require('random')
module.exports = async (message, args, db) => {
try {
// user calls without arguments.
@ -40,11 +41,12 @@ module.exports = async (message, args, db) => {
else {
level = args[0];
}
Random.use(message.author.tag)
const countOccurrences = (arr, val) => arr.reduce((a, v) => (v === val ? a + 1 : a), 0);
const dice = [];
dice.push(Math.floor(Math.random() * 20) + 1);
dice.push(Random.int(1,20));
if (dice[0] == 1 || dice[0] == 20) {
dice.push(Math.floor(Math.random() * 20) + 1);
dice.push(Random.int(1,20));
}
// handle crits
if (countOccurrences(dice, 1) == 2) {