public void GenerateSystem(HexCoordinate hexCoordinate, int planetaryGenerationRoll1, int planetaryGenerationRoll2, int ftlRoll1, int ftlRoll2, bool isExplorer, bool forceSentientSpecies, bool seedHex, bool seedPlanetaryGeneration, bool seedFTL) { Debug.WriteLine("Generating System : Hex:{0}, PG1:{1}, PG2:{2}, FTL1:{3}, FTL2:{4}, IsExplorer:{5}, SeedHex:{6}, SeedPG:{7}, SeedFTL:{8}", hexCoordinate, planetaryGenerationRoll1, planetaryGenerationRoll2, ftlRoll1, ftlRoll2, isExplorer, seedHex, seedPlanetaryGeneration, seedFTL); // First we will seed the dice so that the GM can pull up the system coordinates again with the same input values if (seedHex || seedPlanetaryGeneration || seedFTL) { int seed = 1; if (seedHex) { seed = int.Parse(hexCoordinate.X + "" + hexCoordinate.Y); } if (seedPlanetaryGeneration) { seed += planetaryGenerationRoll1; seed += planetaryGenerationRoll2; } if (seedFTL) { seed += ftlRoll1; seed += ftlRoll2; } Die.ChangeSeed(seed); Debug.WriteLine("Seeded Dice"); } else Die = new Dice(); // Now that everything is setup, begin generating the system ObservableCollection<StarSystem> tempStarSystem = new ObservableCollection<StarSystem>(); FTLTravelResult = FindFTLResult(isExplorer, ftlRoll1, ftlRoll2); int totalPlanetGeneration = planetaryGenerationRoll1 + planetaryGenerationRoll2; int starRoll = Die.Roll(100); int totalStars = 1; if (starRoll > 90) totalStars = Die.Roll(4); // Fill the system with random bodies Debug.WriteLine("Rolling Objects in System"); for (int i = 0; i < totalStars; i++) { Debug.WriteLine("New Star"); StarSystem star = new StarSystem(); star.Radiation = ((RadiationLevel)Die.RollBetween(0, ((int)RadiationLevel.Extreme) + 1)); star.Classification = ((StarClassification)Die.RollBetween(0, (int)StarClassification.Blackhole) + 1); star.Age = ((StarAge)Die.RollBetween(0, (int)StarAge.EndOfLife) + 1); int totalBodies = Die.Roll(6); for (int x = 0; x < totalBodies; x++) { star.CelestialBodies.Add(GenerateCelestialBody(FTLTravel.NormalSystem)); } tempStarSystem.Add(star); } // Roll the Main Generator Debug.WriteLine("Generating the Planet from Inputs"); CelestialObject generatedPlanet = GenerateCelestialBody(FTLTravelResult, forceSentientSpecies); generatedPlanet.CelestialType = CelestialBodyType.TerrestrialPlanet; tempStarSystem[0].CelestialBodies.Add(generatedPlanet); // Finally, update the collection Debug.WriteLine("Finished Generating System"); GeneratedSystem = tempStarSystem; }
public int CalculateResourceValue(FTLTravel ftlTravelResult, TerraformationTier terraformationTier) { if (ftlTravelResult == FTLTravel.DeathWorld) return Die.Roll(20); else if (ftlTravelResult == FTLTravel.GoodSystem) return Die.RollBetween(4, 5 + 1); else if (ftlTravelResult == FTLTravel.BeyondComprehension) return 5; else if (ftlTravelResult == FTLTravel.HyperResourceWorld) return Die.RollBetween(6, 10 + 1); else if (terraformationTier == TerraformationTier.T5) return Die.RollBetween(3, 5 + 1); return Die.Roll(4); }
public void Clear() { Die = new Dice(); GeneratedSystem = new ObservableCollection<StarSystem>(); FTLTravelResult = FTLTravel.None; }
public CelestialObject GenerateCelestialBody(FTLTravel ftlTravel, bool forceSentientSpecies = false) { Debug.WriteLine("Generating Celestial Bodies: {0}", ftlTravel); CelestialObject celestialBody = new CelestialObject(); celestialBody.CelestialType = CalculateCelestialType(); celestialBody.TerraformingTier = CalculateTerraformingTier(); celestialBody.StageOfLife = CalculateStageOfLife(celestialBody.CelestialType); celestialBody.ResourceValue = CalculateResourceValue(ftlTravel, celestialBody.TerraformingTier); if (celestialBody.CelestialType == CelestialBodyType.Wormhole || celestialBody.CelestialType == CelestialBodyType.Blackhole) { celestialBody.StageOfLife = LifeStage.None; } if (celestialBody.StageOfLife == LifeStage.SentientLife || forceSentientSpecies) //|| ftlTravel == FTLTravel.AlreadyColonized) { int numSpeciesRoll = Die.Roll(20); int numSpecies = 1; if (numSpeciesRoll < 15) numSpeciesRoll = 1; else numSpeciesRoll = Die.Roll(5); for (int i = 0; i < numSpecies; i++) { celestialBody.Sentients.Add(GenerateSentientSpecies()); } } return celestialBody; }