Grabacr07.KanColleWrapper.Models.ViewRangeType2.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#area5
            // [索敵装備と装備例] によって示されている計算式
            // stype=7 が偵察機 (2 倍する索敵値)、stype=8 が電探

            var spotter = ships.SelectMany(
                x => x.EquippedSlots
                    .Where(s => s.Item.Info.RawData.api_type.Get(1) == 7)
                    .Where(s => s.Current > 0)
                    .Select(s => s.Item.Info.RawData.api_saku)
                ).Sum();

            var radar = ships.SelectMany(
                x => x.EquippedSlots
                    .Where(s => s.Item.Info.RawData.api_type.Get(1) == 8)
                    .Select(s => s.Item.Info.RawData.api_saku)
                ).Sum();

            return (spotter * 2) + radar + (int)Math.Sqrt(ships.Sum(x => x.ViewRange) - spotter - radar);
        }
ViewRangeType2