public static SolarSystem GenerateSystemFromData(SolarSystemData data, Empire Owner)
        {
            SolarSystem newSys = new SolarSystem()
            {
                SunPath = data.SunPath,
                Name = data.Name
            };
            int numberOfRings = data.RingList.Count;
            int StarRadius = (int)RandomMath.RandomBetween(50f, 500f);
            for (int i = 1; i < numberOfRings + 1; i++)
            {
                int ringtype = 0;

                {
                    int x = (int)(RandomMath.RandomBetween(1, 29));

                        ringtype = x;

                }
                float ringRadius = (float)((i * ((float)StarRadius + RandomMath.RandomBetween(10500f, 12000f))) + 10000f);
                if (data.RingList[i - 1].Asteroids == null )
                {
                    int WhichPlanet = data.RingList[i - 1].WhichPlanet > 0 ? data.RingList[i - 1].WhichPlanet : ringtype;
                    float scale = 1f;
                    if (data.RingList[i - 1].planetScale > 0)
                    {
                        scale = data.RingList[i - 1].planetScale;
                    }
                    else
                    {
                        scale = RandomMath.RandomBetween(0.9f, 1.8f);
                        if (WhichPlanet == 2 || WhichPlanet == 6 || WhichPlanet == 10 || WhichPlanet == 12 || WhichPlanet == 15 || WhichPlanet == 20 || WhichPlanet == 26)
                        {
                            scale += 2.5f;
                        }
                    }

                    float planetRadius = 100f * scale;
                    float RandomAngle = RandomMath.RandomBetween(0f, 360f);
                    Vector2 planetCenter = newSys.findPointFromAngleAndDistance(Vector2.Zero, RandomAngle, ringRadius);

                    Planet newOrbital = new Planet()
                    {
                        Name = data.RingList[i - 1].Planet,
                        OrbitalAngle = RandomAngle,
                        ParentSystem = newSys,
                        SpecialDescription = data.RingList[i - 1].SpecialDescription,
                        planetType = WhichPlanet,
                        Position = planetCenter,
                        scale = scale,
                        ObjectRadius = planetRadius,
                        OrbitalRadius = ringRadius,
                        planetTilt = RandomMath.RandomBetween(45f, 135f)
                    };
                    newOrbital.InitializeUpdate();
                    if (!data.RingList[i - 1].HomePlanet || Owner == null)
                    {
                        if (data.RingList[i - 1].UniqueHabitat)
                        {
                            newOrbital.UniqueHab = true;
                            newOrbital.uniqueHabPercent = data.RingList[i - 1].UniqueHabPC;
                        }
                        newOrbital.SetPlanetAttributes();
                        if (data.RingList[i - 1].MaxPopDefined > 0)
                            newOrbital.MaxPopulation = data.RingList[i - 1].MaxPopDefined * 1000f;
                        if (!string.IsNullOrEmpty(data.RingList[i - 1].Owner) && !string.IsNullOrEmpty(data.RingList[i - 1].Owner))
                        {
                            newOrbital.Owner = EmpireManager.GetEmpireByName(data.RingList[i - 1].Owner);
                            EmpireManager.GetEmpireByName(data.RingList[i - 1].Owner).AddPlanet(newOrbital);
                            newOrbital.Population = newOrbital.MaxPopulation;
                            newOrbital.MineralRichness = 1f;
                            newOrbital.Fertility = 2f;
                            newOrbital.InitializeSliders(newOrbital.Owner);
                            newOrbital.colonyType = Planet.ColonyType.Core;
                            newOrbital.GovernorOn = true;
                        }
                    }
                    else
                    {
                        newOrbital.Owner = Owner;
                        Owner.Capital = newOrbital;
                        newOrbital.InitializeSliders(Owner);
                        Owner.AddPlanet(newOrbital);
                        newOrbital.SetPlanetAttributes(26f);
                        newOrbital.MineralRichness = 1f + Owner.data.Traits.HomeworldRichMod;
                        newOrbital.Special = "None";
                        newOrbital.Fertility = 2f + Owner.data.Traits.HomeworldFertMod;

                        if (data.RingList[i - 1].MaxPopDefined > 0)
                        {
                            newOrbital.MaxPopulation = (data.RingList[i - 1].MaxPopDefined * 1000f) + ((data.RingList[i - 1].MaxPopDefined * 1000f) *  Owner.data.Traits.HomeworldSizeMod);
                        }
                        else
                        {
                            newOrbital.MaxPopulation = 14000f + 14000f * Owner.data.Traits.HomeworldSizeMod;
                        }
                        newOrbital.Population = 14000f;
                        newOrbital.FoodHere = 100f;
                        newOrbital.ProductionHere = 100f;
                        if (!newSys.OwnerList.Contains(newOrbital.Owner))
                        {
                            newSys.OwnerList.Add(newOrbital.Owner);
                        }
                        newOrbital.HasShipyard = true;
                        newOrbital.AddGood("ReactorFuel", 1000);
                        ResourceManager.GetBuilding("Capital City").SetPlanet(newOrbital);
                        ResourceManager.GetBuilding("Space Port").SetPlanet(newOrbital);
                        if (GlobalStats.HardcoreRuleset)
                        {
                            ResourceManager.GetBuilding("Fissionables").SetPlanet(newOrbital);
                            ResourceManager.GetBuilding("Fissionables").SetPlanet(newOrbital);
                            ResourceManager.GetBuilding("Mine Fissionables").SetPlanet(newOrbital);
                            ResourceManager.GetBuilding("Fuel Refinery").SetPlanet(newOrbital);
                        }
                    }
                    if (data.RingList[i - 1].HasRings != null)
                    {
                        newOrbital.hasRings = true;
                        newOrbital.ringTilt = RandomMath.RandomBetween(-80f, -45f);
                    }
                    //Add buildings to planet
                    if (data.RingList[i - 1].BuildingList.Count > 0)
                        foreach (string building in data.RingList[i - 1].BuildingList)
                            ResourceManager.GetBuilding(building).SetPlanet(newOrbital);
                    //Add ships to orbit
                    if (data.RingList[i - 1].Guardians.Count > 0)
                        foreach (string ship in data.RingList[i - 1].Guardians)
                            newOrbital.Guardians.Add(ship);
                    //Add moons to planets
                    if (data.RingList[i - 1].Moons.Count > 0)
                    {
                        for (int j = 0; j < data.RingList[i - 1].Moons.Count; j++)
                        {
                            float radius = newOrbital.ObjectRadius * 5 + (RandomMath.RandomBetween(1000f, 1500f) * (j + 1));
                            Moon moon = new Moon()
                            {
                                orbitTarget = newOrbital.guid,
                                moonType = data.RingList[i - 1].Moons[j].WhichMoon,
                                scale = data.RingList[i - 1].Moons[j].MoonScale,
                                OrbitRadius = radius,
                                OrbitalAngle = RandomMath.RandomBetween(0f, 360f),
                                Position = newSys.GenerateRandomPointOnCircle(radius, newOrbital.Position)
                            };
                            newSys.MoonList.Add(moon);
                        }
                    }
                    newSys.PlanetList.Add(newOrbital);
                    SolarSystem.Ring ring = new SolarSystem.Ring()
                    {
                        Distance = ringRadius,
                        Asteroids = false,
                        planet = newOrbital
                    };
                    newSys.RingList.Add(ring);
                }
                else
                {
                    float numberOfAsteroids = RandomMath.RandomBetween(150f, 250f);
                    for (int k = 0; (float)k < numberOfAsteroids; k++)
                    {
                        Vector3 asteroidCenter = new Vector3(newSys.GenerateRandomPointOnCircle(ringRadius + RandomMath.RandomBetween(-3000f, 3000f), Vector2.Zero), 0f);
                        while (!newSys.RoidPosOK(asteroidCenter))
                        {
                            asteroidCenter = new Vector3(newSys.GenerateRandomPointOnCircle(ringRadius + RandomMath.RandomBetween(-3000f, 3000f), Vector2.Zero), 0f);
                        }
                        Asteroid newRoid = new Asteroid()
                        {
                            scale = RandomMath.RandomBetween(1.2f, 4.6f),
                            Position3D = asteroidCenter
                        };
                        int whichRoid = 0;
                        while (whichRoid == 0 || whichRoid == 3)
                        {
                            whichRoid = (int)RandomMath.RandomBetween(1f, 9f);
                        }
                        newRoid.whichRoid = whichRoid;
                        newRoid.Radius = RandomMath.RandomBetween(30f, 90f);
                        newSys.AsteroidsList.Add(newRoid);
                    }
                    SolarSystem.Ring ring = new SolarSystem.Ring()
                    {
                        Distance = ringRadius,
                        Asteroids = true
                    };
                    newSys.RingList.Add(ring);
                }
            }
            return newSys;
        }
        public void AcceptThreat(Offer ToUs, Offer FromUs, Empire us, Empire Them)
        {
            if (ToUs.PeaceTreaty)
            {
                this.empire.GetRelations()[Them].AtWar = false;
                this.empire.GetRelations()[Them].PreparingForWar = false;
                this.empire.GetRelations()[Them].ActiveWar.EndStarDate = this.empire.GetUS().StarDate;
                this.empire.GetRelations()[Them].WarHistory.Add(this.empire.GetRelations()[Them].ActiveWar);
                this.empire.GetRelations()[Them].Posture = Posture.Neutral;
                if (this.empire.GetRelations()[Them].Anger_FromShipsInOurBorders > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3))
                {
                    this.empire.GetRelations()[Them].Anger_FromShipsInOurBorders = (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3);
                }
                if (this.empire.GetRelations()[Them].Anger_TerritorialConflict > (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3))
                {
                    this.empire.GetRelations()[Them].Anger_TerritorialConflict = (float)(this.empire.data.DiplomaticPersonality.Territorialism / 3);
                }
                this.empire.GetRelations()[Them].Anger_MilitaryConflict = 0f;
                this.empire.GetRelations()[Them].WarnedAboutShips = false;
                this.empire.GetRelations()[Them].WarnedAboutColonizing = false;
                this.empire.GetRelations()[Them].HaveRejected_Demand_Tech = false;
                this.empire.GetRelations()[Them].HaveRejected_OpenBorders = false;
                this.empire.GetRelations()[Them].HaveRejected_TRADE = false;
                this.empire.GetRelations()[Them].HasDefenseFleet = false;
                if (this.empire.GetRelations()[Them].DefenseFleet != -1)
                {
                    this.empire.GetFleetsDict()[this.empire.GetRelations()[Them].DefenseFleet].Task.EndTask();
                }
                lock (GlobalStats.TaskLocker)
                {
                    foreach (MilitaryTask task in this.TaskList)
                    {
                        if (task.GetTargetPlanet() == null || task.GetTargetPlanet().Owner == null || task.GetTargetPlanet().Owner != Them)
                        {
                            continue;
                        }
                        task.EndTask();
                    }
                }
                this.empire.GetRelations()[Them].ActiveWar = null;
                Them.GetRelations()[this.empire].AtWar = false;
                Them.GetRelations()[this.empire].PreparingForWar = false;
                Them.GetRelations()[this.empire].ActiveWar.EndStarDate = Them.GetUS().StarDate;
                Them.GetRelations()[this.empire].WarHistory.Add(Them.GetRelations()[this.empire].ActiveWar);
                Them.GetRelations()[this.empire].Posture = Posture.Neutral;
                if (EmpireManager.GetEmpireByName(Them.GetUS().PlayerLoyalty) != Them)
                {
                    if (Them.GetRelations()[this.empire].Anger_FromShipsInOurBorders > (float)(Them.data.DiplomaticPersonality.Territorialism / 3))
                    {
                        Them.GetRelations()[this.empire].Anger_FromShipsInOurBorders = (float)(Them.data.DiplomaticPersonality.Territorialism / 3);
                    }
                    if (Them.GetRelations()[this.empire].Anger_TerritorialConflict > (float)(Them.data.DiplomaticPersonality.Territorialism / 3))
                    {
                        Them.GetRelations()[this.empire].Anger_TerritorialConflict = (float)(Them.data.DiplomaticPersonality.Territorialism / 3);
                    }
                    Them.GetRelations()[this.empire].Anger_MilitaryConflict = 0f;
                    Them.GetRelations()[this.empire].WarnedAboutShips = false;
                    Them.GetRelations()[this.empire].WarnedAboutColonizing = false;
                    Them.GetRelations()[this.empire].HaveRejected_Demand_Tech = false;
                    Them.GetRelations()[this.empire].HaveRejected_OpenBorders = false;
                    Them.GetRelations()[this.empire].HaveRejected_TRADE = false;
                    if (Them.GetRelations()[this.empire].DefenseFleet != -1)
                    {
                        Them.GetFleetsDict()[Them.GetRelations()[this.empire].DefenseFleet].Task.EndTask();
                    }
                    lock (GlobalStats.TaskLocker)
                    {
                        foreach (MilitaryTask task in Them.GetGSAI().TaskList)
                        {
                            if (task.GetTargetPlanet() == null || task.GetTargetPlanet().Owner == null || task.GetTargetPlanet().Owner != this.empire)
                            {
                                continue;
                            }
                            task.EndTask();
                        }
                    }
                }
                Them.GetRelations()[this.empire].ActiveWar = null;
            }
            if (ToUs.NAPact)
            {
                us.GetRelations()[Them].Treaty_NAPact = true;
                FearEntry te = new FearEntry();
                if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) != us)
                {
                    string name = us.data.DiplomaticPersonality.Name;
                    string str = name;
                    if (name != null)
                    {
                        if (str == "Pacifist")
                        {
                            te.FearCost = 0f;
                        }
                        else if (str == "Cunning")
                        {
                            te.FearCost = 0f;
                        }
                        else if (str == "Xenophobic")
                        {
                            te.FearCost = 15f;
                        }
                        else if (str == "Aggressive")
                        {
                            te.FearCost = 35f;
                        }
                        else if (str == "Honorable")
                        {
                            te.FearCost = 5f;
                        }
                        else if (str == "Ruthless")
                        {
                            te.FearCost = 50f;
                        }
                    }
                }
                us.GetRelations()[Them].FearEntries.Add(te);
            }
            if (FromUs.NAPact)
            {
                Them.GetRelations()[us].Treaty_NAPact = true;
                if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) != Them)
                {
                    FearEntry te = new FearEntry();
                    string name1 = Them.data.DiplomaticPersonality.Name;
                    string str1 = name1;
                    if (name1 != null)
                    {
                        if (str1 == "Pacifist")
                        {
                            te.FearCost = 0f;
                        }
                        else if (str1 == "Cunning")
                        {
                            te.FearCost = 0f;
                        }
                        else if (str1 == "Xenophobic")
                        {
                            te.FearCost = 15f;
                        }
                        else if (str1 == "Aggressive")
                        {
                            te.FearCost = 35f;
                        }
                        else if (str1 == "Honorable")
                        {
                            te.FearCost = 5f;
                        }
                        else if (str1 == "Ruthless")
                        {
                            te.FearCost = 50f;
                        }
                    }
                    Them.GetRelations()[us].FearEntries.Add(te);
                }
            }
            if (ToUs.TradeTreaty)
            {
                us.GetRelations()[Them].Treaty_Trade = true;
                us.GetRelations()[Them].Treaty_Trade_TurnsExisted = 0;
                FearEntry te = new FearEntry()
                {
                    FearCost = 5f
                };
                us.GetRelations()[Them].FearEntries.Add(te);
            }
            if (FromUs.TradeTreaty)
            {
                Them.GetRelations()[us].Treaty_Trade = true;
                Them.GetRelations()[us].Treaty_Trade_TurnsExisted = 0;
                FearEntry te = new FearEntry()
                {
                    FearCost = 0.1f
                };
                Them.GetRelations()[us].FearEntries.Add(te);
            }
            if (ToUs.OpenBorders)
            {
                us.GetRelations()[Them].Treaty_OpenBorders = true;
                FearEntry te = new FearEntry()
                {
                    FearCost = 5f
                };
                us.GetRelations()[Them].FearEntries.Add(te);
            }
            if (FromUs.OpenBorders)
            {
                Them.GetRelations()[us].Treaty_OpenBorders = true;
                FearEntry te = new FearEntry()
                {
                    FearCost = 5f
                };
                Them.GetRelations()[us].FearEntries.Add(te);
            }
            foreach (string tech in FromUs.TechnologiesOffered)
            {
                Them.UnlockTech(tech);
                if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == us)
                {
                    continue;
                }
                FearEntry te = new FearEntry()
                {
                    FearCost = (us.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f),
                    TurnTimer = 40
                };
                us.GetRelations()[Them].FearEntries.Add(te);
            }
            foreach (string tech in ToUs.TechnologiesOffered)
            {
                us.UnlockTech(tech);
                if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == Them)
                {
                    continue;
                }
                FearEntry te = new FearEntry()
                {
                    FearCost = (Them.data.EconomicPersonality.Name == "Technologists" ? ResourceManager.TechTree[tech].Cost / 100f * 0.25f + ResourceManager.TechTree[tech].Cost / 100f : ResourceManager.TechTree[tech].Cost / 100f)
                };
                Them.GetRelations()[us].FearEntries.Add(te);
            }
            foreach (string Art in FromUs.ArtifactsOffered)
            {
                Artifact toGive = ResourceManager.ArtifactsDict[Art];
                foreach (Artifact arti in us.data.OwnedArtifacts)
                {
                    if (arti.Name != Art)
                    {
                        continue;
                    }
                    toGive = arti;
                }
                us.RemoveArtifact(toGive);
                Them.AddArtifact(toGive);
            }
            foreach (string Art in ToUs.ArtifactsOffered)
            {
                Artifact toGive = ResourceManager.ArtifactsDict[Art];
                foreach (Artifact arti in Them.data.OwnedArtifacts)
                {
                    if (arti.Name != Art)
                    {
                        continue;
                    }
                    toGive = arti;
                }
                Them.RemoveArtifact(toGive);
                us.AddArtifact(toGive);

            }
            foreach (string planetName in FromUs.ColoniesOffered)
            {
                List<Planet> toRemove = new List<Planet>();
                List<Ship> TroopShips = new List<Ship>();
                foreach (Planet p in us.GetPlanets())
                {
                    if (p.Name != planetName)
                    {
                        continue;
                    }
                    foreach (PlanetGridSquare pgs in p.TilesList)
                    {
                        if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != this.empire)
                        {
                            continue;
                        }
                        TroopShips.Add(pgs.TroopsHere[0].Launch());
                    }
                    toRemove.Add(p);
                    p.Owner = Them;
                    Them.AddPlanet(p);
                    p.system.OwnerList.Clear();
                    foreach (Planet pl in p.system.PlanetList)
                    {
                        if (pl.Owner == null || p.system.OwnerList.Contains(pl.Owner))
                        {
                            continue;
                        }
                        p.system.OwnerList.Add(pl.Owner);
                    }
                    float value = p.Population / 1000f + p.FoodHere / 50f + p.ProductionHere / 50f + p.Fertility + p.MineralRichness + p.MaxPopulation / 10000f;
                    foreach (Building b in p.BuildingList)
                    {
                        value = value + b.Cost / 50f;
                    }
                    FearEntry te = new FearEntry();
                    if (value < 15f)
                    {
                        value = 15f;
                    }
                    te.FearCost = (us.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value);
                    te.TurnTimer = 40;
                    us.GetRelations()[Them].FearEntries.Add(te);
                }
                foreach (Planet p in toRemove)
                {
                    us.GetPlanets().Remove(p);
                }
                foreach (Ship ship in TroopShips)
                {
                    ship.GetAI().OrderRebaseToNearest();
                }
            }
            foreach (string planetName in ToUs.ColoniesOffered)
            {
                List<Planet> toRemove = new List<Planet>();
                List<Ship> TroopShips = new List<Ship>();
                foreach (Planet p in Them.GetPlanets())
                {
                    if (p.Name != planetName)
                    {
                        continue;
                    }
                    toRemove.Add(p);
                    p.Owner = us;
                    us.AddPlanet(p);
                    p.system.OwnerList.Clear();
                    foreach (Planet pl in p.system.PlanetList)
                    {
                        if (pl.Owner == null || p.system.OwnerList.Contains(pl.Owner))
                        {
                            continue;
                        }
                        p.system.OwnerList.Add(pl.Owner);
                    }
                    float value = p.Population / 1000f + p.FoodHere / 50f + p.ProductionHere / 50f + p.Fertility + p.MineralRichness + p.MaxPopulation / 10000f;
                    foreach (Building b in p.BuildingList)
                    {
                        value = value + b.Cost / 50f;
                    }
                    foreach (PlanetGridSquare pgs in p.TilesList)
                    {
                        if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != Them)
                        {
                            continue;
                        }
                        TroopShips.Add(pgs.TroopsHere[0].Launch());
                    }
                    if (EmpireManager.GetEmpireByName(this.empire.GetUS().PlayerLoyalty) == Them)
                    {
                        continue;
                    }
                    FearEntry te = new FearEntry()
                    {
                        FearCost = (Them.data.EconomicPersonality.Name == "Expansionists" ? value + value : value + 0.5f * value),
                        TurnTimer = 40
                    };
                    Them.GetRelations()[us].FearEntries.Add(te);
                }
                foreach (Planet p in toRemove)
                {
                    Them.GetPlanets().Remove(p);
                }
                foreach (Ship ship in TroopShips)
                {
                    ship.GetAI().OrderRebaseToNearest();
                }
            }
            us.GetRelations()[Them].UpdateRelationship(us, Them);
        }
        public void GenerateStartingSystem(string name, Empire Owner, float systemScale)
        {
            this.isStartingSystem = true;
            int WhichSun = (int)RandomMath.RandomBetween(1f, 6f);
            if (WhichSun > 5)
            {
                WhichSun = 5;
            }
            if (WhichSun == 1)
            {
                this.SunPath = "star_red";
            }
            else if (WhichSun == 2)
            {
                this.SunPath = "star_yellow";
            }
            else if (WhichSun == 3)
            {
                this.SunPath = "star_green";
            }
            else if (WhichSun == 4)
            {
                this.SunPath = "star_blue";
            }
            else if (WhichSun == 5)
            {
                this.SunPath = "star_yellow2";
            }
            else if (WhichSun == 6)
            {
                this.SunPath = "star_binary";
            }
            this.Name = name;
            this.numberOfRings = GlobalStats.ExtraPlanets > 3?GlobalStats.ExtraPlanets:  3;

            this.numberOfRings += (int)(RandomMath.RandomBetween(0, 1) + RandomMath.RandomBetween(0, 1) + RandomMath.RandomBetween(0, 1));
            if (this.numberOfRings > 6)
                this.numberOfRings = 6;
            this.RingsCount = this.numberOfRings;
            this.StarRadius = (int)RandomMath.RandomBetween(250f, 500f);
            for (int i = 1; i < this.numberOfRings + 1; i++)
            {
                float ringRadius = (float)i * ((float)this.StarRadius +  RandomMath.RandomBetween(500f, 3500f) + 10000f);
                ringRadius = ringRadius * systemScale;
                if (i ==1 || i>3)
                {
                    float RandomAngle = RandomMath.RandomBetween(0f, 360f);
                    Vector2 planetCenter = this.findPointFromAngleAndDistance(Vector2.Zero, RandomAngle, ringRadius);
                    Planet newOrbital = new Planet()
                    {
                        Name = string.Concat(this.Name, " ", NumberToRomanConvertor.NumberToRoman(i)),
                        OrbitalAngle = RandomAngle,
                        ParentSystem = this,
                        planetType = (int)RandomMath.RandomBetween(1f, 24f)
                    };
                    float scale = RandomMath.RandomBetween(0.9f, 1.8f);
                    if (newOrbital.planetType == 2 || newOrbital.planetType == 6 || newOrbital.planetType == 10 || newOrbital.planetType == 12 || newOrbital.planetType == 15 || newOrbital.planetType == 20 || newOrbital.planetType == 26)
                    {
                        scale += 2.5f;
                    }
                    float planetRadius = 100f * scale;
                    newOrbital.SetPlanetAttributes();
                    newOrbital.Position = planetCenter;
                    newOrbital.scale = scale;
                    newOrbital.ObjectRadius = planetRadius;
                    newOrbital.OrbitalRadius = ringRadius;
                    newOrbital.planetTilt = RandomMath.RandomBetween(45f, 135f);
                    if (RandomMath.RandomBetween(1f, 100f) < 15f)
                    {
                        newOrbital.hasRings = true;
                        newOrbital.ringTilt = RandomMath.RandomBetween(-80f, -45f);
                    }
                    this.PlanetList.Add(newOrbital);
                    RandomMath.RandomBetween(0f, 3f);
                    SolarSystem.Ring ring = new SolarSystem.Ring()
                    {
                        Distance = ringRadius,
                        Asteroids = false,
                        planet = newOrbital
                    };
                    this.RingList.Add(ring);
                }
                else if (i == 2)
                {
                    float numberOfAsteroids = RandomMath.RandomBetween(150f, 250f);
                    for (int k = 0; (float)k < numberOfAsteroids; k++)
                    {
                        Vector3 asteroidCenter = new Vector3(this.GenerateRandomPointOnCircle(ringRadius + RandomMath.RandomBetween(-3500f * systemScale, 3500f * systemScale), Vector2.Zero), 0f);
                        while (!this.RoidPosOK(asteroidCenter))
                        {
                            asteroidCenter = new Vector3(this.GenerateRandomPointOnCircle(ringRadius + RandomMath.RandomBetween(-3500f * systemScale, 3500f * systemScale), Vector2.Zero), 0f);
                        }
                        Asteroid newRoid = new Asteroid()
                        {
                            scale = RandomMath.RandomBetween(0.75f, 1.6f),
                            Position3D = asteroidCenter
                        };
                        int whichRoid = 0;
                        while (whichRoid == 0 || whichRoid == 3)
                        {
                            whichRoid = (int)RandomMath.RandomBetween(1f, 9f);
                        }
                        newRoid.whichRoid = whichRoid;
                        newRoid.Radius = RandomMath.RandomBetween(30f, 90f);
                    }
                    SolarSystem.Ring ring = new SolarSystem.Ring()
                    {
                        Distance = ringRadius,
                        Asteroids = true
                    };
                    this.RingList.Add(ring);
                }
                else if (i == 3)
                {
                    float scale = RandomMath.RandomBetween(1f, 2f);
                    float planetRadius = 100f * scale;
                    float RandomAngle = RandomMath.RandomBetween(0f, 360f);
                    Vector2 planetCenter = this.findPointFromAngleAndDistance(Vector2.Zero, RandomAngle, ringRadius);
                    Planet newOrbital = new Planet()
                    {
                        Name = string.Concat(this.Name, " ", NumberToRomanConvertor.NumberToRoman(i)),
                        OrbitalAngle = RandomAngle,
                        ParentSystem = this
                    };
                    int random = (int)RandomMath.RandomBetween(1f, 3f);
                    if (random == 1)
                    {
                        newOrbital.planetType = 27;
                    }
                    else if (random == 2)
                    {
                        newOrbital.planetType = 29;
                    }
                    newOrbital.Owner = Owner;
                    Owner.Capital = newOrbital;
                    newOrbital.InitializeSliders(Owner);
                    Owner.AddPlanet(newOrbital);
                    newOrbital.SetPlanetAttributes(26f);
                    newOrbital.MineralRichness = 1f + Owner.data.Traits.HomeworldRichMod;
                    newOrbital.Special = "None";
                    newOrbital.Fertility = 2f + Owner.data.Traits.HomeworldFertMod;
                    newOrbital.MaxPopulation = 14000f + 14000f * Owner.data.Traits.HomeworldSizeMod;
                    newOrbital.Population = 14000f;
                    newOrbital.FoodHere = 100f;
                    newOrbital.ProductionHere = 100f;
                    newOrbital.HasShipyard = true;
                    newOrbital.AddGood("ReactorFuel", 1000);
                    ResourceManager.GetBuilding("Capital City").SetPlanet(newOrbital);
                    ResourceManager.GetBuilding("Space Port").SetPlanet(newOrbital);
                    if (GlobalStats.HardcoreRuleset)
                    {
                        ResourceManager.GetBuilding("Fissionables").SetPlanet(newOrbital);
                        ResourceManager.GetBuilding("Fissionables").SetPlanet(newOrbital);
                        ResourceManager.GetBuilding("Mine Fissionables").SetPlanet(newOrbital);
                        ResourceManager.GetBuilding("Fuel Refinery").SetPlanet(newOrbital);
                    }
                    newOrbital.Position = planetCenter;
                    newOrbital.scale = scale;
                    newOrbital.ObjectRadius = planetRadius;
                    newOrbital.OrbitalRadius = ringRadius;
                    newOrbital.planetTilt = RandomMath.RandomBetween(45f, 135f);
                    if (RandomMath.RandomBetween(1f, 100f) < 15f)
                    {
                        newOrbital.hasRings = true;
                        newOrbital.ringTilt = RandomMath.RandomBetween(-80f, -45f);
                    }
                    this.PlanetList.Add(newOrbital);
                    RandomMath.RandomBetween(0f, 3f);
                    SolarSystem.Ring ring = new SolarSystem.Ring()
                    {
                        Distance = ringRadius,
                        Asteroids = false,
                        planet = newOrbital
                    };
                    this.RingList.Add(ring);
                }
            }
        }