From 032b1f25a568f49909cda6d20f737028cfb807f4 Mon Sep 17 00:00:00 2001 From: dragonfire535 Date: Tue, 14 Mar 2017 10:18:39 -0400 Subject: [PATCH] Make Math * Less Painful --- commands/random/mathgame.js | 46 ++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/commands/random/mathgame.js b/commands/random/mathgame.js index 37648913..558adebd 100644 --- a/commands/random/mathgame.js +++ b/commands/random/mathgame.js @@ -23,20 +23,38 @@ class MathGameCommand extends commando.Command { let [level] = message.content.toLowerCase().split(" ").slice(1); let randomType = ['+', '-', '*']; randomType = randomType[Math.floor(Math.random() * randomType.length)]; - let randomValue; - switch (level) { - case "easy": - randomValue = 10; - break; - case "medium": - randomValue = 50; - break; - case "hard": - randomValue = 100; - break; - case "extreme": - randomValue = 1000; - break; + if(randomType === '*') { + let randomValue; + switch (level) { + case "easy": + randomValue = 10; + break; + case "medium": + randomValue = 12; + break; + case "hard": + randomValue = 15; + break; + case "extreme": + randomValue = 20; + break; + } + } else { + let randomValue; + switch (level) { + case "easy": + randomValue = 10; + break; + case "medium": + randomValue = 50; + break; + case "hard": + randomValue = 100; + break; + case "extreme": + randomValue = 1000; + break; + } } let randomValue1 = Math.floor(Math.random() * randomValue) + 1; let randomValue2 = Math.floor(Math.random() * randomValue) + 1;