Пример #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 AllSlotInstance)
            {
                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(AllSlotMaster.ToArray(), ShipID, 126, false) == DayAttackKind.AirAttack)                            //126=伊168; 対潜攻撃が空撃なら
            {
                basepower += 8;
            }
            else                        //爆雷攻撃なら
            {
                basepower += 13;
            }


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

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

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

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #2
0
        /// <summary>
        /// 砲撃戦での砲撃威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateShellingPower(int engagementForm = 1)
        {
            var attackKind = Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1);

            if (attackKind == DayAttackKind.AirAttack || attackKind == DayAttackKind.CutinAirAttack)
            {
                return(0);
            }


            double basepower = FirepowerTotal + GetDayBattleEquipmentLevelBonus() + GetCombinedFleetShellingDamageBonus() + 5;

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

            basepower += GetLightCruiserDamageBonus() + GetItalianDamageBonus();

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

            // 弾着観測射撃
            switch (attackKind)
            {
            case DayAttackKind.DoubleShelling:
            case DayAttackKind.CutinMainRadar:
                basepower *= 1.2;
                break;

            case DayAttackKind.CutinMainSub:
                basepower *= 1.1;
                break;

            case DayAttackKind.CutinMainAP:
                basepower *= 1.3;
                break;

            case DayAttackKind.CutinMainMain:
                basepower *= 1.5;
                break;

            case DayAttackKind.ZuiunMultiAngle:
                basepower *= 1.35;
                break;

            case DayAttackKind.SeaAirMultiAngle:
                basepower *= 1.3;
                break;
            }

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #3
0
        /// <summary>
        /// 夜戦での威力を求めます。
        /// </summary>
        private int CalculateNightBattlePower()
        {
            double basepower = FirepowerTotal + TorpedoTotal + GetNightBattleEquipmentLevelBonus();

            basepower *= GetHPDamageBonus();

            switch (Calculator.GetNightAttackKind(AllSlotMaster.ToArray(), ShipID, -1))
            {
            case NightAttackKind.DoubleShelling:
                basepower *= 1.2;
                break;

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

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

                case 2:
                    basepower *= 1.6;
                    break;

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

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

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

            basepower += GetLightCruiserDamageBonus() + GetItalianDamageBonus();

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


            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #4
0
        /// <summary>
        /// 砲撃戦での空撃威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateAircraftPower(int engagementForm = 1)
        {
            if (Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1, false) != DayAttackKind.AirAttack)
            {
                return(0);                              //空撃以外は除外
            }
            double basepower = Math.Floor((FirepowerTotal + TorpedoTotal + Math.Floor(BomberTotal * 1.3) + GetAircraftEquipmentLevelBonus() + GetCombinedFleetShellingDamageBonus()) * 1.5) + 55;

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

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

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #5
0
        /// <summary>
        /// 砲撃戦での空撃威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateAircraftPower(int engagementForm = 1)
        {
            var attackKind = Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1, false);

            if (attackKind != DayAttackKind.AirAttack && attackKind != DayAttackKind.CutinAirAttack)
            {
                return(0);
            }


            double basepower = Math.Floor((FirepowerTotal + TorpedoTotal + Math.Floor(BomberTotal * 1.3) + GetAircraftEquipmentLevelBonus() + GetCombinedFleetShellingDamageBonus()) * 1.5) + 55;

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

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


            // 空母カットイン
            if (attackKind == DayAttackKind.CutinAirAttack)
            {
                var kind = Calculator.GetDayAirAttackCutinKind(SlotInstanceMaster);
                switch (kind)
                {
                case DayAirAttackCutinKind.FighterBomberAttacker:
                    basepower *= 1.25;
                    break;

                case DayAirAttackCutinKind.BomberBomberAttacker:
                    basepower *= 1.20;
                    break;

                case DayAirAttackCutinKind.BomberAttacker:
                    basepower *= 1.15;
                    break;
                }
            }

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #6
0
        /// <summary>
        /// 砲撃戦での砲撃威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateShellingPower(int engagementForm = 1)
        {
            if (Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1, false) != 0)
            {
                return(0);                              //砲撃以外は除外
            }
            double basepower = FirepowerTotal + GetDayBattleEquipmentLevelBonus() + GetCombinedFleetShellingDamageBonus() + 5;

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

            basepower += GetLightCruiserDamageBonus() + GetItalianDamageBonus();

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

            //弾着
            switch (Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1))
            {
            case DayAttackKind.DoubleShelling:
            case DayAttackKind.CutinMainLadar:
                basepower *= 1.2;
                break;

            case DayAttackKind.CutinMainSub:
                basepower *= 1.1;
                break;

            case DayAttackKind.CutinMainAP:
                basepower *= 1.3;
                break;

            case DayAttackKind.CutinMainMain:
                basepower *= 1.5;
                break;
            }

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #7
0
        /// <summary>
        /// 砲撃戦での砲撃威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateShellingPower(int engagementForm = 1)
        {
            if (Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1, false) != 0)
            {
                return(0);                              //砲撃以外は除外
            }
            double basepower = FirepowerTotal + GetDayBattleEquipmentLevelBonus() + GetCombinedFleetShellingDamageBonus() + 5;

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

            basepower += GetLightCruiserDamageBonus();

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

            //弾着
            switch (Calculator.GetDayAttackKind(AllSlotMaster.ToArray(), ShipID, -1))
            {
            case 2:                             //連撃
            case 4:                             //主砲/電探
                basepower *= 1.2;
                break;

            case 3:                             //主砲/副砲
                basepower *= 1.1;
                break;

            case 5:                             //主砲/徹甲弾
                basepower *= 1.3;
                break;

            case 6:                             //主砲/主砲
                basepower *= 1.5;
                break;
            }

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #8
0
        /// <summary>
        /// 夜戦での威力を求めます。
        /// </summary>
        private int CalculateNightBattlePower()
        {
            double basepower = FirepowerTotal + TorpedoTotal + GetNightBattleEquipmentLevelBonus();

            basepower *= GetHPDamageBonus();

            switch (Calculator.GetNightAttackKind(AllSlotMaster.ToArray(), ShipID, -1))
            {
            case 1:                     //連撃
                basepower *= 1.2;
                break;

            case 2:                     //主砲/魚雷
                basepower *= 1.3;
                break;

            case 3:                     //魚雷x2
                basepower *= 1.5;
                break;

            case 4:                     //主砲x2/副砲
                basepower *= 1.75;
                break;

            case 5:                     //主砲x3
                basepower *= 2.0;
                break;
            }

            basepower += GetLightCruiserDamageBonus();

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


            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #9
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()));
        }
Пример #10
0
        /// <summary>
        /// 砲撃戦での対潜威力を求めます。
        /// </summary>
        /// <param name="engagementForm">交戦形態。既定値は 1 (同航戦) です。</param>
        private int CalculateAntiSubmarinePower(int engagementForm = 1)
        {
            if (!CanAttackSubmarine)
            {
                return(0);
            }

            double eqpower = 0;

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

                switch (slot.MasterEquipment.CategoryType)
                {
                case EquipmentTypes.CarrierBasedBomber:
                case EquipmentTypes.CarrierBasedTorpedo:
                case EquipmentTypes.SeaplaneBomber:
                case EquipmentTypes.Sonar:
                case EquipmentTypes.DepthCharge:
                case EquipmentTypes.Autogyro:
                case EquipmentTypes.ASPatrol:
                case EquipmentTypes.SonarLarge:
                    eqpower += slot.MasterEquipment.ASW;
                    break;
                }
            }

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

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


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


            //対潜シナジー

            int depthChargeCount          = 0;
            int depthChargeProjectorCount = 0;
            int sonarCount      = 0;    // ソナーと大型ソナーの合算
            int largeSonarCount = 0;

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

                switch (slot.CategoryType)
                {
                case EquipmentTypes.Sonar:
                    sonarCount++;
                    break;

                case EquipmentTypes.DepthCharge:
                    if (slot.IsDepthCharge)
                    {
                        depthChargeCount++;
                    }
                    else
                    {
                        depthChargeProjectorCount++;
                    }
                    break;

                case EquipmentTypes.SonarLarge:
                    largeSonarCount++;
                    sonarCount++;
                    break;
                }
            }

            double projector_sonar  = depthChargeProjectorCount > 0 && sonarCount > 0 ? 1.15 : 1;
            double charge_projector = depthChargeCount > 0 && depthChargeProjectorCount > 0 ? 1.1 : 1;
            double charge_sonar     = (!(projector_sonar > 1 && charge_projector > 1 && largeSonarCount > 0) && depthChargeCount > 0 && sonarCount > 0) ? 0.15 : 0;

            basepower *= projector_sonar * (charge_projector + charge_sonar);


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

            return((int)(basepower * GetAmmoDamageRate()));
        }
Пример #11
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 AllSlotInstance)
            {
                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(AllSlotMaster.ToArray(), ShipID, 126, false) == DayAttackKind.AirAttack)                            //126=伊168; 対潜攻撃が空撃なら
            {
                basepower += 8;
            }
            else                        //爆雷攻撃なら
            {
                basepower += 13;
            }


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


            //対潜シナジー

            int depthChargeCount        = 0;
            int depthChargeThrowerCount = 0;
            int sonarCount      = 0;                            // ソナーと大型ソナーの合算
            int largeSonarCount = 0;

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

                switch (slot.CategoryType)
                {
                case 14:                                // ソナー
                    sonarCount++;
                    break;

                case 15:                                // 爆雷/投射機
                    if (Calculator.DepthChargeList.Contains(slot.EquipmentID))
                    {
                        depthChargeCount++;
                    }
                    else
                    {
                        depthChargeThrowerCount++;
                    }
                    break;

                case 40:                                // 大型ソナー
                    largeSonarCount++;
                    sonarCount++;
                    break;
                }
            }

            double thrower_sonar  = depthChargeThrowerCount > 0 && sonarCount > 0 ? 1.15 : 1;
            double charge_thrower = depthChargeCount > 0 && depthChargeThrowerCount > 0 ? 1.1 : 1;
            double charge_sonar   = (!(thrower_sonar > 1 && charge_thrower > 1 && largeSonarCount > 0) && depthChargeCount > 0 && sonarCount > 0) ? 0.15 : 0;

            basepower *= thrower_sonar * (charge_thrower + charge_sonar);


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

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