private void btnRollDice_Click(object sender, EventArgs e) { List <int> diceList = new List <int>(); int sum = 0; int grandTotal = 0; string showWork = string.Empty; string lineBreaker = Environment.NewLine + "------------------------------------------------------------------------------------------------------" + Environment.NewLine; diceList = DiceRoller.RollD2((uint)nudNumD2.Value, out sum); showWork += "D2: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD3((uint)nudNumD3.Value, out sum); showWork += "D3: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD4((uint)nudNumD4.Value, out sum); showWork += "D4: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD6((uint)nudNumD6.Value, out sum); showWork += "D6: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD8((uint)nudNumD8.Value, out sum); showWork += "D8: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD10((uint)nudNumD10.Value, out sum); showWork += "D10: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD12((uint)nudNumD12.Value, out sum); showWork += "D12: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD20((uint)nudNumD20.Value, out sum); showWork += "D20: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; diceList = DiceRoller.RollD100((uint)nudNumD100.Value, out sum); showWork += "D100: "; foreach (int diceRoll in diceList) { showWork += diceRoll.ToString() + ", "; } showWork = showWork.Remove(showWork.Length - 2, 2); showWork += " : Total: " + sum.ToString() + lineBreaker; grandTotal += sum; showWork += "Grand Total: " + grandTotal.ToString(); tbDiceBox.Text = showWork; }
private void SetTempVariation(bool reroll) { if (reroll) { tempVariationRoll = DiceRoller.RollD100(); } switch (climate) { case Climate.Cold: if (tempVariationRoll >= 1 && tempVariationRoll <= 20) { tempVariation = -DiceRoller.RollD10(3); tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll >= 21 && tempVariationRoll <= 40) { tempVariation = -DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD6() + 1; } else if (tempVariationRoll >= 41 && tempVariationRoll <= 60) { tempVariation = -DiceRoller.RollD10(); tempForDays = DiceRoller.RollD6() + 2; } else if (tempVariationRoll >= 61 && tempVariationRoll <= 80) { tempVariation = 0; tempForDays = DiceRoller.RollD6() + 2; } else if (tempVariationRoll >= 81 && tempVariationRoll <= 95) { tempVariation = DiceRoller.RollD10(); tempForDays = DiceRoller.RollD6() + 1; } else if (tempVariationRoll >= 96 && tempVariationRoll <= 99) { tempVariation = DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll == 100) { tempVariation = DiceRoller.RollD10(3); tempForDays = DiceRoller.RollD2(); } else { Console.WriteLine("SetTempVariation() Cold d100: " + tempVariationRoll); } break; case Climate.Temperate: if (tempVariationRoll >= 1 && tempVariationRoll <= 5) { tempVariation = -DiceRoller.RollD10(3); tempForDays = DiceRoller.RollD2(); } else if (tempVariationRoll >= 6 && tempVariationRoll <= 15) { tempVariation = -DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll >= 16 && tempVariationRoll <= 35) { tempVariation = -DiceRoller.RollD10(); tempForDays = DiceRoller.RollD4() + 1; } else if (tempVariationRoll >= 36 && tempVariationRoll <= 65) { tempVariation = 0; tempForDays = DiceRoller.RollD6() + 1; } else if (tempVariationRoll >= 66 && tempVariationRoll <= 85) { tempVariation = DiceRoller.RollD10(); tempForDays = DiceRoller.RollD4() + 1; } else if (tempVariationRoll >= 86 && tempVariationRoll <= 95) { tempVariation = DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll >= 96 && tempVariationRoll <= 100) { tempVariation = DiceRoller.RollD10(3); tempForDays = DiceRoller.RollD2(); } else { Console.WriteLine("SetTempVariation() Temperate d100: " + tempVariationRoll); } break; case Climate.Tropical: if (tempVariationRoll >= 1 && tempVariationRoll <= 10) { tempVariation = -DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD2(); } else if (tempVariationRoll >= 11 && tempVariationRoll <= 25) { tempVariation = -DiceRoller.RollD10(); tempForDays = DiceRoller.RollD2(); } else if (tempVariationRoll >= 26 && tempVariationRoll <= 55) { tempVariation = 0; tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll >= 56 && tempVariationRoll <= 85) { tempVariation = DiceRoller.RollD10(); tempForDays = DiceRoller.RollD4(); } else if (tempVariationRoll >= 86 && tempVariationRoll <= 100) { tempVariation = DiceRoller.RollD10(2); tempForDays = DiceRoller.RollD2(); } else { Console.WriteLine("SetTempVariation() Temperate d100: " + tempVariationRoll); } break; default: break; } if (reroll) { switch (season) { case Season.Spring: tempVariation -= 10; break; case Season.Summer: tempVariation -= 10; break; case Season.Fall: tempVariation += 10; break; case Season.Winter: tempVariation += 10; break; default: break; } nightTempDrop = DiceRoller.RollD6(2) + 3; } }