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 void Clear() { Die = new Dice(); GeneratedSystem = new ObservableCollection<StarSystem>(); FTLTravelResult = FTLTravel.None; }