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}"; }
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; } }