Exemplo n.º 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()));
        }