Example #1
0
        /// <summary>
        /// 砲撃戦での対潜威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateAntiSubmarinePower(int engagementForm = 1)
        {
            if (!Calculator.CanAttackSubmarine(this))
            {
                return(0);
            }

            double eqpower = 0;

            foreach (var slot in SlotInstance)
            {
                if (slot == null)
                {
                    continue;
                }

                switch (slot.MasterEquipment.CategoryType)
                {
                case 7:                                 //艦爆
                case 8:                                 //艦攻
                case 11:                                //水爆
                case 14:                                //ソナー
                case 15:                                //爆雷
                case 25:                                //オートジャイロ
                case 26:                                //対潜哨戒機
                case 40:                                //大型ソナー
                    eqpower += slot.MasterEquipment.ASW;
                    break;
                }
            }

            double basepower = Math.Sqrt(ASWBase) * 2 + eqpower * 1.5 + GetAntiSubmarineEquipmentLevelBonus();

            if (Calculator.GetDayAttackKind(SlotMaster.ToArray(), ShipID, 126, false) == 7)                             //126=伊168; 対潜攻撃が空撃なら
            {
                basepower += 8;
            }
            else                        //爆雷攻撃なら
            {
                basepower += 13;
            }


            basepower *= GetHPDamageBonus() * GetEngagementFormDamageRate(engagementForm);

            //対潜シナジー
            if (SlotInstanceMaster.Where(s => s != null && (s.CategoryType == 14 || s.CategoryType == 40)).Any() &&             //ソナー or 大型ソナー
                SlotInstanceMaster.Where(s => s != null && s.CategoryType == 15).Any())                                         //爆雷
            {
                basepower *= 1.15;
            }

            //キャップ
            basepower = Math.Floor(CapDamage(basepower, 100));

            return((int)(basepower * GetAmmoDamageRate()));
        }
Example #2
0
        /// <summary>
        /// 夜戦での威力を求めます。
        /// </summary>
        private int CalculateNightBattlePower()
        {
            var    kind      = Calculator.GetNightAttackKind(AllSlotMaster.ToArray(), ShipID, -1);
            double basepower = 0;

            if (kind == NightAttackKind.CutinAirAttack)
            {
                var airs = SlotInstance.Zip(Aircraft, (eq, count) => new { eq, master = eq?.MasterEquipment, count }).Where(a => a.eq != null);

                basepower = FirepowerBase +
                            airs.Where(p => p.master.IsNightAircraft)
                            .Sum(p => p.master.Firepower + p.master.Torpedo + p.master.Bomber +
                                 3 * p.count +
                                 0.45 * (p.master.Firepower + p.master.Torpedo + p.master.Bomber + p.master.ASW) * Math.Sqrt(p.count) + Math.Sqrt(p.eq.Level)) +
                            airs.Where(p => p.master.IsSwordfish || p.master.EquipmentID == 154 || p.master.EquipmentID == 320) // 零戦62型(爆戦/岩井隊)、彗星一二型(三一号光電管爆弾搭載機)
                            .Sum(p => p.master.Firepower + p.master.Torpedo + p.master.Bomber +
                                 0.3 * (p.master.Firepower + p.master.Torpedo + p.master.Bomber + p.master.ASW) * Math.Sqrt(p.count) + Math.Sqrt(p.eq.Level));
            }
            else if (ShipID == 515 || ShipID == 393)
            {       // Ark Royal (改)
                basepower = FirepowerBase + SlotInstanceMaster.Where(eq => eq?.IsSwordfish ?? false).Sum(eq => eq.Firepower + eq.Torpedo);
            }
            else if (ShipID == 353 || ShipID == 432 || ShipID == 433)
            {       // Graf Zeppelin(改), Saratoga
                basepower = FirepowerBase + SlotInstanceMaster.Where(eq => eq?.IsSwordfish ?? false).Sum(eq => eq.Firepower + eq.Torpedo);
            }
            else
            {
                basepower = FirepowerTotal + TorpedoTotal + GetNightBattleEquipmentLevelBonus();
            }


            basepower *= GetHPDamageBonus();

            switch (kind)
            {
            case NightAttackKind.DoubleShelling:
                basepower *= 1.2;
                break;

            case NightAttackKind.CutinMainTorpedo:
                basepower *= 1.3;
                break;

            case NightAttackKind.CutinTorpedoTorpedo:
            {
                switch (Calculator.GetNightTorpedoCutinKind(AllSlotInstanceMaster, ShipID, -1))
                {
                case NightTorpedoCutinKind.LateModelTorpedoSubmarineEquipment:
                    basepower *= 1.75;
                    break;

                case NightTorpedoCutinKind.LateModelTorpedo2:
                    basepower *= 1.6;
                    break;

                default:
                    basepower *= 1.5;
                    break;
                }
            }
            break;

            case NightAttackKind.CutinMainSub:
                basepower *= 1.75;
                break;

            case NightAttackKind.CutinMainMain:
                basepower *= 2.0;
                break;

            case NightAttackKind.CutinAirAttack:
            {
                int nightFighter  = SlotInstanceMaster.Count(eq => eq?.IsNightFighter ?? false);
                int nightAttacker = SlotInstanceMaster.Count(eq => eq?.IsNightAttacker ?? false);
                int nightBomber   = SlotInstanceMaster.Count(eq => eq?.EquipmentID == 320);           // 彗星一二型(三一号光電管爆弾搭載機)

                if (nightFighter >= 2 && nightAttacker >= 1)
                {
                    basepower *= 1.25;
                }
                else if (nightBomber >= 1 && nightFighter + nightAttacker >= 1)
                {
                    basepower *= 1.2;
                }
                else if (nightFighter >= 1 && nightAttacker >= 1)
                {
                    basepower *= 1.2;
                }
                else
                {
                    basepower *= 1.18;
                }
            }
            break;

            case NightAttackKind.CutinTorpedoRadar:
                if (ShipID == 543 && AllSlotInstanceMaster.Any(eq => eq?.EquipmentID == 267))         // 長波改二 + 12.7cm連装砲D型改二
                {
                    basepower *= 1.625;
                }
                else
                {
                    basepower *= 1.3;
                }
                break;

            case NightAttackKind.CutinTorpedoPicket:
                basepower *= 1.25;
                break;
            }

            basepower += GetLightCruiserDamageBonus() + GetItalianDamageBonus();

            //キャップ
            basepower = Math.Floor(CapDamage(basepower, 300));


            return((int)(basepower * GetAmmoDamageRate()));
        }