protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            int num = 0;

            using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.get_Current();
                    num += current.obj.Houm;
                }
            }
            double num2 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num;

            num2 += (double)((int)((double)atk_pow * 0.35));
            num2  = this.valance2 + num2;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                formation  = this.F_Data.Formation;
                formation2 = this.E_Data.Formation;
            }
            else
            {
                formation  = this.E_Data.Formation;
                formation2 = this.F_Data.Formation;
            }
            double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2);

            num2 *= formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num3         = 1.0;

            if (fatigueState == FatigueState.Exaltation)
            {
                num3 = 1.3;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num3 = 0.7;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num3 = 0.35;
            }
            num2 *= num3;
            return((int)num2);
        }
예제 #2
0
 protected bool isValidHougeki(Mem_ship ship)
 {
     if (!ship.IsFight())
     {
         return(false);
     }
     if (Mst_DataManager.Instance.Mst_stype[ship.Stype].IsSubmarine())
     {
         return(false);
     }
     return((ship.GetBattleBaseParam().Houg > 0) ? true : false);
 }
예제 #3
0
 protected virtual bool isValidRaigeki(Mem_ship ship)
 {
     if (ship.Get_DamageState() > DamageState.Shouha || !ship.IsFight())
     {
         return(false);
     }
     if (ship.GetBattleBaseParam().Raig <= 0)
     {
         return(false);
     }
     return(true);
 }
예제 #4
0
        protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            int num = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num += item.obj.Houm;
            }
            double num2 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num;

            num2 += (double)(int)((double)atk_pow * 0.35);
            num2  = valance2 + num2;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                formation  = F_Data.Formation;
                formation2 = E_Data.Formation;
            }
            else
            {
                formation  = E_Data.Formation;
                formation2 = F_Data.Formation;
            }
            double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2);

            num2 *= formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num3         = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num3 = 1.3;
                break;

            case FatigueState.Light:
                num3 = 0.7;
                break;

            case FatigueState.Distress:
                num3 = 0.35;
                break;
            }
            num2 *= num3;
            return((int)num2);
        }
예제 #5
0
        protected int getBattleAvo(FormationDatas.GetFormationKinds battleState, Mem_ship targetShip)
        {
            double num = (double)targetShip.Kaihi + Math.Sqrt(targetShip.GetBattleBaseParam().Luck * 2);
            BattleFormationKinds1 formation;

            if (!targetShip.IsEnemy())
            {
                formation = F_Data.Formation;
                BattleFormationKinds2 battleFormation = F_Data.BattleFormation;
                BattleFormationKinds1 formation2      = E_Data.Formation;
            }
            else
            {
                formation = E_Data.Formation;
                BattleFormationKinds2 battleFormation2 = E_Data.BattleFormation;
                BattleFormationKinds1 formation3       = F_Data.Formation;
            }
            num *= formationData.GetFormationParamF3(battleState, formation);
            double num2 = (int)num;

            if (num2 >= 65.0)
            {
                double num3 = 55.0 + Math.Sqrt(num2 - 65.0) * 2.0;
                num2 = (int)num3;
            }
            else if (num2 >= 40.0)
            {
                double num4 = 40.0 + Math.Sqrt(num2 - 40.0) * 3.0;
                num2 = (int)num4;
            }
            num2 += getAvoHosei(targetShip);
            if (!targetShip.IsEnemy() && commandParams != null)
            {
                double num5 = (double)commandParams.Rspp / 100.0;
                double num6 = num2 * num5;
                num2 += num6;
            }
            int    num7 = 100;
            double num8 = Mst_DataManager.Instance.Mst_ship[targetShip.Ship_id].Fuel_max;

            if (num8 != 0.0)
            {
                num7 = (int)((double)targetShip.Fuel / num8 * 100.0);
            }
            if (num7 < 75)
            {
                num2 -= (double)(75 - num7);
            }
            return((int)num2);
        }
예제 #6
0
        private void getPracticeUpInfo_To_Sougou(PracticeDeckResultFmt fmt)
        {
            int    level = this.mem_ship.get_Item(0).Level;
            double num   = Math.Sqrt((double)this.mem_ship.get_Item(0).Level);
            bool   flag  = Mst_DataManager.Instance.Mst_stype.get_Item(this.mem_ship.get_Item(0).Stype).IsTrainingShip();
            double num2  = 30.0 + Utils.GetRandDouble(0.0, 10.0, 1.0, 1) + num;

            fmt.PracticeResult.GetMemberExp = (int)num2;
            int num3 = (!flag) ? 0 : 1;

            fmt.PracticeResult.GetShipExp = new Dictionary <int, int>();
            fmt.PowerUpData = new Dictionary <int, PowUpInfo>();
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;
            double difficultShipExpKeisu        = this.getDifficultShipExpKeisu();
            double shipExpCommonKeisu           = this.getShipExpCommonKeisu();

            using (List <Mem_ship> .Enumerator enumerator = this.mem_ship.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    fmt.PracticeResult.GetShipExp.Add(current.Rid, 0);
                    fmt.PowerUpData.Add(current.Rid, default(PowUpInfo));
                    Mst_ship mst_ship2 = mst_ship.get_Item(current.Ship_id);
                    double   num4      = Math.Sqrt((double)current.Level);
                    double   num5      = 40.0 + Utils.GetRandDouble(0.0, 10.0, 1.0, 1) + (double)(num3 * 10) + Utils.GetRandDouble(0.0, num, 1.0, 1) + num4;
                    num5 = num5 * difficultShipExpKeisu * shipExpCommonKeisu;
                    fmt.PracticeResult.GetShipExp.set_Item(current.Rid, (int)num5);
                    Ship_GrowValues battleBaseParam = current.GetBattleBaseParam();
                    PowUpInfo       powUpInfo       = default(PowUpInfo);
                    double          max             = 1.0 + (num + num4) / 20.0;
                    powUpInfo.Karyoku = (int)Utils.GetRandDouble(0.0, max, 1.0, 1);
                    if (battleBaseParam.Houg + powUpInfo.Karyoku > mst_ship2.Houg_max)
                    {
                        int num6 = mst_ship2.Houg_max - mst_ship2.Houg;
                        powUpInfo.Karyoku = num6 - current.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Houg);
                    }
                    double max2 = 0.7 + (num + num4) / 20.0;
                    powUpInfo.Lucky = (int)Utils.GetRandDouble(0.0, max2, 1.0, 1);
                    if (battleBaseParam.Luck + powUpInfo.Lucky > mst_ship2.Luck_max)
                    {
                        int num7 = mst_ship2.Luck_max - mst_ship2.Luck;
                        powUpInfo.Lucky = num7 - current.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Luck);
                    }
                    fmt.PowerUpData.set_Item(current.Rid, powUpInfo);
                }
            }
        }
예제 #7
0
        private bool isValidRaigeki(Mem_ship ship, List <Mst_slotitem> slotitems)
        {
            if (ship.Get_DamageState() > DamageState.Shouha || !ship.IsFight())
            {
                return(false);
            }
            if (ship.GetBattleBaseParam().Raig <= 0)
            {
                return(false);
            }
            if (!ship.IsEnemy() || practiceFlag)
            {
                if (ship.Level >= 10 && Mst_DataManager.Instance.Mst_stype[ship.Stype].IsSubmarine())
                {
                    return(true);
                }
                if (slotitems == null || slotitems.Count == 0)
                {
                    return(false);
                }
                Mst_slotitem item = Mst_DataManager.Instance.Mst_Slotitem[41];
                if (slotitems.Contains(item))
                {
                    return(true);
                }
                return(false);
            }
            if (Mst_DataManager.Instance.Mst_stype[ship.Stype].IsSubmarine())
            {
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[ship.Ship_id];
                return((mst_ship.Yomi.Equals("flagship") || mst_ship.Yomi.Equals("elite")) ? true : false);
            }
            if (slotitems == null || slotitems.Count == 0)
            {
                return(false);
            }
            Mst_slotitem item2 = Mst_DataManager.Instance.Mst_Slotitem[541];

            if (slotitems.Contains(item2))
            {
                return(true);
            }
            return(false);
        }
예제 #8
0
        private void getPracticeUpInfo_To_Taisen(PracticeDeckResultFmt fmt)
        {
            int    level = this.mem_ship.get_Item(0).Level;
            double num   = Math.Sqrt((double)this.mem_ship.get_Item(0).Level);
            bool   flag  = Mst_DataManager.Instance.Mst_stype.get_Item(this.mem_ship.get_Item(0).Stype).IsTrainingShip();

            fmt.PracticeResult.GetMemberExp = 0;
            int num2 = (!flag) ? 0 : 1;

            fmt.PracticeResult.GetShipExp = new Dictionary <int, int>();
            fmt.PowerUpData = new Dictionary <int, PowUpInfo>();
            double difficultShipExpKeisu        = this.getDifficultShipExpKeisu();
            double shipExpCommonKeisu           = this.getShipExpCommonKeisu();
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;

            using (List <Mem_ship> .Enumerator enumerator = this.mem_ship.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    fmt.PracticeResult.GetShipExp.Add(current.Rid, 0);
                    fmt.PowerUpData.Add(current.Rid, default(PowUpInfo));
                    Mst_ship mst_ship2 = mst_ship.get_Item(current.Ship_id);
                    if (mst_ship2.Tais != 0)
                    {
                        double num3 = Math.Sqrt((double)current.Level);
                        double max  = (double)(12 + num2 * 6);
                        double num4 = 7.0 + Utils.GetRandDouble(0.0, max, 1.0, 1) + Utils.GetRandDouble(0.0, num, 1.0, 1) + num / 2.0 + num3;
                        num4 = num4 * difficultShipExpKeisu * shipExpCommonKeisu;
                        fmt.PracticeResult.GetShipExp.set_Item(current.Rid, (int)num4);
                        PowUpInfo powUpInfo = default(PowUpInfo);
                        double    max2      = 1.4 + (double)num2 * 0.3 + (num + num3) / 20.0;
                        powUpInfo.Taisen = (int)Utils.GetRandDouble(0.0, max2, 1.0, 1);
                        Ship_GrowValues battleBaseParam = current.GetBattleBaseParam();
                        if (battleBaseParam.Taisen + powUpInfo.Taisen > mst_ship2.Tais_max)
                        {
                            int num5 = mst_ship2.Tais_max - mst_ship2.Tais;
                            powUpInfo.Taisen = num5 - current.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taisen);
                        }
                        fmt.PowerUpData.set_Item(current.Rid, powUpInfo);
                    }
                }
            }
        }
예제 #9
0
        private double getShipTaikuPow(Mem_ship shipData, List <Mst_slotitem> mst_slotData, List <int> slotLevels)
        {
            double num;

            if (shipData.IsEnemy())
            {
                num = Math.Sqrt(shipData.Taiku);
            }
            else
            {
                Ship_GrowValues battleBaseParam = shipData.GetBattleBaseParam();
                num = (double)battleBaseParam.Taiku * 0.5;
            }
            double num2 = 0.0;
            double num3 = 0.0;

            for (int i = 0; i < mst_slotData.Count; i++)
            {
                Mst_slotitem mst_slotitem = mst_slotData[i];
                if (mst_slotitem.Tyku > 0)
                {
                    int slotLevel = slotLevels[i];
                    if (mst_slotitem.Type4 == 16 || mst_slotitem.Type4 == 30)
                    {
                        double a1Plus = getA1Plus(1, mst_slotitem.Tyku, slotLevel);
                        num3 += a1Plus;
                        num2 += (double)mst_slotitem.Tyku * 2.0;
                    }
                    else if (mst_slotitem.Type4 == 15)
                    {
                        double a1Plus2 = getA1Plus(2, mst_slotitem.Tyku, slotLevel);
                        num3 += a1Plus2;
                        num2 += (double)mst_slotitem.Tyku * 3.0;
                    }
                    else if (mst_slotitem.Type4 == 11)
                    {
                        num2 += (double)mst_slotitem.Tyku * 1.5;
                    }
                }
            }
            return(num + num2 + num3);
        }
예제 #10
0
        protected virtual KeyValuePair <int, int> getSubMarineAtackKeisu(List <Mem_ship> targetShips, Mem_ship attacker, List <Mst_slotitem> attacker_items, bool midnight)
        {
            if (!targetShips.Any((Mem_ship x) => x.IsFight() && Mst_DataManager.Instance.Mst_stype[x.Stype].IsSubmarine()))
            {
                return(new KeyValuePair <int, int>(0, 0));
            }
            if (!practiceFlag && attacker.IsEnemy() && attacker.Stype == 7)
            {
                string yomi = Mst_DataManager.Instance.Mst_ship[attacker.Ship_id].Yomi;
                if (!yomi.Equals("flagship"))
                {
                    return(new KeyValuePair <int, int>(0, 0));
                }
            }
            if (!midnight && attacker.Ship_id == 352)
            {
                DamageState damageState = attacker.Get_DamageState();
                if (isHaveSubmarineAirPlane(attacker_items, attacker.Onslot) && damageState <= DamageState.Tyuuha)
                {
                    return(new KeyValuePair <int, int>(2, 5));
                }
            }
            if (attacker.GetBattleBaseParam().Taisen > 0)
            {
                return(new KeyValuePair <int, int>(1, 10));
            }
            HashSet <int> hashSet = new HashSet <int>();

            hashSet.Add(6);
            hashSet.Add(7);
            hashSet.Add(10);
            hashSet.Add(16);
            hashSet.Add(17);
            HashSet <int> hashSet2 = hashSet;

            if (!midnight && hashSet2.Contains(attacker.Stype) && attacker_items.Count > 0 && isHaveSubmarineAirPlane(attacker_items, attacker.Onslot))
            {
                return(new KeyValuePair <int, int>(2, 5));
            }
            return(new KeyValuePair <int, int>(0, 0));
        }
예제 #11
0
 private bool isValidRaigeki(Mem_ship ship, List <Mst_slotitem> slotitems)
 {
     if (ship.Get_DamageState() > DamageState.Shouha || !ship.IsFight())
     {
         return(false);
     }
     if (ship.GetBattleBaseParam().Raig <= 0)
     {
         return(false);
     }
     if (!ship.IsEnemy() || this.practiceFlag)
     {
         if (ship.Level >= 10 && Mst_DataManager.Instance.Mst_stype.get_Item(ship.Stype).IsSubmarine())
         {
             return(true);
         }
         if (slotitems == null || slotitems.get_Count() == 0)
         {
             return(false);
         }
         Mst_slotitem mst_slotitem = Mst_DataManager.Instance.Mst_Slotitem.get_Item(41);
         return(slotitems.Contains(mst_slotitem));
     }
     else
     {
         if (Mst_DataManager.Instance.Mst_stype.get_Item(ship.Stype).IsSubmarine())
         {
             Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(ship.Ship_id);
             return(mst_ship.Yomi.Equals("flagship") || mst_ship.Yomi.Equals("elite"));
         }
         if (slotitems == null || slotitems.get_Count() == 0)
         {
             return(false);
         }
         Mst_slotitem mst_slotitem2 = Mst_DataManager.Instance.Mst_Slotitem.get_Item(541);
         return(slotitems.Contains(mst_slotitem2));
     }
 }
        public BattleShipFmt(Mem_ship ship)
        {
            this.Id          = ship.Rid;
            this.ShipId      = ship.Ship_id;
            this.Level       = ship.Level;
            this.NowHp       = ship.Nowhp;
            this.MaxHp       = ship.Maxhp;
            this.BattleParam = ship.GetBattleBaseParam().Copy();
            this.EscapeFlag  = ship.Escape_sts;
            this.Slot        = new List <int>();
            if (!ship.IsEnemy())
            {
                ship.Slot.ForEach(delegate(int x)
                {
                    int num = -1;
                    if (Comm_UserDatas.Instance.User_slot.ContainsKey(x))
                    {
                        num = Comm_UserDatas.Instance.User_slot.get_Item(x).Slotitem_id;
                    }
                    this.Slot.Add(num);
                });
            }
            else
            {
                ship.Slot.ForEach(delegate(int x)
                {
                    this.Slot.Add(x);
                });
            }
            Mst_slotitem mstSlotItemToExSlot = ship.GetMstSlotItemToExSlot();

            if (mstSlotItemToExSlot != null)
            {
                this.ExSlot = mstSlotItemToExSlot.Id;
            }
        }
예제 #13
0
        public BattleShipFmt(Mem_ship ship)
        {
            Id          = ship.Rid;
            ShipId      = ship.Ship_id;
            Level       = ship.Level;
            NowHp       = ship.Nowhp;
            MaxHp       = ship.Maxhp;
            BattleParam = ship.GetBattleBaseParam().Copy();
            EscapeFlag  = ship.Escape_sts;
            Slot        = new List <int>();
            if (!ship.IsEnemy())
            {
                ship.Slot.ForEach(delegate(int x)
                {
                    int item = -1;
                    if (Comm_UserDatas.Instance.User_slot.ContainsKey(x))
                    {
                        item = Comm_UserDatas.Instance.User_slot[x].Slotitem_id;
                    }
                    Slot.Add(item);
                });
            }
            else
            {
                ship.Slot.ForEach(delegate(int x)
                {
                    Slot.Add(x);
                });
            }
            Mst_slotitem mstSlotItemToExSlot = ship.GetMstSlotItemToExSlot();

            if (mstSlotItemToExSlot != null)
            {
                ExSlot = mstSlotItemToExSlot.Id;
            }
        }
 protected virtual bool isValidRaigeki(Mem_ship ship)
 {
     return(ship.Get_DamageState() <= DamageState.Shouha && ship.IsFight() && ship.GetBattleBaseParam().Raig > 0);
 }
예제 #15
0
        protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            double                num = 0.0;
            List <int>            list;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                list       = F_Data.SlotLevel[F_SubInfo[atk_ship.Rid].DeckIdx];
                formation  = F_Data.Formation;
                formation2 = E_Data.Formation;
                num        = (double)commandParams.Tspp / 100.0;
            }
            else
            {
                list       = E_Data.SlotLevel[E_SubInfo[atk_ship.Rid].DeckIdx];
                formation  = E_Data.Formation;
                formation2 = F_Data.Formation;
            }
            double num2 = 0.0;
            int    num3 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num3 += item.obj.Houm;
                num2 += getSlotPlus_HitProb(item.obj, list[item.idx]);
            }
            int    raim = Mst_DataManager.Instance.Mst_ship[atk_ship.Ship_id].Raim;
            double num4 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num3;

            num4 = num4 + (double)(int)((double)atk_pow * 0.2) + (double)raim;
            num4 = valance2 + num4 + num2;
            double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2);

            num4 *= formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num5         = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num5 = 1.3;
                break;

            case FatigueState.Light:
                num5 = 0.7;
                break;

            case FatigueState.Distress:
                num5 = 0.35;
                break;
            }
            num4 *= num5;
            double num6 = num4 * num;

            num4 += num6;
            return((int)num4);
        }
예제 #16
0
        protected KeyValuePair <BattleAtackKinds_Day, List <int> > getSpAttackKind(Mem_ship ship, List <Mst_slotitem> slotitems)
        {
            if (slotitems.Count == 0)
            {
                return(new KeyValuePair <BattleAtackKinds_Day, List <int> >(BattleAtackKinds_Day.Normal, new List <int>
                {
                    0
                }));
            }
            BattleAtackKinds_Day battleAtackKinds_Day = BattleAtackKinds_Day.Normal;
            List <int>           ret_slotitem         = new List <int>();
            Func <List <Mst_slotitem>, KeyValuePair <BattleAtackKinds_Day, List <int> > > func = delegate(List <Mst_slotitem> x)
            {
                int hougSlotData = getHougSlotData(x);
                ret_slotitem.Add(hougSlotData);
                return(new KeyValuePair <BattleAtackKinds_Day, List <int> >(BattleAtackKinds_Day.Normal, ret_slotitem));
            };
            int            num;
            BattleBaseData battleBaseData;
            Dictionary <int, BattleShipSubInfo> dictionary;

            if (ship.IsEnemy())
            {
                num            = seikuValue[1];
                battleBaseData = E_Data;
                dictionary     = E_SubInfo;
            }
            else
            {
                num            = seikuValue[0];
                battleBaseData = F_Data;
                dictionary     = F_SubInfo;
            }
            if (num <= 1)
            {
                return(func(slotitems));
            }
            if (ship.Get_DamageState() >= DamageState.Taiha)
            {
                return(func(slotitems));
            }
            Dictionary <int, List <Mst_slotitem> > dictionary2 = new Dictionary <int, List <Mst_slotitem> >();

            dictionary2.Add(1, new List <Mst_slotitem>());
            dictionary2.Add(12, new List <Mst_slotitem>());
            dictionary2.Add(10, new List <Mst_slotitem>());
            dictionary2.Add(19, new List <Mst_slotitem>());
            dictionary2.Add(4, new List <Mst_slotitem>());
            Dictionary <int, List <Mst_slotitem> > dictionary3 = dictionary2;
            double num2 = 0.0;

            foreach (var item in slotitems.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                int api_mapbattle_type = item.obj.Api_mapbattle_type3;
                num2 += (double)item.obj.Saku;
                switch (api_mapbattle_type)
                {
                case 1:
                case 2:
                case 3:
                    dictionary3[1].Add(item.obj);
                    continue;

                case 12:
                case 13:
                    dictionary3[12].Add(item.obj);
                    continue;

                case 10:
                case 11:
                    if (ship.Onslot[item.idx] > 0)
                    {
                        dictionary3[10].Add(item.obj);
                        continue;
                    }
                    break;
                }
                if (api_mapbattle_type == 19 || api_mapbattle_type == 4)
                {
                    dictionary3[api_mapbattle_type].Add(item.obj);
                }
            }
            if (dictionary3[10].Count == 0 || dictionary3[1].Count == 0)
            {
                return(func(slotitems));
            }
            double num3 = 0.0;

            foreach (var item2 in battleBaseData.ShipData.Select((Mem_ship obj, int ship_idx) => new
            {
                obj,
                ship_idx
            }))
            {
                if (item2.obj.IsFight())
                {
                    num3 += (double)item2.obj.GetBattleBaseParam().Sakuteki;
                    List <Mst_slotitem> list = battleBaseData.SlotData[item2.ship_idx];
                    if (list.Count != 0)
                    {
                        foreach (var item3 in list.Select((Mst_slotitem obj, int slot_idx) => new
                        {
                            obj,
                            slot_idx
                        }))
                        {
                            int num4 = item2.obj.Onslot[item3.slot_idx];
                            if ((item3.obj.Api_mapbattle_type3 == 10 || item3.obj.Api_mapbattle_type3 == 11) && num4 > 0)
                            {
                                int num5 = item3.obj.Saku * (int)Math.Sqrt(num4);
                                num3 += (double)num5;
                            }
                        }
                    }
                }
            }
            double num6 = (int)(Math.Sqrt(num3) + num3 * 0.1);
            int    num7 = (int)(Math.Sqrt(ship.GetBattleBaseParam().Luck) + 10.0);

            switch (num)
            {
            case 3:
                num7 = (int)((double)num7 + 10.0 + (num6 + num2 * 1.6) * 0.7);
                break;

            case 2:
                num7 = (int)((double)num7 + (num6 + num2 * 1.2) * 0.6);
                break;
            }
            if (dictionary[ship.Rid].DeckIdx == 0)
            {
                num7 += 15;
            }
            Dictionary <BattleAtackKinds_Day, int> dictionary4 = new Dictionary <BattleAtackKinds_Day, int>();

            dictionary4.Add(BattleAtackKinds_Day.Sp4, 150);
            dictionary4.Add(BattleAtackKinds_Day.Sp3, 140);
            dictionary4.Add(BattleAtackKinds_Day.Sp2, 130);
            dictionary4.Add(BattleAtackKinds_Day.Sp1, 120);
            dictionary4.Add(BattleAtackKinds_Day.Renzoku, 130);
            Dictionary <BattleAtackKinds_Day, int> dictionary5 = dictionary4;

            if (dictionary3[1].Count >= 2 && dictionary3[19].Count >= 1 && num7 > randInstance.Next(dictionary5[BattleAtackKinds_Day.Sp4]))
            {
                ret_slotitem.Add(dictionary3[10][0].Id);
                ret_slotitem.Add(dictionary3[1][0].Id);
                ret_slotitem.Add(dictionary3[1][1].Id);
                battleAtackKinds_Day = BattleAtackKinds_Day.Sp4;
            }
            else if (dictionary3[4].Count >= 1 && dictionary3[19].Count >= 1 && num7 > randInstance.Next(dictionary5[BattleAtackKinds_Day.Sp3]))
            {
                ret_slotitem.Add(dictionary3[10][0].Id);
                ret_slotitem.Add(dictionary3[1][0].Id);
                ret_slotitem.Add(dictionary3[19][0].Id);
                battleAtackKinds_Day = BattleAtackKinds_Day.Sp3;
            }
            else if (dictionary3[4].Count >= 1 && dictionary3[12].Count >= 1 && num7 > randInstance.Next(dictionary5[BattleAtackKinds_Day.Sp2]))
            {
                ret_slotitem.Add(dictionary3[10][0].Id);
                ret_slotitem.Add(dictionary3[12][0].Id);
                ret_slotitem.Add(dictionary3[1][0].Id);
                battleAtackKinds_Day = BattleAtackKinds_Day.Sp2;
            }
            else if (dictionary3[4].Count >= 1 && num7 > randInstance.Next(dictionary5[BattleAtackKinds_Day.Sp1]))
            {
                ret_slotitem.Add(dictionary3[10][0].Id);
                ret_slotitem.Add(dictionary3[1][0].Id);
                ret_slotitem.Add(dictionary3[4][0].Id);
                battleAtackKinds_Day = BattleAtackKinds_Day.Sp1;
            }
            else if (dictionary3[1].Count >= 2 && num7 > randInstance.Next(dictionary5[BattleAtackKinds_Day.Renzoku]))
            {
                ret_slotitem.Add(dictionary3[1][0].Id);
                ret_slotitem.Add(dictionary3[1][1].Id);
                battleAtackKinds_Day = BattleAtackKinds_Day.Renzoku;
            }
            if (battleAtackKinds_Day == BattleAtackKinds_Day.Normal)
            {
                return(func(slotitems));
            }
            return(new KeyValuePair <BattleAtackKinds_Day, List <int> >(battleAtackKinds_Day, ret_slotitem));
        }
예제 #17
0
        protected virtual int getHougHitProb(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int tekkouKind)
        {
            double num = 0.0;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;
            List <int>            list;

            if (!atk_ship.IsEnemy())
            {
                formation  = F_Data.Formation;
                formation2 = E_Data.Formation;
                int deckIdx = F_SubInfo[atk_ship.Rid].DeckIdx;
                list = F_Data.SlotLevel[deckIdx];
                num  = (double)commandParams.Fspp / 100.0;
            }
            else
            {
                formation  = E_Data.Formation;
                formation2 = F_Data.Formation;
                int deckIdx2 = E_SubInfo[atk_ship.Rid].DeckIdx;
                list = E_Data.SlotLevel[deckIdx2];
            }
            double num2 = 0.0;
            int    num3 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num3 += item.obj.Houm;
                num2 += getHougSlotPlus_Hit(item.obj, list[item.idx]);
            }
            double num4            = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num3;
            double num5            = valance2 + num4 + num2;
            double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.HOUGEKI, formation, formation2);

            num5 *= formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num6         = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num6 = 1.2;
                break;

            case FatigueState.Light:
                num6 = 0.8;
                break;

            case FatigueState.Distress:
                num6 = 0.5;
                break;
            }
            num5 *= num6;
            num5  = getHougHitProbUpValue(num5, atk_ship, atk_slot);
            Dictionary <BattleAtackKinds_Day, double> dictionary = new Dictionary <BattleAtackKinds_Day, double>();

            dictionary.Add(BattleAtackKinds_Day.Renzoku, 1.1);
            dictionary.Add(BattleAtackKinds_Day.Sp1, 1.3);
            dictionary.Add(BattleAtackKinds_Day.Sp2, 1.5);
            dictionary.Add(BattleAtackKinds_Day.Sp3, 1.3);
            dictionary.Add(BattleAtackKinds_Day.Sp4, 1.2);
            Dictionary <BattleAtackKinds_Day, double> dictionary2 = dictionary;

            if (dictionary2.ContainsKey(kind))
            {
                num5 *= dictionary2[kind];
            }
            num5 *= getTekkouKeisu_Hit(tekkouKind);
            double num7 = num5 * num;

            num5 += num7;
            return((int)num5);
        }
예제 #18
0
        private void setSlotData(int attackerIdx, Mem_ship attacker, List <Mst_slotitem> atk_slot, Mem_ship target, Hougeki <BattleAtackKinds_Night> setData)
        {
            Mst_stype mst_stype = Mst_DataManager.Instance.Mst_stype[target.Stype];

            if (mst_stype.IsSubmarine())
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            if (atk_slot == null || atk_slot.Count == 0)
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            int luck = attacker.GetBattleBaseParam().Luck;
            int num  = (int)((double)(luck + 15) + Math.Sqrt(attacker.Level) * 0.75);

            if (luck >= 50)
            {
                num = (int)(65.0 + (Math.Sqrt(luck) - 50.0) + Math.Sqrt(attacker.Level) * 0.8);
            }
            if (atk_slot.Any((Mst_slotitem x) => x.Id == 129))
            {
                num += 5;
            }
            List <int> list;
            List <int> list2;
            List <int> list3;
            List <int> list4;

            if (attacker.IsEnemy())
            {
                list  = eSerchLightIdxs;
                list2 = fSerchLightIdxs;
                list3 = eFlareIdxs;
                list4 = fFlareIdxs;
            }
            else
            {
                list  = fSerchLightIdxs;
                list2 = eSerchLightIdxs;
                list3 = fFlareIdxs;
                list4 = eFlareIdxs;
            }
            if (list3.Count > 0)
            {
                num += 4;
            }
            if (list4.Count > 0)
            {
                num -= 10;
            }
            if (list.Count > 0)
            {
                num += 7;
            }
            if (list2.Count > 0)
            {
                num -= 5;
            }
            if (attacker.Get_DamageState() == DamageState.Tyuuha)
            {
                num += 18;
            }
            if (attackerIdx == 0)
            {
                num += 15;
            }
            List <int> list5 = new List <int>();

            list5.Add(1);
            list5.Add(2);
            list5.Add(3);
            List <int> list6 = list5;

            list5 = new List <int>();
            list5.Add(4);
            List <int> list7 = list5;

            list5 = new List <int>();
            list5.Add(5);
            list5.Add(32);
            List <int>          list8  = list5;
            List <Mst_slotitem> list9  = new List <Mst_slotitem>();
            List <Mst_slotitem> list10 = new List <Mst_slotitem>();
            List <Mst_slotitem> list11 = new List <Mst_slotitem>();
            List <Mst_slotitem> list12 = new List <Mst_slotitem>();
            int soku = Mst_DataManager.Instance.Mst_ship[target.Ship_id].Soku;

            foreach (Mst_slotitem item in atk_slot)
            {
                if (list6.Contains(item.Api_mapbattle_type3))
                {
                    list9.Add(item);
                    list12.Add(item);
                }
                else if (list7.Contains(item.Api_mapbattle_type3))
                {
                    list10.Add(item);
                    list12.Add(item);
                }
                else if (list8.Contains(item.Api_mapbattle_type3) && !mst_stype.IsLandFacillity(soku))
                {
                    list11.Add(item);
                    list12.Add(item);
                }
            }
            if (list12.Count == 0)
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            List <BattleAtackKinds_Night> list13 = new List <BattleAtackKinds_Night>();
            Dictionary <BattleAtackKinds_Night, List <int> > dictionary = new Dictionary <BattleAtackKinds_Night, List <int> >();

            if (list9.Count >= 3)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Syu_Syu);
                list5 = new List <int>();
                list5.Add(list9[0].Id);
                list5.Add(list9[1].Id);
                list5.Add(list9[2].Id);
                List <int> value = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Syu_Syu, value);
            }
            if (list9.Count >= 2 && list10.Count >= 1)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Syu_Fuku);
                list5 = new List <int>();
                list5.Add(list9[0].Id);
                list5.Add(list9[1].Id);
                list5.Add(list10[0].Id);
                List <int> value2 = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Syu_Fuku, value2);
            }
            if (list11.Count >= 2)
            {
                list13.Add(BattleAtackKinds_Night.Rai_Rai);
                list5 = new List <int>();
                list5.Add(list11[0].Id);
                list5.Add(list11[1].Id);
                List <int> value3 = list5;
                dictionary.Add(BattleAtackKinds_Night.Rai_Rai, value3);
            }
            if (list11.Count >= 1 && list9.Count >= 1)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Rai);
                list5 = new List <int>();
                list5.Add(list9[0].Id);
                list5.Add(list11[0].Id);
                List <int> value4 = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Rai, value4);
            }
            if (list12.Count >= 2)
            {
                list13.Add(BattleAtackKinds_Night.Renzoku);
                list5 = new List <int>();
                list5.Add(list12[0].Id);
                list5.Add(list12[1].Id);
                List <int> value5 = list5;
                dictionary.Add(BattleAtackKinds_Night.Renzoku, value5);
            }
            setData.SpType = BattleAtackKinds_Night.Normal;
            setData.Slot_List.Add(list12[0].Id);
            Dictionary <BattleAtackKinds_Night, int> dictionary2 = new Dictionary <BattleAtackKinds_Night, int>();

            dictionary2.Add(BattleAtackKinds_Night.Syu_Syu_Syu, 140);
            dictionary2.Add(BattleAtackKinds_Night.Syu_Syu_Fuku, 130);
            dictionary2.Add(BattleAtackKinds_Night.Rai_Rai, 122);
            dictionary2.Add(BattleAtackKinds_Night.Syu_Rai, 115);
            dictionary2.Add(BattleAtackKinds_Night.Renzoku, 110);
            Dictionary <BattleAtackKinds_Night, int> dictionary3 = dictionary2;

            foreach (BattleAtackKinds_Night item2 in list13)
            {
                int num2 = randInstance.Next(dictionary3[item2]);
                if (num > num2)
                {
                    setData.SpType    = item2;
                    setData.Slot_List = dictionary[item2];
                    break;
                }
            }
        }
예제 #19
0
        private void getPracticeUpInfo_To_Kouku(PracticeDeckResultFmt fmt)
        {
            int    level = this.mem_ship.get_Item(0).Level;
            double num   = Math.Sqrt((double)this.mem_ship.get_Item(0).Level);
            bool   flag  = Mst_DataManager.Instance.Mst_stype.get_Item(this.mem_ship.get_Item(0).Stype).IsTrainingShip();

            fmt.PracticeResult.GetMemberExp = 0;
            int num2 = (!flag) ? 0 : 1;

            fmt.PracticeResult.GetShipExp = new Dictionary <int, int>();
            fmt.PowerUpData = new Dictionary <int, PowUpInfo>();
            double difficultShipExpKeisu        = this.getDifficultShipExpKeisu();
            double shipExpCommonKeisu           = this.getShipExpCommonKeisu();
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;

            using (List <Mem_ship> .Enumerator enumerator = this.mem_ship.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    fmt.PracticeResult.GetShipExp.Add(current.Rid, 0);
                    fmt.PowerUpData.Add(current.Rid, default(PowUpInfo));
                    Mst_ship mst_ship2 = mst_ship.get_Item(current.Ship_id);
                    if (mst_ship2.Stype != 13)
                    {
                        if (mst_ship2.Stype == 14)
                        {
                            List <Mst_slotitem> mstSlotItems = current.GetMstSlotItems();
                            bool flag2 = false;
                            for (int i = 0; i < mstSlotItems.get_Count(); i++)
                            {
                                SlotitemCategory slotitem_type = Mst_DataManager.Instance.Mst_equip_category.get_Item(mstSlotItems.get_Item(i).Type3).Slotitem_type;
                                if (slotitem_type == SlotitemCategory.Kanjouki || slotitem_type == SlotitemCategory.Suijouki)
                                {
                                    flag2 = true;
                                    break;
                                }
                            }
                            if (!flag2)
                            {
                                continue;
                            }
                        }
                        double num3 = Math.Sqrt((double)current.Level);
                        double max  = (double)(14 + num2 * 7);
                        double num4 = 10.0 + Utils.GetRandDouble(0.0, max, 1.0, 1) + Utils.GetRandDouble(0.0, num, 1.0, 1) + num / 2.0 + num3;
                        num4 = num4 * difficultShipExpKeisu * shipExpCommonKeisu;
                        fmt.PracticeResult.GetShipExp.set_Item(current.Rid, (int)num4);
                        Ship_GrowValues battleBaseParam = current.GetBattleBaseParam();
                        PowUpInfo       powUpInfo       = default(PowUpInfo);
                        double          max2            = 1.5 + (double)num2 * 0.2 + (num + num3) / 20.0;
                        powUpInfo.Taiku = (int)Utils.GetRandDouble(0.0, max2, 1.0, 1);
                        if (battleBaseParam.Taiku + powUpInfo.Taiku > mst_ship2.Tyku_max)
                        {
                            int num5 = mst_ship2.Tyku_max - mst_ship2.Tyku;
                            powUpInfo.Taiku = num5 - current.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Tyku);
                        }
                        if (this.motherBGroup.Contains(current.Stype))
                        {
                            double max3 = 1.2 + (num + num3) / 20.0;
                            powUpInfo.Karyoku = (int)Utils.GetRandDouble(0.0, max3, 1.0, 1);
                            if (battleBaseParam.Houg + powUpInfo.Karyoku > mst_ship2.Houg_max)
                            {
                                int num6 = mst_ship2.Houg_max - mst_ship2.Houg;
                                powUpInfo.Karyoku = num6 - current.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Houg);
                            }
                        }
                        fmt.PowerUpData.set_Item(current.Rid, powUpInfo);
                    }
                }
            }
        }
예제 #20
0
        private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight)
        {
            List <int> list;

            if (atk_ship.IsEnemy())
            {
                int deckIdx = E_SubInfo[atk_ship.Rid].DeckIdx;
                list = E_Data.SlotLevel[deckIdx];
            }
            else
            {
                int deckIdx2 = F_SubInfo[atk_ship.Rid].DeckIdx;
                list = F_Data.SlotLevel[deckIdx2];
            }
            double num  = 0.0;
            int    num2 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num2 += item.obj.Houm;
                num  += getSlotPlus_HitProb(item.obj, list[item.idx]);
            }
            double num3 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(atk_ship.Level) * 2.0 + (double)num2;
            double num4 = (!atk_ship.IsEnemy()) ? fValance2 : eValance2;

            num3 = num4 + num3;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                formation  = F_Data.Formation;
                formation2 = E_Data.Formation;
            }
            else
            {
                formation  = E_Data.Formation;
                formation2 = F_Data.Formation;
            }
            double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.MIDNIGHT, formation, formation2);

            num3 = num3 * spHitProbKeisu[kind] * formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num5         = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num5 = 1.2;
                break;

            case FatigueState.Light:
                num5 = 0.8;
                break;

            case FatigueState.Distress:
                num5 = 0.5;
                break;
            }
            num3 *= num5;
            if (atk_ship.Stype == 5 || atk_ship.Stype == 6)
            {
                int num6 = 0;
                if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[6]))
                {
                    num6 = 10;
                }
                else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[50]))
                {
                    num6 = 15;
                }
                num3 += (double)num6;
            }
            if (deckSearchLight.Count > 0)
            {
                num3 += 7.0;
            }
            num3 = getMidnightHitProbUpValue(num3, atk_ship, atk_slot);
            return((int)num3);
        }
예제 #21
0
        private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight)
        {
            List <int> list;

            if (atk_ship.IsEnemy())
            {
                int deckIdx = this.E_SubInfo.get_Item(atk_ship.Rid).DeckIdx;
                list = this.E_Data.SlotLevel.get_Item(deckIdx);
            }
            else
            {
                int deckIdx2 = this.F_SubInfo.get_Item(atk_ship.Rid).DeckIdx;
                list = this.F_Data.SlotLevel.get_Item(deckIdx2);
            }
            double num  = 0.0;
            int    num2 = 0;

            using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.get_Current();
                    num2 += current.obj.Houm;
                    num  += this.getSlotPlus_HitProb(current.obj, list.get_Item(current.idx));
                }
            }
            double num3 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num2;
            double num4 = (!atk_ship.IsEnemy()) ? this.fValance2 : this.eValance2;

            num3 = num4 + num3;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                formation  = this.F_Data.Formation;
                formation2 = this.E_Data.Formation;
            }
            else
            {
                formation  = this.E_Data.Formation;
                formation2 = this.F_Data.Formation;
            }
            double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.MIDNIGHT, formation, formation2);

            num3 = num3 * this.spHitProbKeisu.get_Item(kind) * formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num5         = 1.0;

            if (fatigueState == FatigueState.Exaltation)
            {
                num5 = 1.2;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num5 = 0.8;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num5 = 0.5;
            }
            num3 *= num5;
            if (atk_ship.Stype == 5 || atk_ship.Stype == 6)
            {
                int num6 = 0;
                if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(6)))
                {
                    num6 = 10;
                }
                else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(50)))
                {
                    num6 = 15;
                }
                num3 += (double)num6;
            }
            if (deckSearchLight.get_Count() > 0)
            {
                num3 += 7.0;
            }
            num3 = this.getMidnightHitProbUpValue(num3, atk_ship, atk_slot);
            return((int)num3);
        }
예제 #22
0
        private void setSlotData(int attackerIdx, Mem_ship attacker, List <Mst_slotitem> atk_slot, Mem_ship target, Hougeki <BattleAtackKinds_Night> setData)
        {
            Mst_stype mst_stype = Mst_DataManager.Instance.Mst_stype.get_Item(target.Stype);

            if (mst_stype.IsSubmarine())
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            if (atk_slot == null || atk_slot.get_Count() == 0)
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            int luck = attacker.GetBattleBaseParam().Luck;
            int num  = (int)((double)(luck + 15) + Math.Sqrt((double)attacker.Level) * 0.75);

            if (luck >= 50)
            {
                num = (int)(65.0 + (Math.Sqrt((double)luck) - 50.0) + Math.Sqrt((double)attacker.Level) * 0.8);
            }
            if (Enumerable.Any <Mst_slotitem>(atk_slot, (Mst_slotitem x) => x.Id == 129))
            {
                num += 5;
            }
            List <int> list;
            List <int> list2;
            List <int> list3;
            List <int> list4;

            if (attacker.IsEnemy())
            {
                list  = this.eSerchLightIdxs;
                list2 = this.fSerchLightIdxs;
                list3 = this.eFlareIdxs;
                list4 = this.fFlareIdxs;
            }
            else
            {
                list  = this.fSerchLightIdxs;
                list2 = this.eSerchLightIdxs;
                list3 = this.fFlareIdxs;
                list4 = this.eFlareIdxs;
            }
            if (list3.get_Count() > 0)
            {
                num += 4;
            }
            if (list4.get_Count() > 0)
            {
                num -= 10;
            }
            if (list.get_Count() > 0)
            {
                num += 7;
            }
            if (list2.get_Count() > 0)
            {
                num -= 5;
            }
            if (attacker.Get_DamageState() == DamageState.Tyuuha)
            {
                num += 18;
            }
            if (attackerIdx == 0)
            {
                num += 15;
            }
            List <int> list5 = new List <int>();

            list5.Add(1);
            list5.Add(2);
            list5.Add(3);
            List <int> list6 = list5;

            list5 = new List <int>();
            list5.Add(4);
            List <int> list7 = list5;

            list5 = new List <int>();
            list5.Add(5);
            list5.Add(32);
            List <int>          list8  = list5;
            List <Mst_slotitem> list9  = new List <Mst_slotitem>();
            List <Mst_slotitem> list10 = new List <Mst_slotitem>();
            List <Mst_slotitem> list11 = new List <Mst_slotitem>();
            List <Mst_slotitem> list12 = new List <Mst_slotitem>();
            int soku = Mst_DataManager.Instance.Mst_ship.get_Item(target.Ship_id).Soku;

            using (List <Mst_slotitem> .Enumerator enumerator = atk_slot.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mst_slotitem current = enumerator.get_Current();
                    if (list6.Contains(current.Api_mapbattle_type3))
                    {
                        list9.Add(current);
                        list12.Add(current);
                    }
                    else if (list7.Contains(current.Api_mapbattle_type3))
                    {
                        list10.Add(current);
                        list12.Add(current);
                    }
                    else if (list8.Contains(current.Api_mapbattle_type3) && !mst_stype.IsLandFacillity(soku))
                    {
                        list11.Add(current);
                        list12.Add(current);
                    }
                }
            }
            if (list12.get_Count() == 0)
            {
                setData.Slot_List.Add(0);
                setData.SpType = BattleAtackKinds_Night.Normal;
                return;
            }
            List <BattleAtackKinds_Night> list13 = new List <BattleAtackKinds_Night>();
            Dictionary <BattleAtackKinds_Night, List <int> > dictionary = new Dictionary <BattleAtackKinds_Night, List <int> >();

            if (list9.get_Count() >= 3)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Syu_Syu);
                list5 = new List <int>();
                list5.Add(list9.get_Item(0).Id);
                list5.Add(list9.get_Item(1).Id);
                list5.Add(list9.get_Item(2).Id);
                List <int> list14 = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Syu_Syu, list14);
            }
            if (list9.get_Count() >= 2 && list10.get_Count() >= 1)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Syu_Fuku);
                list5 = new List <int>();
                list5.Add(list9.get_Item(0).Id);
                list5.Add(list9.get_Item(1).Id);
                list5.Add(list10.get_Item(0).Id);
                List <int> list15 = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Syu_Fuku, list15);
            }
            if (list11.get_Count() >= 2)
            {
                list13.Add(BattleAtackKinds_Night.Rai_Rai);
                list5 = new List <int>();
                list5.Add(list11.get_Item(0).Id);
                list5.Add(list11.get_Item(1).Id);
                List <int> list16 = list5;
                dictionary.Add(BattleAtackKinds_Night.Rai_Rai, list16);
            }
            if (list11.get_Count() >= 1 && list9.get_Count() >= 1)
            {
                list13.Add(BattleAtackKinds_Night.Syu_Rai);
                list5 = new List <int>();
                list5.Add(list9.get_Item(0).Id);
                list5.Add(list11.get_Item(0).Id);
                List <int> list17 = list5;
                dictionary.Add(BattleAtackKinds_Night.Syu_Rai, list17);
            }
            if (list12.get_Count() >= 2)
            {
                list13.Add(BattleAtackKinds_Night.Renzoku);
                list5 = new List <int>();
                list5.Add(list12.get_Item(0).Id);
                list5.Add(list12.get_Item(1).Id);
                List <int> list18 = list5;
                dictionary.Add(BattleAtackKinds_Night.Renzoku, list18);
            }
            setData.SpType = BattleAtackKinds_Night.Normal;
            setData.Slot_List.Add(list12.get_Item(0).Id);
            Dictionary <BattleAtackKinds_Night, int> dictionary2 = new Dictionary <BattleAtackKinds_Night, int>();

            dictionary2.Add(BattleAtackKinds_Night.Syu_Syu_Syu, 140);
            dictionary2.Add(BattleAtackKinds_Night.Syu_Syu_Fuku, 130);
            dictionary2.Add(BattleAtackKinds_Night.Rai_Rai, 122);
            dictionary2.Add(BattleAtackKinds_Night.Syu_Rai, 115);
            dictionary2.Add(BattleAtackKinds_Night.Renzoku, 110);
            Dictionary <BattleAtackKinds_Night, int> dictionary3 = dictionary2;

            using (List <BattleAtackKinds_Night> .Enumerator enumerator2 = list13.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    BattleAtackKinds_Night current2 = enumerator2.get_Current();
                    int num2 = this.randInstance.Next(dictionary3.get_Item(current2));
                    if (num > num2)
                    {
                        setData.SpType    = current2;
                        setData.Slot_List = dictionary.get_Item(current2);
                        break;
                    }
                }
            }
        }
예제 #23
0
        protected virtual int getSubmarineAttackValue(KeyValuePair <int, int> submarineKeisu, Mem_ship attacker, List <Mst_slotitem> attackerSlot, List <int> slotLevels)
        {
            if (submarineKeisu.Key == 0)
            {
                return(0);
            }
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;

            if (!attacker.IsEnemy())
            {
                formation       = F_Data.Formation;
                battleFormation = F_Data.BattleFormation;
                BattleFormationKinds1 formation2 = E_Data.Formation;
            }
            else
            {
                formation       = E_Data.Formation;
                battleFormation = E_Data.BattleFormation;
                BattleFormationKinds1 formation3 = F_Data.Formation;
            }
            int           value   = submarineKeisu.Value;
            HashSet <int> hashSet = new HashSet <int>();

            hashSet.Add(7);
            hashSet.Add(8);
            hashSet.Add(11);
            hashSet.Add(14);
            hashSet.Add(15);
            hashSet.Add(25);
            hashSet.Add(26);
            hashSet.Add(40);
            HashSet <int> hashSet2 = hashSet;
            HashSet <int> hashSet3 = new HashSet <int>();
            int           num      = 0;
            double        num2     = 0.0;

            foreach (var item in attackerSlot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                if (hashSet2.Contains(item.obj.Api_mapbattle_type3))
                {
                    num += item.obj.Tais;
                    hashSet3.Add(item.obj.Api_mapbattle_type3);
                }
                if ((item.obj.Api_mapbattle_type3 == 14 || item.obj.Api_mapbattle_type3 == 15 || item.obj.Api_mapbattle_type3 == 40) && slotLevels[item.idx] > 0)
                {
                    num2 += Math.Sqrt(slotLevels[item.idx]);
                }
            }
            double num3                 = Math.Sqrt(attacker.GetBattleBaseParam().Taisen * 2);
            double num4                 = (double)num * 1.5;
            double num5                 = valanceSubmarine1 + num3 + num4 + num2;
            double formationParamF      = formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.SUBMARINE, formation);
            double formationParamBattle = formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.SUBMARINE, battleFormation);
            double num6                 = 1.0;

            if (hashSet3.Contains(15) && (hashSet3.Contains(14) || hashSet3.Contains(40)))
            {
                num6 = 1.15;
            }
            num5 *= formationParamBattle;
            num5 *= formationParamF;
            num5 *= num6;
            switch (attacker.Get_DamageState())
            {
            case DamageState.Tyuuha:
                num5 *= 0.7;
                break;

            case DamageState.Taiha:
                num5 *= 0.4;
                break;
            }
            num5 = Math.Floor(num5);
            if (num5 > 100.0)
            {
                num5 = 100.0 + Math.Sqrt(num5 - 100.0);
            }
            return((int)num5);
        }
예제 #24
0
        protected int getSubmarineHitProb(Mem_ship attackShip, List <Mst_slotitem> attackSlot, List <int> slotLevels)
        {
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!attackShip.IsEnemy())
            {
                formation = F_Data.Formation;
                BattleFormationKinds2 battleFormation = F_Data.BattleFormation;
                formation2 = E_Data.Formation;
            }
            else
            {
                formation = E_Data.Formation;
                BattleFormationKinds2 battleFormation2 = E_Data.BattleFormation;
                formation2 = F_Data.Formation;
            }
            int    num  = 0;
            double num2 = 0.0;

            foreach (var item in attackSlot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                if (item.obj.Api_mapbattle_type3 == 14)
                {
                    num += item.obj.Tais;
                }
                if ((item.obj.Api_mapbattle_type3 == 14 || item.obj.Api_mapbattle_type3 == 15 || item.obj.Api_mapbattle_type3 == 40) && slotLevels[item.idx] > 0)
                {
                    num2 += Math.Sqrt(slotLevels[item.idx]) * 1.3;
                }
            }
            double num3            = Math.Sqrt((double)attackShip.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt(attackShip.Level * 2) + (double)num * 2.0;
            double num4            = valanceSubmarine2 + num3 + num2;
            double formationParamF = formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.SUBMARINE, formation, formation2);

            num4 *= formationParamF;
            FatigueState fatigueState = attackShip.Get_FatigueState();
            double       num5         = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num5 = 1.2;
                break;

            case FatigueState.Normal:
                num5 = 1.0;
                break;

            case FatigueState.Light:
                num5 = 0.8;
                break;

            case FatigueState.Distress:
                num5 = 0.5;
                break;
            }
            double num6 = num4 * num5;

            if (practiceFlag)
            {
                num6 *= 1.5;
            }
            return((int)num6);
        }
        protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            double                num = 0.0;
            List <int>            list;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

            if (!atk_ship.IsEnemy())
            {
                list       = this.F_Data.SlotLevel.get_Item(this.F_SubInfo.get_Item(atk_ship.Rid).DeckIdx);
                formation  = this.F_Data.Formation;
                formation2 = this.E_Data.Formation;
                num        = (double)this.commandParams.Tspp / 100.0;
            }
            else
            {
                list       = this.E_Data.SlotLevel.get_Item(this.E_SubInfo.get_Item(atk_ship.Rid).DeckIdx);
                formation  = this.E_Data.Formation;
                formation2 = this.F_Data.Formation;
            }
            double num2 = 0.0;
            int    num3 = 0;

            using (var enumerator = Enumerable.Select(atk_slot, (Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.get_Current();
                    num3 += current.obj.Houm;
                    num2 += this.getSlotPlus_HitProb(current.obj, list.get_Item(current.idx));
                }
            }
            int    raim = Mst_DataManager.Instance.Mst_ship.get_Item(atk_ship.Ship_id).Raim;
            double num4 = Math.Sqrt((double)atk_ship.GetBattleBaseParam().Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num3;

            num4 = num4 + (double)((int)((double)atk_pow * 0.2)) + (double)raim;
            num4 = this.valance2 + num4 + num2;
            double formationParamF = this.formationData.GetFormationParamF2(FormationDatas.GetFormationKinds.RAIGEKI, formation, formation2);

            num4 *= formationParamF;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num5         = 1.0;

            if (fatigueState == FatigueState.Exaltation)
            {
                num5 = 1.3;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num5 = 0.7;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num5 = 0.35;
            }
            num4 *= num5;
            double num6 = num4 * num;

            num4 += num6;
            return((int)num4);
        }