private bool RollPrecipitationChance(bool reroll) { isRaining = false; if (reroll) { precipitationChanceRoll = DiceRoller.RollD100(); } switch (precipitationFrequency) { case PrecipitationFrequency.Drought: if (precipitationChanceRoll <= 5) { cloudCover = CloudCover.Overcast; isRaining = true; } break; case PrecipitationFrequency.Rare: if (precipitationChanceRoll <= 15) { cloudCover = CloudCover.Overcast; isRaining = true; } break; case PrecipitationFrequency.Intermittent: if (precipitationChanceRoll <= 30) { cloudCover = CloudCover.Overcast; isRaining = true; } break; case PrecipitationFrequency.Common: if (precipitationChanceRoll <= 60) { cloudCover = CloudCover.Overcast; isRaining = true; } break; case PrecipitationFrequency.Constant: if (precipitationChanceRoll <= 95) { cloudCover = CloudCover.Overcast; isRaining = true; } break; default: break; } currentTemp = tempBaseline + tempVariation; return(isRaining); }
public List <string> RollFindAllPlants() { List <string> plants = new List <string>(); while (NumberOfPlants > 0) { NumberOfPlants--; int d100 = DiceRoller.RollD100(); plants.Add(GetRandomPlantNameBasedOn(GetPlantSearchCategory(d100))); } return(plants); }
private void SetSevereEvents() // if the system spits out a crazy number cool things happen { if ((windStrength == WindStrength.Severe || windStrength == WindStrength.Windstorm) && isRaining && precipitationForm == PrecipitationForm.SnowHeavy) { if (DiceRoller.RollD100() <= 20) { rainForHours = DiceRoller.RollD12(2); } severeWeatherEvent = SevereWeatherEvent.Blizzard; } else if ((windStrength == WindStrength.Severe || windStrength == WindStrength.Windstorm) && inDesert) { severeWeatherEvent = SevereWeatherEvent.Sandstorm; } else if ((windStrength == WindStrength.Severe || windStrength == WindStrength.Windstorm) && inDesert && precipitationForm == PrecipitationForm.Thunderstorm) { severeWeatherEvent = SevereWeatherEvent.Haboob; } else if (precipitationForm == PrecipitationForm.Thunderstorm) { if (DiceRoller.RollD100() <= 5) { severeWeatherEvent = SevereWeatherEvent.Hail; } } else if (precipitationForm == PrecipitationForm.RainHeavy && windStrength == WindStrength.Windstorm && windSpeed >= 75) { severeWeatherEvent = SevereWeatherEvent.Hurricane; } else if (windSpeed >= 174) { severeWeatherEvent = SevereWeatherEvent.Tornado; } else { severeWeatherEvent = SevereWeatherEvent.None; } }
private void SetCloudCover(bool reroll) { if (reroll) { cloudCoverRoll = DiceRoller.RollD100(); } if (cloudCoverRoll <= 50) { cloudCover = CloudCover.None; } else if (cloudCoverRoll >= 51 && cloudCoverRoll <= 70) { cloudCover = CloudCover.CloudsLight; } else if (cloudCoverRoll >= 71 && cloudCoverRoll <= 85) { cloudCover = CloudCover.CloudsMedium; } else if (cloudCoverRoll >= 86 && cloudCoverRoll <= 100) { cloudCover = CloudCover.Overcast; } }
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; } }
private void SetWindStrength(bool reroll) { if (reroll) { windStrengthRoll = DiceRoller.RollD100(); } if (windStrengthRoll <= 50) { windStrength = WindStrength.Light; if (reroll) { windSpeed = DiceRoller.RandomRangeNumber(0, 10); } windCheckSize = CharacterSize.None; windBlownAwaySize = CharacterSize.None; windSkillCheckPenalty = 0; } else if (windStrengthRoll >= 51 && windStrengthRoll <= 80) { windStrength = WindStrength.Moderate; if (reroll) { windSpeed = DiceRoller.RandomRangeNumber(11, 20); } windCheckSize = CharacterSize.None; windBlownAwaySize = CharacterSize.None; windSkillCheckPenalty = 0; } else if (windStrengthRoll >= 81 && windStrengthRoll <= 90) { windStrength = WindStrength.Strong; if (reroll) { windSpeed = DiceRoller.RandomRangeNumber(21, 30); } windCheckSize = CharacterSize.Tiny; windBlownAwaySize = CharacterSize.None; windSkillCheckPenalty = -2; } else if (windStrengthRoll >= 91 && windStrengthRoll <= 95) { windStrength = WindStrength.Severe; if (reroll) { windSpeed = DiceRoller.RandomRangeNumber(31, 50); } windCheckSize = CharacterSize.Small; windBlownAwaySize = CharacterSize.Tiny; windSkillCheckPenalty = -4; } else if (windStrengthRoll >= 96 && windStrengthRoll <= 100) { windStrength = WindStrength.Windstorm; if (reroll) { windSpeed = DiceRoller.RandomRangeNumber(51, 300); } windCheckSize = CharacterSize.Medium; windBlownAwaySize = CharacterSize.Small; windSkillCheckPenalty = -8; } }