예제 #1
0
        protected void GetTempChart(Planet mainWorld, Orbit orbit, double ComLumAddFromPrim, Star primary, bool forSatellite)
        {
            var L         = primary.Luminosity;
            var O         = Constants.HABITNUM / Math.Sqrt(orbit.Range);
            var atmosCode = 0;
            var E         = 0.0;

            if (Normal.Atmosphere.Value < 4)
            {
                atmosCode = 0;
            }
            else if (Normal.Atmosphere.Value < 10)
            {
                atmosCode = 1;
            }
            else if (Normal.Atmosphere.Value < 16)
            {
                atmosCode = 2;
            }
            else
            {
                atmosCode = 3;
            }

            if (orbit.OrbitalType == Orbit.OrbitType.HABITABLE)
            {
                E = DataTables.EnergyAbsorbHZ[Normal.Hydro.Value, atmosCode];
            }
            else
            {
                E = DataTables.EnergyAbsorbNHZ[Normal.Hydro.Value, atmosCode];
            }

            var G = DataTables.Greenhouse[Normal.Atmosphere.Value];

            if (_configuration.UseGaiaFactor && Maxpop > 5)
            {
                E = Common.CalcGaiaFactor(L, O, G, E);
            }

            var X = ((L * O) + ComLumAddFromPrim) * E * G;

            Temp = X - 273;

            var DayPlus    = Daytime(Rotation / 2, L, orbit.Range, forSatellite);
            var NightMinus = Nighttime(Rotation / 2, forSatellite);

            Tilt = AxialTilt();
            var k = 0;

            if (Tilt == 0.0)
            {
                k = 0;
            }
            else if (Tilt < 6.0)
            {
                k = 1;
            }
            else if (Tilt < 110)
            {
                k = 2;
            }
            else if (Tilt < 16.0)
            {
                k = 3;
            }
            else if (Tilt < 21.0)
            {
                k = 4;
            }
            else if (Tilt < 26.0)
            {
                k = 5;
            }
            else if (Tilt < 31.0)
            {
                k = 6;
            }
            else if (Tilt < 36.0)
            {
                k = 7;
            }
            else if (Tilt < 46.0)
            {
                k = 8;
            }
            else if (Tilt < 61.0)
            {
                k = 9;
            }
            else if (Tilt < 85.0)
            {
                k = 10;
            }
            else
            {
                k = 11;
            }

            Ecc = OrbitEcc();

            for (var i = 0; i < (Constants.NUM_HEX_ROWS * 2) - 1; i++)
            {
                if (i % 2 == 0)
                {
                    X = DayPlus;
                }
                else
                {
                    X = NightMinus;
                }

                if (!TidallyLocked || forSatellite)
                {
                    var eccentricty = 0.0;
                    if (forSatellite)
                    {
                        eccentricty = mainWorld.Ecc;
                    }
                    else
                    {
                        eccentricty = Ecc;
                    }
                    Summer[i] = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] + (eccentricty * 30) + ((0.6 * Tilt) * DataTables.AxialTiltEffects[i / 2, k]) + X;
                    Fall[i]   = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] + X;
                    Winter[i] = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] - (eccentricty * 30) - (Tilt * DataTables.AxialTiltEffects[i / 2, k]) + X;
                }
                else
                {
                    var latEffect = 0.0;
                    if (i % 2 == 0)
                    {
                        latEffect = Math.Min((X / Normal.Size.Value) * i / 2, X);
                    }
                    else
                    {
                        latEffect = Math.Max((X / Normal.Size.Value) * i / 2, X);
                    }
                    // Axial tilt has no effect on a tiddaly locked world
                    Summer[i] = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] + (Ecc * 30) + latEffect;
                    Fall[i]   = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] + latEffect;
                    Winter[i] = Temp + DataTables.LatitudeMods[i / 2, Normal.Size.Value] - (Ecc * 30) + latEffect;
                }
                if (_configuration.UseFarenheight)
                {
                    Summer[i] = Common.CtoF(Summer[i]);
                    Fall[i]   = Common.CtoF(Fall[i]);
                    Winter[i] = Common.CtoF(Winter[i]);
                }
            }
        }
예제 #2
0
        public int FleshOut(double OrbitNum, Orbit myOrbit, Star primary, int HZone, double ComLumAddFromPrim)
        {
            var M       = primary.StellarMass;
            var D       = myOrbit.Range;
            var numsats = 0;
            var dieroll = 0;

            var X = (D * D * D) / M;

            OrbitPeriod = Math.Sqrt(X);
            OrbitRange  = myOrbit.Range;
            OrbitNumber = OrbitNum;

            switch (myOrbit.Occupied)
            {
            case Orbit.OccupiedBy.GASGIANT:
                if (Common.d6() < 3)
                {
                    numsats    = Common.d6() + Common.d6() - 4;
                    PlanetType = WorldType.SGG;
                    Diameter   = 20000 + Common.Change(20000);
                }
                else
                {
                    numsats    = Common.d6() + Common.d6();
                    PlanetType = WorldType.LGG;
                    Diameter   = 60000 + Common.Change(100000);
                }
                Dense = DensityType.LIGHT;
                if (numsats < 0)
                {
                    numsats = 0;
                }

                Maxpop = BuildSatellites(OrbitNum, myOrbit, primary, HZone, ComLumAddFromPrim, numsats);
                break;

            case Orbit.OccupiedBy.CAPTURED:
            case Orbit.OccupiedBy.WORLD:
                dieroll = Common.d6() + Common.d6() - 2;
                if (OrbitNum == 0)
                {
                    dieroll -= 5;
                }
                else if (OrbitNum == 1)
                {
                    dieroll -= 4;
                }
                else if (OrbitNum == 2)
                {
                    dieroll -= 2;
                }
                if (primary.StarType == Star.StellarType.M)
                {
                    dieroll -= 2;
                }
                if (dieroll < 1)
                {
                    dieroll = 0;
                }
                Normal.Size.Value       = dieroll;
                Diameter                = GetDiameter();
                Dense                   = GetDensity(myOrbit);
                Normal.Atmosphere.Value = GetAtmosphere(myOrbit);
                Pressure                = GetPressure();
                Normal.Hydro.Value      = GetHydrographics(myOrbit);
                Maxpop                  = GetMaxPop(myOrbit, HZone, OrbitNum);
                Rotation                = (4 * (Common.d6() + Common.d6() - 2)) + 5 + (M / D);
                if (Rotation > 40.0)
                {
                    // Chance of tidal locking
                    if (primary.StarType == Star.StellarType.M)
                    {
                        if (myOrbit.OrbitalType == Orbit.OrbitType.HABITABLE)
                        {
                            dieroll = Common.d6();
                            if (dieroll >= 3)
                            {
                                TidallyLocked = true;
                            }
                            else
                            {
                                TidallyLocked = false;
                            }
                        }
                        else if (myOrbit.OrbitalType == Orbit.OrbitType.INNER)
                        {
                            TidallyLocked = true;
                        }
                        else
                        {
                            TidallyLocked = false;
                        }
                    }
                    else if (primary.StarType == Star.StellarType.K)
                    {
                        dieroll = Common.d6();
                        if (dieroll >= 4)
                        {
                            TidallyLocked = true;
                        }
                        else
                        {
                            TidallyLocked = false;
                        }
                    }
                    else
                    {
                        dieroll = Common.d10();
                        if (dieroll >= 6)
                        {
                            TidallyLocked = true;
                        }
                        else
                        {
                            TidallyLocked = false;
                        }
                    }
                }
                else
                {
                    TidallyLocked = false;
                }

                if (myOrbit.Occupied == Orbit.OccupiedBy.CAPTURED)
                {
                    double roll = Common.d6() + Common.d6() - 7;
                    roll         = roll / 10.0;
                    OrbitNumber += roll;
                }

                GetTempChart(this, myOrbit, ComLumAddFromPrim, primary, false);

                GetNativeLife(false, primary);

                if (Normal.Size.Value == 0 || myOrbit.Occupied == Orbit.OccupiedBy.CAPTURED)
                {
                    numsats = 0;
                }
                else
                {
                    numsats = Common.d6() - 3;
                }
                if (numsats < 0)
                {
                    numsats = 0;
                }
                var satMaxPop = BuildSatellites(OrbitNum, myOrbit, primary, HZone, ComLumAddFromPrim, numsats);

                Maxpop = Math.Max(satMaxPop, Maxpop);

                if (_configuration.GenerateTravInfo)
                {
                    GetTravInfo();
                }
                break;

            case Orbit.OccupiedBy.PLANETOID:
                PlanetType = WorldType.PLANETOID;
                break;

            case Orbit.OccupiedBy.STAR:
                PlanetType = WorldType.STAR;
                break;
            }

            if (Life)
            {
                if (LifeFactor > 5)
                {
                    Encounters = TableGenerator.Generate(2, Normal);
                }
                else
                {
                    Encounters = TableGenerator.Generate(1, Normal);
                }
            }
            Collapse.Size.Value       = Normal.Size.Value;
            Collapse.Atmosphere.Value = Normal.Atmosphere.Value;
            Collapse.Hydro.Value      = Normal.Hydro.Value;
            return(Maxpop);
        }