コード例 #1
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        private static void CalcEccentricity( Dice ourDice, Star s )
        {
            var modifiers = 0; //reset the thing.

            if (OptionCont.LessStellarEccent)
            {
                //now we generate eccentricities
                if (s.OrbitalSep == Star.OrbsepVeryclose)
                {
                    modifiers = modifiers - 10; //Very Close
                }
                if (s.OrbitalSep == Star.OrbsepClose)
                {
                    modifiers = modifiers - 6; //Close
                }
                if (s.OrbitalSep == Star.OrbsepModerate)
                {
                    modifiers = modifiers - 2; //Moderate
                }
            }
            else
            {
                if (s.OrbitalSep == Star.OrbsepVeryclose)
                {
                    modifiers = modifiers - 6; //Very Close
                }
                if (s.OrbitalSep == Star.OrbsepClose)
                {
                    modifiers = modifiers - 4; //Close
                }
                if (s.OrbitalSep == Star.OrbsepModerate)
                {
                    modifiers = modifiers - 2; //Moderate
                }
            }

            var roll = ourDice.GurpsRoll(modifiers);
            Star.GenerateEccentricity(roll, s);

            if (OptionCont.ForceVeryLowStellarEccent)
            {
                if (s.OrbitalEccent > .2)
                {
                    s.OrbitalEccent = .1;
                }
                if (s.OrbitalEccent > .1 && s.OrbitalEccent < .2)
                {
                    s.OrbitalEccent = .05;
                }
            }
        }
コード例 #2
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Determines RVM, and geologic values for a satelite
        /// </summary>
        /// <param name="s">The satelite</param>
        /// <param name="ourBag">Ddice object</param>
        /// <param name="sysAge">System Age</param>
        /// <param name="isGasGiantMoon">Is this a moon of a gas giant?</param>
        private static void DetermineGeologicValues( Satellite s, Dice ourBag, double sysAge, bool isGasGiantMoon )
        {
            //volcanic set first.
            var addVal = s.Gravity / sysAge * 40;

            if (s.MajorMoons.Count == 1)
            {
                addVal = addVal + 5;
            }
            if (s.MajorMoons.Count == 2)
            {
                addVal = addVal + 10;
            }

            if (s.SatelliteType == Satellite.SubtypeSulfur)
            {
                addVal = addVal + 60;
            }
            if (isGasGiantMoon)
            {
                addVal = addVal + 5;
            }

            var roll = ourBag.GurpsRoll();

            addVal = addVal + roll;

            if (addVal <= 16.5)
            {
                s.VolActivity = Satellite.GeologicNone;
            }
            if (addVal > 16.5 && addVal <= 20.5)
            {
                s.VolActivity = Satellite.GeologicLight;
            }
            if (addVal > 20.5 && addVal <= 26.5)
            {
                s.VolActivity = Satellite.GeologicModerate;
            }
            if (addVal > 26.5 && addVal <= 70.5)
            {
                s.VolActivity = Satellite.GeologicHeavy;
            }
            if (addVal > 70.5)
            {
                s.VolActivity = Satellite.GeologicExtreme;
            }

            roll = ourBag.GurpsRoll();
            if (s.VolActivity == Satellite.GeologicHeavy && s.SatelliteType == Satellite.SubtypeGarden && roll <= 8)
            {
                roll = ourBag.Rng(6);
                if (roll <= 3)
                {
                    s.AddAtmCategory(Satellite.AtmMargPollutants);
                }
                if (roll >= 4)
                {
                    s.AddAtmCategory(Satellite.AtmMargSulfur);
                }
            }

            roll = ourBag.GurpsRoll();
            if (s.VolActivity == Satellite.GeologicExtreme && s.SatelliteType == Satellite.SubtypeGarden && roll <= 14)
            {
                roll = ourBag.Rng(6);
                if (roll <= 3)
                {
                    s.AddAtmCategory(Satellite.AtmMargPollutants);
                }
                if (roll >= 4)
                {
                    s.AddAtmCategory(Satellite.AtmMargSulfur);
                }
            }

            //tectonic next
            roll = ourBag.GurpsRoll();

            //negative mods
            if (Math.Abs(s.HydCoverage) < 0)
            {
                roll = roll - 4;
            }
            if (s.HydCoverage > 0 && s.HydCoverage < .5)
            {
                roll = roll - 2;
            }
            if (s.VolActivity == Satellite.GeologicNone)
            {
                roll = roll - 8;
            }
            if (s.VolActivity == Satellite.GeologicLight)
            {
                roll = roll - 4;
            }

            //postive mods
            if (s.VolActivity == Satellite.GeologicHeavy)
            {
                roll = roll + 4;
            }
            if (s.VolActivity == Satellite.GeologicExtreme)
            {
                roll = roll + 8;
            }
            if (s.MajorMoons.Count == 1)
            {
                roll = roll + 2;
            }
            if (s.MajorMoons.Count > 1)
            {
                roll = roll + 4;
            }

            //nullers.
            if (s.SatelliteSize == Satellite.SizeTiny)
            {
                roll = 0;
            }
            if (s.SatelliteSize == Satellite.SizeSmall)
            {
                roll = 0;
            }

            if (roll <= 6.5)
            {
                s.TecActivity = Satellite.GeologicNone;
            }
            if (roll > 6.5 && roll <= 10.5)
            {
                s.TecActivity = Satellite.GeologicLight;
            }
            if (roll > 10.5 && roll <= 14.5)
            {
                s.TecActivity = Satellite.GeologicModerate;
            }
            if (roll > 14.5 && roll <= 18.5)
            {
                s.TecActivity = Satellite.GeologicHeavy;
            }
            if (roll > 18.5)
            {
                s.TecActivity = Satellite.GeologicExtreme;
            }

            //update RVM
            if ((bool) !OptionCont.HighRvmVal)
            {
                roll = ourBag.GurpsRoll();
            }
            if (OptionCont.HighRvmVal != null && (bool) OptionCont.HighRvmVal)
            {
                roll = ourBag.Rng(1, 6, 10);
            }

            if (s.VolActivity == Satellite.GeologicNone)
            {
                roll = roll - 2;
            }
            if (s.VolActivity == Satellite.GeologicLight)
            {
                roll = roll - 1;
            }
            if (s.VolActivity == Satellite.GeologicHeavy)
            {
                roll = roll + 1;
            }
            if (s.VolActivity == Satellite.GeologicExtreme)
            {
                roll = roll + 2;
            }

            if (s.BaseType == Satellite.BasetypeAsteroidbelt)
            {
                if (s.SatelliteSize == Satellite.SizeTiny)
                {
                    roll = roll - 1;
                }
                if (s.SatelliteSize == Satellite.SizeMedium)
                {
                    roll = roll + 2;
                }
                if (s.SatelliteSize == Satellite.SizeLarge)
                {
                    roll = roll + 4;
                }
            }

            //set stable activity here:
            if (OptionCont.StableActivity != null && ( (bool) OptionCont.StableActivity && s.SatelliteSize >= Satellite.SizeSmall && ( s.BaseType == Satellite.BasetypeMoon || s.BaseType == Satellite.BasetypeTerrestial ) ))
            {
                s.VolActivity = Satellite.GeologicModerate;
                s.TecActivity = Satellite.GeologicModerate;
            }

            s.PopulateRvm(roll);
        }
コード例 #3
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This function rolls for mass on a star.
        /// </summary>
        /// <param name="velvetBag">The Ddice object</param>
        /// <param name="orderId">The order ID of the star</param>
        /// <param name="maxMass">the maximum mass. Has a default value of 0.0, indicating no max mass (may be left out)</param>
        /// <returns>The rolled mass of a star</returns>
        public static double RollStellarMass( Dice velvetBag, int orderId, double maxMass = 0.0 )
        {
            int rollA; //roll integers

            if (Math.Abs(maxMass) < 0.0)
            {
                if (!(bool) !OptionCont.StellarMassRangeSet)
                {
                    return velvetBag.RollInRange(OptionCont.MinStellarMass, OptionCont.MaxStellarMass);
                }
                if (OptionCont.ForceGardenFavorable != null && ( orderId != Star.IsPrimary || !(bool) OptionCont.ForceGardenFavorable ))
                {
                    return Star.GetMassByRoll(velvetBag.GurpsRoll(), velvetBag.GurpsRoll());
                }
                rollA = velvetBag.Rng(6);
                if (rollA == 1)
                {
                    rollA = 5;
                }
                if (rollA == 2)
                {
                    rollA = 6;
                }
                if (rollA == 3 || rollA == 4)
                {
                    rollA = 7;
                }
                if (rollA == 5 || rollA == 6)
                {
                    rollA = 8;
                }

                return Star.GetMassByRoll(rollA, velvetBag.GurpsRoll());
            }

            var currPos = Star.GetStellarMassPos(maxMass);

            //error bound checking. The entire program is kinda predicated aroudn the idea you won't have this happen.
            //IF IT DOES, then do the simple method.
            if (currPos == -1)
            {
                double tmpRoll; //test value.
                do
                {
                    tmpRoll = Star.GetMassByRoll(velvetBag.GurpsRoll(), velvetBag.GurpsRoll());
                }
                while (tmpRoll > maxMass);

                return tmpRoll;
            }

            //else, roll for the new index.
            rollA = velvetBag.GurpsRoll();
            var rollB = velvetBag.Rng(rollA, 6); //roll integers

            //get the new index
            if (currPos - rollB <= 0)
            {
                currPos = 0;
            }
            else
            {
                currPos = currPos - rollB;
            }

            return Star.GetMassByIndex(currPos);
        }
コード例 #4
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This sets the flare status of a star
        /// </summary>
        /// <param name="s">The star we're setting for</param>
        /// <param name="ourDice">The Ddice object we use.</param>
        public static void SetFlareStatus( Star s, Dice ourDice )
        {
            var roll = ourDice.GurpsRoll();
            var limit = 12;
            var massLimit = .45;

            if (OptionCont.AnyStarFlareStar)
            {
                massLimit = 11;
            }
            if (OptionCont.MoreFlareStarChance != null && (bool) OptionCont.MoreFlareStarChance)
            {
                limit = 9;
            }

            if (roll >= limit && s.CurrMass <= massLimit)
            {
                s.IsFlareStar = true;
            }
        }
コード例 #5
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This function creates planets. (durr hurr). Only invoke after you've deteremined the orbitals.
        /// </summary>
        /// <param name="ourSystem">The star system we are creating for</param>
        /// <param name="ourPlanets">The orbitals we've created</param>
        /// <param name="velvetBag">Our Ddice object</param>
        public static void CreatePlanets( StarSystem ourSystem, List<Satellite> ourPlanets, Dice velvetBag )
        {
            var distanceTable = GenDistChart(ourSystem.SysStars);

            foreach (var s in ourPlanets)
            {
                if (s.BaseType == Satellite.BasetypeAsteroidbelt || s.BaseType == Satellite.BasetypeEmpty)
                {
                    if (s.BaseType == Satellite.BasetypeAsteroidbelt)
                    {
                        DetermineGeologicValues(s, velvetBag, ourSystem.SysAge, false);
                    }

                    continue;
                }

                double temp;
                var parent = ourSystem.GetValidParent(s.ParentId);

                //set physical properties
                s.GenGenericName(ourSystem.SysStars[parent].Name, ourSystem.SysName);
                s.GenWorldType(ourSystem.MaxMass, ourSystem.SysAge, velvetBag);

                s.GenDensity(velvetBag);
                s.GenPhysicalParameters(velvetBag);
                s.SetClimateData(ourSystem.MaxMass, velvetBag);
                s.DetSurfaceTemp(0);
                if (s.BaseType != Satellite.BasetypeGasgiant)
                {
                    s.CalcAtmPres();
                }

                s.CreateMoons(ourSystem.SysName, velvetBag, OptionCont.MoonOrbitFlag);

                s.GetPlanetEccentricity(ourSystem.SysStars[parent].GasGiantFlag, Star.SnowLine(ourSystem.SysStars[parent].InitLumin), velvetBag);
                s.GenerateOrbitalPeriod(ourSystem.SysStars[parent].CurrMass);
                s.CreateAxialTilt(velvetBag);

                foreach (var sun in from sun in ourSystem.SysStars let dist = DetermineDistance(s.OrbitalRadius, distanceTable, s.ParentId, sun.SelfId) select sun)
                {
                    temp = .46 * sun.CurrMass * s.Diameter / Math.Pow(s.OrbitalRadius, 3);
                    var tide = 0;

                    //add the correct flag.
                    if (sun.SelfId == Star.IsPrimary)
                    {
                        tide = Satellite.TidePrimarystar;
                    }
                    if (sun.SelfId == Star.IsSecondary)
                    {
                        tide = Satellite.TideSecondarystar;
                    }
                    if (sun.SelfId == Star.IsTrinary)
                    {
                        tide = Satellite.TideTrinarystar;
                    }
                    if (sun.SelfId == Star.IsSeccomp)
                    {
                        tide = Satellite.TideSeccompstar;
                    }
                    if (sun.SelfId == Star.IsTricomp)
                    {
                        tide = Satellite.TideTricompstar;
                    }

                    s.TideForce.Add(tide, temp);
                }

                if (s.MajorMoons.Count > 0)
                {
                    foreach (var moon in s.MajorMoons)
                    {
                        double lunarTides;
                        double different = 0;

                        moon.GenGenericName(s.Name, ourSystem.SysName);
                        //establish physical properties
                        moon.GenWorldType(ourSystem.MaxMass, ourSystem.SysAge, velvetBag);
                        if (s.BaseType == Satellite.BasetypeGasgiant)
                        {
                            //first, differentation test.
                            var dFactor = moon.GetDifferentationFactor(s.Mass, velvetBag);
                            if (dFactor > 100)
                            {
                                if (moon.SatelliteType == Satellite.SubtypeIce)
                                {
                                    moon.UpdateType(Satellite.SubtypeSulfur);
                                }
                                different = -.15;
                            }
                            if (dFactor > 80 && dFactor <= 100)
                            {
                                if (moon.SatelliteType == Satellite.SubtypeIce)
                                {
                                    moon.UpdateType(Satellite.SubtypeSulfur);
                                }
                                different = -.1;
                            }
                            if (dFactor > 50 && dFactor <= 80)
                            {
                                different = -.05;
                                moon.UpdateDescListing(Satellite.DescSubsurfocean);
                            }
                            if (dFactor > 30 && dFactor <= 50)
                            {
                                moon.UpdateDescListing(Satellite.DescSubsurfocean);
                            }
                        }

                        moon.GenDensity(velvetBag);
                        moon.GenPhysicalParameters(velvetBag);
                        moon.SetClimateData(ourSystem.MaxMass, velvetBag);
                        moon.DetSurfaceTemp(different);
                        moon.CalcAtmPres();

                        if (s.BaseType == Satellite.BasetypeGasgiant)
                        {
                            //radiation test
                            moon.UpdateDescListing(moon.AtmPres > .2 ? Satellite.DescRadHighback : Satellite.DescRadLethalback);
                        }

                        //orbital period
                        moon.GenerateOrbitalPeriod(s.Mass);

                        //update parent.
                        temp = 2230000 * moon.Mass * s.Diameter / Math.Pow(moon.OrbitalRadius, 3);
                        s.TideForce.Add(Satellite.TideMoonBase + moon.SelfId + 1, temp);

                        //moon tides
                        lunarTides = 2230000 * s.Mass * moon.Diameter / Math.Pow(moon.OrbitalRadius, 3);

                        lunarTides = lunarTides * ourSystem.SysAge / moon.Mass;
                        moon.TideForce.Add(Satellite.TideParplanet, lunarTides);
                        moon.TideTotal = moon.TotalTidalForce(ourSystem.SysAge);

                        if (moon.TideTotal >= 50 && velvetBag.GurpsRoll() > 17)
                        {
                            moon.IsResonant = true;
                        }
                        else if (moon.TideTotal >= 50)
                        {
                            moon.IsTideLocked = true;
                        }

                        moon.GenerateOrbitalVelocity(velvetBag);
                        if (moon.IsTideLocked && !moon.IsResonant)
                        {
                            UpdateTidalLock(moon, velvetBag);
                        }
                        if (moon.IsResonant)
                        {
                            moon.SiderealPeriod = moon.OrbitalPeriod * 2.0 / 3.0;
                            moon.RotationalPeriod = moon.SiderealPeriod;
                        }

                        if (velvetBag.GurpsRoll() >= 17)
                        {
                            moon.RetrogradeMotion = true;
                        }

                        if (moon.OrbitalPeriod == moon.SiderealPeriod)
                        {
                            moon.RotationalPeriod = 0;
                        }

                        else //calculate solar day from sidereal
                        {
                            double sidereal;
                            if (moon.RetrogradeMotion)
                            {
                                sidereal = -1 * moon.SiderealPeriod;
                            }
                            else
                            {
                                sidereal = moon.SiderealPeriod;
                            }

                            moon.RotationalPeriod = s.OrbitalPeriod * sidereal / ( s.OrbitalPeriod - sidereal );
                            moon.OrbitalCycle = moon.OrbitalPeriod * s.RotationalPeriod / ( moon.OrbitalPeriod - s.RotationalPeriod );
                        }
                        moon.CreateAxialTilt(velvetBag);
                        DetermineGeologicValues(moon, velvetBag, ourSystem.SysAge, s.BaseType == Satellite.BasetypeGasgiant);
                    }
                }

                //tides calculated already.
                s.TideTotal = s.TotalTidalForce(ourSystem.SysAge);
                if (s.TideTotal >= 50 && s.OrbitalEccent > .1)
                {
                    s.IsResonant = true;
                }
                else if (s.TideTotal >= 50)
                {
                    s.IsTideLocked = true;
                }

                s.GenerateOrbitalVelocity(velvetBag);

                if (s.IsTideLocked && !s.IsResonant)
                {
                    UpdateTidalLock(s, velvetBag);
                }
                if (s.IsResonant)
                {
                    s.SiderealPeriod = s.OrbitalPeriod * 2.0 / 3.0;
                    s.RotationalPeriod = s.SiderealPeriod;
                }

                if (velvetBag.GurpsRoll() >= 13)
                {
                    s.RetrogradeMotion = true;
                }
                if (s.OrbitalPeriod == s.SiderealPeriod)
                {
                    s.RotationalPeriod = 0;
                }

                else
                {
                    double sidereal;
                    if (s.RetrogradeMotion)
                    {
                        sidereal = -1 * s.SiderealPeriod;
                    }
                    else
                    {
                        sidereal = s.SiderealPeriod;
                    }

                    s.RotationalPeriod = s.OrbitalPeriod * sidereal / ( s.OrbitalPeriod - sidereal );
                }
                s.CreateAxialTilt(velvetBag);
                DetermineGeologicValues(s, velvetBag, ourSystem.SysAge, false);
            }
        }
コード例 #6
0
ファイル: Satelite.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Creaates moons around sateliets according to GURPS 4e rules.
        /// </summary>
        /// <param name="sysName">The system name</param>
        /// <param name="ourBag">Ddice object used in rolling</param>
        /// <param name="flag">The OptionCont flag describing where we put moon orbits</param>
        public void CreateMoons( string sysName, Dice ourBag, int flag = 0 )
        {
            string[] moonletNames =
            {
                "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Ksi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega"
            };

            //initiate objects
            var currMoonlet = 0;
            var occupiedOrbits = new List<double>();
            double currOrbit;

            int numRoll, roll; //roll variables

            //terrestial
            if (BaseType == BasetypeTerrestial)
            {
                //moonlets
                numRoll = ourBag.Rng(1, 6, -2);

                //modifiers for moonlets
                if (SatelliteSize == SizeTiny)
                {
                    numRoll = numRoll - 2;
                }
                if (SatelliteSize == SizeSmall)
                {
                    numRoll = numRoll - 1;
                }
                if (SatelliteSize == SizeLarge)
                {
                    numRoll = numRoll + 1;
                }
                if (OrbitalRadius <= 1.5 && .75 < OrbitalRadius)
                {
                    numRoll = numRoll - 1;
                }
                if (OrbitalRadius <= .75 && .5 < OrbitalRadius)
                {
                    numRoll = numRoll - 3;
                }

                if (OrbitalRadius <= .5)
                {
                    numRoll = 0; //set to 0, since we cannot have any in this range
                }

                if (numRoll > 0)
                {
                    for (var i = 0; i < numRoll; i++)
                    {
                        do
                        {
                            roll = ourBag.Rng(1, 6, 4);
                            currOrbit = roll / 4.0;
                        }
                        while (ScanOccupiedOrbits(occupiedOrbits, currOrbit));

                        occupiedOrbits.Add(currOrbit);
                        InnerMoonlets.Add(new Moonlet(SelfId, i, currOrbit, moonletNames[currMoonlet]));
                        InnerMoonlets[i].OrbitalRadius = InnerMoonlets[i].PlanetRadius * Diameter;
                        currMoonlet++;
                    }
                }

                //major moons
                numRoll = ourBag.Rng(1, 6, -4);

                if (SatelliteSize == SizeTiny)
                {
                    numRoll = numRoll - 2;
                }
                if (SatelliteSize == SizeSmall)
                {
                    numRoll = numRoll + 1;
                }
                if (SatelliteSize == SizeLarge)
                {
                    numRoll = numRoll - 1;
                }
                if (OrbitalRadius <= 1.5 && .75 < OrbitalRadius)
                {
                    numRoll = numRoll - 1;
                }

                if (OrbitalRadius <= .75)
                {
                    numRoll = 0;
                }

                if (OptionCont.GetNumberOfMoonsOverGarden() != -1 && SatelliteType == SubtypeGarden)
                {
                    numRoll = OptionCont.GetNumberOfMoonsOverGarden();
                }

                if (numRoll > 0)
                {
                    for (var i = 0; i < numRoll; i++)
                    {
                        var size = SizeMedium;

                        roll = ourBag.Rng(3, 6, 0);
                        if (SatelliteSize == SizeTiny)
                        {
                            size = SizeTiny;
                        }

                        if (SatelliteSize == SizeSmall)
                        {
                            size = SizeTiny;
                        }

                        if (SatelliteSize == SizeMedium)
                        {
                            size = roll >= 10 ? SizeSmall : SizeTiny;
                        }

                        if (SatelliteSize == SizeLarge)
                        {
                            if (roll >= 15)
                            {
                                size = SizeMedium;
                            }
                            if (roll >= 12 && roll <= 14)
                            {
                                size = SizeSmall;
                            }
                            size = SizeTiny;
                        }

                        do
                        {
                            var mods = 0; //roll variables
                            if (SatelliteType - size == 2)
                            {
                                mods = 2;
                            }
                            if (SatelliteType - size == 1)
                            {
                                mods = 4;
                            }

                            if (flag == OptionCont.MoonBook)
                            {
                                roll = ourBag.Rng(2, 6, mods);
                            }
                            if (flag == OptionCont.MoonBookhigh)
                            {
                                roll = ourBag.Rng(1, 6, mods + 6);
                            }
                            if (flag == OptionCont.MoonExpand)
                            {
                                roll = ourBag.Rng(2, 10, mods);
                            }
                            if (flag == OptionCont.MoonExpandhigh)
                            {
                                roll = ourBag.Rng(2, 6, mods + 12);
                            }

                            currOrbit = roll * 2.5;
                        }
                        while (ScanOccupiedOrbits(occupiedOrbits, currOrbit) && !WithinOtherOrbits(occupiedOrbits, currOrbit, 5.0));

                        occupiedOrbits.Add(currOrbit);
                        MajorMoons.Add(new Satellite(OrbitPlanet, i, currOrbit * Diameter, i, BasetypeMoon));
                        MajorMoons[i].UpdateSize(size);
                        MajorMoons[i].MoonRadius = currOrbit;
                        MajorMoons[i].BlackbodyTemp = BlackbodyTemp;
                        MajorMoons[i].ParentDiam = Diameter * 12756.2;
                    }
                }
            }

            //gas giant
            if (BaseType == BasetypeGasgiant)
            {
                //moonlets (inner)
                numRoll = ourBag.Rng(2, 6, 0);
                if (OrbitalRadius <= .1)
                {
                    numRoll = numRoll - 10;
                }
                else if (OrbitalRadius > .1 && .5 >= OrbitalRadius)
                {
                    numRoll = numRoll - 8;
                }
                else if (OrbitalRadius > .5 && .75 >= OrbitalRadius)
                {
                    numRoll = numRoll - 6;
                }
                else if (OrbitalRadius > .75 && 1.5 >= OrbitalRadius)
                {
                    numRoll = numRoll - 3;
                }

                if (numRoll > 0)
                {
                    for (var i = 0; i < numRoll; i++)
                    {
                        currOrbit = ourBag.Rng(1, 6, 4) * .25;
                        InnerMoonlets.Add(new Moonlet(SelfId, currMoonlet, currOrbit, moonletNames[currMoonlet]));
                        InnerMoonlets[i].OrbitalRadius = currOrbit * Diameter;
                        currMoonlet++;
                    }
                }

                //major moons
                numRoll = ourBag.Rng(1, 6, 0);
                if (OrbitalRadius <= .1)
                {
                    numRoll = numRoll - 6;
                }
                else if (OrbitalRadius > .1 && .5 >= OrbitalRadius)
                {
                    numRoll = numRoll - 5;
                }
                else if (OrbitalRadius > .5 && .75 >= OrbitalRadius)
                {
                    numRoll = numRoll - 4;
                }
                else if (OrbitalRadius > .75 && 1.5 >= OrbitalRadius)
                {
                    numRoll = numRoll - 1;
                }

                if (numRoll > 0)
                {
                    for (var i = 0; i < numRoll; i++)
                    {
                        var size = SizeMedium;

                        roll = ourBag.GurpsRoll();
                        if (roll >= 15)
                        {
                            size = SizeMedium;
                        }
                        if (roll >= 12 && roll <= 14)
                        {
                            size = SizeSmall;
                        }
                        if (roll < 12)
                        {
                            size = SizeTiny;
                        }

                        do
                        {
                            roll = ourBag.Rng(3, 6, 3);
                            if (roll >= 15)
                            {
                                roll = roll + ourBag.Rng(2, 6, 0);
                            }
                            currOrbit = roll / 2.0;
                        }
                        while (ScanOccupiedOrbits(occupiedOrbits, currOrbit) && !WithinOtherOrbits(occupiedOrbits, currOrbit, 1.0));

                        occupiedOrbits.Add(currOrbit);
                        MajorMoons.Add(new Satellite(OrbitPlanet, i, currOrbit * Diameter, i, BasetypeMoon));
                        MajorMoons[i].UpdateSize(size);
                        MajorMoons[i].MoonRadius = currOrbit;
                        MajorMoons[i].BlackbodyTemp = BlackbodyTemp;
                        MajorMoons[i].ParentDiam = Diameter * 12756.2;
                    }
                }

                //Captured Moons
                numRoll = ourBag.Rng(1, 6, 0);
                if (OrbitalRadius <= .5)
                {
                    numRoll = numRoll - 6;
                }
                else if (OrbitalRadius > .5 && .75 >= OrbitalRadius)
                {
                    numRoll = numRoll - 5;
                }
                else if (OrbitalRadius > .75 && 1.5 >= OrbitalRadius)
                {
                    numRoll = numRoll - 4;
                }
                else if (OrbitalRadius > 1.5 && 3 >= OrbitalRadius)
                {
                    numRoll = numRoll - 1;
                }

                if (numRoll > 0)
                {
                    for (var i = 0; i < numRoll; i++)
                    {
                        do
                        {
                            roll = ourBag.Rng(1, 280, 20);
                            currOrbit = roll;
                        }
                        while (ScanOccupiedOrbits(occupiedOrbits, currOrbit));
                        occupiedOrbits.Add(currOrbit);

                        OuterMoonlets.Add(new Moonlet(SelfId, currMoonlet, currOrbit, moonletNames[currMoonlet]));
                        OuterMoonlets[i].OrbitalRadius = currMoonlet * Diameter;
                        currMoonlet++;
                    }
                }
            }

            if (BaseType == BasetypeGasgiant)
            {
                if (InnerMoonlets.Count >= 10)
                {
                    UpdateDescListing(DescSpecringsys);
                }
                if (InnerMoonlets.Count >= 6 && InnerMoonlets.Count < 9)
                {
                    UpdateDescListing(DescFaintringsys);
                }
            }
        }
コード例 #7
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
 private LandHabitats DetermineLandHabitat()
 {
     var dice = new Dice();
     var roll = dice.GurpsRoll();
     var hab = LandHabitats.None;
     switch (roll)
     {
         case 3:
         case 4:
         case 5:
         case 6:
         case 7:
             hab = LandHabitats.Plains;
             break;
         case 8:
             hab = LandHabitats.Desert;
             break;
         case 9:
             hab = LandHabitats.IslandBeach;
             break;
         case 10:
             hab = LandHabitats.Woodlands;
             break;
         case 11:
             hab = LandHabitats.Swampland;
             break;
         case 12:
             hab = LandHabitats.Mountain;
             break;
         case 13:
             hab = LandHabitats.Arctic;
             break;
         case 14:
         case 15:
         case 16:
         case 17:
         case 18:
             hab = LandHabitats.Jungle;
             break;
     }
     return hab;
 }
コード例 #8
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This function generates a random age per GURPS Space 4e rules.
        /// </summary>
        /// <param name="ourDice">The Ddice this rolls</param>
        /// <returns>The system age</returns>
        public static double GenSystemAge( Dice ourDice )
        {
            //get first roll
            var roll = ourDice.GurpsRoll();

            if (OptionCont.GetSystemAge() != -1)
            {
                return OptionCont.GetSystemAge();
            }

            if (roll == 3)
            {
                return 0.01;
            }
            if (roll >= 4 && roll <= 6)
            {
                return .1 + ourDice.Rng(1, 6, -1) * .3 + ourDice.Rng(1, 6, -1) * .05;
            }
            if (roll >= 7 && roll <= 10)
            {
                return 2 + ourDice.Rng(1, 6, -1) * .6 + ourDice.Rng(1, 6, -1) * .1;
            }
            if (roll >= 11 && roll <= 14)
            {
                return 5.6 + ourDice.Rng(1, 6, -1) * .6 + ourDice.Rng(1, 6, -1) * .1;
            }
            if (roll >= 15 && roll <= 17)
            {
                return 8 + ourDice.Rng(1, 6, -1) * .6 + ourDice.Rng(1, 6, -1) * .1;
            }
            if (roll == 18)
            {
                return 10 + ourDice.Rng(1, 6, -1) * .6 + ourDice.Rng(1, 6, -1) * .1;
            }

            return 13.8;
        }
コード例 #9
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
 private TrophicDiets DetermineDiet( bool issapient )
 {
     var diet = TrophicDiets.None;
     var dice = new Dice();
     var roll = dice.GurpsRoll();
     if (issapient)
     {
         switch (roll)
         {
             case 3:
                 diet = TrophicDiets.CombinedMethod;
                 break;
             case 4:
                 diet = TrophicDiets.ParasiteSymbiont;
                 break;
             case 5:
                 diet = TrophicDiets.FilterFeeder;
                 break;
             case 6:
                 diet = TrophicDiets.PouncingCarnivore;
                 break;
             case 7:
                 diet = TrophicDiets.Scavenger;
                 break;
             case 8:
             case 9:
                 diet = TrophicDiets.GatheringHerbivore;
                 break;
             case 10:
                 diet = TrophicDiets.Omnivore;
                 break;
             case 11:
             case 12:
                 diet = TrophicDiets.ChasingCarnivore;
                 break;
             case 13:
                 diet = TrophicDiets.GrazingHerbivore;
                 break;
             case 14:
                 diet = TrophicDiets.HijackingCarnivore;
                 break;
             case 15:
             case 16:
                 diet = TrophicDiets.TrappingCarnivore;
                 break;
             case 17:
                 diet = TrophicDiets.Decomposer;
                 break;
             case 18:
                 var newdice = new Dice();
                 var autothrophroll = newdice.Rng(6);
                 switch (autothrophroll)
                 {
                     case 1:
                     case 2:
                     case 3:
                         diet = TrophicDiets.AutothrophPhotosynthetic;
                         break;
                     case 4:
                     case 5:
                         diet = TrophicDiets.AutothrophChemosynthetic;
                         break;
                     case 6:
                         diet = TrophicDiets.AutothrophOther;
                         break;
                 }
                 break;
         }
     }
     else
     {
         switch (roll)
         {
             case 3:
                 diet = TrophicDiets.CombinedMethod;
                 break;
             case 4:
                 var newdice = new Dice();
                 var autothrophroll = newdice.Rng(6);
                 switch (autothrophroll)
                 {
                     case 1:
                     case 2:
                     case 3:
                         diet = TrophicDiets.AutothrophPhotosynthetic;
                         break;
                     case 4:
                     case 5:
                         diet = TrophicDiets.AutothrophChemosynthetic;
                         break;
                     case 6:
                         diet = TrophicDiets.AutothrophOther;
                         break;
                 }
                 break;
             case 5:
                 diet = TrophicDiets.Decomposer;
                 break;
             case 6:
                 diet = TrophicDiets.Scavenger;
                 break;
             case 7:
                 diet = TrophicDiets.Omnivore;
                 break;
             case 8:
             case 9:
                 diet = TrophicDiets.GatheringHerbivore;
                 break;
             case 10:
             case 11:
                 diet = TrophicDiets.GrazingHerbivore;
                 break;
             case 12:
                 diet = TrophicDiets.PouncingCarnivore;
                 break;
             case 13:
                 diet = TrophicDiets.PouncingCarnivore;
                 break;
             case 14:
                 diet = TrophicDiets.TrappingCarnivore;
                 break;
             case 15:
                 diet = TrophicDiets.HijackingCarnivore;
                 break;
             case 16:
                 diet = TrophicDiets.FilterFeeder;
                 break;
             case 17:
             case 18:
                 diet = TrophicDiets.ParasiteSymbiont;
                 break;
         }
     }
     return diet;
 }
コード例 #10
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
        private Hearings DetermineHearing()
        {
            var hearing = Hearings.None;
            var dice = new Dice();
            var roll = dice.GurpsRoll();
            if (PrimarySense == PrimarySenses.Hearing)
            {
                roll += 4;
            }
            if (Vision == Visions.Blindness || Vision == Visions.BlindnessSoft)
            {
                roll += 2;
            }
            if (Vision == Visions.BadSight || Vision == Visions.BadSightColorblind)
            {
                roll += 1;
            }
            if (LandOrWater == LandWater.Water)
            {
                roll += 1;
            }
            if (PrimaryLocomotion == Locomotions.Immobile || SecondaryLocomotion == Locomotions.Immobile)
            {
                roll -= 4;
            }
            if (roll <= 6)
            {
                hearing = Hearings.Deafness;
            }

            switch (roll)
            {
                case 7:
                case 8:
                    hearing = Hearings.HardOfhearing;
                    break;
                case 9:
                case 10:
                    hearing = Hearings.Normal;
                    break;
                case 11:
                    hearing = Hearings.NormalPlusRange;
                    break;
                case 12:
                    hearing = Hearings.Acute;
                    break;
                case 13:
                    hearing = Hearings.AcutePlusSubSonic;
                    break;
                case 14:
                case 15:
                case 16:
                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    hearing = Hearings.AcutePlusSubSonicAndSonar;
                    break;
            }
            return hearing;
        }
コード例 #11
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
 private ChemicalBasis DetermineChemicalBasis()
 {
     var cb = ChemicalBasis.None;
     var dice = new Dice();
     var roll = dice.GurpsRoll();
     switch (roll)
     {
         case 3:
         case 4:
         case 5:
             cb = ChemicalBasis.Hydrogen;
             break;
         case 6:
         case 7:
             cb = ChemicalBasis.Ammonia;
             break;
         case 8:
             cb = ChemicalBasis.Hydrocarbon;
             break;
         case 9:
         case 10:
         case 11:
             cb = ChemicalBasis.Water;
             break;
         case 12:
             cb = ChemicalBasis.Chlorine;
             break;
         case 13:
             cb = ChemicalBasis.SulfuricAcid;
             break;
         case 14:
             cb = ChemicalBasis.LiquidSulfur;
             break;
         case 15:
             cb = ChemicalBasis.LiquidRock;
             break;
         case 16:
             cb = ChemicalBasis.Plasma;
             break;
         case 17:
         case 18:
             cb = ChemicalBasis.Exotic;
             break;
     }
     return cb;
 }
コード例 #12
0
ファイル: Satelite.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Generates the eccentricity of the planet's orbit around it's primary.
        /// </summary>
        /// <param name="flag">The gas giant flag</param>
        /// <param name="snowLine">Location of the snow line</param>
        /// <param name="ourDice">Our Ddice object</param>
        public virtual void GetPlanetEccentricity( int flag, double snowLine, Dice ourDice )
        {
            var roll = ourDice.GurpsRoll();
            double mod = 0;

            if (SelfId == 0 && BaseType == BasetypeGasgiant && flag == Star.GasgiantEpistellar)
            {
                roll = roll - 6;
            }
            if (BaseType == BasetypeGasgiant && flag == Star.GasgiantEccentric && OrbitalRadius < snowLine)
            {
                roll = roll + 4;
            }
            if (flag == Star.GasgiantConventional)
            {
                roll = roll - 6;
            }
            if (roll <= 3)
            {
                OrbitalEccent = .0;
            }
            else if (roll >= 4 && roll <= 6)
            {
                OrbitalEccent = .05;
            }
            else if (roll >= 7 && roll <= 9)
            {
                OrbitalEccent = .1;
            }
            else if (roll >= 10 && roll <= 11)
            {
                OrbitalEccent = .15;
            }
            else if (roll == 12)
            {
                OrbitalEccent = .2;
            }
            else if (roll == 13)
            {
                OrbitalEccent = .3;
            }
            else if (roll == 14)
            {
                OrbitalEccent = .4;
            }
            else if (roll == 15)
            {
                OrbitalEccent = .5;
            }
            else if (roll == 16)
            {
                OrbitalEccent = .6;
            }
            else if (roll == 17)
            {
                OrbitalEccent = .7;
            }
            else if (roll >= 18)
            {
                OrbitalEccent = .8;
            }

            if (roll <= 11 && roll != 3)
            {
                mod = ourDice.Rng(1, 5, -2) * .01;
            }
            else if (roll >= 12)
            {
                mod = ourDice.Rng(1, 10, -5) * .01;
            }

            OrbitalEccent = OrbitalEccent + mod;
        }
コード例 #13
0
ファイル: Satelite.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Generate (and store) the orbital velocity for an object (sidereal period)
        /// </summary>
        /// <param name="ourBag">Ddice object</param>
        public void GenerateOrbitalVelocity( Dice ourBag )
        {
            if (TideTotal < 50)
            {
                var roll = ourBag.GurpsRoll();
                var temp = (int) Math.Floor(roll + TideTotal);

                if (SatelliteSize == SizeTiny)
                {
                    temp = temp + 18;
                }
                if (SatelliteSize == SizeSmall)
                {
                    temp = temp + 14;
                }
                if (SatelliteSize == SizeMedium)
                {
                    temp = temp + 10;
                }
                if (SatelliteSize == SizeLarge)
                {
                    temp = temp + 6;
                }

                if (( roll >= 16 ) || ( temp >= 36 ))
                {
                    switch (ourBag.Rng(2, 6, 0))
                    {
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                            SiderealPeriod = temp / 24.0;
                            break;
                        case 7:
                            SiderealPeriod = ourBag.Rng(1, 6) * 2;
                            break;
                        case 8:
                            SiderealPeriod = ourBag.Rng(1, 6) * 5;
                            break;
                        case 9:
                            SiderealPeriod = ourBag.Rng(1, 6) * 10;
                            break;
                        case 10:
                            SiderealPeriod = ourBag.Rng(1, 6) * 20;
                            break;
                        case 11:
                            SiderealPeriod = ourBag.Rng(1, 6) * 50;
                            break;
                        case 12:
                            SiderealPeriod = ourBag.Rng(1, 6) * 100;
                            break;
                    }
                }
                else if (!IsTideLocked)
                {
                    SiderealPeriod = temp / 24.0;
                }

                if (IsTideLocked)
                {
                    SiderealPeriod = OrbitalPeriod;
                }
            }
            if (SiderealPeriod >= OrbitalPeriod)
            {
                IsTideLocked = true;
            }
        }
コード例 #14
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This places our stars around the primary, as well as creating the secondary stars if called for
        /// </summary>
        /// <param name="ourSystem">The star system to be added to.</param>
        /// <param name="velvetBag">Our Ddice object.</param>
        private static void PlaceOurStars( StarSystem ourSystem, Dice velvetBag )
        {
            //initiate the variables we need to ensure distances are kept
            var maxOrbitalDistance = 600.0;
            var starLimit = ourSystem.SysStars.Count;
            for (var i = 1; i < starLimit; i++)
            {
                var modifiers = 0;
                var minOrbitalDistance = ourSystem.SysStars[i - 1].OrbitalRadius;

                //set the min and max conditions for the first star here.
                int roll;
                double tempVal;
                if (ourSystem.SysStars[i].ParentId == 0 || ourSystem.SysStars[i].ParentId == Star.IsPrimary)
                {
                    //apply modifiers
                    if (ourSystem.SysStars[i].SelfId == Star.IsTrinary)
                    {
                        modifiers = modifiers + 6;
                    }
                    if (OptionCont.ForceGardenFavorable != null)
                    {
                        if ((bool) OptionCont.ForceGardenFavorable && ourSystem.SysStars[i].ParentId == Star.IsPrimary)
                        {
                            modifiers = modifiers + 4;
                        }
                    }

                    if (minOrbitalDistance == 600.0)
                    {
                        //in this situation, orbital 3 or so can't be safely placed because the range is 0.
                        // so we autogenerate it.
                        tempVal = velvetBag.RollRange(25, 25);
                        ourSystem.SysStars[i].OrbitalSep = 5;
                        ourSystem.SysStars[ourSystem.Star2Index].OrbitalRadius = ourSystem.SysStars[ourSystem.Star2Index].OrbitalRadius - tempVal;
                        ourSystem.SysStars[i].OrbitalRadius = 600 + tempVal;
                        ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius;
                    }
                    else
                    {
                        do
                        {
                            //roll the Ddice and generate the orbital radius
                            do
                            {
                                roll = velvetBag.GurpsRoll(modifiers);
                                if (roll <= 6)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepVeryclose;
                                }
                                if (roll >= 7 && roll <= 9)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepClose;
                                }
                                if (roll >= 10 && roll <= 11)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepModerate;
                                }
                                if (roll >= 12 && roll <= 14)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepWide;
                                }
                                if (roll >= 15)
                                {
                                    ourSystem.SysStars[i].OrbitalSep = Star.OrbsepDistant;
                                }
                                tempVal = velvetBag.Rng(2, 6) * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                            }
                            while (tempVal <= minOrbitalDistance);

                            //if (ourSystem.sysStars[i].selfID == 2) tempVal = this.velvetBag.six(1, 7) * ourSystem.sysStars[i].getSepModifier();
                            var lowerBound = tempVal - .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                            var higherBound = .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep) + tempVal;

                            //set for constraints
                            if (lowerBound < minOrbitalDistance)
                            {
                                lowerBound = minOrbitalDistance;
                            }
                            if (higherBound > maxOrbitalDistance)
                            {
                                higherBound = maxOrbitalDistance;
                            }

                            ourSystem.SysStars[i].OrbitalRadius = tempVal;
                            ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius;
                        }
                        while (ourSystem.SysStars[i].OrbitalRadius <= minOrbitalDistance);

                        //let's see if it has a subcompanion
                        if (ourSystem.SysStars[i].OrbitalSep == Star.OrbsepDistant)
                        {
                            roll = velvetBag.GurpsRoll();
                            if (roll >= 11)
                            {
                                //generate the subcompanion
                                var order = 0;

                                if (ourSystem.SysStars[i].SelfId == Star.IsSecondary)
                                {
                                    order = Star.IsSeccomp;
                                }
                                if (ourSystem.SysStars[i].SelfId == Star.IsTrinary)
                                {
                                    order = Star.IsTricomp;
                                }

                                //add the star
                                ourSystem.AddStar(order, ourSystem.SysStars[i].SelfId, i + 1);

                                ourSystem.SysStars[starLimit].Name = Star.GenGenericName(ourSystem.SysName, i + 1);

                                //set the name, then generate the star
                                ourSystem.SysStars[starLimit].ParentName = ourSystem.SysStars[i].Name;
                                GenerateAStar(ourSystem.SysStars[starLimit], velvetBag, ourSystem.SysStars[i].CurrMass, ourSystem.SysName);
                                starLimit++; //increment the total number of stars we have generated
                            }
                        }
                    }
                }
                else
                {
                    maxOrbitalDistance = ourSystem.SysStars[ourSystem.GetStellarParentId(ourSystem.SysStars[i].ParentId)].OrbitalRadius;
                    //roll for seperation
                    do
                    {
                        //roll the Ddice

                        roll = velvetBag.GurpsRoll(-6);
                        if (roll <= 6)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepVeryclose;
                        }
                        if (roll >= 7 && roll <= 9)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepClose;
                        }
                        if (roll >= 10 && roll <= 11)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepModerate;
                        }
                        if (roll >= 12 && roll <= 14)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepWide;
                        }
                        if (roll >= 15)
                        {
                            ourSystem.SysStars[i].OrbitalSep = Star.OrbsepDistant;
                        }

                        //set the subcompanion orbital
                        tempVal = velvetBag.Rng(2, 6) * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                        tempVal -= 0.5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep);
                        var higherBound = .5 * GetSepModifier(ourSystem.SysStars[i].OrbitalSep) + tempVal;

                        if (higherBound > maxOrbitalDistance)
                        {
                            higherBound = maxOrbitalDistance;
                        }

                        ourSystem.SysStars[i].OrbitalRadius = tempVal;
                        ourSystem.SysStars[i].DistFromPrimary = ourSystem.SysStars[i].OrbitalRadius + maxOrbitalDistance;
                    }
                    while (ourSystem.SysStars[i].OrbitalRadius > maxOrbitalDistance);
                }

                CalcEccentricity(velvetBag, ourSystem.SysStars[i]);

                var parent = ourSystem.GetStellarParentId(ourSystem.SysStars[i].ParentId);
                ourSystem.SysStars[i].OrbitalPeriod = Star.CalcOrbitalPeriod(ourSystem.SysStars[parent].CurrMass, ourSystem.SysStars[i].CurrMass, ourSystem.SysStars[i].OrbitalRadius);
            }
        }
コード例 #15
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
        private Visions DetermineVision()
        {
            var vision = Visions.None;
            var dice = new Dice();
            var roll = dice.GurpsRoll();
            if (PrimarySense == PrimarySenses.Vision)
            {
                roll += 4;
            }
            if (PrimaryLocomotion == Locomotions.Digging)
            {
                roll -= 4;
            }
            if (PrimaryLocomotion == Locomotions.Climbing || SecondaryLocomotion == Locomotions.Climbing)
            {
                roll += 2;
            }
            if (PrimaryLocomotion == Locomotions.Wingedflight || SecondaryLocomotion == Locomotions.Wingedflight)
            {
                roll += 3;
            }
            if (PrimaryLocomotion == Locomotions.Immobile || SecondaryLocomotion == Locomotions.Immobile)
            {
                roll -= 4;
            }
            if (WaterHabitat == WaterHabitats.DeepOceanVents)
            {
                roll -= 4;
            }
            if (TrophicDiet == TrophicDiets.FilterFeeder)
            {
                roll -= 2;
            }
            if (TrophicDiet == TrophicDiets.ChasingCarnivore || TrophicDiet == TrophicDiets.HijackingCarnivore || TrophicDiet == TrophicDiets.TrappingCarnivore || TrophicDiet == TrophicDiets.PouncingCarnivore ||
                TrophicDiet == TrophicDiets.GatheringHerbivore)
            {
                roll += 2;
            }

            if (roll <= 6)
            {
                vision = Visions.Blindness;
            }
            switch (roll)
            {
                case 7:
                    vision = Visions.BlindnessSoft;
                    break;
                case 8:
                case 9:
                    vision = Visions.BadSightColorblind;
                    break;
                case 10:
                case 11:
                    vision = Visions.BadSight;
                    break;
                case 12:
                case 13:
                case 14:
                    vision = Visions.Normal;
                    break;
                case 15:
                case 16:
                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    vision = Visions.TelescopicVision;
                    break;
            }
            return vision;
        }
コード例 #16
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     This function generates and populates our stars.
        /// </summary>
        /// <param name="ourBag">The Ddice object used for our PRNG</param>
        /// <param name="ourSystem">The solar system we are creating stars for</param>
        public static void CreateStars( Dice ourBag, StarSystem ourSystem )
        {
            var numStars = 0;

            //determine the number of stars
            if (OptionCont.GetNumberOfStars() != -1)
            {
                numStars = OptionCont.GetNumberOfStars();
            }
            else
            {
                // We take the roll, add 2 if it's in an open cluster,subtract 1 if not, then divide it by 5.
                // This matches the roll probablity to the table.
                numStars = (int) Math.Floor(( ourBag.GurpsRoll() + ( OptionCont.InOpenCluster ? 2 : -1 ) ) / 5.0);

                if (numStars < 1)
                {
                    numStars = 1;
                }
                if (numStars > 3)
                {
                    numStars = 3;
                }
            }

            //creating the stars.
            for (var i = 0; i < numStars; i++)
            {
                if (i == 0)
                {
                    ourSystem.AddStar(Star.IsPrimary, Star.IsPrimary, i);

                    //manually set the first star's mass and push it to the max mass setting
                    ourSystem.SysStars[0].UpdateMass(RollStellarMass(ourBag, Star.IsPrimary));
                    ourSystem.MaxMass = ourSystem.SysStars[0].CurrMass;

                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }
                if (i == 1)
                {
                    ourSystem.AddStar(Star.IsSecondary, Star.IsPrimary, i);
                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }
                if (i == 2)
                {
                    ourSystem.AddStar(Star.IsTrinary, Star.IsPrimary, i);
                    //generate the star
                    GenerateAStar(ourSystem.SysStars[i], ourBag, ourSystem.MaxMass, ourSystem.SysName);
                }

                GasGiantFlag(ourSystem.SysStars[i], ourBag.GurpsRoll());
            }

            //now generate orbitals
            if (ourSystem.CountStars() > 1)
            {
                PlaceOurStars(ourSystem, ourBag);
            }
        }
コード例 #17
0
ファイル: Alien.cs プロジェクト: Neakas/ProjectSWN
 private WaterHabitats DetermineWaterHabitat()
 {
     var dice = new Dice();
     var roll = dice.GurpsRoll();
     var hab = WaterHabitats.None;
     switch (roll)
     {
         case 3:
         case 4:
         case 5:
         case 6:
         case 7:
             hab = WaterHabitats.Banks;
             break;
         case 8:
             hab = WaterHabitats.OpenOcean;
             break;
         case 9:
             hab = WaterHabitats.FreshWaterLakes;
             break;
         case 10:
             hab = WaterHabitats.RiverStream;
             break;
         case 11:
             hab = WaterHabitats.TropicalLagoon;
             break;
         case 12:
             hab = WaterHabitats.DeepOceanVents;
             break;
         case 13:
             hab = WaterHabitats.SaltWaterSea;
             break;
         case 14:
         case 15:
         case 16:
         case 17:
         case 18:
             hab = WaterHabitats.Reef;
             break;
     }
     return hab;
 }
コード例 #18
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     deteremine the orbital ratio between planets
        /// </summary>
        /// <param name="myDice">Ddice object</param>
        /// <returns>The orbital ratio between planets</returns>
        public static double GetOrbitalRatio( Dice myDice )
        {
            double ratio = 0;

            var roll = myDice.GurpsRoll();

            if (roll == 3 || roll == 4)
            {
                ratio = 1.4 + myDice.Rng(1, 5) * .01;
            }

            if (roll == 5 || roll == 6)
            {
                ratio = 1.5 + myDice.Rng(1, 10, -5) * .01;
            }

            if (roll == 7 || roll == 8)
            {
                ratio = 1.6 + myDice.Rng(1, 10, -5) * .01;
            }

            if (roll == 9 || roll == 10 || roll == 11 || roll == 12)
            {
                ratio = 1.7 + myDice.Rng(1, 10, -5) * .01;
            }

            if (roll == 13 || roll == 14)
            {
                ratio = 1.8 + myDice.Rng(1, 10, -5) * .01;
            }

            if (roll == 15 || roll == 16)
            {
                ratio = 1.9 + myDice.Rng(1, 10, -5) * .01;
            }

            if (roll == 17 || roll == 18)
            {
                ratio = 2.0 + myDice.Rng(1, 10, -5) * .01;
            }

            return ratio;
        }
コード例 #19
0
ファイル: StarSystem.cs プロジェクト: Neakas/ProjectSWN
        public static int GenNumOfStars( Dice ourDice )
        {
            //if there's an override in, autoreturn it.
            //if (OptionCont.numStarOverride) return OptionCont.numStars;

            var roll = ourDice.GurpsRoll();

            if (OptionCont.InOpenCluster)
            {
                roll = roll + 3;
            }

            roll = (int) Math.Floor(( roll - 1 ) / 5.0);

            //logic bugs.
            if (roll < 1)
            {
                roll = 1;
            }
            if (roll > 3)
            {
                roll = 3;
            }

            return roll;
        }
コード例 #20
0
ファイル: libStarGen.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Populates orbits around a star, according to GURPS 4e rules. (Does not create them)
        /// </summary>
        /// <param name="s">The star we're populating around</param>
        /// <param name="myDice">Our Ddice object.</param>
        public static void PopulateOrbits( Star s, Dice myDice )
        {
            const double maxRatio = 2.0;
            const double minRatio = 1.4;
            const double minDistance = .15;
            var firstGasGiant = !s.ContainsGasGiants();

            foreach (var sat in s.SysPlanets)
            {
                var roll = myDice.GurpsRoll();

                //set gas giants first.
                if (s.GasGiantFlag != Star.GasgiantNone)
                {
                    //BEFORE SNOW LINE: Only Eccentric, Epistellar
                    if (sat.OrbitalRadius < Star.SnowLine(s.InitLumin))
                    {
                        if (roll <= 8 && s.GasGiantFlag == Star.GasgiantEccentric)
                        {
                            sat.UpdateType(Satellite.BasetypeGasgiant);
                            UpdateGasGiantSize(sat, myDice.GurpsRoll() + 4);
                        }

                        if (roll <= 6 && s.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            sat.UpdateType(Satellite.BasetypeGasgiant);
                            UpdateGasGiantSize(sat, myDice.GurpsRoll() + 4);
                        }
                    }

                    //AFTER SNOW LINE: All three
                    if (sat.OrbitalRadius >= Star.SnowLine(s.InitLumin))
                    {
                        if (roll <= 15 && s.GasGiantFlag == Star.GasgiantConventional)
                        {
                            sat.UpdateType(Satellite.BasetypeGasgiant);
                            if (firstGasGiant)
                            {
                                UpdateGasGiantSize(sat, myDice.GurpsRoll() + 4);
                                firstGasGiant = false;
                            }
                            else
                            {
                                UpdateGasGiantSize(sat, myDice.GurpsRoll());
                            }
                        }

                        if (roll <= 14 && ( s.GasGiantFlag == Star.GasgiantEccentric || s.GasGiantFlag == Star.GasgiantEpistellar ))
                        {
                            sat.UpdateType(Satellite.BasetypeGasgiant);
                            if (firstGasGiant)
                            {
                                UpdateGasGiantSize(sat, myDice.GurpsRoll() + 4);
                                firstGasGiant = false;
                            }
                            else
                            {
                                UpdateGasGiantSize(sat, myDice.GurpsRoll());
                            }
                        }
                    }
                }

                //Done with the gas giant. Let's go start seeign what else it could be.

                //We can get mods now.
                if (sat.BaseType != Satellite.BasetypeGasgiant)
                {
                    //INNER AND OUTER RADIUS
                    var mod = 0;

                    if (sat.OrbitalRadius - minDistance <= Star.InnerRadius(s.InitLumin, s.InitMass) || sat.OrbitalRadius / Star.InnerRadius(s.InitLumin, s.InitMass) <= maxRatio)
                    {
                        mod = mod - 3;
                    }

                    if (sat.OrbitalRadius + minDistance >= Star.OuterRadius(s.InitMass) || Star.OuterRadius(s.InitMass) / sat.OrbitalRadius <= maxRatio)
                    {
                        mod = mod - 3;
                    }

                    //FORBIDDDEN ZONE
                    if (s.GetClosestDistToForbiddenZone(sat.OrbitalRadius) <= minDistance || ( s.GetClosestForbiddenZoneRatio(sat.OrbitalRadius) < maxRatio && s.GetClosestForbiddenZoneRatio(sat.OrbitalRadius) > minRatio ))
                    {
                        //MessageBox.Show("THE FORBIDDEN ZONE!!!!");
                        mod = mod - 6;
                    }

                    //GAS GIANT LOCATION
                    if (s.IsPrevSatelliteGasGiant(sat.OrbitalRadius))
                    {
                        mod = mod - 6;
                    }
                    if (s.IsNextSatelliteGasGiant(sat.OrbitalRadius))
                    {
                        mod = mod - 3;
                    }

                    //now let's get the orbit type.
                    // MessageBox.Show("Mod is " + mod);
                    mod = mod + myDice.GurpsRoll();
                    //MessageBox.Show("Mod + Roll is " + mod);
                    if (mod <= 3)
                    {
                        sat.UpdateType(Satellite.BasetypeEmpty);
                    }

                    if (mod >= 4 && mod <= 6)
                    {
                        sat.UpdateType(Satellite.BasetypeAsteroidbelt);

                        //Expanded Asteroid Belt options
                        if (OptionCont.ExpandAsteroidBelt != null && (bool) OptionCont.ExpandAsteroidBelt)
                        {
                            roll = myDice.GurpsRoll();
                            if (roll <= 6)
                            {
                                sat.UpdateSize(Satellite.SizeTiny);
                            }
                            if (roll >= 7 && roll <= 13)
                            {
                                sat.UpdateSize(Satellite.SizeSmall);
                            }
                            if (roll >= 14 && roll <= 15)
                            {
                                sat.UpdateSize(Satellite.SizeMedium);
                            }
                            if (roll >= 16)
                            {
                                sat.UpdateSize(Satellite.SizeLarge);
                            }
                        }

                        else
                        {
                            sat.UpdateSize(Satellite.SizeSmall);
                        }
                    }

                    if (mod >= 7 && mod <= 8)
                    {
                        sat.UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeTiny);
                    }

                    if (mod >= 9 && mod <= 11)
                    {
                        sat.UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeSmall);
                    }

                    if (mod >= 12 && mod <= 15)
                    {
                        sat.UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeMedium);
                    }

                    if (mod >= 16)
                    {
                        sat.UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeLarge);
                    }
                }
            }
        }
コード例 #21
0
ファイル: Satelite.cs プロジェクト: Neakas/ProjectSWN
        /// <summary>
        ///     Calculates an axial tilt of a satellite given the ruleset
        /// </summary>
        /// <param name="ourBag"></param>
        public virtual void CreateAxialTilt( Dice ourBag )
        {
            do
            {
                switch (ourBag.GurpsRoll())
                {
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                        AxialTilt = ourBag.Rng(2, 6, -2);
                        break;
                    case 7:
                    case 8:
                    case 9:
                        AxialTilt = 10 + ourBag.Rng(2, 6, -2);
                        break;
                    case 10:
                    case 11:
                    case 12:
                        AxialTilt = 20 + ourBag.Rng(2, 6, -2);
                        break;
                    case 13:
                    case 14:
                        AxialTilt = 30 + ourBag.Rng(2, 6, -2);
                        break;
                    case 15:
                    case 16:
                        AxialTilt = 30 + ourBag.Rng(2, 6, -2);
                        break;
                    case 17:
                    case 18:
                        switch (ourBag.Rng(1, 6, 0))
                        {
                            case 1:
                            case 2:
                                AxialTilt = 50 + ourBag.Rng(2, 6, -2);
                                break;
                            case 3:
                            case 4:
                                AxialTilt = 60 + ourBag.Rng(2, 6, -2);
                                break;
                            case 5:
                                AxialTilt = 70 + ourBag.Rng(2, 6, -2);
                                break;
                            case 6:
                                AxialTilt = 80 + ourBag.Rng(2, 6, -2);
                                break;
                        }
                        break;
                }
            }
            while (OptionCont.RerollAxialTiltOver45 != null && (bool) OptionCont.RerollAxialTiltOver45 && AxialTilt > 45);

            if (OptionCont.GetAxialTilt() != -1)
            {
                AxialTilt = OptionCont.GetAxialTilt();
            }
        }