* linting, rolling dice now calculates the sum of each shown value.

* package update
This commit is contained in:
2021-02-09 17:23:23 +01:00
committed by GitHub
parent 20fb66643e
commit 9c0c365cd5
13 changed files with 201 additions and 202 deletions

View File

@ -1,7 +1,7 @@
// eslint-disable-next-line no-unused-vars
const Random = require('random');
const globals = require('../globals')
const Discord = require('discord.js')
const globals = require('../globals');
const Discord = require('discord.js');
module.exports = {
name: 'tp',
@ -15,17 +15,17 @@ module.exports = {
async exec(message, args) {
if(isNaN(args[0])) {
return message.reply(globals.Replies.find(x => x.id === 'WRONG_ARGUMENTS').string)
return message.reply(globals.Replies.find(x => x.id === 'WRONG_ARGUMENTS').string);
}
Random.use(message.author.tag);
const roll = [];
let bonus = 0
let bonus_orig = 0
let erschwernis = 0
let bonus = 0;
let bonus_orig = 0;
let erschwernis = 0;
if (args[3]) {
bonus_orig = parseInt(args[3]);
bonus = bonus_orig
bonus = bonus_orig;
}
if (args[4]) {
erschwernis = parseInt(args[4]);
@ -48,36 +48,36 @@ module.exports = {
if (roll[i] == 20) patzer++;
}
const Reply = new Discord.MessageEmbed()
const Reply = new Discord.MessageEmbed();
//Reply.setTitle('Du würfelst auf ' + args[0] + ' ' + args[1] + ' ' + args[2] + ' (Bonus: ' + bonus_orig + ')')
Reply.setTitle('Deine 🎲: ' + roll.join(', ') + '.')
Reply.setTitle('Deine 🎲: ' + roll.join(', ') + '.');
if (patzer >= 2) {
Reply.setColor('#900c3f')
Reply.setColor('#900c3f');
Reply.addFields({
name: globals.Replies.find(x => x.id === 'TITLE_CRIT_FAILURE').string,
value: globals.Replies.find(x => x.id === 'MSG_CRIT_FAILURE').string,
inline: false
})
});
} else if (crit >= 2) {
Reply.setColor('#1E8449')
Reply.setColor('#1E8449');
Reply.addFields({
name: globals.Replies.find(x => x.id === 'TITLE_CRIT_SUCCESS').string,
value: globals.Replies.find(x => x.id === 'MSG_CRIT_SUCCESS').string,
inline: false
})
});
} else if (ok < 3) {
Reply.addFields({
name: globals.Replies.find(x => x.id === 'TITLE_FAILURE').string,
value: 'Nur ' + ok + '/3 Proben erfolgreich. 😪',
inline: false
})
});
} else {
Reply.addFields({
name: globals.Replies.find(x => x.id === 'TITLE_SUCCESS').string,
value: ok + '/3 Proben erfolgreich. Dein Bonus: ' + bonus + '/' + bonus_orig + '.',
inline: false
})
});
}
message.reply(Reply)
message.reply(Reply);
}
}
};