Format numbers, style changes, fixes

This commit is contained in:
Daniel Odendahl Jr
2018-10-13 02:28:07 +00:00
parent 5c2c9d25a5
commit b0780575be
45 changed files with 146 additions and 159 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { delay, randomRange, verify } = require('../../util/Util');
const words = ['fire', 'draw', 'shoot', 'bang', 'pull'];
const words = ['fire', 'draw', 'shoot', 'bang', 'pull', 'boom'];
module.exports = class GunfightCommand extends Command {
constructor(client) {
+1 -1
View File
@@ -66,7 +66,6 @@ module.exports = class MafiaCommand extends Command {
}
const display = killed ? players.get(killed).user : null;
const story = stories[Math.floor(Math.random() * stories.length)];
if (killed && killed !== saved) players.delete(killed);
if (killed && killed === saved) {
await msg.say(stripIndents`
Late last night, a Mafia member emerged from the dark and tried to kill ${display}${story}
@@ -80,6 +79,7 @@ module.exports = class MafiaCommand extends Command {
`);
break;
} else if (killed && killed !== saved) {
players.delete(killed);
await msg.say(stripIndents`
Late last night, a Mafia member emerged from the dark and killed poor ${display}${story}
Who is this mysterious Mafia member? You have one minute to decide.
+1 -1
View File
@@ -8,7 +8,7 @@ const maxValues = {
medium: 100,
hard: 500,
extreme: 1000,
impossible: 1000000
impossible: Number.MAX_SAFE_INTEGER
};
module.exports = class MathQuizCommand extends Command {
+13 -11
View File
@@ -22,7 +22,7 @@ module.exports = class TicTacToeCommand extends Command {
this.playing = new Set();
}
async run(msg, { opponent }) { // eslint-disable-line complexity
async run(msg, { opponent }) {
if (opponent.bot) return msg.reply('Bots may not be played against.');
if (opponent.id === msg.author.id) return msg.reply('You may not play against yourself.');
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
@@ -67,16 +67,7 @@ module.exports = class TicTacToeCommand extends Command {
const choice = turn.first().content;
sides[Number.parseInt(choice, 10)] = sign;
taken.push(choice);
if (
(sides[0] === sides[1] && sides[0] === sides[2])
|| (sides[0] === sides[3] && sides[0] === sides[6])
|| (sides[3] === sides[4] && sides[3] === sides[5])
|| (sides[1] === sides[4] && sides[1] === sides[7])
|| (sides[6] === sides[7] && sides[6] === sides[8])
|| (sides[2] === sides[5] && sides[2] === sides[8])
|| (sides[0] === sides[4] && sides[0] === sides[8])
|| (sides[2] === sides[4] && sides[2] === sides[6])
) winner = userTurn ? msg.author : opponent;
if (this.verifyWin(sides)) winner = userTurn ? msg.author : opponent;
userTurn = !userTurn;
}
this.playing.delete(msg.channel.id);
@@ -86,4 +77,15 @@ module.exports = class TicTacToeCommand extends Command {
throw err;
}
}
verifyWin(sides) {
return (sides[0] === sides[1] && sides[0] === sides[2])
|| (sides[0] === sides[3] && sides[0] === sides[6])
|| (sides[3] === sides[4] && sides[3] === sides[5])
|| (sides[1] === sides[4] && sides[1] === sides[7])
|| (sides[6] === sides[7] && sides[6] === sides[8])
|| (sides[2] === sides[5] && sides[2] === sides[8])
|| (sides[0] === sides[4] && sides[0] === sides[8])
|| (sides[2] === sides[4] && sides[2] === sides[6]);
}
};
+1 -1
View File
@@ -66,7 +66,6 @@ module.exports = class WizardConventionCommand extends Command {
}
const display = eaten ? players.get(eaten).user : null;
const story = stories[Math.floor(Math.random() * stories.length)];
if (eaten && eaten !== healed) players.delete(eaten);
if (eaten && eaten === healed) {
await msg.say(stripIndents`
Late last night, a dragon emerged and tried to eat ${display}${story}
@@ -80,6 +79,7 @@ module.exports = class WizardConventionCommand extends Command {
`);
break;
} else if (eaten && eaten !== healed) {
players.delete(eaten);
await msg.say(stripIndents`
Late last night, a dragon emerged and devoured poor ${display}${story}
Who is this mysterious dragon? You have one minute to decide.