public void Update( FleetData fleet ) { KCDatabase db = KCDatabase.Instance; if ( fleet == null ) return; Name.Text = fleet.Name; { int levelSum = fleet.MembersInstance.Sum( s => s != null ? s.Level : 0 ); int fueltotal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.FuelMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammototal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.AmmoMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int fuelunit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Fuel * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammounit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Ammo * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int speed = fleet.MembersWithoutEscaped.Min( s => s == null ? 10 : s.MasterShip.Speed ); var slots = fleet.MembersWithoutEscaped .Where( s => s != null ) .SelectMany( s => s.SlotInstance ) .Where( e => e != null ); var daihatsu = slots.Where( e => e.EquipmentID == 68 ); var daihatsu_tank = slots.Where( e => e.EquipmentID == 166 ); var landattacker = slots.Where( e => e.EquipmentID == 167 ); double expeditionBonus = Math.Min( daihatsu.Count() * 0.05 + daihatsu_tank.Count() * 0.02 + landattacker.Count() * 0.01, 0.20 ); ToolTipInfo.SetToolTip( Name, string.Format( "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個 ({6}艦, +{7:p1})\r\n総積載: 燃 {8} / 弾 {9}\r\n(1戦当たり 燃 {10} / 弾 {11})", levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) ), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Any( q => q == null ? false : q.CategoryType == 30 ) ), daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Any( q => q == null ? false : q.CategoryType == 24 || q.CategoryType == 46 ) ), expeditionBonus + 0.01 * expeditionBonus * ( daihatsu.Sum( e => e.Level ) + daihatsu_tank.Sum( e => e.Level ) + landattacker.Sum( e => e.Level ) ) / Math.Max( daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), 1 ), fueltotal, ammototal, fuelunit, ammounit ) ); } State = FleetData.UpdateFleetState( fleet, StateMain, ToolTipInfo, State, ref Timer ); var config = Utility.Configuration.Config.FormFleetPlus.FleetsInfoIcon[FleetID - 1]; //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n", (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), (int)( airSuperiority * 1.5 - 1 ), (int)( airSuperiority * 3.0 - 1 ) ) ); AirSuperiority.Visible = config[0]; } //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); { StringBuilder sb = new StringBuilder(); double probStart = fleet.GetContactProbability(); var probSelect = fleet.GetContactSelectionProbability(); sb.AppendFormat( "(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n判定式(33): {3}\r\n\r\n触接開始率: \r\n 確保 {4:p1} / 優勢 {5:p1}\r\n", fleet.GetSearchingAbilityString( 0 ), fleet.GetSearchingAbilityString( 1 ), fleet.GetSearchingAbilityString( 2 ), fleet.GetSearchingAbilityString( 3 ), probStart, probStart * 0.6 ); if ( probSelect.Count > 0 ) { sb.AppendLine( "触接選択率: " ); foreach ( var p in probSelect.OrderBy( p => p.Key ) ) { sb.AppendFormat( " 命中{0} : {1:p1}\r\n", p.Key, p.Value ); } } ToolTipInfo.SetToolTip( SearchingAbility, sb.ToString() ); } SearchingAbility.Visible = config[1]; int drumTotal = fleet.MembersInstance.Sum( s => s?.SlotInstanceMaster.Count( q => q?.CategoryType == 30 ) ?? 0 ); int drumShipTotal = fleet.MembersInstance.Count( s => s?.SlotInstanceMaster.Any( q => q?.CategoryType == 30 ) ?? false ); DrumCanister.Text = $"{drumTotal}/{drumShipTotal}"; DrumCanister.Visible = config[2]; int landingCraftTotal = fleet.MembersInstance.Sum(s => s?.SlotInstanceMaster.Count(q => q?.CategoryType == 24) ?? 0); LandingCraft.Text = $"{landingCraftTotal}"; LandingCraft.Visible = config[3]; if ( ConditionSparkle.Visible = config[4] ) { var sparkleShipCount = fleet.MembersInstance.Count(s => s?.Condition > 50); if ( sparkleShipCount == 6 ) { // 全艦キラ var minCond = fleet.MembersInstance.Min(s => s.Condition); ConditionSparkle.Text = $"{Math.Ceiling((minCond - 49.0) / 3.0)}"; ConditionSparkle.ForeColor = Color.Black; } else if ( sparkleShipCount >= 4 ) { // 4隻以上キラ var minCond = fleet.MembersInstance.Where(s => s?.Condition > 50).Min(s => s.Condition); ConditionSparkle.Text = $"{Math.Ceiling((minCond - 49.0) / 3.0)}"; ConditionSparkle.ForeColor = Color.Red; } else { // キラ3隻以下 ConditionSparkle.Text = "0"; ConditionSparkle.ForeColor = Color.Red; } } }
public void Update( FleetData fleet ) { KCDatabase db = KCDatabase.Instance; if ( fleet == null ) return; Name.Text = fleet.Name; { int levelSum = fleet.MembersInstance.Sum( s => s != null ? s.Level : 0 ); int fueltotal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.FuelMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammototal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.AmmoMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int fuelunit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Fuel * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammounit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Ammo * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int speed = fleet.MembersWithoutEscaped.Min( s => s == null ? 10 : s.MasterShip.Speed ); ToolTipInfo.SetToolTip( Name, string.Format( "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個\r\n総積載: 燃 {6} / 弾 {7}\r\n(1戦当たり 燃 {8} / 弾 {9})", levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) ), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) > 0 ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 24 ) ), fueltotal, ammototal, fuelunit, ammounit ) ); } State = FleetData.UpdateFleetState( fleet, StateMain, ToolTipInfo, State, ref Timer ); //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n", (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), (int)( airSuperiority * 1.5 - 1 ), (int)( airSuperiority * 3.0 - 1 ) ) ); } //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); ToolTipInfo.SetToolTip( SearchingAbility, string.Format( "(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n", fleet.GetSearchingAbilityString( 0 ), fleet.GetSearchingAbilityString( 1 ), fleet.GetSearchingAbilityString( 2 ) ) ); }
public void Update( FleetData fleet ) { KCDatabase db = KCDatabase.Instance; if ( fleet == null ) return; Name.Text = fleet.Name; { int levelSum = fleet.MembersInstance.Sum( s => s != null ? s.Level : 0 ); int fueltotal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.FuelMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammototal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.AmmoMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int fuelunit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Fuel * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammounit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Ammo * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int speed = fleet.MembersWithoutEscaped.Min( s => s == null ? 10 : s.MasterShip.Speed ); ToolTipInfo.SetToolTip( Name, string.Format( "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個\r\n総積載: 燃 {6} / 弾 {7}\r\n(1戦当たり 燃 {8} / 弾 {9})", levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) ), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) > 0 ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 24 ) ), fueltotal, ammototal, fuelunit, ammounit ) ); } State = FleetData.UpdateFleetState( fleet, StateMain, ToolTipInfo, State, ref Timer ); //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n", (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), (int)( airSuperiority * 1.5 - 1 ), (int)( airSuperiority * 3.0 - 1 ) ) ); } //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); { StringBuilder sb = new StringBuilder(); double probStart = fleet.GetContactProbability(); var probSelect = fleet.GetContactSelectionProbability(); sb.AppendFormat("(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n\r\n触接開始率: \r\n 確保 {3:p1} / 優勢 {4:p1}\r\n", fleet.GetSearchingAbilityString( 0 ), fleet.GetSearchingAbilityString( 1 ), fleet.GetSearchingAbilityString( 2 ), probStart, probStart * 0.6 ); if ( probSelect.Count > 0 ) { sb.AppendLine( "触接選択率: " ); foreach ( var p in probSelect.OrderBy( p => p.Key ) ) { sb.AppendFormat( " 命中{0} : {1:p1}\r\n", p.Key, p.Value ); } } ToolTipInfo.SetToolTip( SearchingAbility, sb.ToString() ); } }
public void Update( FleetData fleet ) { KCDatabase db = KCDatabase.Instance; if ( fleet == null ) return; Name.Text = fleet.Name; { int levelSum = fleet.MembersInstance.Sum( s => s != null ? s.Level : 0 ); int fueltotal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)( s.MasterShip.Fuel * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammototal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)( s.MasterShip.Ammo * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int speed = fleet.MembersWithoutEscaped.Min( s => s == null ? 10 : s.MasterShip.Speed ); ToolTipInfo.SetToolTip(Name, string.Format( GeneralRes.FleetTooltip, levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) ), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) > 0 ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 24 ) ), fueltotal, ammototal, (int)( fueltotal * 0.2 ), (int)( ammototal * 0.2 ) ) ); } State = FleetData.UpdateFleetState( fleet, StateMain, ToolTipInfo, State, ref Timer ); //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( GeneralRes.ASTooltip, (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), (int)( airSuperiority * 1.5 ), (int)( airSuperiority * 3.0 ) ) ); } //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); ToolTipInfo.SetToolTip( SearchingAbility, string.Format( GeneralRes.LoSTooltip, fleet.GetSearchingAbilityString( 0 ), fleet.GetSearchingAbilityString( 1 ), fleet.GetSearchingAbilityString( 2 ) ) ); }
public void Update( FleetData fleet ) { KCDatabase db = KCDatabase.Instance; if ( fleet == null ) return; Name.Text = fleet.Name; { int levelSum = fleet.MembersInstance.Sum( s => s != null ? s.Level : 0 ); int fueltotal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.FuelMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammototal = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.AmmoMax * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int fuelunit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Fuel * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int ammounit = fleet.MembersInstance.Sum( s => s == null ? 0 : (int)Math.Floor( s.MasterShip.Ammo * 0.2 * ( s.IsMarried ? 0.85 : 1.00 ) ) ); int speed = fleet.MembersWithoutEscaped.Min( s => s == null ? 10 : s.MasterShip.Speed ); var slots = fleet.MembersWithoutEscaped .Where( s => s != null ) .SelectMany( s => s.SlotInstance ) .Where( e => e != null ); var daihatsu = slots.Where( e => e.EquipmentID == 68 ); var daihatsu_tank = slots.Where( e => e.EquipmentID == 166 ); var landattacker = slots.Where( e => e.EquipmentID == 167 ); double expeditionBonus = Math.Min( daihatsu.Count() * 0.05 + daihatsu_tank.Count() * 0.02 + landattacker.Count() * 0.01, 0.20 ); ToolTipInfo.SetToolTip( Name, string.Format( GeneralRes.FleetTooltip, levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), fleet.MembersInstance.Sum( s => s == null ? 0 : s.SlotInstanceMaster.Count( q => q == null ? false : q.CategoryType == 30 ) ), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Any( q => q == null ? false : q.CategoryType == 30 ) ), daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Any( q => q == null ? false : q.CategoryType == 24 || q.CategoryType == 46 ) ), expeditionBonus + 0.01 * expeditionBonus * ( daihatsu.Sum( e => e.Level ) + daihatsu_tank.Sum( e => e.Level ) + landattacker.Sum( e => e.Level ) ) / Math.Max( daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), 1 ), fueltotal, ammototal, fuelunit, ammounit ) ); } State = FleetData.UpdateFleetState( fleet, StateMain, ToolTipInfo, State, ref Timer ); //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( GeneralRes.ASTooltip, (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), (int)( airSuperiority * 1.5 - 1 ), (int)( airSuperiority * 3.0 - 1 ) ) ); } //索敵能力計算 SearchingAbility.Text = fleet.GetSearchingAbilityString(); { StringBuilder sb = new StringBuilder(); double probStart = fleet.GetContactProbability(); var probSelect = fleet.GetContactSelectionProbability(); sb.AppendFormat( GeneralRes.LoSTooltip, fleet.GetSearchingAbilityString( 0 ), fleet.GetSearchingAbilityString( 1 ), fleet.GetSearchingAbilityString( 2 ), fleet.GetSearchingAbilityString( 3 ), probStart, probStart * 0.6 ); if ( probSelect.Count > 0 ) { sb.AppendLine( GeneralRes.SelectionRate ); foreach ( var p in probSelect.OrderBy( p => p.Key ) ) { sb.AppendFormat( " " + EncycloRes.Accuracy + "+{0} : {1:p1}\r\n", p.Key, p.Value ); } } ToolTipInfo.SetToolTip( SearchingAbility, sb.ToString() ); } }