コード例 #1
0
        /// <summary>
        ///     Saves set options to the Option Container and generates the stars. Then updates the datatable, and returns back to
        ///     the
        ///     main window.
        /// </summary>
        /// <param name="sender">The sender object</param>
        /// <param name="e">The event arguments</param>
        private void btnGenStars_Click(object sender, EventArgs e)
        {
            //save to OptionCont
            OptionCont.ForceGardenFavorable = ChkForceGarden.IsChecked != null && (bool)ChkForceGarden.IsChecked;
            OptionCont.InOpenCluster        = ChkOpenCluster.IsChecked != null && (bool)ChkOpenCluster.IsChecked;
            OptionCont.SetVerboseOutput(ChkVerbose.IsChecked != null && (bool)ChkVerbose.IsChecked);
            OptionCont.EnsureOneOrbit = ChkForceOneOrbit.IsChecked != null && (bool)ChkForceOneOrbit.IsChecked;

            //set age, or clear age.
            if (ChkAgeOverride.IsChecked == true)
            {
                OptionCont.SetSystemAge(double.Parse(NumAge.Text));
            }

            if (ChkAgeOverride.IsChecked == false)
            {
                OptionCont.SetSystemAge(-1.0);
            }

            //set stars, or clear stars
            if (ChkStarOverride.IsChecked == true)
            {
                OptionCont.SetNumberOfStars(int.Parse(NumStars.Text));
            }
            if (ChkStarOverride.IsChecked == false)
            {
                OptionCont.SetNumberOfStars(-1);
            }

            OptionCont.LessStellarEccent         = ChkLesserEccentricity.IsChecked != null && (bool)ChkLesserEccentricity.IsChecked;
            OptionCont.ForceVeryLowStellarEccent = ChkExtLowStellar.IsChecked != null && (bool)ChkExtLowStellar.IsChecked;

            //set stellar mass options
            OptionCont.StellarMassRangeSet = ChkStellarMass.IsChecked != null && (bool)ChkStellarMass.IsChecked;
            OptionCont.MinStellarMass      = double.Parse(NumMinMass.Text);
            OptionCont.MaxStellarMass      = double.Parse(NumMaxMass.Text);

            OptionCont.FantasyColors       = ChkFantasyColors.IsChecked != null && (bool)ChkFantasyColors.IsChecked;
            OptionCont.MoreFlareStarChance = ChkMoreFlare.IsChecked != null && (bool)ChkMoreFlare.IsChecked;
            OptionCont.AnyStarFlareStar    = (bool)ChkAnyFlareStar.IsChecked;

            //now we start setting system parameters.
            OurSystem.SysName = TxtSysName.Text == "" ? LibStarGen.GenRandomSysName(OptionCont.SysNamePrefix, VelvetBag) : TxtSysName.Text;

            OurSystem.SysAge = LibStarGen.GenSystemAge(VelvetBag);

            //start creating and making stars.
            LibStarGen.CreateStars(VelvetBag, OurSystem);
            SystemParent.CreateStarsFinished = true;
            Close(); //close the form
        }
コード例 #2
0
        /// <summary>
        ///     Sends the completed status and begins generating the planets
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">EventArgs object</param>
        private void btnGenPlanets_Click(object sender, EventArgs e)
        {
            //save options
            OptionCont.MoreConGasGiantChances    = ChkConGasGiant.IsChecked != null && (bool)ChkConGasGiant.IsChecked;
            OptionCont.NoOceanOnlyGarden         = OnlyGarden.IsChecked != null && (bool)OnlyGarden.IsChecked;
            OptionCont.MoreAccurateO2Catastrophe = ChkMoreAccurateO2Catastrophe.IsChecked != null && (bool)ChkMoreAccurateO2Catastrophe.IsChecked;
            OptionCont.StableActivity            = FrcStableActivity.IsChecked != null && (bool)FrcStableActivity.IsChecked;
            OptionCont.NoMarginalAtm             = NoMarginAtm.IsChecked != null && (bool)NoMarginAtm.IsChecked;
            OptionCont.HighRvmVal                     = HighRvm.IsChecked != null && (bool)HighRvm.IsChecked;
            OptionCont.OverrideHabitability           = ChkHigherHabitability.IsChecked != null && (bool)ChkHigherHabitability.IsChecked;
            OptionCont.IgnoreLunarTidesOnGardenWorlds = IgnoreTides.IsChecked != null && (bool)IgnoreTides.IsChecked;
            OptionCont.RerollAxialTiltOver45          = ChkKeepAxialTiltUnder45.IsChecked != null && (bool)ChkKeepAxialTiltUnder45.IsChecked;
            OptionCont.AlwaysDisplayTidalData         = ChkDisplayTidalData.IsChecked != null && (bool)ChkDisplayTidalData.IsChecked;
            OptionCont.ExpandAsteroidBelt             = ChkExpandAsteroidBelt.IsChecked != null && (bool)ChkExpandAsteroidBelt.IsChecked;

            if (OverrideMoons.IsChecked == true)
            {
                OptionCont.SetNumberOfMoonsOverGarden(int.Parse(NumMoons.Text));
            }
            if (OverridePressure.IsChecked == true)
            {
                OptionCont.SetAtmPressure = double.Parse(NumAtmPressure.Text);
            }
            if (ChkOverrideTilt.IsChecked == true)
            {
                OptionCont.SetAxialTilt(int.Parse(NumTilt.Text));
            }

            //set the moon option.
            if (BookHigh.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonBookhigh;
            }
            if (BookMoon.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonBook;
            }
            if (ExtendHigh.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonExpandhigh;
            }
            if (ExtendNorm.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonExpand;
            }

            //generate the planets!
            var totalOrbCount = 0; //total orbital count

            //first off, master loop.
            foreach (var star in OurSystem.SysStars)
            {
                if (!star.TestInitlizationZones())
                {
                    star.InitalizeZonesOfInterest();
                }
                for (var i = 1; i < OurSystem.SysStars.Count; i++)
                {
                    Range temp;
                    if (OurSystem.SysStars[i].ParentId == star.SelfId)
                    {
                        temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                        star.CreateForbiddenZone(temp, star.SelfId, OurSystem.SysStars[i].SelfId);
                    }
                    if (OurSystem.SysStars[i].SelfId != star.SelfId)
                    {
                        continue;
                    }
                    temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                    star.CreateForbiddenZone(temp, star.ParentId, star.SelfId);
                }

                star.SortForbidden();
                star.CreateCleanZones();
                var placeHolder = new Satellite(0, 0, 0, 0);
                int ownership;
                if (star.GasGiantFlag != Star.GasgiantNone)
                {
                    double rangeAvail = 0, lowerBound = 0, diffRange = 0;
                    var    spawnRange = new Range(0, 1);

                    //get range availability and spawn range

                    //CONVENTIONAL
                    if (star.GasGiantFlag == Star.GasgiantConventional)
                    {
                        rangeAvail = star.CheckConRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * 1;
                        diffRange  = Star.SnowLine(star.InitLumin) * 1.5 - lowerBound;
                        spawnRange = star.GetConventionalRange();
                    }

                    //ECCENTRIC
                    if (star.GasGiantFlag == Star.GasgiantEccentric)
                    {
                        rangeAvail = star.CheckEccRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * .125;
                        diffRange  = Star.SnowLine(star.InitLumin) * .75 - lowerBound;
                        spawnRange = star.GetEccentricRange();
                    }

                    //EPISTELLAR
                    if (star.GasGiantFlag == Star.GasgiantEpistellar)
                    {
                        rangeAvail = star.CheckEpiRange();
                        lowerBound = Star.InnerRadius(star.InitLumin, star.InitMass) * .1;
                        diffRange  = Star.InnerRadius(star.InitLumin, star.InitMass) * 1.8 - lowerBound;
                        spawnRange = star.GetEpistellarRange();
                    }

                    int    roll;
                    double orbit;
                    if (rangeAvail >= .25)
                    {
                        do
                        {
                            orbit = VelvetBag.RollRange(lowerBound, diffRange);
                        }while (!star.VerifyCleanOrbit(orbit));

                        ownership = star.GetOwnership(orbit);

                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }

                    if (rangeAvail >= .005 && rangeAvail < .25)
                    {
                        orbit     = star.PickInRange(spawnRange);
                        ownership = star.GetOwnership(orbit);
                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }
                }

                //now we've determined our placeholdr, let's start working on our orbitals.

                double       currOrbit = Star.InnerRadius(star.InitLumin, star.InitMass), nextOrbit;
                const double distance = .15;

                //now we have our placeholder.
                if (Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    star.AddSatellite(placeHolder);
                    currOrbit = placeHolder.OrbitalRadius;
                }

                if (star.GasGiantFlag != Star.GasgiantEpistellar && Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    //we're moving left.
                    //LEFT RIGHT LEFT
                    //.. sorry about that
                    var innerRadius = Star.InnerRadius(star.InitLumin, star.InitMass);
                    do
                    {
                        //as we're moving left, divide.
                        nextOrbit = currOrbit / LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit > currOrbit - distance)
                        {
                            nextOrbit = currOrbit - distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        //now let's check on
                    }while (currOrbit > innerRadius);
                }

                //MOVE RIGHT!
                //now we have our placeholder.
                if (star.GasGiantFlag == Star.GasgiantEpistellar || Math.Abs(placeHolder.OrbitalRadius) < 0)
                {
                    var outerRadius = Star.OuterRadius(star.InitMass);
                    do
                    {
                        //as we're moving right, multiply.
                        nextOrbit = currOrbit * LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit < currOrbit + distance)
                        {
                            nextOrbit = currOrbit + distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        if (currOrbit < 0)
                        {
                            currOrbit = outerRadius + 10;
                        }
                        //now let's check on
                    }while (currOrbit < outerRadius);
                }

                //if a clean zone has 0 planets, add one.
                foreach (var c in star.ZonesOfInterest.FormationZones)
                {
                    if (!star.CleanZoneHasOrbits(c))
                    {
                        nextOrbit = star.PickInRange(c.GetRange());
                        ownership = star.GetOwnership(nextOrbit);
                        star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                    }
                }

                //sort orbitals
                star.SortOrbitals();
                star.GiveOrbitalsOrder(ref totalOrbCount);

                //now we get orbital contents, then fill in details
                LibStarGen.PopulateOrbits(star, VelvetBag);

                //set any star with all empty orbits to have one planet
                if (!star.IsAllEmptyOrbits() || !(bool)OptionCont.EnsureOneOrbit)
                {
                    continue;
                }
                var newPlanet = VelvetBag.Rng(1, star.SysPlanets.Count, -1);
                star.SysPlanets[newPlanet].UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeMedium);
            }

            foreach (var star in OurSystem.SysStars)
            {
                var distChart = LibStarGen.GenDistChart(OurSystem.SysStars);
                foreach (var sat in star.SysPlanets)
                {
                    sat.UpdateBlackBodyTemp(distChart, OurSystem.SysStars);
                }
                LibStarGen.CreatePlanets(OurSystem, star.SysPlanets, VelvetBag);
            }

            OParent.CreatePlanetsFinished = true;
            Close(); //close the form
        }
コード例 #3
0
        public StarSystem CreateNewSystem()
        {
            OurSystem.SysName = LibStarGen.GenRandomSysName(OptionCont.SysNamePrefix, VelvetBag);
            OurSystem.SysAge  = LibStarGen.GenSystemAge(VelvetBag);
            LibStarGen.CreateStars(VelvetBag, OurSystem);
            //---------------------
            //generate the planets!
            var totalOrbCount = 0; //total orbital count

            //first off, master loop.
            foreach (var star in OurSystem.SysStars)
            {
                //draw up forbidden zones.
                if (!star.TestInitlizationZones())
                {
                    star.InitalizeZonesOfInterest();
                }
                for (var i = 1; i < OurSystem.SysStars.Count; i++)
                {
                    Range temp;
                    if (OurSystem.SysStars[i].ParentId == star.SelfId)
                    {
                        temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                        star.CreateForbiddenZone(temp, star.SelfId, OurSystem.SysStars[i].SelfId);
                    }
                    if (OurSystem.SysStars[i].SelfId != star.SelfId)
                    {
                        continue;
                    }
                    temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                    star.CreateForbiddenZone(temp, star.ParentId, star.SelfId);
                }

                star.SortForbidden();
                star.CreateCleanZones();
                //gas giant flag
                //                LibStarGen.gasGiantFlag(this.OurSystem.sysStars[currStar], VelvetBag.gurpsRoll());

                var placeHolder = new Satellite(0, 0, 0, 0);
                int ownership;
                if (star.GasGiantFlag != Star.GasgiantNone)
                {
                    double rangeAvail = 0, lowerBound = 0, diffRange = 0;
                    var    spawnRange = new Range(0, 1);

                    //get range availability and spawn range

                    //CONVENTIONAL
                    if (star.GasGiantFlag == Star.GasgiantConventional)
                    {
                        rangeAvail = star.CheckConRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * 1;
                        diffRange  = Star.SnowLine(star.InitLumin) * 1.5 - lowerBound;
                        spawnRange = star.GetConventionalRange();
                    }

                    //ECCENTRIC
                    if (star.GasGiantFlag == Star.GasgiantEccentric)
                    {
                        rangeAvail = star.CheckEccRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * .125;
                        diffRange  = Star.SnowLine(star.InitLumin) * .75 - lowerBound;
                        spawnRange = star.GetEccentricRange();
                    }

                    //EPISTELLAR
                    if (star.GasGiantFlag == Star.GasgiantEpistellar)
                    {
                        rangeAvail = star.CheckEpiRange();
                        lowerBound = Star.InnerRadius(star.InitLumin, star.InitMass) * .1;
                        diffRange  = Star.InnerRadius(star.InitLumin, star.InitMass) * 1.8 - lowerBound;
                        spawnRange = star.GetEpistellarRange();
                    }

                    int    roll;
                    double orbit;
                    if (rangeAvail >= .25)
                    {
                        do
                        {
                            orbit = VelvetBag.RollRange(lowerBound, diffRange);
                        }while (!star.VerifyCleanOrbit(orbit));

                        ownership = star.GetOwnership(orbit);

                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }

                    if (rangeAvail >= .005 && rangeAvail < .25)
                    {
                        orbit     = star.PickInRange(spawnRange);
                        ownership = star.GetOwnership(orbit);
                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }
                }

                //now we've determined our placeholdr, let's start working on our orbitals.

                double       currOrbit = Star.InnerRadius(star.InitLumin, star.InitMass), nextOrbit;
                const double distance = .15;

                //now we have our placeholder.
                if (Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    star.AddSatellite(placeHolder);
                    currOrbit = placeHolder.OrbitalRadius;
                }

                if (star.GasGiantFlag != Star.GasgiantEpistellar && Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    //we're moving left.
                    //LEFT RIGHT LEFT
                    //.. sorry about that
                    var innerRadius = Star.InnerRadius(star.InitLumin, star.InitMass);
                    do
                    {
                        //as we're moving left, divide.
                        nextOrbit = currOrbit / LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit > currOrbit - distance)
                        {
                            nextOrbit = currOrbit - distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        //now let's check on
                    }while (currOrbit > innerRadius);
                }

                //MOVE RIGHT!
                //now we have our placeholder.
                if (star.GasGiantFlag == Star.GasgiantEpistellar || Math.Abs(placeHolder.OrbitalRadius) < 0)
                {
                    var outerRadius = Star.OuterRadius(star.InitMass);
                    do
                    {
                        //as we're moving right, multiply.
                        nextOrbit = currOrbit * LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit < currOrbit + distance)
                        {
                            nextOrbit = currOrbit + distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        if (currOrbit < 0)
                        {
                            currOrbit = outerRadius + 10;
                        }
                        //now let's check on
                    }while (currOrbit < outerRadius);
                }

                //if a clean zone has 0 planets, add one.
                foreach (var c in star.ZonesOfInterest.FormationZones.Where(c => !star.CleanZoneHasOrbits(c)))
                {
                    nextOrbit = star.PickInRange(c.GetRange());
                    ownership = star.GetOwnership(nextOrbit);
                    star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                }

                //sort orbitals
                star.SortOrbitals();
                star.GiveOrbitalsOrder(ref totalOrbCount);

                //now we get orbital contents, then fill in details
                LibStarGen.PopulateOrbits(star, VelvetBag);

                //set any star with all empty orbits to have one planet
                if (OptionCont.EnsureOneOrbit != null && (!star.IsAllEmptyOrbits() || !(bool)OptionCont.EnsureOneOrbit))
                {
                    continue;
                }
                var newPlanet = VelvetBag.Rng(1, star.SysPlanets.Count, -1);
                star.SysPlanets[newPlanet].UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeMedium);
            }

            foreach (var star in OurSystem.SysStars)
            {
                var distChart = LibStarGen.GenDistChart(OurSystem.SysStars);
                foreach (var sat in star.SysPlanets)
                {
                    sat.UpdateBlackBodyTemp(distChart, OurSystem.SysStars);
                }
                LibStarGen.CreatePlanets(OurSystem, star.SysPlanets, VelvetBag);
            }
            //-----------------------
            return(OurSystem);
        }
コード例 #4
0
ファイル: Star.cs プロジェクト: Neakas/ProjectSWN
        public static string SetColor(Dice ourDice, double effTemp)
        {
            if ((bool)!OptionCont.FantasyColors)
            {
                if (effTemp >= 33000)
                {
                    return("Blue");
                }
                if (effTemp >= 10000 && effTemp < 33000)
                {
                    return("Blue-White");
                }
                if (effTemp >= 7500 && effTemp < 10000)
                {
                    return("Whitish Blue");
                }
                if (effTemp >= 6000 && effTemp < 7500)
                {
                    return("White");
                }
                if (effTemp >= 5200 && effTemp < 6000)
                {
                    return("Yellow");
                }
                if (effTemp >= 4250 && effTemp < 5200)
                {
                    return("Yellowish Orange");
                }
                if (effTemp >= 3700 && effTemp < 4250)
                {
                    return("Orange");
                }
                if (effTemp >= 2000 && effTemp < 3700)
                {
                    return("Orangish Red");
                }
                if (effTemp >= 1300 && effTemp < 2000)
                {
                    return("Red");
                }
                if (effTemp >= 700 && effTemp < 1300)
                {
                    return("Purplish Red");
                }
                if (effTemp >= 100 && effTemp < 700)
                {
                    return("Brown");
                }
                if (effTemp < 100)
                {
                    return("Black");
                }
            }
            else
            {
                var roll = ourDice.Rng(100019);
                if (LibStarGen.Inbetween(roll, 0, 10))
                {
                    return("Black");
                }
                if (LibStarGen.Inbetween(roll, 11, 531))
                {
                    return("Green");
                }
                if (LibStarGen.Inbetween(roll, 532, 952))
                {
                    return("Yellow-Green");
                }
                if (LibStarGen.Inbetween(roll, 953, 6057))
                {
                    return("Red-Orange");
                }
                if (LibStarGen.Inbetween(roll, 6058, 6835))
                {
                    return("Blue");
                }
                if (LibStarGen.Inbetween(roll, 6836, 11940))
                {
                    return("Purple-Red");
                }
                if (LibStarGen.Inbetween(roll, 11941, 23948))
                {
                    return("Red");
                }
                if (LibStarGen.Inbetween(roll, 23949, 49960))
                {
                    return("Yellow");
                }
                if (LibStarGen.Inbetween(roll, 49961, 75972))
                {
                    return("Orange");
                }
                if (LibStarGen.Inbetween(roll, 75973, 87980))
                {
                    return("Yellow-Orange");
                }
                if (LibStarGen.Inbetween(roll, 87981, 93085))
                {
                    return("Blue-White");
                }
                if (LibStarGen.Inbetween(roll, 93086, 93763))
                {
                    return("White");
                }
                if (LibStarGen.Inbetween(roll, 93764, 98868))
                {
                    return("White-Blue");
                }
                if (LibStarGen.Inbetween(roll, 98869, 99289))
                {
                    return("Green-Blue");
                }
                if (LibStarGen.Inbetween(roll, 99290, 99710))
                {
                    return("Blue-Violet");
                }
                if (LibStarGen.Inbetween(roll, 99711, 100019))
                {
                    return("Purple");
                }
            }

            return("ERROR");
        }
コード例 #5
0
ファイル: Star.cs プロジェクト: Neakas/ProjectSWN
        public override string ToString()
        {
            var nL = Environment.NewLine + "    ";

            var ret = Name + " is a " + GetStatusDesc() + " star with spectral type " + SpecType;

            ret = ret + nL + "This star has " + CurrMass + " solar masses, and a current luminosity of " + Math.Round(CurrLumin, OptionCont.NumberOfDecimal);
            ret = ret + nL + "solar luminosities. It has a surface temperature of " + Math.Round(EffTemp, OptionCont.NumberOfDecimal) + "K.";
            ret = ret + nL + "This star's radius is " + Math.Round(GetRadiusAu(), OptionCont.NumberOfDecimal) + " AU.";
            ret = ret + nL + "Apparent Color : " + StarColor;

            if (OptionCont.GetVerboseOutput())
            {
                ret = ret + Environment.NewLine;
                ret = ret + nL + "Initial Luminosity: " + InitLumin + " solar luminosities.";
                ret = ret + nL + "Initial Mass: " + InitMass + " solar masses";
                ret = ret + nL + "Formation Zones: " + InnerRadius(InitLumin, InitMass) + " AU to " + Math.Round(OuterRadius(InitMass), OptionCont.NumberOfDecimal) + " AU";
                ret = ret + nL + "Snow Line: " + Math.Round(SnowLine(InitLumin), OptionCont.NumberOfDecimal) + " AU.";
            }

            ret = ret + Environment.NewLine;
            if (IsFlareStar)
            {
                ret = ret + nL + "This star is a flare star.";
            }

            ret = ret + Environment.NewLine;

            if (OptionCont.GetVerboseOutput())
            {
                ret = ret + nL + "Self ID: " + GetDescSelfFlag(SelfId) + " and Parent ID: " + GetDescSelfFlag(ParentId);
                ret = ret + nL;
            }

            //printing out age details
            ret = ret + nL + "Evolution Data";
            ret = ret + Environment.NewLine;

            if (EvoLine.GetGiantLimit() < 1000)
            {
                ret = ret + nL + "Main Sequence Ends: " + EvoLine.GetMainLimit() + " Gyr,";
                ret = ret + " Subgiant Ends: " + EvoLine.GetSubLimit() + " Gyr";
                ret = ret + nL + "Giant Stage Ends: " + EvoLine.GetGiantLimit() + " Gyr";

                if (StarAge < EvoLine.GetMainLimit())
                {
                    ret = ret + nL + "This star will exit the main sequence phase in: " + (EvoLine.GetMainLimit() - StarAge) + " Gyr";
                }
                if (StarAge >= EvoLine.GetMainLimit() && StarAge < EvoLine.GetSubLimit())
                {
                    ret = ret + nL + "This star will exit the subgiant phase in: " + (EvoLine.GetSubLimit() - StarAge) + " Gyr";
                }
                if (StarAge >= EvoLine.GetSubLimit() && StarAge < EvoLine.GetGiantLimit())
                {
                    ret = ret + nL + "This star will exit the giant phase in: " + (EvoLine.GetGiantLimit() - StarAge) + " Gyr";
                }
                if (StarAge >= EvoLine.GetGiantLimit())
                {
                    ret = ret + nL + "This star has been a white dwarf for: " + (StarAge - EvoLine.GetGiantLimit()) + " Gyr";
                }
            }

            else
            {
                ret = ret + nL + "This star will burn out sometime well after the galaxy disappears.";
            }

            if (SelfId != IsPrimary)
            {
                ret = ret + Environment.NewLine;
                ret = ret + nL + "Orbital Details";
                ret = ret + nL + "This orbits " + ParentName + " at " + OrbitalRadius + " AU.";

                if (OrbitalEccent > 0)
                {
                    ret = ret + nL + "Eccentricity: " + OrbitalEccent + ".";
                    ret = ret + nL + "Periapsis: " + GetPeriapsis(OrbitalEccent, OrbitalRadius) + " AU and Apapasis: " + GetApapsis(OrbitalEccent, OrbitalRadius) + " AU.";
                }

                ret = ret + nL + "Orbital period is " + Math.Round(OrbitalPeriod, 2) + " years (" + Math.Round(OrbitalPeriod * 365.25, 2);
                ret = ret + " days)";
                ret = ret + nL + "This has a seperation of " + LibStarGen.GetSeperationStr(OrbitalSep);
            }

            //ret = ret + nL;
            //ret = ret + nL + "Orbital Details";
            //foreach (Satellite s in this.sysPlanets)
            //{
            //    ret = ret + nL + s;
            //    ret = ret + nL;
            //}
            //ret = ret + nL;

            if (!OptionCont.GetVerboseOutput())
            {
                return(ret);
            }
            ret = ret + nL;
            ret = ret + nL + "Formation Zone Details";
            ret = ret + nL;
            ret = ZonesOfInterest.ForbiddenZones.Aggregate(ret, (current, r) => current + nL + r);
            ret = ret + nL;
            ret = ZonesOfInterest.FormationZones.Aggregate(ret, (current, r) => current + nL + r);
            ret = ret + nL;
            ret = ret + nL + "Gas Giant Flag: " + DescGasGiantFlag(GasGiantFlag);
            ret = ret + nL;

            return(ret);
        }
コード例 #6
0
        /// <summary>
        ///     The object called when the create planets form is closed. Checks to see if we should update the listing
        /// </summary>
        /// <param name="sender">The sender object</param>
        /// <param name="e">The event arguments</param>
        private void createPlanets_Closed(object sender, EventArgs e)
        {
            if (CreatePlanetsFinished)
            {
                LblNumberPlanets.Content = OurSystem.CountPlanets().ToString();
                foreach (var s in OurSystem.SysStars)
                {
                    foreach (var pl in s.SysPlanets)
                    {
                        if (pl.BaseType == Satellite.BasetypeEmpty)
                        {
                            continue;
                        }
                        var ourValues = new object[10];
                        ourValues[0] = pl.Name;

                        if (OptionCont.ExpandAsteroidBelt != null && (pl.BaseType != Satellite.BasetypeAsteroidbelt || (bool)OptionCont.ExpandAsteroidBelt))
                        {
                            ourValues[1] = pl.DescSizeType();
                        }
                        if (pl.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            ourValues[1] = "Asteroid Belt";
                        }

                        ourValues[2] = Math.Round(pl.DiameterInKm(), 2);
                        ourValues[3] = Math.Round(pl.OrbitalRadius, 2);
                        ourValues[4] = Math.Round(pl.Gravity * Satellite.Gforce, 2);

                        if (pl.BaseType == Satellite.BasetypeAsteroidbelt)
                        {
                            ourValues[5] = "None.";
                        }

                        if (pl.BaseType == Satellite.BasetypeGasgiant)
                        {
                            ourValues[5] = "Superdense Atmosphere.";
                        }

                        if (pl.BaseType == Satellite.BasetypeMoon || pl.BaseType == Satellite.BasetypeTerrestial)
                        {
                            ourValues[5] = pl.GetDescAtmCategory() + "(" + Math.Round(pl.AtmPres, 2) + ")";
                        }

                        ourValues[6] = pl.DescAtm();
                        ourValues[7] = pl.HydCoverage * 100 + "%";

                        if (pl.BaseType == Satellite.BasetypeMoon || pl.BaseType == Satellite.BasetypeTerrestial)
                        {
                            ourValues[8] = pl.GetClimateDesc(pl.GetClimate(pl.SurfaceTemp)) + "( " + Math.Round(pl.SurfaceTemp, 2) + "K/ " + Math.Round(LibStarGen.ConvertTemp("kelvin", "celsius", pl.SurfaceTemp), 2) + "C)";
                        }
                        else
                        {
                            ourValues[8] = "Blackbody Temperature: " + Math.Round(pl.BlackbodyTemp, 2) + "K";
                        }

                        ourValues[9] = pl.GetRvmDesc();

                        PlanetTable.Rows.Add(ourValues);
                    }
                }
            }
        }