/// <summary> /// 航空戦での与ダメージを推測します。 /// </summary> /// <param name="damages">与ダメージリスト。</param> private void CalculateAttackDamage(int[] damages) { // 敵はめんどくさすぎるので省略 // 仮想火力を求め、それに従って合計ダメージを分配 var firepower = new int[12]; var launchedIndex = LaunchedShipIndexFriend; foreach (int i in launchedIndex) { var ship = Battle.Initial.GetFriendShip(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 EquipmentTypes.CarrierBasedBomber: case EquipmentTypes.SeaplaneBomber: firepower[i] += (int)(1.0 * (slots[s].Bomber * Math.Sqrt(aircrafts[s]) + 25)); break; // 噴式爆撃機 case EquipmentTypes.JetBomber: firepower[i] += (int)(1.0 / Math.Sqrt(2) * (slots[s].Bomber * Math.Sqrt(aircrafts[s]) + 25)); break; // 通常の攻撃機系 (80%と150%はランダムのため係数は平均値) case EquipmentTypes.CarrierBasedTorpedo: firepower[i] += (int)(1.15 * (slots[s].Torpedo * Math.Sqrt(aircrafts[s]) + 25)); break; // 噴式攻撃機(いる?) case EquipmentTypes.JetTorpedo: firepower[i] += (int)(1.15 / Math.Sqrt(2) * (slots[s].Torpedo * Math.Sqrt(aircrafts[s]) + 25)); break; } } } int totalFirepower = firepower.Sum(); int totalDamage = Damages.Select(dmg => (int)dmg).Skip(12).Take(12).Sum(); for (int i = 0; i < firepower.Length; i++) { damages[i] += (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[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.Select(dmg => (int)dmg).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)); } }
private Weapon CloneWeapon(Weapon target, bool mundane = false) { target.Ammunition = !string.IsNullOrEmpty(Ammunition) ? Ammunition : target.Ammunition; if (CriticalDamages.Any()) { target.CriticalDamages = CriticalDamages.Select(d => d.Clone()).ToList(); } if (Damages.Any()) { target.Damages = Damages.Select(d => d.Clone()).ToList(); } if (SecondaryCriticalDamages.Any()) { target.SecondaryCriticalDamages = SecondaryCriticalDamages.Select(d => d.Clone()).ToList(); } if (SecondaryDamages.Any()) { target.SecondaryDamages = SecondaryDamages.Select(d => d.Clone()).ToList(); } target.Size = !string.IsNullOrEmpty(Size) ? Size : target.Size; target.ThreatRange = ThreatRange > 0 ? ThreatRange : target.ThreatRange; target.CriticalMultiplier = !string.IsNullOrEmpty(CriticalMultiplier) ? CriticalMultiplier : target.CriticalMultiplier; target.Quantity = Quantity > 1 ? Quantity : target.Quantity; target.SecondaryCriticalMultiplier = !string.IsNullOrEmpty(SecondaryCriticalMultiplier) ? SecondaryCriticalMultiplier : target.SecondaryCriticalMultiplier; if (!mundane) { target.SecondaryHasAbilities = SecondaryHasAbilities ? SecondaryHasAbilities : target.SecondaryHasAbilities; target.SecondaryMagicBonus = SecondaryMagicBonus > 0 ? SecondaryMagicBonus : target.SecondaryMagicBonus; } return(target); }