From cf1f6739f76a9685e0e796f66041053b174207b3 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 4 Dec 2017 15:44:34 +0000 Subject: [PATCH] This is better --- commands/games/battle.js | 4 ++-- commands/games/lottery.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/games/battle.js b/commands/games/battle.js index ea22c531..bac40f0d 100644 --- a/commands/games/battle.js +++ b/commands/games/battle.js @@ -85,8 +85,8 @@ module.exports = class BattleCommand extends Command { guard = true; reset(false); } else if (choice === 'special') { - const hit = Math.floor(Math.random() * 4) + 1; - if (hit === 1) { + const miss = Math.floor(Math.random() * 4); + if (!miss) { const damage = randomRange(100, guard ? 150 : 300); await msg.say(`${user} deals **${damage}** damage!`); dealDamage(damage); diff --git a/commands/games/lottery.js b/commands/games/lottery.js index 9e12cda0..c705da17 100644 --- a/commands/games/lottery.js +++ b/commands/games/lottery.js @@ -11,8 +11,8 @@ module.exports = class LotteryCommand extends Command { } run(msg) { - const lottery = Math.floor(Math.random() * 1000) + 1; - if (lottery === 1) return msg.reply('Nice job! 10/10! You deserve some cake!'); + const loss = Math.floor(Math.random() * 1000); + if (!loss) return msg.reply('Nice job! 10/10! You deserve some cake!'); return msg.reply('Nope, sorry, you lost.'); } };