=Fixed Bug #6 Roll improperly formats when providing single number

Edited roll function, array index had incorrect variable assigned
This commit is contained in:
Alex Stewart
2020-03-27 02:22:37 -04:00
parent 99e3566188
commit 4c4835e342
3 changed files with 31 additions and 22 deletions
+10 -4
View File
@@ -22,7 +22,9 @@ public class CommandRoll extends Command
{
KittyEmbed embed = new KittyEmbed();
embed.title = user.name +"'s roll!";
System.out.println("HERE");
embed.descriptionText = rollDice(input.args);
System.out.println("THERE");
Random numGen = new Random(user.name.hashCode());
float hue = numGen.nextFloat();
float sat = .7f;
@@ -41,10 +43,11 @@ public class CommandRoll extends Command
Stack<Integer> values = new Stack<Integer>();
Stack<Character> operators = new Stack<Character>();
String steps = "";
for(int i = 0; i < thing.length(); i ++)
{
char current = thing.charAt(i);
System.out.println("ROLLING");
switch(current)
{
case '+':
@@ -122,8 +125,11 @@ public class CommandRoll extends Command
{
steps += "\n" + calculate(values, operators);
}
return "Roll```" + thing + "```" + "Steps```" + steps + "```" + "Final value ```" + values.pop() +"```";
if(steps != "")
{
return "Roll```" + thing + "```" + "Steps```" + steps + "```" + "Final value ```" + values.pop() +"```";
}
return "That's not a roll that's just " + values.pop() +"!";
}
@@ -173,7 +179,7 @@ public class CommandRoll extends Command
int roll = 0;
int dice = first;
int sides = second;
int [] rolls = new int [sides];
int [] rolls = new int [dice];
if(dice < 1)
return new int[0];
+3
View File
@@ -387,8 +387,11 @@ public class ObjectBuilderFactory
// Determine token based on config. Default to test token.
String tokenToUse = Ref.TestToken;
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
tokenToUse = Ref.Token;
if(ConfigGlobals.getStartupMode() == KittyStartupMode.PoguRelease)
tokenToUse = Ref.PoguToken;
// Construct bot based on token
kitty = new JDABuilder(AccountType.BOT)
.setToken(tokenToUse).buildBlocking();
+1 -1
View File
@@ -2,7 +2,7 @@ package dataStructures;
public enum KittyStartupMode
{
Dev(1), Release(2);
Dev(1), Release(2), PoguRelease(3);
private final int value;
private KittyStartupMode(int value)