Пример #1
0
        /// <summary>
        /// その艦載機における制空値を計算する
        /// </summary>
        /// <param name="airSize">スロットの搭載数数</param>
        /// <returns><制空値/returns>
        private int CalcAirValueXImpl(int airSize)
        {
            // データベースに存在しない装備における制空値は0とする
            if (!DataBase.ContainsWeapon(Id))
            {
                return(0);
            }
            // ステージ1に参加しなければ制空値0とする
            if (!isStage1X)
            {
                return(0);
            }
            // 素対空値と改修度
            double airValue = AntiAir;

            switch (Type)
            {
            case "艦上戦闘機":
                airValue += 0.2 * Improvement;
                break;

            case "艦上爆撃機":
                // wikiaには「爆戦」とあったので、厳密に爆戦を指定する
                if (Name.Contains("爆戦"))
                {
                    airValue += 0.25 * Improvement;
                }
                break;
            }
            // 迎撃値
            airValue += 1.5 * Intercept;
            // √スロット数を乗算
            airValue *= Math.Sqrt(airSize);
            // 艦載機熟練度
            var nativeProficiency = new int[] { 0, 10, 25, 40, 55, 70, 85, 100 };
            var typeBonusAF       = new int[] { 0, 0, 2, 5, 9, 14, 14, 22 };
            var typeBonusWB       = new int[] { 0, 0, 1, 1, 1, 3, 3, 6 };

            switch (Type)
            {
            case "艦上戦闘機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                airValue += typeBonusAF[Proficiency];
                break;

            case "水上戦闘機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                airValue += typeBonusAF[Proficiency];
                break;

            case "水上爆撃機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                airValue += typeBonusWB[Proficiency];
                break;

            case "局地戦闘機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                airValue += typeBonusAF[Proficiency];
                break;

            case "陸上攻撃機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "艦上攻撃機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "艦上爆撃機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "噴式戦闘爆撃機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "大型飛行艇":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "水上偵察機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;

            case "艦上偵察機":
                airValue += Math.Sqrt((double)nativeProficiency[Proficiency] / 10);
                break;
            }
            return((int)(airValue));
        }
Пример #2
0
        /// <summary>
        /// 入力された文字列を大艦隊クラスに変換する
        /// </summary>
        /// <param name="inputFriendDataText">文字列</param>
        /// <returns>大艦隊クラス</returns>
        public static Fleet ToFleet(string inputFriendDataText)
        {
            var fleet = new Fleet();
            // fre形式と考えて読み込む
            var kammusuList     = new List <KeyValuePair <int, int> >();
            var kammusuDataList = new List <Kammusu>();

            using (var rs = new System.IO.StringReader(inputFriendDataText)) {
                while (rs.Peek() > -1)
                {
                    try {
                        string getLine = rs.ReadLine();
                        var    column  = getLine.Split(',');
                        if (column.Count() < 19)
                        {
                            continue;
                        }
                        // 艦隊番号と艦番を読み込む
                        int ui = int.Parse(column[0]);
                        ui = (ui <= 1 ? 1 : 2);
                        int ki = int.Parse(column[1]);
                        ki = (ki <= 1 ? 1 : ki >= 6 ? 6 : ki);
                        // 艦娘部分のデータを読み込む
                        var tempKammusu = new Kammusu();
                        int id          = DataBase.KammusuId(column[2]);
                        if (id >= 0)
                        {
                            tempKammusu.Id        = id;
                            tempKammusu.Level     = int.Parse(column[3]);
                            tempKammusu.Luck      = -1;
                            tempKammusu.IsKammusu = true;
                            // 装備(データベースから情報を拾う)
                            for (int i = 0; i < 5; ++i)
                            {
                                var tempWeapon = new Weapon();
                                int id2        = DataBase.WeaponId(column[4 + i * 3]);
                                if (id2 >= 0)
                                {
                                    tempWeapon.Id          = id2;
                                    tempWeapon.Improvement = int.Parse(column[5 + i * 3]);
                                    tempWeapon.Proficiency = int.Parse(column[6 + i * 3]);
                                }
                                tempWeapon.Complete();
                                tempKammusu.Weapon.Add(tempWeapon);
                            }
                            tempKammusu.Complete();
                            kammusuList.Add(new KeyValuePair <int, int>(ui, ki));
                            kammusuDataList.Add(tempKammusu);
                        }
                    }
                    catch {
                        continue;
                    }
                }
            }
            // 読み込んだものをfleetにセットしていく
            int unitCount = kammusuList.Select(k => k.Key).Max();

            for (int ui = 0; ui < unitCount; ++ui)
            {
                fleet.Unit.Add(new Unit());
                int maxKammusuIndex = kammusuList.Where(k => k.Key == ui + 1).Select(k => k.Value).Max();
                for (int ki = 0; ki < maxKammusuIndex; ++ki)
                {
                    fleet.Unit[ui].Kammusu.Add(new Kammusu());
                }
            }
            for (int i = 0; i < kammusuList.Count; ++i)
            {
                fleet.Unit[kammusuList[i].Key - 1].Kammusu[kammusuList[i].Value - 1] = kammusuDataList[i];
            }
            fleet.Complete();
            return(fleet);
        }