Make Battle Pretty

This commit is contained in:
Daniel Odendahl Jr
2017-05-28 14:56:29 +00:00
parent 971c4769e4
commit 4bd10517f1
+5 -5
View File
@@ -44,7 +44,7 @@ module.exports = class BattleCommand extends Command {
while (userHP > 0 && oppoHP > 0) { while (userHP > 0 && oppoHP > 0) {
const username = userTurn ? msg.author.username : opponent.username; const username = userTurn ? msg.author.username : opponent.username;
await msg.say(stripIndents` await msg.say(stripIndents`
${username}, do you **fight**, **guard**, **special**, **cure** or **run**? **${username}**, do you **fight**, **guard**, **special**, **cure** or **run**?
**${msg.author.username}**: ${userHP}HP **${msg.author.username}**: ${userHP}HP
**${opponent.username}**: ${oppoHP}HP **${opponent.username}**: ${oppoHP}HP
`); `);
@@ -57,7 +57,7 @@ module.exports = class BattleCommand extends Command {
const choice = turn.first().content.toLowerCase(); const choice = turn.first().content.toLowerCase();
if (choice === 'fight') { if (choice === 'fight') {
const damage = Math.floor(Math.random() * (guard ? 25 : 100)) + 1; const damage = Math.floor(Math.random() * (guard ? 25 : 100)) + 1;
await msg.say(`${username} deals ${damage} damage!`); await msg.say(`**${username}** deals **${damage}** damage!`);
if (userTurn) { if (userTurn) {
oppoHP = oppoHP - damage; oppoHP = oppoHP - damage;
userTurn = false; userTurn = false;
@@ -67,7 +67,7 @@ module.exports = class BattleCommand extends Command {
} }
if (guard) guard = false; if (guard) guard = false;
} else if (choice === 'guard') { } else if (choice === 'guard') {
await msg.say(`${username} guards!`); await msg.say(`**${username}** guards!`);
guard = true; guard = true;
if (userTurn) userTurn = false; if (userTurn) userTurn = false;
else userTurn = true; else userTurn = true;
@@ -75,7 +75,7 @@ module.exports = class BattleCommand extends Command {
const hit = Math.floor(Math.random() * 4) + 1; const hit = Math.floor(Math.random() * 4) + 1;
if (hit === 1) { if (hit === 1) {
const damage = Math.floor(Math.random() * ((guard ? 300 : 150) - 100 + 1) + 100); const damage = Math.floor(Math.random() * ((guard ? 300 : 150) - 100 + 1) + 100);
await msg.say(`${username} deals ${damage} damage!`); await msg.say(`**${username}** deals **${damage}** damage!`);
if (userTurn) { if (userTurn) {
oppoHP = oppoHP - damage; oppoHP = oppoHP - damage;
userTurn = false; userTurn = false;
@@ -92,7 +92,7 @@ module.exports = class BattleCommand extends Command {
} }
} else if (choice === 'cure') { } else if (choice === 'cure') {
if (userTurn ? userCure : oppoCure) { if (userTurn ? userCure : oppoCure) {
await msg.say(`${username} regains 250HP!`); await msg.say(`**${username}** regains **250HP**!`);
if (userTurn) { if (userTurn) {
userHP = userHP + 250; userHP = userHP + 250;
userCure = false; userCure = false;