diff --git a/src/commands/general/CommandBlurry.java b/src/commands/general/CommandBlurry.java index 145510e..5d646c8 100644 --- a/src/commands/general/CommandBlurry.java +++ b/src/commands/general/CommandBlurry.java @@ -20,6 +20,11 @@ public class CommandBlurry extends Command public String getHelpText() { return LocStrings.stub("BlurryInfo"); }; private static Long num = 0l; + private static double [][] blur = {{0.0030, 0.0133, 0.0219, 0.0133, 0.0030}, + {0.0133, 0.0596, 0.0983, 0.0596, 0.0133}, + {0.0219, 0.0983, 0.1621, 0.0983, 0.0219}, + {0.0133, 0.0596, 0.0983, 0.0596, 0.0133}, + {0.0030, 0.0133, 0.0219, 0.0133, 0.0030}}; @Override public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) diff --git a/src/commands/general/CommandRoll.java b/src/commands/general/CommandRoll.java index 6dcfc2e..10bbee8 100644 --- a/src/commands/general/CommandRoll.java +++ b/src/commands/general/CommandRoll.java @@ -6,14 +6,7 @@ import java.util.Stack; import core.Command; import core.LocStrings; -import dataStructures.KittyChannel; -import dataStructures.KittyEmbed; -import dataStructures.KittyGuild; -import dataStructures.KittyRating; -import dataStructures.KittyRole; -import dataStructures.KittyUser; -import dataStructures.Response; -import dataStructures.UserInput; +import dataStructures.*; public class CommandRoll extends Command { @@ -133,10 +126,12 @@ public class CommandRoll extends Command return "Roll```" + thing + "```" + "Steps```" + steps + "```" + "Final value ```" + values.pop() +"```"; } + private String calculate(Stack nums, Stack operators) { int second = nums.pop(); int first = nums.pop(); + int rolls[] = null; int value = 0; char op = operators.pop(); @@ -155,27 +150,40 @@ public class CommandRoll extends Command value = first / second; break; case 'd': - value = roll(first, second); + rolls = roll(first, second); + System.out.println(first); + for(int i= 0; i < first; i++) + { + value += rolls[i]; + } + } nums.add(value); - return (first + "" + op + "" + second + "=" + value); + if(rolls == null) + return (first + "" + op + "" + second + "=" + value); + String rollValues = ""; + for(int i= 0; i < first; i++) + { + rollValues += "\uD83C\uDFB2" + rolls[i] + " "; + } + return (first + "" + op + "" + second + "=" + value + "(" + rollValues.trim() + ")"); } - private int roll(int first, int second) + private int[] roll(int first, int second) { - int total = 0; int roll = 0; int dice = first; int sides = second; + int [] rolls = new int [sides]; if(dice < 1) - return 0; + return new int[0]; for(int i = 0; dice > i; i ++) { roll = (int)(Math.random() * sides) + 1; - total += roll; + rolls[i] = roll; } - return total; + return rolls; } private boolean hasPrecendence(char op1, char op2)