/// <summary>
/// 艦隊の平均レベルや制空戦力などの各種数値を再計算します。
/// </summary>
internal void Calculate()
{
var ships = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
this.TotalLevel = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
this.MinAirSuperiorityPotential = ships.Sum(s => s.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Minimum));
this.MaxAirSuperiorityPotential = ships.Sum(s => s.GetAirSuperiorityPotential(AirSuperiorityCalculationOptions.Maximum));
this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
? FleetSpeed.Fast
: ships.All(x => x.Info.Speed == ShipSpeed.Low)
? FleetSpeed.Low
: FleetSpeed.Hybrid;
var logic = ViewRangeCalcLogic.Get(KanColleClient.Current.Settings.ViewRangeCalcType);
this.ViewRange = logic.Calc(this.source);
this.ViewRangeCalcType = logic.Name;
if (this.Calculated != null)
{
this.Calculated(this, new EventArgs());
}
}