Skip to content

Commit

Permalink
Progress on #43, started a char stats roller
Browse files Browse the repository at this point in the history
  • Loading branch information
jake@chrx committed Feb 22, 2018
1 parent 2f60449 commit f3b4016
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
5 changes: 3 additions & 2 deletions discordlib/discordroles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ exports.addrole = function(input, message, client) {
return 'a role has no name'
}

//List the requestor's roles
//List the requestor's roles.
//TODO Use this, list a target's roles; let targetToSummon = message.mentions.users.first()
exports.roles = function(input, message, client) {
const userRolesRaw = message.member.roles
let roleResults = []
Expand All @@ -27,7 +28,7 @@ exports.roles = function(input, message, client) {
//Self-remove a role
exports.unrole = function(input, message, client) {
//TODO Ensure requestor is admin or the user. Then remove role if exists.
return 'by your decree, we have banished you from the cool kids club';
return 'by your decree, we have banished you from the cool kids club'
}

//Number of people in a given role
Expand Down
22 changes: 22 additions & 0 deletions dungeonary/diceroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,26 @@ exports.dice = function(rollInput = '') {
* roll(2d20, worst) Multiple take worst
*/
return 'This was a triumph'; // TODO: Parse input, roll dice, return reasonable output chunk
}

// Stat roller function. Uses an approved method and reports results cleanly
// TODO This should go in a character gen lib eventually
exports.rollstats = function(methodInput = '4d6k3') {
const validMethods = ['4d6k3', '2d6+6', 'colville']
const method = validMethods.includes(methodInput) ? methodInput.toLowerCase() : validMethods[0]
let stats = { 'STR': 0, 'DEX': 0, 'CON': 0, 'INT': 0, 'WIS': 0, 'CHA': 0 }
if (method == '4d6k3') {

} else if (method == '2d6+6') {

} else if (method == 'colville') {
// Roll 4d6k3 until two 15+ stats have been achieved. This happens in order
}
let [header, footer] = ['', '']
for (stat in stats) {
header += stat + ' '
footer += stats[stat] + ' '
while (footer.length < header.length) footer += ' '
}
return `the ${method} method has blessed you with: \n\`\`\`${header}\n${footer}\`\`\``
}

0 comments on commit f3b4016

Please sign in to comment.