public static void Assign(List <Orbit> orbits, int numberToAssign, string assignmentType, int rollAdjustment = 0)
        {
            int i        = numberToAssign;
            int hitCount = 0;

            while (i > 0)
            {
                int roll = DieRoll.Roll2D6() + rollAdjustment;

                if (roll > SystemConstants.MaxOrbits)
                {
                    roll = SystemConstants.MaxOrbits - 1;
                }

                var orbit = orbits[roll];

                if (orbit.OccupiedType is null)
                {
                    orbit.OccupiedType = assignmentType;
                    i--;
                }
                else
                {
                    hitCount++;

                    if (hitCount > 100)
                    {
                        //Give up and don't place empty orbits.
                        break;
                    }
                }
            }
        }
        public static short Generate(string orbitType, int size)
        {
            int dieRoll = DieRoll.Roll2D6() - 7 + size;

            if (orbitType.Equals(OrbitTypes.Inner))
            {
                dieRoll -= 2;
            }

            if (orbitType.Equals(OrbitTypes.Outer))
            {
                dieRoll -= 4;
            }

            if (size == 0)
            {
                dieRoll = 0;
            }

            if (dieRoll < 1)
            {
                dieRoll = 0;
            }

            return((short)dieRoll);
        }
        public static short Generate(short orbit, string stellarClassification)
        {
            int dieRoll = DieRoll.Roll2D6() - 2;

            if (orbit == 0)
            {
                dieRoll -= 5;
            }

            if (orbit == 1)
            {
                dieRoll -= 4;
            }

            if (orbit == 2)
            {
                dieRoll -= 2;
            }

            if (stellarClassification == StellarClassifications.M)
            {
                dieRoll -= 2;
            }

            if (dieRoll < 1)
            {
                dieRoll = 0;
            }

            return((short)dieRoll);
        }
        public static short Generate()
        {
            int dieRoll = DieRoll.Roll2D6();

            switch (dieRoll)
            {
            case 2: return(0);

            case 3: return(0);

            case 4: return(1);

            case 5: return(2);

            case 6: return(3);

            case 7: return((short)(4 + DieRoll.Roll1D6()));

            case 8: return((short)(5 + DieRoll.Roll1D6()));

            case 9: return((short)(6 + DieRoll.Roll1D6()));

            case 10: return((short)(7 + DieRoll.Roll1D6()));

            case 11: return((short)(8 + DieRoll.Roll1D6()));

            case 12: return(99);
            }

            throw new Exception("Unexpected die roll");
        }
Пример #5
0
        private static bool IsSystemPresent(SubsectorDensity density)
        {
            int roll;

            switch (density)
            {
            case SubsectorDensity.Rift:
                roll = DieRoll.Roll2D6();

                if (roll == 12)
                {
                    return(true);
                }

                break;

            case SubsectorDensity.Sparse:
                roll = DieRoll.Roll1D6();

                if (roll == 6)
                {
                    return(true);
                }

                break;

            case SubsectorDensity.Scattered:
                roll = DieRoll.Roll1D6();

                if (roll >= 5)
                {
                    return(true);
                }

                break;

            case SubsectorDensity.Standard:
                roll = DieRoll.Roll1D6();

                if (roll >= 4)
                {
                    return(true);
                }

                break;

            case SubsectorDensity.Dense:
                roll = DieRoll.Roll1D6();

                if (roll >= 3)
                {
                    return(true);
                }

                break;
            }

            return(false);
        }
        public static double Generate()
        {
            int dieRoll = DieRoll.Roll2D6();

            switch (dieRoll)
            {
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                return(0.0);

            case 8:
                return(0.005);

            case 9:
                return(0.010);

            case 10:
                return(0.015);

            case 11:
                return(0.020);

            default:
                dieRoll = DieRoll.Roll2D6();

                switch (dieRoll)
                {
                case 1:
                    return(0.025);

                case 2:
                    return(0.050);

                case 3:
                    return(0.100);

                case 4:
                    return(0.200);

                case 5:
                    return(0.250);

                default:
                    return(0.300);
                }
            }
        }
        public static short Generate(string orbitType, int satelliteSize, int atmosphere)
        {
            int dieRoll = DieRoll.Roll2D6() - 2;

            if (orbitType.Equals(OrbitTypes.Inner))
            {
                dieRoll = 0;
            }

            if (orbitType.Equals(OrbitTypes.Outer))
            {
                dieRoll -= 2;
            }

            if (atmosphere < 2)
            {
                dieRoll -= 1;
            }

            if (atmosphere < 4)
            {
                dieRoll -= 1;
            }

            if (satelliteSize == 0)
            {
                dieRoll -= 4;
            }

            if (satelliteSize == 1)
            {
                dieRoll -= 3;
            }

            if (satelliteSize == 2)
            {
                dieRoll -= 1;
            }

            if (dieRoll < 1)
            {
                dieRoll = 0;
            }

            if (dieRoll > 10)
            {
                dieRoll = 10;
            }

            return((short)dieRoll);
        }
        public static double Generate()
        {
            int dieRoll = DieRoll.Roll2D6();

            switch (dieRoll)
            {
            case 2:
            case 3:
                return(-1.0 + DieRoll.Roll1D10());

            case 4:
            case 5:
                return(9.0 + DieRoll.Roll1D10());

            case 6:
            case 7:
                return(19.0 + DieRoll.Roll1D10());

            case 8:
            case 9:
                return(20.0 + DieRoll.Roll1D10());

            case 10:
            case 11:
                return(29.0 + DieRoll.Roll1D10());

            default:
                dieRoll = DieRoll.Roll1D6();

                switch (dieRoll)
                {
                case 1:
                case 2:
                    return(49 + DieRoll.Roll1D10());

                case 3:
                    return(59 + DieRoll.Roll1D10());

                case 4:
                    return(69 + DieRoll.Roll1D10());

                case 5:
                    return(79 + DieRoll.Roll1D10());

                default:
                    return(90.00);
                }
            }
        }
        public static short Generate()
        {
            int dieRoll = DieRoll.Roll2D6();

            if (dieRoll < 8)
            {
                return(0);
            }

            dieRoll = DieRoll.Roll2D6();

            switch (dieRoll)
            {
            case 2:
                return(1);

            case 3:
                return(1);

            case 4:
                return(1);

            case 5:
                return(1);

            case 6:
                return(1);

            case 7:
                return(2);

            case 8:
                return(2);

            case 9:
                return(2);

            case 10:
                return(2);

            case 11:
                return(2);

            case 12:
                return(3);
            }

            throw new Exception("Unexpected die roll");
        }
        public static string Generate()
        {
            int roll = DieRoll.Roll2D6();

            if (roll < 8)
            {
                return(SystemNature.Solo);
            }

            if (roll == 12)
            {
                return(SystemNature.Trinary);
            }

            return(SystemNature.Binary);
        }
Пример #11
0
        public static string Generate(bool noRareStars = false)
        {
            int dieRoll;

            if (!noRareStars)
            {
                dieRoll = DieRoll.Roll3D6();

                if (dieRoll == 3)
                {
                    return(StellarClassifications.O);
                }
                if (dieRoll == 4)
                {
                    return(StellarClassifications.B);
                }
            }

            dieRoll = DieRoll.Roll2D6();

            switch (dieRoll)
            {
            case 2: return(StellarClassifications.A);

            case 3: return(StellarClassifications.M);

            case 4: return(StellarClassifications.M);

            case 5: return(StellarClassifications.M);

            case 6: return(StellarClassifications.M);

            case 7: return(StellarClassifications.M);

            case 8: return(StellarClassifications.K);

            case 9: return(StellarClassifications.G);

            case 10: return(StellarClassifications.G);

            case 11: return(StellarClassifications.F);

            case 12: return(StellarClassifications.F);
            }

            throw new Exception("Invalid type");
        }
Пример #12
0
        public static IOrbitingBody Generate(IStar parentStar, IStellarOrbitingBody parentBody, double combinedLuminosity)
        {
            Moon moon = new Moon();

            //Body Details
            moon.Size     = SatelliteSizeGenerator.Generate(parentBody.Size);
            moon.Density  = DensityGenerator.Generate(parentBody.OrbitType);
            moon.Diameter = PlanetDiameterGenerator.Generate(OccupiedTypes.World, moon.Size);
            moon.Mass     = PlanetMassGenerator.Generate(moon.Diameter, moon.Density);

            //Orbital
            moon.OrbitalDistance   = SatelliteOrbitDistanceGenerator.Generate(parentBody);
            moon.OrbitalPeriod     = OrbitalPeriodGenerator.Generate(parentBody, moon);
            moon.OrbitFactor       = OrbitFactorGenerator.Generate(parentBody);
            moon.OrbitEccentricity = OrbitalEccentricityGenerator.Generate();
            moon.RotationPeriod    = (4 * (DieRoll.Roll2D6() - 2)) + 5;
            moon.AxialTilt         = AxialTiltGenerator.Generate();
            moon.AxialTiltEffect   = TiltEffectGenerator.Generate(moon.AxialTilt);

            //Environmental
            moon.Atmosphere     = AtmosphereGenerator.Generate(parentBody.OrbitType, parentBody.Size);
            moon.AtmosphereCode = AtmosphereCodeGenerator.Generate(moon.Atmosphere);
            moon.Hydrographics  = HydrographicsGenerator.Generate(parentBody.OrbitType, moon.Size, moon.Atmosphere);
            moon.MaxPopulation  = MaxPopulationGenerator.Generate(parentBody.OrbitNumber, parentBody.OrbitType, moon.Size,
                                                                  moon.Atmosphere, moon.Hydrographics, parentStar.HabitableZone);
            moon.EnergyAbsorptionFactor = EnergyAbsorptionGenerator.Generate(parentBody.OrbitType, moon.Hydrographics, moon.AtmosphereCode);
            moon.GreenhouseFactor       = GreenhouseTables.GreenHouse[moon.Atmosphere];

            if (SystemConstants.UseGaiaFactor &&
                moon.MaxPopulation > 5)
            {
                moon.EnergyAbsorptionFactor = GaiaFactorGenerator.Generate(combinedLuminosity, moon.OrbitFactor, moon.GreenhouseFactor, moon.EnergyAbsorptionFactor);
            }

            moon.MeanTemperature = MeanTemperatureGenerator.Generate(combinedLuminosity, moon.OrbitFactor, moon.EnergyAbsorptionFactor, moon.GreenhouseFactor);

            moon.Seasons = SeasonsGenerator.Generate(moon.Size, moon.AxialTilt, moon.AxialTiltEffect, moon.OrbitFactor,
                                                     moon.MeanTemperature, combinedLuminosity, moon.OrbitalDistance, moon.RotationPeriod, moon.Atmosphere);

            return(moon);
        }
Пример #13
0
        public static int Generate(string occupiedType, int size)
        {
            int numberOfSatellites = 0;

            if (occupiedType.Equals(OccupiedTypes.GasGiant))
            {
                if (size == -1)
                {
                    //Small
                    numberOfSatellites = DieRoll.Roll2D6() - 4;
                }
                else if (size == -2)
                {
                    //Large
                    numberOfSatellites = DieRoll.Roll2D6();
                }
            }
            else if (size == 0)
            {
                numberOfSatellites = 0;
            }
            else if (occupiedType.Equals(OccupiedTypes.CapturedPlanet))
            {
                numberOfSatellites = 0;
            }
            else
            {
                numberOfSatellites = DieRoll.Roll1D6() - 3;
            }

            if (numberOfSatellites < 1)
            {
                numberOfSatellites = 0;
            }

            return(numberOfSatellites);
        }
Пример #14
0
        public static short Generate(int worldSize)
        {
            int dieRoll;

            if (worldSize == -1)                 /* Small Gas Giant */
            {
                dieRoll = DieRoll.Roll2D6() - 6; //Max 6
            }
            else if (worldSize == -2)            /* Large Gas Giant */
            {
                dieRoll = DieRoll.Roll2D6() - 4; //Max 8
            }
            else
            {
                dieRoll = DieRoll.Roll1D6() - 3;  //Max 3
            }

            if (dieRoll == 0)
            {
                //Ring
                return(0);
            }

            if (dieRoll >= worldSize &&
                worldSize >= 0)
            {
                dieRoll = worldSize - 1;
            }

            if (dieRoll < 1)
            {
                dieRoll = 0;
            }

            return((short)dieRoll);
        }
        public static short Generate(string classification, string luminosityClassification)
        {
            int dieRoll = DieRoll.Roll2D6();

            /* Class O stars (Blue) are still forming */
            if (classification == StellarClassifications.O)
            {
                return(0);
            }

            if (luminosityClassification == StellarLuminosities.I)
            {
                dieRoll = dieRoll + 8;
            }

            if (luminosityClassification == StellarLuminosities.Ia)
            {
                dieRoll = dieRoll + 8;
            }

            if (luminosityClassification == StellarLuminosities.Ib)
            {
                dieRoll = dieRoll + 8;
            }

            if (luminosityClassification == StellarLuminosities.II)
            {
                dieRoll = dieRoll + 8;
            }

            if (luminosityClassification == StellarLuminosities.III)
            {
                dieRoll = dieRoll + 4;
            }

            if (luminosityClassification == StellarLuminosities.IV)
            {
                dieRoll = dieRoll + 2;
            }

            if (classification == StellarClassifications.K)
            {
                dieRoll = dieRoll - 2;
            }

            if (classification == StellarClassifications.M)
            {
                dieRoll = dieRoll - 4;
            }

            if (dieRoll < 0)
            {
                return(0);
            }

            if (dieRoll > 19)
            {
                return(19);
            }

            return((short)dieRoll);
        }
Пример #16
0
        public static int Generate()
        {
            int dieRoll = DieRoll.Roll2D6();

            if (dieRoll < 8)
            {
                switch (DieRoll.Roll2D6())
                {
                case 2:
                {
                    return(3);
                }

                case 3:
                {
                    return(4);
                }

                case 4:
                {
                    return(5);
                }

                case 5:
                {
                    return(6);
                }

                case 6:
                {
                    return(7);
                }

                case 7:
                {
                    return(8);
                }

                case 8:
                {
                    return(9);
                }

                case 9:
                {
                    return(10);
                }

                case 10:
                {
                    return(11);
                }

                case 11:
                {
                    return(12);
                }

                case 12:
                {
                    return(12);
                }
                }
            }
            else if (dieRoll < 12)
            {
                switch (DieRoll.Roll2D6())
                {
                case 2:
                {
                    return(15);
                }

                case 3:
                {
                    return(20);
                }

                case 4:
                {
                    return(25);
                }

                case 5:
                {
                    return(30);
                }

                case 6:
                {
                    return(35);
                }

                case 7:
                {
                    return(40);
                }

                case 8:
                {
                    return(45);
                }

                case 9:
                {
                    return(50);
                }

                case 10:
                {
                    return(55);
                }

                case 11:
                {
                    return(60);
                }

                case 12:
                {
                    return(65);
                }
                }
            }
            else
            {
                switch (DieRoll.Roll2D6())
                {
                case 2:
                {
                    return(75);
                }

                case 3:
                {
                    return(100);
                }

                case 4:
                {
                    return(125);
                }

                case 5:
                {
                    return(150);
                }

                case 6:
                {
                    return(175);
                }

                case 7:
                {
                    return(200);
                }

                case 8:
                {
                    return(225);
                }

                case 9:
                {
                    return(250);
                }

                case 10:
                {
                    return(275);
                }

                case 11:
                {
                    return(300);
                }

                case 12:
                {
                    return(325);
                }
                }
            }

            return(12);
        }
 public static double Generate(Mass parentMass, Distance orbitalDistance)
 {
     return((4 * (DieRoll.Roll2D6() - 2)) + 5 + (parentMass.ToStellarMasses().Value / orbitalDistance.ToAstronomicalUnits().Value));
 }
        public static string Generate(string stellarClassification, string primaryLuminosity = null)
        {
            /* Check for rare values */
            int dieRoll;

            if (primaryLuminosity == null)
            {
                dieRoll = DieRoll.Roll3D6();

                if (dieRoll == 3)
                {
                    return(StellarLuminosities.Ia);
                }
                if (dieRoll == 4)
                {
                    return(StellarLuminosities.Ib);
                }
            }

            dieRoll = DieRoll.Roll2D6() + GetModifier(primaryLuminosity);

            switch (dieRoll)
            {
            case 2:
                return(StellarLuminosities.II);

            case 3:
                return(StellarLuminosities.III);

            case 4:
                if (stellarClassification == StellarClassifications.M)
                {
                    return(StellarLuminosities.V);
                }
                else
                {
                    return(StellarLuminosities.IV);
                }

            case 5:
                return(StellarLuminosities.V);

            case 6:
                return(StellarLuminosities.V);

            case 7:
                return(StellarLuminosities.V);

            case 8:
                return(StellarLuminosities.V);

            case 9:
                return(StellarLuminosities.V);

            case 10:
                return(StellarLuminosities.V);

            case 11:
                return(StellarLuminosities.V);

            case 12:
                return(StellarLuminosities.V);

            case 13:
                return(StellarLuminosities.V);

            default:
                if (DieRoll.Roll1D6() < 4)
                {
                    return(StellarLuminosities.V);
                }
                else
                {
                    return(StellarLuminosities.D);
                }
            }

            throw new Exception("Unsupported Type");
        }