This commit is contained in:
Daniel Odendahl Jr
2017-06-17 03:26:31 +00:00
parent 5bb78126a9
commit fd4e35533a
129 changed files with 322 additions and 319 deletions
+13 -13
View File
@@ -8,7 +8,7 @@ module.exports = class BattleCommand extends Command {
aliases: ['fight', 'death-battle'],
group: 'games',
memberName: 'battle',
description: 'Choose another user and fight to the death!',
description: 'Engage in a turn-based battle against another user.',
guildOnly: true,
args: [
{
@@ -24,11 +24,11 @@ module.exports = class BattleCommand extends Command {
async run(msg, args) {
const { opponent } = args;
if (opponent.bot) return msg.say('Bots cannot be fought.');
if (opponent.bot) return msg.say('Bots may not be fought.');
if (opponent.id === msg.author.id) return msg.say('You may not fight yourself.');
if (this.fighting.has(msg.guild.id)) return msg.say('Only one fight may be occurring per server.');
this.fighting.add(msg.guild.id);
await msg.say(`**${opponent.username}**, do you accept this challenge? **__Y__es** or **No**?`);
await msg.say(`${opponent}, do you accept this challenge? **__Y__es** or **No**?`);
const verify = await msg.channel.awaitMessages((res) => res.author.id === opponent.id, {
max: 1,
time: 30000
@@ -55,10 +55,10 @@ module.exports = class BattleCommand extends Command {
else oppoHP = 0;
};
while (userHP > 0 && oppoHP > 0) { // eslint-disable-line no-unmodified-loop-condition
const username = userTurn ? msg.author.username : opponent.username;
const user = userTurn ? msg.author : opponent;
const id = userTurn ? msg.author.id : opponent.id;
await msg.say(stripIndents`
**${username}**, do you **fight**, **guard**, **special**, or **run**?
${user}, do you **fight**, **guard**, **special**, or **run**?
**${msg.author.username}**: ${userHP}HP
**${opponent.username}**: ${oppoHP}HP
`);
@@ -74,37 +74,37 @@ module.exports = class BattleCommand extends Command {
const choice = turn.first().content.toLowerCase();
if (choice === 'fight') {
const damage = Math.floor(Math.random() * (guard ? 10 : 100)) + 1;
await msg.say(`**${username}** deals **${damage}** damage!`);
await msg.say(`${user} deals **${damage}** damage!`);
dealDamage(damage);
reset();
} else if (choice === 'guard') {
await msg.say(`**${username}** guards!`);
await msg.say(`${user} guards!`);
guard = true;
reset(false);
} else if (choice === 'special') {
const hit = Math.floor(Math.random() * 4) + 1;
if (hit === 1) {
const damage = Math.floor(Math.random() * ((guard ? 300 : 150) - 100 + 1) + 100);
await msg.say(`**${username}** deals **${damage}** damage!`);
await msg.say(`${user} deals **${damage}** damage!`);
dealDamage(damage);
reset();
} else {
await msg.say(`**${username}**'s attack missed!`);
await msg.say(`${user}'s attack missed!`);
reset();
}
} else if (choice === 'run') {
await msg.say(`**${username}** flees!`);
await msg.say(`${user} flees!`);
forfeit();
break;
} else {
await msg.say('I do not understand what you want to do.');
await msg.say(`${user}, I do not understand what you want to do.`);
}
}
this.fighting.delete(msg.guild.id);
return msg.say(stripIndents`
The match is over!
**Winner:** ${userHP > oppoHP ? `${msg.author.username} (${userHP})` : `${opponent.username} (${oppoHP})`}
**Loser:** ${userHP > oppoHP ? `${opponent.username} (${oppoHP})` : `${msg.author.username} (${userHP})`}
**Winner:** ${userHP > oppoHP ? `${msg.author} (${userHP}HP)` : `${opponent} (${oppoHP}HP)`}
**Loser:** ${userHP > oppoHP ? `${opponent} (${oppoHP}HP)` : `${msg.author} (${userHP}HP)`}
`);
}
};
+3 -3
View File
@@ -6,13 +6,13 @@ module.exports = class LotteryCommand extends Command {
name: 'lottery',
group: 'games',
memberName: 'lottery',
description: '1 in 100 chance of winning. Winners get... The feeling of winning?'
description: 'Attempt to win the lottery, with a 1 in 100 chance of winning.'
});
}
run(msg) {
const lottery = Math.floor(Math.random() * 100) + 1;
if (lottery === 1) return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
else return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
if (lottery === 1) return msg.reply(`Wow! You actually won! Great job!`);
else return msg.reply(`Nope, sorry, you lost.`);
}
};
+2 -3
View File
@@ -29,9 +29,8 @@ module.exports = class MathGameCommand extends Command {
async run(msg, args) {
const { difficulty } = args;
const operation = operations[Math.floor(Math.random() * operations.length)];
const maxValue = maxValues[difficulty];
const value1 = Math.floor(Math.random() * maxValue) + 1;
const value2 = Math.floor(Math.random() * maxValue) + 1;
const value1 = Math.floor(Math.random() * maxValues[difficulty]) + 1;
const value2 = Math.floor(Math.random() * maxValues[difficulty]) + 1;
const expression = `${value1} ${operation} ${value2}`;
const answer = math.eval(expression).toString();
const embed = new RichEmbed()
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = class QuizCommand extends Command {
aliases: ['jeopardy'],
group: 'games',
memberName: 'quiz',
description: 'Answer a quiz question.',
description: 'Answer a true/false quiz question.',
clientPermissions: ['EMBED_LINKS']
});
}
+3 -3
View File
@@ -26,15 +26,15 @@ module.exports = class RockPaperScissorsCommand extends Command {
if (choice === 'rock') {
if (response === 'rock') return msg.say('Rock! Aw... A tie...');
else if (response === 'paper') return msg.say('Paper! Yes! I win!');
else return msg.say('Scissors! Aw... I lose...');
else if (response === 'scissors') return msg.say('Scissors! Aw... I lose...');
} else if (choice === 'paper') {
if (response === 'rock') return msg.say('Rock! Aw... I lose...');
else if (response === 'paper') return msg.say('Paper! Aw... A tie...');
else return msg.say('Scissors! Yes! I win!');
else if (response === 'scissors') return msg.say('Scissors! Yes! I win!');
} else if (choice === 'scissors') {
if (response === 'rock') return msg.say('Rock! Yes! I win!');
else if (response === 'paper') return msg.say('Paper! Aw... I lose...');
else return msg.say('Scissors! Aw... A tie...');
else if (response === 'scissors') return msg.say('Scissors! Aw... A tie...');
} else {
return msg.say('I win by default, you little cheater.');
}
+2 -2
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
const slots = [':grapes:', ':tangerine:', ':pear:', ':cherries:'];
const slots = [':grapes:', ':tangerine:', ':pear:', ':cherries:', ':lemon:'];
module.exports = class SlotsCommand extends Command {
constructor(client) {
@@ -8,7 +8,7 @@ module.exports = class SlotsCommand extends Command {
name: 'slots',
group: 'games',
memberName: 'slots',
description: 'Play slots.'
description: 'Play a game of slots.'
});
}
+1 -2
View File
@@ -37,8 +37,7 @@ module.exports = class TypingGameCommand extends Command {
max: 1,
time
});
if (!msgs.size) return msg.say('Time! Sorry!');
if (msgs.first().content !== sentence) return msg.say('Nope, sorry!');
if (!msgs.size || msgs.first().content !== sentence) return msg.say('Sorry! You lose!');
else return msg.say('Nice job! 10/10! You deserve some cake!');
}
};