Esempio n. 1
0
        public void TakeMaterialNum(Dictionary <int, Mem_mapclear> mapclear, int tankerNum, ref Dictionary <enumMaterialCategory, int> addValues, bool randMaxFlag, DeckShips deckShip)
        {
            if (tankerNum == 0)
            {
                return;
            }
            if (!this.IsActiveArea())
            {
                return;
            }
            int    num  = Enumerable.Count <Mem_ship>(deckShip.getMemShip(), (Mem_ship x) => x.IsEscortDeffender());
            double num2 = (double)tankerNum;
            double num3 = (double)this.Req_tanker_num;
            Dictionary <enumMaterialCategory, double> dictionary = new Dictionary <enumMaterialCategory, double>();

            dictionary.Add(enumMaterialCategory.Fuel, 0.0);
            dictionary.Add(enumMaterialCategory.Bull, 0.0);
            dictionary.Add(enumMaterialCategory.Steel, 0.0);
            dictionary.Add(enumMaterialCategory.Bauxite, 0.0);
            Dictionary <enumMaterialCategory, double> dictionary2 = dictionary;
            int materialLimitTankerNum = this.GetMaterialLimitTankerNum();

            if (tankerNum <= this.Req_tanker_num)
            {
                dictionary2.set_Item(enumMaterialCategory.Fuel, (double)((int)((double)this.Material_1 * num2 / num3)));
                dictionary2.set_Item(enumMaterialCategory.Bull, (double)((int)((double)this.Material_2 * num2 / num3)));
                dictionary2.set_Item(enumMaterialCategory.Steel, (double)((int)((double)this.Material_3 * num2 / num3)));
                dictionary2.set_Item(enumMaterialCategory.Bauxite, (double)((int)((double)this.Material_4 * num2 / num3)));
                if (num == 0)
                {
                    double min = (!randMaxFlag) ? 0.5 : 0.75;
                    dictionary2.set_Item(enumMaterialCategory.Fuel, dictionary2.get_Item(enumMaterialCategory.Fuel) * Utils.GetRandDouble(min, 0.75, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bull, dictionary2.get_Item(enumMaterialCategory.Bull) * Utils.GetRandDouble(min, 0.75, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Steel, dictionary2.get_Item(enumMaterialCategory.Steel) * Utils.GetRandDouble(min, 0.75, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bauxite, dictionary2.get_Item(enumMaterialCategory.Bauxite) * Utils.GetRandDouble(min, 0.75, 0.01, 2));
                }
                int num4 = num * 2;
                if (num4 < tankerNum && num < 6)
                {
                    double min2 = (!randMaxFlag) ? 0.75 : 1.0;
                    dictionary2.set_Item(enumMaterialCategory.Fuel, dictionary2.get_Item(enumMaterialCategory.Fuel) * Utils.GetRandDouble(min2, 1.0, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bull, dictionary2.get_Item(enumMaterialCategory.Bull) * Utils.GetRandDouble(min2, 1.0, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Steel, dictionary2.get_Item(enumMaterialCategory.Steel) * Utils.GetRandDouble(min2, 1.0, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bauxite, dictionary2.get_Item(enumMaterialCategory.Bauxite) * Utils.GetRandDouble(min2, 1.0, 0.01, 2));
                }
            }
            else if (tankerNum >= materialLimitTankerNum)
            {
                double min3 = (!randMaxFlag) ? 1.0 : 1.3;
                dictionary2.set_Item(enumMaterialCategory.Fuel, (double)this.Material_1 * Utils.GetRandDouble(min3, 1.3, 0.1, 1));
                dictionary2.set_Item(enumMaterialCategory.Bull, (double)this.Material_2 * Utils.GetRandDouble(min3, 1.3, 0.1, 1));
                dictionary2.set_Item(enumMaterialCategory.Steel, (double)this.Material_3 * Utils.GetRandDouble(min3, 1.3, 0.1, 1));
                dictionary2.set_Item(enumMaterialCategory.Bauxite, (double)this.Material_4 * Utils.GetRandDouble(min3, 1.3, 0.1, 1));
                if (num == 0)
                {
                    min3 = ((!randMaxFlag) ? 0.5 : 0.85);
                    dictionary2.set_Item(enumMaterialCategory.Fuel, dictionary2.get_Item(enumMaterialCategory.Fuel) * Utils.GetRandDouble(min3, 0.85, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bull, dictionary2.get_Item(enumMaterialCategory.Bull) * Utils.GetRandDouble(min3, 0.85, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Steel, dictionary2.get_Item(enumMaterialCategory.Steel) * Utils.GetRandDouble(min3, 0.85, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bauxite, dictionary2.get_Item(enumMaterialCategory.Bauxite) * Utils.GetRandDouble(min3, 0.85, 0.01, 2));
                }
                int num5 = num * 2;
                if (num5 < tankerNum && num < 6)
                {
                    min3 = ((!randMaxFlag) ? 0.75 : 0.95);
                    dictionary2.set_Item(enumMaterialCategory.Fuel, dictionary2.get_Item(enumMaterialCategory.Fuel) * Utils.GetRandDouble(min3, 0.95, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bull, dictionary2.get_Item(enumMaterialCategory.Bull) * Utils.GetRandDouble(min3, 0.95, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Steel, dictionary2.get_Item(enumMaterialCategory.Steel) * Utils.GetRandDouble(min3, 0.95, 0.01, 2));
                    dictionary2.set_Item(enumMaterialCategory.Bauxite, dictionary2.get_Item(enumMaterialCategory.Bauxite) * Utils.GetRandDouble(min3, 0.95, 0.01, 2));
                }
            }
            double        num6      = 1.0;
            DifficultKind difficult = Comm_UserDatas.Instance.User_basic.Difficult;

            if (difficult == DifficultKind.SHI)
            {
                num6 = 1.0;
            }
            else if (difficult == DifficultKind.KOU)
            {
                num6 = 2.0;
            }
            else if (difficult == DifficultKind.OTU)
            {
                num6 = 2.5;
            }
            else if (difficult == DifficultKind.HEI)
            {
                num6 = 3.0;
            }
            else if (difficult == DifficultKind.TEI)
            {
                num6 = 4.0;
            }
            using (Dictionary <enumMaterialCategory, double> .Enumerator enumerator = dictionary2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <enumMaterialCategory, double> current = enumerator.get_Current();
                    double num7  = (current.get_Key() != enumMaterialCategory.Bauxite) ? 1.0 : 0.65;
                    double num8  = current.get_Value() * num6 * num7;
                    int    num9  = (int)(Math.Ceiling(num8) / 5.0);
                    int    num10 = 5 * num9;
                    Dictionary <enumMaterialCategory, int> dictionary3;
                    Dictionary <enumMaterialCategory, int> expr_605 = dictionary3 = addValues;
                    enumMaterialCategory key;
                    enumMaterialCategory expr_60F = key = current.get_Key();
                    int num11 = dictionary3.get_Item(key);
                    expr_605.set_Item(expr_60F, num11 + num10);
                }
            }
        }
Esempio n. 2
0
        public void TakeMaterialNum(Dictionary <int, Mem_mapclear> mapclear, int tankerNum, ref Dictionary <enumMaterialCategory, int> addValues, bool randMaxFlag, DeckShips deckShip)
        {
            if (tankerNum == 0 || !IsActiveArea())
            {
                return;
            }
            int    num  = deckShip.getMemShip().Count((Mem_ship x) => x.IsEscortDeffender());
            double num2 = tankerNum;
            double num3 = Req_tanker_num;
            Dictionary <enumMaterialCategory, double> dictionary = new Dictionary <enumMaterialCategory, double>();

            dictionary.Add(enumMaterialCategory.Fuel, 0.0);
            dictionary.Add(enumMaterialCategory.Bull, 0.0);
            dictionary.Add(enumMaterialCategory.Steel, 0.0);
            dictionary.Add(enumMaterialCategory.Bauxite, 0.0);
            Dictionary <enumMaterialCategory, double> dictionary2 = dictionary;
            int materialLimitTankerNum = GetMaterialLimitTankerNum();

            if (tankerNum <= Req_tanker_num)
            {
                dictionary2[enumMaterialCategory.Fuel]    = (int)((double)Material_1 * num2 / num3);
                dictionary2[enumMaterialCategory.Bull]    = (int)((double)Material_2 * num2 / num3);
                dictionary2[enumMaterialCategory.Steel]   = (int)((double)Material_3 * num2 / num3);
                dictionary2[enumMaterialCategory.Bauxite] = (int)((double)Material_4 * num2 / num3);
                if (num == 0)
                {
                    double min = (!randMaxFlag) ? 0.5 : 0.75;
                    dictionary2[enumMaterialCategory.Fuel]    *= Utils.GetRandDouble(min, 0.75, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bull]    *= Utils.GetRandDouble(min, 0.75, 0.01, 2);
                    dictionary2[enumMaterialCategory.Steel]   *= Utils.GetRandDouble(min, 0.75, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bauxite] *= Utils.GetRandDouble(min, 0.75, 0.01, 2);
                }
                int num4 = num * 2;
                if (num4 < tankerNum && num < 6)
                {
                    double min2 = (!randMaxFlag) ? 0.75 : 1.0;
                    dictionary2[enumMaterialCategory.Fuel]    *= Utils.GetRandDouble(min2, 1.0, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bull]    *= Utils.GetRandDouble(min2, 1.0, 0.01, 2);
                    dictionary2[enumMaterialCategory.Steel]   *= Utils.GetRandDouble(min2, 1.0, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bauxite] *= Utils.GetRandDouble(min2, 1.0, 0.01, 2);
                }
            }
            else if (tankerNum >= materialLimitTankerNum)
            {
                double min3 = (!randMaxFlag) ? 1.0 : 1.3;
                dictionary2[enumMaterialCategory.Fuel]    = (double)Material_1 * Utils.GetRandDouble(min3, 1.3, 0.1, 1);
                dictionary2[enumMaterialCategory.Bull]    = (double)Material_2 * Utils.GetRandDouble(min3, 1.3, 0.1, 1);
                dictionary2[enumMaterialCategory.Steel]   = (double)Material_3 * Utils.GetRandDouble(min3, 1.3, 0.1, 1);
                dictionary2[enumMaterialCategory.Bauxite] = (double)Material_4 * Utils.GetRandDouble(min3, 1.3, 0.1, 1);
                if (num == 0)
                {
                    min3 = ((!randMaxFlag) ? 0.5 : 0.85);
                    dictionary2[enumMaterialCategory.Fuel]    *= Utils.GetRandDouble(min3, 0.85, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bull]    *= Utils.GetRandDouble(min3, 0.85, 0.01, 2);
                    dictionary2[enumMaterialCategory.Steel]   *= Utils.GetRandDouble(min3, 0.85, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bauxite] *= Utils.GetRandDouble(min3, 0.85, 0.01, 2);
                }
                int num5 = num * 2;
                if (num5 < tankerNum && num < 6)
                {
                    min3 = ((!randMaxFlag) ? 0.75 : 0.95);
                    dictionary2[enumMaterialCategory.Fuel]    *= Utils.GetRandDouble(min3, 0.95, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bull]    *= Utils.GetRandDouble(min3, 0.95, 0.01, 2);
                    dictionary2[enumMaterialCategory.Steel]   *= Utils.GetRandDouble(min3, 0.95, 0.01, 2);
                    dictionary2[enumMaterialCategory.Bauxite] *= Utils.GetRandDouble(min3, 0.95, 0.01, 2);
                }
            }
            double num6 = 1.0;

            switch (Comm_UserDatas.Instance.User_basic.Difficult)
            {
            case DifficultKind.SHI:
                num6 = 1.0;
                break;

            case DifficultKind.KOU:
                num6 = 2.0;
                break;

            case DifficultKind.OTU:
                num6 = 2.5;
                break;

            case DifficultKind.HEI:
                num6 = 3.0;
                break;

            case DifficultKind.TEI:
                num6 = 4.0;
                break;
            }
            foreach (KeyValuePair <enumMaterialCategory, double> item in dictionary2)
            {
                double num7 = (item.Key != enumMaterialCategory.Bauxite) ? 1.0 : 0.65;
                double a    = item.Value * num6 * num7;
                int    num8 = (int)(Math.Ceiling(a) / 5.0);
                int    num9 = 5 * num8;
                Dictionary <enumMaterialCategory, int> dictionary3;
                Dictionary <enumMaterialCategory, int> dictionary4 = dictionary3 = addValues;
                enumMaterialCategory key;
                enumMaterialCategory key2 = key = item.Key;
                int num10 = dictionary3[key];
                dictionary4[key2] = num10 + num9;
            }
        }