private void fillRollResults(Command cmd, Die d, ref List <int> rolls, ref int total) { int mod = cmd.getMod(); if (cmd.getMultiRoll()) { for (int rollCount = 0; rollCount < cmd.getRollCount(); rollCount++) { int roll = d.roll(cmd.getSides()); rolls.Add(roll); total += roll; } if (cmd.getMultiMod()) { total += (mod * cmd.getRollCount()); } else { total += mod; } } else { int roll = d.roll(cmd.getSides()); rolls.Add(roll); total += (roll + mod); } }
private Bitmap getRandomDCI() { Die DCI = new Die(); switch (DCI.roll(7)) { case 1: return(Properties.Resources.DCI_guy); case 2: return(Properties.Resources.DCI_derpguy); case 3: return(Properties.Resources.DCI_beardguy); case 4: return(Properties.Resources.DCI_younglady); case 5: return(Properties.Resources.DCI_hoodguy); case 6: return(Properties.Resources.DCI_orcguy); case 7: return(Properties.Resources.DCI_madguy); default: return(Properties.Resources.DCI_guy); } }
private void setRandBackColor() { Die randColor = new Die(); switch (randColor.roll(10)) { case 1: imageBackColor = Color.FromArgb(165, 55, 55); break; case 2: imageBackColor = Color.FromArgb(55, 165, 55); break; case 3: imageBackColor = Color.FromArgb(55, 55, 165); break; case 4: imageBackColor = Color.FromArgb(165, 165, 55); break; case 5: imageBackColor = Color.FromArgb(165, 55, 165); break; case 6: imageBackColor = Color.FromArgb(55, 165, 165); break; case 7: imageBackColor = Color.FromArgb(165, 55, 130); break; case 8: imageBackColor = Color.FromArgb(165, 130, 55); break; case 9: imageBackColor = Color.FromArgb(130, 165, 55); break; case 10: imageBackColor = Color.FromArgb(55, 165, 130); break; } }
private void processDieCommand(string[] sLine) { bool multiRoll = false; bool sum = false; int sides; int rollCount = 1; sLine[0] = sLine[0].Remove(0, 1); string[] diceString = sLine[0].Split('*'); sides = int.Parse(diceString[0]); if (diceString.Length == 2) { rollCount = int.Parse(diceString[1]); } if (rollCount <= 1) { rollCount = 1; } else { multiRoll = true; } foreach (string s in sLine) { if (multiRoll) { if (s.Equals("sum") || s.Equals("s")) { sum = true; } } } Die d = new Die(2494); if (rollCount == 1) { printLine("\nD" + sides + " Roll: " + d.roll(sides)); } else if (sum) { int total = 0; printLine("\nD" + sides + " x" + rollCount + ":"); while (rollCount > 0) { int roll = d.roll(sides); total += roll; printLine(" " + roll); rollCount -= 1; } printLine("\nTotal: " + total); } else { printLine("\nD" + sides + " x" + rollCount + ":"); while (rollCount > 0) { printLine(" " + d.roll(sides)); rollCount -= 1; } } }