public int RollNumberOnPlantsFound() { int total = 0; foreach (Dice die in SearchRolls) { if (die == Dice.d8) { total += DiceRoller.RollD8(); } if (die == Dice.d4) { total += DiceRoller.RollD4(); } } NumberOfPlants = total; return(total); }
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 GetPrecipitation(bool reroll) { if (reroll) { precipitationFormRoll = DiceRoller.RollD100(); } int startTime = DiceRoller.RollD12(); string startM = DiceRoller.RollD6() > 3 ? "PM" : "AM"; if (currentTemp > 32) { switch (precipitationIntensity) { case PrecipitationIntensity.Light: if (precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogLight; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 40) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD6(); } } else if (precipitationFormRoll >= 41 && precipitationFormRoll <= 50) { precipitationForm = PrecipitationForm.Drizzle; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 51 && precipitationFormRoll <= 75) { precipitationForm = PrecipitationForm.Drizzle; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } else if (precipitationFormRoll >= 76 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.RainLight; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { if (currentTemp >= 40) { precipitationForm = PrecipitationForm.RainLight; } else { precipitationForm = PrecipitationForm.Sleet; } if (reroll) { rainForHours = 1; } } break; case PrecipitationIntensity.Medium: if (precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD12(); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 30) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 31 && precipitationFormRoll <= 35) { precipitationForm = PrecipitationForm.Rain; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 36 && precipitationFormRoll <= 70) { precipitationForm = PrecipitationForm.Rain; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 71 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.Rain; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { if (currentTemp >= 40) { precipitationForm = PrecipitationForm.Rain; } else { precipitationForm = PrecipitationForm.Sleet; } if (reroll) { rainForHours = DiceRoller.RollD4(); } } break; case PrecipitationIntensity.Heavy: if (precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 50) { precipitationForm = PrecipitationForm.RainHeavy; if (reroll) { rainForHours = DiceRoller.RollD12(); } } else if (precipitationFormRoll >= 51 && precipitationFormRoll <= 70) { precipitationForm = PrecipitationForm.RainHeavy; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } else if (precipitationFormRoll >= 71 && precipitationFormRoll <= 85) { if (currentTemp >= 40) { precipitationForm = PrecipitationForm.RainHeavy; } else { precipitationForm = PrecipitationForm.Sleet; } if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 86 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.Thunderstorm; if (reroll) { rainForHours = 1; } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.Thunderstorm; if (reroll) { rainForHours = DiceRoller.RollD3(); } } break; case PrecipitationIntensity.Torrential: if (precipitationFormRoll <= 5) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 6 && precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 30) { precipitationForm = PrecipitationForm.RainHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 31 && precipitationFormRoll <= 60) { precipitationForm = PrecipitationForm.RainHeavy; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } else if (precipitationFormRoll >= 61 && precipitationFormRoll <= 80) { if (currentTemp >= 40) { precipitationForm = PrecipitationForm.RainHeavy; } else { precipitationForm = PrecipitationForm.Sleet; } if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 81 && precipitationFormRoll <= 95) { precipitationForm = PrecipitationForm.Thunderstorm; if (reroll) { rainForHours = DiceRoller.RollD3(); } } else if (precipitationFormRoll >= 96 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.Thunderstorm; if (reroll) { rainForHours = DiceRoller.RollD6(); } } break; default: break; } } else { switch (precipitationIntensity) { case PrecipitationIntensity.Light: if (precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogLight; if (reroll) { rainForHours = DiceRoller.RollD6(); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 40) { precipitationForm = PrecipitationForm.FogLight; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 41 && precipitationFormRoll <= 50) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 51 && precipitationFormRoll <= 60) { precipitationForm = PrecipitationForm.SnowLight; if (reroll) { rainForHours = 1; } } else if (precipitationFormRoll >= 61 && precipitationFormRoll <= 75) { precipitationForm = PrecipitationForm.SnowLight; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 76 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.SnowLight; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } break; case PrecipitationIntensity.Medium: if (precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD6(); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 30) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 31 && precipitationFormRoll <= 50) { precipitationForm = PrecipitationForm.SnowMedium; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 51 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.SnowMedium; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.SnowMedium; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } break; case PrecipitationIntensity.Heavy: if (precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogMedium; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 20) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 21 && precipitationFormRoll <= 60) { precipitationForm = PrecipitationForm.SnowLight; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } else if (precipitationFormRoll >= 61 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.SnowMedium; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.SnowHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(); } } break; case PrecipitationIntensity.Torrential: if (precipitationFormRoll <= 5) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 6 && precipitationFormRoll <= 10) { precipitationForm = PrecipitationForm.FogHeavy; if (reroll) { rainForHours = DiceRoller.RollD6(2); } } else if (precipitationFormRoll >= 11 && precipitationFormRoll <= 50) { precipitationForm = PrecipitationForm.SnowHeavy; if (reroll) { rainForHours = DiceRoller.RollD4(); } } else if (precipitationFormRoll >= 51 && precipitationFormRoll <= 90) { precipitationForm = PrecipitationForm.SnowHeavy; if (reroll) { rainForHours = DiceRoller.RollD8(); } } else if (precipitationFormRoll >= 91 && precipitationFormRoll <= 100) { precipitationForm = PrecipitationForm.SnowHeavy; if (reroll) { rainForHours = DiceRoller.RollD12(2); } } break; default: break; } } int endTime = startTime + rainForHours; string endM = startM; while (endTime > 12) { endTime -= 12; if (endM == "AM") { endM = "PM"; } else { endM = "AM"; } } rainFromTo = $"{startTime}{startM} - {endTime}{endM}"; }