Exemple #1
0
        public static double GetAirSuperiorityPotential(this PresetShipModel ship, AirSuperiorityCalculationOptions option)
        {
            var slots = new PresetShipData(ship).Ship.RawData.api_maxeq;

            return(ship.Slots
                   .Select((x, y) =>
            {
                var calc = new PresetSlotData(x).Item?.Type.GetCalculator() ?? EmptyCalculator.Instance;

                if (slots[y] <= 0)
                {
                    return 0;
                }
                if (!option.HasFlag(calc.Options))
                {
                    return 0;
                }

                return calc.GetAirSuperiority(x, slots[y], option);
            })
                   .Sum());
        }
Exemple #2
0
        public static double GetViewRange(this PresetShipModel[] ships)
        {
            var itemLOS = ships
                          .SelectMany(x => x.Slots)
                          .Sum(x => {
                var y = new PresetSlotData(x).Item;
                if (y == null)
                {
                    return(0);
                }

                return((y.ViewRange + GetLevelCoefficient(y.Type, x.Level)) * GetTypeCoefficient(y.Type));
            });

            var shipLOS = ships
                          .Select(x => x.LOS - x.Slots.Sum(y => new PresetSlotData(y).Item?.RawData.api_saku ?? 0))
                          .Sum(x => Math.Sqrt(x));

            var admiralLOS   = Math.Ceiling(KanColleClient.Current.Homeport.Admiral.Level * 0.4);
            var vacancyScore = (6 - ships.Count(x => x.Id > 0)) * 2;

            return(itemLOS + shipLOS - admiralLOS + vacancyScore);
        }