Grabacr07.KanColleWrapper.Models.ViewRangeType3.Calc C# (CSharp) Method

Calc() public method

public Calc ( Ship ships ) : double
ships Ship
return double
        public override double Calc(Ship[] ships)
        {
            if (ships == null || ships.Length == 0) return 0;

            // http://wikiwiki.jp/kancolle/?%C6%EE%C0%BE%BD%F4%C5%E7%B3%A4%B0%E8#search-calc
            // > 2-5式では説明出来ない事象を解決するため膨大な検証報告数より導き出した新式。2014年11月に改良され精度があがった。
            // > 索敵スコア
            // > = 艦上爆撃機 × (1.04)
            // > + 艦上攻撃機 × (1.37)
            // > + 艦上偵察機 × (1.66)
            // > + 水上偵察機 × (2.00)
            // > + 水上爆撃機 × (1.78)
            // > + 小型電探 × (1.00)
            // > + 大型電探 × (0.99)
            // > + 探照灯 × (0.91)
            // > + √(各艦毎の素索敵) × (1.69)
            // > + (司令部レベルを5の倍数に切り上げ) × (-0.61)

            var itemScore = ships
                .SelectMany(x => x.EquippedSlots)
                .Select(x => x.Item.Info)
                .GroupBy(
                    x => x.Type,
                    x => x.RawData.api_saku,
                    (type, scores) => new { type, score = scores.Sum() })
                .Aggregate(.0, (score, item) => score + GetScore(item.type, item.score));

            var shipScore = ships
                .Select(x => x.ViewRange - x.EquippedSlots.Sum(s => s.Item.Info.RawData.api_saku))
                .Select(x => Math.Sqrt(x))
                .Sum() * 1.69;

            var level = (((KanColleClient.Current.Homeport.Admiral.Level + 4) / 5) * 5);
            var admiralScore = level * -0.61;

            return itemScore + shipScore + admiralScore;
        }
ViewRangeType3