Ejemplo n.º 1
0
 public static object CalculateHabValue2(Planet Planet, Race Race)
 {
     int num4 = 0;
     int num = 0;
     int num5 = 0;
     int num3 = 0;
     if (Race.CentreGravity == 0xff)
     {
         num = 0x2710;
     }
     else if (Planet.Gravity > Race.CentreGravity)
     {
         if (Planet.Gravity > Race.HighGravity)
         {
             num = Race.HighGravity - Planet.Gravity;
             if (num < -15)
             {
                 num4 = -15;
             }
             else
             {
                 num4 += num;
             }
         }
         else
         {
             num = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Planet.Gravity - Race.CentreGravity)) / ((double) (Race.HighGravity - Race.CentreGravity))) * 100.0))));
         }
     }
     else if (Planet.Gravity < Race.LowGravity)
     {
         num = Race.LowGravity - Planet.Gravity;
         if (num < -15)
         {
             num4 = -15;
         }
         else
         {
             num4 += num;
         }
     }
     else
     {
         num = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Race.CentreGravity - Planet.Gravity)) / ((double) (Race.CentreGravity - Race.LowGravity))) * 100.0))));
     }
     if (Race.CentreTemperature == 0xff)
     {
         num5 = 0x2710;
     }
     else if (Planet.Gravity > Race.CentreTemperature)
     {
         if (Planet.Temperature > Race.HighTemperature)
         {
             num5 = Race.HighTemperature - Planet.Temperature;
             if (num5 < -15)
             {
                 num4 = -15;
             }
             else
             {
                 num4 += num5;
             }
         }
         else
         {
             num5 = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Planet.Temperature - Race.CentreTemperature)) / ((double) (Race.HighTemperature - Race.CentreTemperature))) * 100.0))));
         }
     }
     else if (Planet.Temperature < Race.LowTemperature)
     {
         num5 = Race.LowTemperature - Planet.Temperature;
         if (num5 < -15)
         {
             num4 = -15;
         }
         else
         {
             num4 += num5;
         }
     }
     else
     {
         num5 = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Race.CentreTemperature - Planet.Temperature)) / ((double) (Race.CentreTemperature - Race.LowTemperature))) * 100.0))));
     }
     if (Race.CentreRadiation == 0xff)
     {
         num3 = 0x2710;
     }
     else if (Planet.Radiation > Race.CentreRadiation)
     {
         if (Planet.Radiation > Race.HighRadiation)
         {
             num3 = Race.HighRadiation - Planet.Radiation;
             if (num3 < -15)
             {
                 num4 = -15;
             }
             else
             {
                 num4 += num3;
             }
         }
         else
         {
             num3 = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Planet.Radiation - Race.CentreRadiation)) / ((double) (Race.HighRadiation - Race.CentreRadiation))) * 100.0))));
         }
     }
     else if (Planet.Radiation < Race.LowRadiation)
     {
         num3 = Race.LowRadiation - Planet.Radiation;
         if (num3 < -15)
         {
             num4 = -15;
         }
         else
         {
             num4 += num3;
         }
     }
     else
     {
         num3 = (int) Math.Round((double) (100.0 - Conversion.Int((double) ((((double) (Race.CentreRadiation - Planet.Radiation)) / ((double) (Race.CentreRadiation - Race.LowRadiation))) * 100.0))));
     }
     if (num4 < 0)
     {
         return num4;
     }
     return Conversion.Int((double) (Math.Sqrt(((double) (((num * num) + (num5 * num5)) + (num3 * num3))) / 3.0) + 0.9));
 }
Ejemplo n.º 2
0
        public static object CalculateHabValue2(Planet Planet, Race Race)
        {
            int num4 = 0;
            int num  = 0;
            int num5 = 0;
            int num3 = 0;

            if (Race.CentreGravity == 0xff)
            {
                num = 0x2710;
            }
            else if (Planet.Gravity > Race.CentreGravity)
            {
                if (Planet.Gravity > Race.HighGravity)
                {
                    num = Race.HighGravity - Planet.Gravity;
                    if (num < -15)
                    {
                        num4 = -15;
                    }
                    else
                    {
                        num4 += num;
                    }
                }
                else
                {
                    num = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Planet.Gravity - Race.CentreGravity)) / ((double)(Race.HighGravity - Race.CentreGravity))) * 100.0))));
                }
            }
            else if (Planet.Gravity < Race.LowGravity)
            {
                num = Race.LowGravity - Planet.Gravity;
                if (num < -15)
                {
                    num4 = -15;
                }
                else
                {
                    num4 += num;
                }
            }
            else
            {
                num = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Race.CentreGravity - Planet.Gravity)) / ((double)(Race.CentreGravity - Race.LowGravity))) * 100.0))));
            }
            if (Race.CentreTemperature == 0xff)
            {
                num5 = 0x2710;
            }
            else if (Planet.Gravity > Race.CentreTemperature)
            {
                if (Planet.Temperature > Race.HighTemperature)
                {
                    num5 = Race.HighTemperature - Planet.Temperature;
                    if (num5 < -15)
                    {
                        num4 = -15;
                    }
                    else
                    {
                        num4 += num5;
                    }
                }
                else
                {
                    num5 = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Planet.Temperature - Race.CentreTemperature)) / ((double)(Race.HighTemperature - Race.CentreTemperature))) * 100.0))));
                }
            }
            else if (Planet.Temperature < Race.LowTemperature)
            {
                num5 = Race.LowTemperature - Planet.Temperature;
                if (num5 < -15)
                {
                    num4 = -15;
                }
                else
                {
                    num4 += num5;
                }
            }
            else
            {
                num5 = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Race.CentreTemperature - Planet.Temperature)) / ((double)(Race.CentreTemperature - Race.LowTemperature))) * 100.0))));
            }
            if (Race.CentreRadiation == 0xff)
            {
                num3 = 0x2710;
            }
            else if (Planet.Radiation > Race.CentreRadiation)
            {
                if (Planet.Radiation > Race.HighRadiation)
                {
                    num3 = Race.HighRadiation - Planet.Radiation;
                    if (num3 < -15)
                    {
                        num4 = -15;
                    }
                    else
                    {
                        num4 += num3;
                    }
                }
                else
                {
                    num3 = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Planet.Radiation - Race.CentreRadiation)) / ((double)(Race.HighRadiation - Race.CentreRadiation))) * 100.0))));
                }
            }
            else if (Planet.Radiation < Race.LowRadiation)
            {
                num3 = Race.LowRadiation - Planet.Radiation;
                if (num3 < -15)
                {
                    num4 = -15;
                }
                else
                {
                    num4 += num3;
                }
            }
            else
            {
                num3 = (int)Math.Round((double)(100.0 - Conversion.Int((double)((((double)(Race.CentreRadiation - Planet.Radiation)) / ((double)(Race.CentreRadiation - Race.LowRadiation))) * 100.0))));
            }
            if (num4 < 0)
            {
                return(num4);
            }
            return(Conversion.Int((double)(Math.Sqrt(((double)(((num * num) + (num5 * num5)) + (num3 * num3))) / 3.0) + 0.9)));
        }