/// <summary> /// 航空戦での与ダメージを推測します。 /// </summary> /// <param name="damages">与ダメージリスト。</param> private void CalculateAttackDamage(int[] damages) { // 敵はめんどくさすぎるので省略 // 仮想火力を求め、それに従って合計ダメージを分配 var firepower = new int[12]; var launchedIndex = LaunchedShipIndexFriend; var members = _battleData.Initial.FriendFleet.MembersWithoutEscaped; foreach (int i in launchedIndex) { ShipData ship; if (i < 6) { ship = _battleData.Initial.FriendFleet.MembersWithoutEscaped[i]; } else { ship = _battleData.Initial.FriendFleetEscort.MembersWithoutEscaped[i - 6]; } if (ship == null) { continue; } var slots = ship.SlotInstanceMaster; var aircrafts = ship.Aircraft; for (int s = 0; s < slots.Count; s++) { if (slots[s] == null) { continue; } switch (slots[s].CategoryType) { case 7: // 艦上爆撃機 case 11: // 水上爆撃機 case 57: // 噴式戦闘爆撃機 firepower[i] += (int)(1.0 * (slots[s].Bomber * Math.Sqrt(aircrafts[s]) + 25)); break; case 8: // 艦上攻撃機 (80%と150%はランダムのため係数は平均値) case 58: // 噴式攻撃機 firepower[i] += (int)(1.15 * (slots[s].Torpedo * Math.Sqrt(aircrafts[s]) + 25)); break; } } } int totalFirepower = firepower.Sum(); int totalDamage = Damages.Skip(6).Take(6).Sum() + damages.Skip(18).Take(6).Sum(); for (int i = 0; i < firepower.Length; i++) { damages[(i < 6 ? i : (i + 6))] += (int)Math.Round((double)totalDamage * firepower[i] / Math.Max(totalFirepower, 1)); } }
/// <summary> /// 航空戦での与ダメージを推測します。 /// </summary> /// <param name="damages">与ダメージリスト。</param> private void CalculateAttackDamage(int[] damages) { // 敵はめんどくさすぎるので省略 // 仮想火力を求め、それに従って合計ダメージを分配 var firepower = new int[6]; var members = _battleData.Initial.FriendFleet.MembersWithoutEscaped; for (int i = 0; i < members.Count; i++) { var ship = members[i]; if (ship == null) { continue; } var slots = ship.SlotInstanceMaster; var aircrafts = ship.Aircraft; for (int s = 0; s < slots.Count; s++) { if (slots[s] == null) { continue; } switch (slots[s].CategoryType) { case 7: //艦上爆撃機 case 11: //水上爆撃機 firepower[i] += (int)(1.0 * (slots[s].Bomber * Math.Sqrt(aircrafts[s]) + 25)); break; case 8: //艦上攻撃機 (80%と150%はランダムのため係数は平均値) firepower[i] += (int)(1.15 * (slots[s].Torpedo * Math.Sqrt(aircrafts[s]) + 25)); break; } } } int totalFirepower = firepower.Sum(); int totalDamage = Damages.Skip(6).Take(6).Sum(); for (int i = 0; i < 6; i++) { damages[i] += (int)Math.Round((double)totalDamage * firepower[i] / Math.Max(totalFirepower, 1)); } }