This commit is contained in:
Daniel Odendahl Jr
2017-06-01 19:05:20 +00:00
parent 712d6ebc4c
commit 2e93aed4df
+3 -3
View File
@@ -49,8 +49,8 @@ module.exports = class BattleCommand extends Command {
if (guard) guard = false; if (guard) guard = false;
}; };
const dealDamage = (damage) => { const dealDamage = (damage) => {
if (userTurn) userHP -= damage; if (userTurn) oppoHP -= damage;
else oppoHP -= damage; else userHP -= damage;
}; };
while (userHP > 0 && oppoHP > 0) { // eslint-disable-line no-unmodified-loop-condition while (userHP > 0 && oppoHP > 0) { // eslint-disable-line no-unmodified-loop-condition
const username = userTurn ? msg.author.username : opponent.username; const username = userTurn ? msg.author.username : opponent.username;
@@ -89,7 +89,7 @@ module.exports = class BattleCommand extends Command {
} }
} else if (choice === 'run') { } else if (choice === 'run') {
await msg.say(`**${username}** flees!`); await msg.say(`**${username}** flees!`);
dealDamage(500 - (userTurn ? userHP : oppoHP)); break;
} else { } else {
await msg.say('I do not understand what you want to do.'); await msg.say('I do not understand what you want to do.');
} }