Exemplo n.º 1
0
        private SerializableDictionary <int, int> getShipExpSortie(BattleWinRankKinds rank, int mvpShip, int shipBaseExp)
        {
            SerializableDictionary <int, int> serializableDictionary = new SerializableDictionary <int, int>();
            float  num  = 1.5f;
            int    num2 = 2;
            double num3 = 4.5;

            new List <int>();
            foreach (KeyValuePair <int, BattleShipSubInfo> item in F_SubInfo)
            {
                Mem_ship shipInstance = item.Value.ShipInstance;
                double   num4         = shipInstance.IsFight() ? shipBaseExp : 0;
                if (item.Value.DeckIdx == 0)
                {
                    num4 *= (double)num;
                }
                num4 *= num3;
                serializableDictionary.Add(shipInstance.Rid, (int)num4);
            }
            if (mvpShip <= 0)
            {
                return(serializableDictionary);
            }
            double num5 = serializableDictionary[mvpShip] * num2;

            serializableDictionary[mvpShip] = (int)num5;
            return(serializableDictionary);
        }
Exemplo n.º 2
0
        private void setEscapeData(IEnumerable <Mem_ship> ships, IEnumerable <Mem_ship> enableTowShips)
        {
            List <int> list  = new List <int>();
            List <int> list2 = new List <int>();

            using (IEnumerator <Mem_ship> enumerator = ships.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    if (current.IsFight())
                    {
                        DamageState damageState = current.Get_DamageState();
                        bool        flag        = Enumerable.Contains <Mem_ship>(enableTowShips, current);
                        if (damageState == DamageState.Taiha)
                        {
                            list.Add(current.Rid);
                        }
                        else if (damageState == DamageState.Normal && current.Stype == 2 && flag)
                        {
                            list2.Add(current.Rid);
                        }
                    }
                }
            }
            if (list.get_Count() > 0 && list2.get_Count() > 0)
            {
                this.EscapeShips = list;
                this.TowShips    = list2;
            }
        }
Exemplo n.º 3
0
        protected bool CanAirAttack(Mem_ship ship, List <Mst_slotitem> slotData)
        {
            if (!ship.IsFight())
            {
                return(false);
            }
            HashSet <int> hashSet = new HashSet <int>();

            hashSet.Add(7);
            hashSet.Add(8);
            HashSet <int> hashSet2 = hashSet;
            int           num      = 0;
            int           num2     = 0;
            int           num3     = 0;

            for (int i = 0; i < slotData.Count(); i++)
            {
                Mst_slotitem mst_slotitem = slotData[i];
                if (mst_slotitem != null && hashSet2.Contains(mst_slotitem.Api_mapbattle_type3))
                {
                    num  += ship.Onslot[i];
                    num2 += mst_slotitem.Baku;
                    num3 += mst_slotitem.Raig;
                }
            }
            if (num <= 0)
            {
                return(false);
            }
            if (getAirAtackPow(num2, num3) <= 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
        protected void setPlaneData(BattleBaseData baseData, Dictionary <int, BattleShipSubInfo> subInfo, List <int> planeFrom, out Dictionary <Mem_ship, List <FighterInfo> > fighterData)
        {
            fighterData = null;
            int count = baseData.ShipData.Count;

            if (count > 0)
            {
                Dictionary <Mem_ship, List <FighterInfo> > dictionary = new Dictionary <Mem_ship, List <FighterInfo> >();
                foreach (var item3 in baseData.SlotData.Select((List <Mst_slotitem> items, int idx) => new
                {
                    items,
                    idx
                }))
                {
                    Mem_ship mem_ship = baseData.ShipData[item3.idx];
                    if (mem_ship.IsFight() && isAttackerFromTargetKind(subInfo[mem_ship.Rid]))
                    {
                        bool flag = false;
                        dictionary.Add(mem_ship, new List <FighterInfo>());
                        foreach (var item4 in item3.items.Select((Mst_slotitem item, int slot_pos) => new
                        {
                            item,
                            slot_pos
                        }))
                        {
                            if (mem_ship.Onslot[item4.slot_pos] > 0 && FighterInfo.ValidFighter(item4.item))
                            {
                                FighterInfo item2 = new FighterInfo(item4.slot_pos, item4.item);
                                dictionary[mem_ship].Add(item2);
                                flag = true;
                            }
                        }
                        if (!flag)
                        {
                            dictionary.Remove(mem_ship);
                        }
                        else
                        {
                            planeFrom.Add(mem_ship.Rid);
                        }
                    }
                }
                if (dictionary.Count > 0)
                {
                    fighterData = dictionary;
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
        private SerializableDictionary <int, int> getShipExpPractice(BattleWinRankKinds rank, int mvpShip, int shipBaseExp)
        {
            SerializableDictionary <int, int> serializableDictionary = new SerializableDictionary <int, int>();
            float  num  = 1.5f;
            int    num2 = 2;
            double num3 = 0.7;
            double difficultShipExpKeisuToPractice = getDifficultShipExpKeisuToPractice();
            double trainingShipExpKeisuToPractice  = getTrainingShipExpKeisuToPractice();
            double num4 = 7.5;

            new List <int>();
            foreach (KeyValuePair <int, BattleShipSubInfo> item in F_SubInfo)
            {
                Mem_ship shipInstance = item.Value.ShipInstance;
                double   num5         = shipInstance.IsFight() ? shipBaseExp : 0;
                if (item.Value.DeckIdx == 0)
                {
                    num5 *= (double)num;
                }
                num5 = num5 * difficultShipExpKeisuToPractice * trainingShipExpKeisuToPractice * num4 * num3;
                serializableDictionary.Add(shipInstance.Rid, (int)num5);
            }
            double num6 = (double)shipBaseExp * 0.5;
            double num7 = 3.5;

            foreach (KeyValuePair <int, BattleShipSubInfo> item2 in E_SubInfo)
            {
                Mem_ship shipInstance2 = item2.Value.ShipInstance;
                double   num8          = (!shipInstance2.IsFight()) ? 0.0 : num6;
                num8 = num8 * difficultShipExpKeisuToPractice * num7 * num3;
                serializableDictionary.Add(shipInstance2.Rid, (int)num8);
            }
            if (mvpShip <= 0)
            {
                return(serializableDictionary);
            }
            double num9 = serializableDictionary[mvpShip] * num2;

            serializableDictionary[mvpShip] = (int)num9;
            return(serializableDictionary);
        }
Exemplo n.º 9
0
        private DayBattleProductionFmt Tousha(int index)
        {
            List <Mst_slotitem> list = this.userBaseData.SlotData.get_Item(0);
            double num  = 2.0;
            double num2 = 0.0;
            double num3 = -2.0;

            if (Enumerable.Any <Mst_slotitem>(list, (Mst_slotitem x) => (x.Api_mapbattle_type3 == 12 || x.Api_mapbattle_type3 == 13) && x.Tyku == 0))
            {
                num = num + 2.0 + Utils.GetRandDouble(0.0, Math.Sqrt((double)(this.userBaseData.ShipData.get_Item(0).Level / 10)), 1.0, 1);
            }
            List <List <Mst_slotitem> > list2 = Enumerable.ToList <List <Mst_slotitem> >(Enumerable.Skip <List <Mst_slotitem> >(this.userBaseData.SlotData, 1));

            using (var enumerator = Enumerable.Select(list2, (List <Mst_slotitem> obj, int ship_idx) => new
            {
                obj,
                ship_idx
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var      current  = enumerator.get_Current();
                    Mem_ship mem_ship = this.userBaseData.ShipData.get_Item(current.ship_idx + 1);
                    if (mem_ship.IsFight())
                    {
                        num = num + 1.0 + Utils.GetRandDouble(0.0, Math.Sqrt((double)(mem_ship.Level / 30)), 1.0, 1);
                    }
                }
            }
            this.Fspp += (int)num;
            this.Tspp += (int)num2;
            this.Rspp += (int)num3;
            return(new DayBattleProductionFmt
            {
                productionKind = BattleCommand.Tousha,
                FSPP = this.Fspp,
                RSPP = this.Rspp,
                TSPP = this.Tspp,
                BoxNo = index + 1
            });
        }
Exemplo n.º 10
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));
     }
 }
Exemplo n.º 11
0
        private DayBattleProductionFmt Tousha(int index)
        {
            List <Mst_slotitem> source = userBaseData.SlotData[0];
            double num  = 2.0;
            double num2 = 0.0;
            double num3 = -2.0;

            if (source.Any((Mst_slotitem x) => (x.Api_mapbattle_type3 == 12 || x.Api_mapbattle_type3 == 13) && x.Tyku == 0))
            {
                num = num + 2.0 + Utils.GetRandDouble(0.0, Math.Sqrt(userBaseData.ShipData[0].Level / 10), 1.0, 1);
            }
            List <List <Mst_slotitem> > source2 = userBaseData.SlotData.Skip(1).ToList();

            foreach (var item in source2.Select((List <Mst_slotitem> obj, int ship_idx) => new
            {
                obj,
                ship_idx
            }))
            {
                Mem_ship mem_ship = userBaseData.ShipData[item.ship_idx + 1];
                if (mem_ship.IsFight())
                {
                    num = num + 1.0 + Utils.GetRandDouble(0.0, Math.Sqrt(mem_ship.Level / 30), 1.0, 1);
                }
            }
            Fspp += (int)num;
            Tspp += (int)num2;
            Rspp += (int)num3;
            DayBattleProductionFmt dayBattleProductionFmt = new DayBattleProductionFmt();

            dayBattleProductionFmt.productionKind = BattleCommand.Tousha;
            dayBattleProductionFmt.FSPP           = Fspp;
            dayBattleProductionFmt.RSPP           = Rspp;
            dayBattleProductionFmt.TSPP           = Tspp;
            dayBattleProductionFmt.BoxNo          = index + 1;
            return(dayBattleProductionFmt);
        }
        private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips)
        {
            int mapBattleCellPassCount = this.mapInstance.MapBattleCellPassCount;

            useShipInfo = null;
            givenShips  = null;
            if (mapBattleCellPassCount < 2)
            {
                return(false);
            }
            Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >();
            List <int>    list    = new List <int>();
            HashSet <int> hashSet = new HashSet <int>();

            hashSet.Add(145);
            hashSet.Add(150);
            HashSet <int> searchIds = hashSet;
            Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >();
            Dictionary <int, int>         dictionary3 = Enumerable.ToDictionary <int, int, int>(this.userSubInfo.get_Keys(), (int key) => key, (int value) => 0);

            for (int i = 0; i < this.userData.ShipData.get_Count(); i++)
            {
                Mem_ship mem_ship = this.userData.ShipData.get_Item(i);
                if (mem_ship.IsFight())
                {
                    Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds);
                    if (slotIndexFromId.get_Item(145).get_Count() != 0 || slotIndexFromId.get_Item(150).get_Count() != 0)
                    {
                        if (this.isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck))
                        {
                            List <int> rationRecoveryShips = this.getRationRecoveryShips(i);
                            if (rationRecoveryShips.get_Count() != 0)
                            {
                                dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>());
                                int        num   = 0;
                                List <int> list2 = new List <int>();
                                if (slotIndexFromId.get_Item(145).get_Count() > 0)
                                {
                                    num++;
                                    int num2 = slotIndexFromId.get_Item(145).get_Count() - 1;
                                    list2.Add(slotIndexFromId.get_Item(145).get_Item(num2));
                                    dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(145));
                                }
                                if (slotIndexFromId.get_Item(150).get_Count() > 0)
                                {
                                    num += 2;
                                    int num3 = slotIndexFromId.get_Item(150).get_Count() - 1;
                                    list2.Add(slotIndexFromId.get_Item(150).get_Item(num3));
                                    dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(150));
                                }
                                Dictionary <int, int> dictionary4;
                                Dictionary <int, int> expr_23B = dictionary4 = dictionary3;
                                int num4;
                                int expr_245 = num4 = mem_ship.Rid;
                                num4 = dictionary4.get_Item(num4);
                                expr_23B.set_Item(expr_245, num4 + this.getCombatRationCondPlus(num, false));
                                dictionary2.Add(i, list2);
                                rationRecoveryShips.Remove(mem_ship.Rid);
                                list.AddRange(rationRecoveryShips);
                                using (List <int> .Enumerator enumerator = rationRecoveryShips.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        int current = enumerator.get_Current();
                                        Dictionary <int, int> dictionary5;
                                        Dictionary <int, int> expr_29F = dictionary5 = dictionary3;
                                        int expr_2A4 = num4 = current;
                                        num4 = dictionary5.get_Item(num4);
                                        expr_29F.set_Item(expr_2A4, num4 + this.getCombatRationCondPlus(num, true));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (dictionary2.get_Count() == 0)
            {
                return(false);
            }
            List <int> list3 = new List <int>();
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;

            using (Dictionary <int, List <int> > .Enumerator enumerator2 = dictionary2.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <int, List <int> > current2 = enumerator2.get_Current();
                    Mem_ship            mem_ship2            = this.userData.ShipData.get_Item(current2.get_Key());
                    Mem_shipBase        mem_shipBase         = new Mem_shipBase(mem_ship2);
                    List <Mst_slotitem> list4 = this.userData.SlotData.get_Item(current2.get_Key());
                    using (List <int> .Enumerator enumerator3 = current2.get_Value().GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            int current3 = enumerator3.get_Current();
                            int num5;
                            if (current3 != 2147483647)
                            {
                                num5 = mem_ship2.Slot.get_Item(current3);
                                mem_shipBase.Slot.set_Item(current3, -1);
                                list4.set_Item(current3, null);
                            }
                            else
                            {
                                num5 = mem_ship2.Exslot;
                                mem_shipBase.Exslot = -1;
                            }
                            list3.Add(num5);
                        }
                    }
                    mem_ship2.Set_ShipParam(mem_shipBase, mst_ship.get_Item(mem_shipBase.Ship_id), false);
                    mem_ship2.TrimSlot();
                    list4.RemoveAll((Mst_slotitem x) => x == null);
                }
            }
            using (Dictionary <int, int> .Enumerator enumerator4 = dictionary3.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    KeyValuePair <int, int> current4 = enumerator4.get_Current();
                    Mem_ship shipInstance            = this.userSubInfo.get_Item(current4.get_Key()).ShipInstance;
                    int      value2 = current4.get_Value();
                    shipInstance.AddRationItemCond(value2);
                }
            }
            Comm_UserDatas.Instance.Remove_Slot(list3);
            useShipInfo = dictionary;
            givenShips  = Enumerable.ToList <int>(Enumerable.Distinct <int>(list));
            return(true);
        }
Exemplo n.º 13
0
        private Hougeki <BattleAtackKinds_Day> getHougekiData(int atk_idx, Mem_ship attacker)
        {
            if (!attacker.IsFight())
            {
                return(null);
            }
            BattleBaseData e_Data = E_Data;
            Dictionary <int, BattleShipSubInfo> e_SubInfo = E_SubInfo;
            Dictionary <int, BattleShipSubInfo> f_SubInfo = F_SubInfo;
            BattleBaseData f_Data = F_Data;

            if (!isAttackerFromTargetKind(e_SubInfo[attacker.Rid]))
            {
                return(null);
            }
            BattleAtackKinds_Day    battleAtackKinds_Day = BattleAtackKinds_Day.Normal;
            List <int>              slot_List            = null;
            List <Mem_ship>         list = f_Data.ShipData;
            KeyValuePair <int, int> subMarineAtackKeisu = getSubMarineAtackKeisu(list, attacker, e_Data.SlotData[atk_idx], midnight: false);
            bool submarine_flag = false;
            bool flag           = IsAirAttackGroup(attacker, e_Data.SlotData[atk_idx], BattleCommand.None);

            if (flag && !CanAirAtack_DamageState(attacker))
            {
                return(null);
            }
            if (subMarineAtackKeisu.Key != 0)
            {
                battleAtackKinds_Day = ((subMarineAtackKeisu.Key == 1) ? BattleAtackKinds_Day.Bakurai : BattleAtackKinds_Day.AirAttack);
                List <int> list2 = new List <int>();
                list2.Add(0);
                slot_List      = list2;
                submarine_flag = true;
            }
            else
            {
                if (flag)
                {
                    if (!CanAirAttack(attacker, e_Data.SlotData[atk_idx]))
                    {
                        return(null);
                    }
                    battleAtackKinds_Day = BattleAtackKinds_Day.AirAttack;
                    List <int> list2 = new List <int>();
                    list2.Add(0);
                    slot_List = list2;
                    if (!isValidAirAtack_To_LandFaccillity(attacker, e_Data.SlotData[atk_idx]))
                    {
                        List <Mem_ship> list3 = (from shipobj in list
                                                 let soku = Mst_DataManager.Instance.Mst_ship[shipobj.Ship_id].Soku
                                                            let land_flag = Mst_DataManager.Instance.Mst_stype[shipobj.Stype].IsLandFacillity(soku)
                                                                            where !land_flag
                                                                            select shipobj).ToList();
                        list = list3;
                    }
                }
                else if (!isValidHougeki(attacker))
                {
                    return(null);
                }
                KeyValuePair <BattleAtackKinds_Day, List <int> > spAttackKind = getSpAttackKind(attacker, e_Data.SlotData[atk_idx]);
                if (battleAtackKinds_Day != BattleAtackKinds_Day.AirAttack || spAttackKind.Key != 0)
                {
                    battleAtackKinds_Day = spAttackKind.Key;
                    slot_List            = spAttackKind.Value;
                }
            }
            Hougeki <BattleAtackKinds_Day> attackData = getAttackData(attacker, e_Data.SlotData[atk_idx], e_Data.SlotLevel[atk_idx], battleAtackKinds_Day, submarine_flag, subMarineAtackKeisu, list, f_Data.LostFlag, f_SubInfo, 0);

            if (attackData != null)
            {
                attackData.Slot_List = slot_List;
            }
            return(attackData);
        }
Exemplo n.º 14
0
        private Hougeki <BattleAtackKinds_Day> getHougekiData(BattleCommand command, int atk_idx, Mem_ship attacker)
        {
            if (!attacker.IsFight())
            {
                return(null);
            }
            BattleBaseData f_Data = F_Data;
            Dictionary <int, BattleShipSubInfo> f_SubInfo = F_SubInfo;
            BattleBaseData e_Data = E_Data;
            Dictionary <int, BattleShipSubInfo> e_SubInfo = E_SubInfo;

            if (!isAttackerFromTargetKind(f_SubInfo[attacker.Rid]))
            {
                return(null);
            }
            Dictionary <int, Mst_stype> mst_stypes = Mst_DataManager.Instance.Mst_stype;
            Dictionary <int, Mst_ship>  mst_ships  = Mst_DataManager.Instance.Mst_ship;
            List <Mem_ship>             shipData   = e_Data.ShipData;
            bool submarine_flag = false;
            BattleAtackKinds_Day    battleAtackKinds_Day = BattleAtackKinds_Day.Normal;
            List <int>              slot_List            = null;
            KeyValuePair <int, int> submarine_keisu      = new KeyValuePair <int, int>(0, 0);
            bool flag = IsAirAttackGroup(attacker, f_Data.SlotData[atk_idx], command);

            if (flag && !CanAirAtack_DamageState(attacker))
            {
                return(null);
            }
            int num = 0;

            if (command != BattleCommand.Taisen)
            {
                shipData = (from x in shipData
                            where !mst_stypes[x.Stype].IsSubmarine()
                            select x).ToList();
                if (flag)
                {
                    if (command != BattleCommand.Kouku)
                    {
                        return(null);
                    }
                    if (!CanAirAttack(attacker, f_Data.SlotData[atk_idx]))
                    {
                        return(null);
                    }
                    battleAtackKinds_Day = BattleAtackKinds_Day.AirAttack;
                    List <int> list = new List <int>();
                    list.Add(0);
                    slot_List = list;
                    if (!isValidAirAtack_To_LandFaccillity(attacker, f_Data.SlotData[atk_idx]))
                    {
                        shipData = (from x in shipData
                                    where (!mst_stypes[x.Stype].IsLandFacillity(mst_ships[x.Ship_id].Soku)) ? true : false
                                    select x).ToList();
                    }
                }
                else if (!isValidHougeki(attacker))
                {
                    return(null);
                }
                if (!flag && command == BattleCommand.Kouku)
                {
                    if (airAttackEndRid.Contains(attacker.Rid))
                    {
                        return(null);
                    }
                    airAttackEndRid.Add(attacker.Rid);
                    num = 2;
                    int        hougSlotData = getHougSlotData(f_Data.SlotData[atk_idx]);
                    List <int> list         = new List <int>();
                    list.Add(hougSlotData);
                    slot_List = list;
                }
            }
            else
            {
                shipData = (from x in shipData
                            where mst_stypes[x.Stype].IsSubmarine()
                            select x).ToList();
                submarine_keisu = getSubMarineAtackKeisu(shipData, attacker, f_Data.SlotData[atk_idx], midnight: false);
                if (submarine_keisu.Key == 0)
                {
                    shipData = (from x in e_Data.ShipData
                                where !mst_stypes[x.Stype].IsSubmarine()
                                select x).ToList();
                    submarine_flag = false;
                    num            = 1;
                    if (flag)
                    {
                        if (!CanAirAttack(attacker, f_Data.SlotData[atk_idx]))
                        {
                            return(null);
                        }
                        battleAtackKinds_Day = BattleAtackKinds_Day.AirAttack;
                        List <int> list = new List <int>();
                        list.Add(0);
                        slot_List = list;
                        if (!isValidAirAtack_To_LandFaccillity(attacker, f_Data.SlotData[atk_idx]))
                        {
                            shipData = (from x in shipData
                                        where (!mst_stypes[x.Stype].IsLandFacillity(mst_ships[x.Ship_id].Soku)) ? true : false
                                        select x).ToList();
                        }
                    }
                    else if (!isValidHougeki(attacker))
                    {
                        return(null);
                    }
                    if (!flag)
                    {
                        int        hougSlotData2 = getHougSlotData(f_Data.SlotData[atk_idx]);
                        List <int> list          = new List <int>();
                        list.Add(hougSlotData2);
                        slot_List = list;
                    }
                }
                else
                {
                    battleAtackKinds_Day = ((submarine_keisu.Key == 1) ? BattleAtackKinds_Day.Bakurai : BattleAtackKinds_Day.AirAttack);
                    List <int> list = new List <int>();
                    list.Add(0);
                    slot_List      = list;
                    submarine_flag = true;
                }
            }
            if (shipData.Count == 0)
            {
                return(null);
            }
            if (command != BattleCommand.Taisen && num == 0)
            {
                KeyValuePair <BattleAtackKinds_Day, List <int> > spAttackKind = getSpAttackKind(attacker, f_Data.SlotData[atk_idx]);
                if (battleAtackKinds_Day != BattleAtackKinds_Day.AirAttack || spAttackKind.Key != 0)
                {
                    battleAtackKinds_Day = spAttackKind.Key;
                    slot_List            = spAttackKind.Value;
                }
            }
            Hougeki <BattleAtackKinds_Day> attackData = getAttackData(attacker, f_Data.SlotData[atk_idx], f_Data.SlotLevel[atk_idx], battleAtackKinds_Day, submarine_flag, submarine_keisu, shipData, e_Data.LostFlag, e_SubInfo, num);

            if (attackData != null)
            {
                attackData.Slot_List = slot_List;
            }
            return(attackData);
        }
Exemplo n.º 15
0
        private Hougeki <BattleAtackKinds_Night> getHougekiData(int atk_idx, Mem_ship attacker)
        {
            if (attacker.Get_DamageState() == DamageState.Taiha || !attacker.IsFight())
            {
                return(null);
            }
            Func <int, bool> func = null;
            BattleBaseData   battleBaseData;
            Dictionary <int, BattleShipSubInfo> dictionary;
            BattleBaseData battleBaseData2;
            Dictionary <int, BattleShipSubInfo> dictionary2;
            List <int> list;
            double     cliticalKeisu;

            if (attacker.IsEnemy())
            {
                battleBaseData  = E_Data;
                dictionary      = E_SubInfo;
                battleBaseData2 = F_Data;
                dictionary2     = F_SubInfo;
                func            = base.RecoveryShip;
                list            = fSerchLightIdxs;
                double eValance4 = eValance1;
                double eValance5 = eValance2;
                cliticalKeisu = eValance3;
            }
            else
            {
                battleBaseData  = F_Data;
                dictionary      = F_SubInfo;
                battleBaseData2 = E_Data;
                dictionary2     = E_SubInfo;
                list            = eSerchLightIdxs;
                double fValance4 = fValance1;
                double fValance5 = fValance2;
                cliticalKeisu = fValance3;
            }
            if (!isAttackerFromTargetKind(dictionary[attacker.Rid]))
            {
                return(null);
            }
            Hougeki <BattleAtackKinds_Night> hougeki             = new Hougeki <BattleAtackKinds_Night>();
            KeyValuePair <int, int>          subMarineAtackKeisu = getSubMarineAtackKeisu(battleBaseData2.ShipData, attacker, battleBaseData.SlotData[atk_idx], midnight: true);
            bool flag = false;

            if (subMarineAtackKeisu.Key != 0)
            {
                hougeki.SpType = ((subMarineAtackKeisu.Key != 1) ? BattleAtackKinds_Night.AirAttack : BattleAtackKinds_Night.Bakurai);
                hougeki.Slot_List.Add(0);
                flag = true;
            }
            BattleDamageKinds dKind       = BattleDamageKinds.Normal;
            Mem_ship          atackTarget = getAtackTarget(attacker, battleBaseData2.ShipData, overKill: false, flag, rescueFlag: true, ref dKind);

            if (atackTarget == null)
            {
                return(null);
            }
            int deckIdx = dictionary2[atackTarget.Rid].DeckIdx;

            if (atackTarget.Nowhp > 1 && list.Count > 0 && list[0] == deckIdx)
            {
                dKind       = BattleDamageKinds.Normal;
                atackTarget = getAtackTarget(attacker, battleBaseData2.ShipData, overKill: false, flag, rescueFlag: true, ref dKind);
                deckIdx     = dictionary2[atackTarget.Rid].DeckIdx;
            }
            if (!flag)
            {
                setSlotData(atk_idx, attacker, battleBaseData.SlotData[atk_idx], atackTarget, hougeki);
            }
            hougeki.Attacker = attacker.Rid;
            int num = (hougeki.SpType != BattleAtackKinds_Night.Renzoku) ? 1 : 2;
            HashSet <BattleAtackKinds_Night> hashSet = new HashSet <BattleAtackKinds_Night>();

            hashSet.Add(BattleAtackKinds_Night.Rai_Rai);
            hashSet.Add(BattleAtackKinds_Night.Renzoku);
            hashSet.Add(BattleAtackKinds_Night.Syu_Rai);
            hashSet.Add(BattleAtackKinds_Night.Syu_Syu_Fuku);
            hashSet.Add(BattleAtackKinds_Night.Syu_Syu_Syu);
            HashSet <BattleAtackKinds_Night> hashSet2 = hashSet;

            for (int i = 0; i < num; i++)
            {
                int soukou = atackTarget.Soukou;
                List <Mst_slotitem> list2 = battleBaseData.SlotData[atk_idx];
                int atkPow;
                int hitProb;
                FormationDatas.GetFormationKinds battleState;
                if (flag)
                {
                    atkPow      = getSubmarineAttackValue(subMarineAtackKeisu, attacker, list2, battleBaseData.SlotLevel[atk_idx]);
                    hitProb     = getSubmarineHitProb(attacker, battleBaseData.SlotData[atk_idx], battleBaseData.SlotLevel[atk_idx]);
                    battleState = FormationDatas.GetFormationKinds.SUBMARINE;
                }
                else
                {
                    atkPow      = getMidnightAttackValue(hougeki.SpType, attacker, list2, atackTarget);
                    hitProb     = getMidnightHitProb(hougeki.SpType, attacker, list2, list);
                    battleState = FormationDatas.GetFormationKinds.MIDNIGHT;
                }
                int             battleAvo_Midnight = getBattleAvo_Midnight(battleState, atackTarget, list.Contains(deckIdx));
                BattleHitStatus battleHitStatus    = getHitStatus(hitProb, battleAvo_Midnight, attacker, atackTarget, cliticalKeisu, airAttack: false);
                if (battleHitStatus == BattleHitStatus.Miss && hashSet2.Contains(hougeki.SpType))
                {
                    battleHitStatus = BattleHitStatus.Normal;
                }
                hougeki.Target.Add(atackTarget.Rid);
                int item = setDamageValue(battleHitStatus, atkPow, soukou, attacker, atackTarget, battleBaseData2.LostFlag);
                hougeki.Damage.Add(item);
                hougeki.Clitical.Add(battleHitStatus);
                hougeki.DamageKind.Add(dKind);
            }
            func?.Invoke(deckIdx);
            return(hougeki);
        }
Exemplo n.º 16
0
        protected virtual int getDeckTaikuPow(BattleBaseData battleBase)
        {
            int num = 0;
            Dictionary <int, double> dictionary = new Dictionary <int, double>();

            dictionary.Add(16, 0.35);
            dictionary.Add(30, 0.35);
            dictionary.Add(12, 0.6);
            dictionary.Add(11, 0.4);
            Dictionary <int, double>    dictionary2 = dictionary;
            List <List <Mst_slotitem> > slotData    = battleBase.SlotData;
            double num2 = 0.0;

            foreach (var item in slotData.Select((List <Mst_slotitem> items, int idx) => new
            {
                items,
                idx
            }))
            {
                double   num3     = 0.0;
                Mem_ship mem_ship = battleBase.ShipData[item.idx];
                if (mem_ship.IsFight())
                {
                    List <int> list = battleBase.SlotLevel[item.idx];
                    foreach (var item2 in item.items.Select((Mst_slotitem item, int idx) => new
                    {
                        item,
                        idx
                    }))
                    {
                        if (item2.item.Tyku > 0)
                        {
                            double value = 0.0;
                            if (item2.item.Id == 9)
                            {
                                value = 0.25;
                            }
                            else if (!dictionary2.TryGetValue(item2.item.Type4, out value))
                            {
                                value = 0.2;
                            }
                            num3 += (double)item2.item.Tyku * value;
                            int num4 = list[item2.idx];
                            if (item2.item.Type4 == 16 || item2.item.Type4 == 30)
                            {
                                double a2Plus = getA2Plus(1, item2.item.Tyku, num4);
                                num2 += a2Plus;
                            }
                            else if (num4 > 0 && (item2.item.Api_mapbattle_type3 == 12 || item2.item.Api_mapbattle_type3 == 13) && item2.item.Tyku > 1)
                            {
                                double a2Plus2 = getA2Plus(2, item2.item.Tyku, num4);
                                num2 += a2Plus2;
                            }
                        }
                    }
                    num += (int)(num3 + num2);
                }
            }
            double formationParamF = formationData.GetFormationParamF3(FormationDatas.GetFormationKinds.AIR, battleBase.Formation);

            return((int)((double)num * formationParamF));
        }
Exemplo n.º 17
0
        private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips)
        {
            int mapBattleCellPassCount = mapInstance.MapBattleCellPassCount;

            useShipInfo = null;
            givenShips  = null;
            if (mapBattleCellPassCount < 2)
            {
                return(false);
            }
            Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >();
            List <int>    list    = new List <int>();
            HashSet <int> hashSet = new HashSet <int>();

            hashSet.Add(145);
            hashSet.Add(150);
            HashSet <int> searchIds = hashSet;
            Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >();
            Dictionary <int, int>         dictionary3 = userSubInfo.Keys.ToDictionary((int key) => key, (int value) => 0);

            for (int i = 0; i < userData.ShipData.Count; i++)
            {
                Mem_ship mem_ship = userData.ShipData[i];
                if (!mem_ship.IsFight())
                {
                    continue;
                }
                Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds);
                if ((slotIndexFromId[145].Count == 0 && slotIndexFromId[150].Count == 0) || !isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck))
                {
                    continue;
                }
                List <int> rationRecoveryShips = getRationRecoveryShips(i);
                if (rationRecoveryShips.Count != 0)
                {
                    dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>());
                    int        num   = 0;
                    List <int> list2 = new List <int>();
                    if (slotIndexFromId[145].Count > 0)
                    {
                        num++;
                        int index = slotIndexFromId[145].Count - 1;
                        list2.Add(slotIndexFromId[145][index]);
                        dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[145]);
                    }
                    if (slotIndexFromId[150].Count > 0)
                    {
                        num += 2;
                        int index2 = slotIndexFromId[150].Count - 1;
                        list2.Add(slotIndexFromId[150][index2]);
                        dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[150]);
                    }
                    Dictionary <int, int> dictionary4;
                    Dictionary <int, int> dictionary5 = dictionary4 = dictionary3;
                    int rid;
                    int key2 = rid = mem_ship.Rid;
                    rid = dictionary4[rid];
                    dictionary5[key2] = rid + getCombatRationCondPlus(num, givenShip: false);
                    dictionary2.Add(i, list2);
                    rationRecoveryShips.Remove(mem_ship.Rid);
                    list.AddRange(rationRecoveryShips);
                    foreach (int item2 in rationRecoveryShips)
                    {
                        Dictionary <int, int> dictionary6;
                        Dictionary <int, int> dictionary7 = dictionary6 = dictionary3;
                        int key3 = rid = item2;
                        rid = dictionary6[rid];
                        dictionary7[key3] = rid + getCombatRationCondPlus(num, givenShip: true);
                    }
                }
            }
            if (dictionary2.Count == 0)
            {
                return(false);
            }
            List <int> list3 = new List <int>();
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;

            foreach (KeyValuePair <int, List <int> > item3 in dictionary2)
            {
                Mem_ship            mem_ship2    = userData.ShipData[item3.Key];
                Mem_shipBase        mem_shipBase = new Mem_shipBase(mem_ship2);
                List <Mst_slotitem> list4        = userData.SlotData[item3.Key];
                foreach (int item4 in item3.Value)
                {
                    int item;
                    if (item4 != int.MaxValue)
                    {
                        item = mem_ship2.Slot[item4];
                        mem_shipBase.Slot[item4] = -1;
                        list4[item4]             = null;
                    }
                    else
                    {
                        item = mem_ship2.Exslot;
                        mem_shipBase.Exslot = -1;
                    }
                    list3.Add(item);
                }
                mem_ship2.Set_ShipParam(mem_shipBase, mst_ship[mem_shipBase.Ship_id], enemy_flag: false);
                mem_ship2.TrimSlot();
                list4.RemoveAll((Mst_slotitem x) => x == null);
            }
            foreach (KeyValuePair <int, int> item5 in dictionary3)
            {
                Mem_ship shipInstance = userSubInfo[item5.Key].ShipInstance;
                int      value2       = item5.Value;
                shipInstance.AddRationItemCond(value2);
            }
            Comm_UserDatas.Instance.Remove_Slot(list3);
            useShipInfo = dictionary;
            givenShips  = list.Distinct().ToList();
            return(true);
        }
Exemplo n.º 18
0
        public void SetParametar(BattleBaseData baseData, out List <SearchUsePlane> planes)
        {
            List <Mem_ship>             shipData       = baseData.ShipData;
            List <List <Mst_slotitem> > slotData       = baseData.SlotData;
            Dictionary <int, int[]>     slotExperience = baseData.SlotExperience;
            List <double> list = new List <double>();

            list.Add(2.0);
            list.Add(5.0);
            list.Add(8.0);
            list.Add(8.0);
            list.Add(8.0);
            list.Add(8.0);
            List <double> list2 = list;
            int           num   = 0;
            int           num2  = 0;
            int           num3  = 0;
            int           num4  = 0;

            planes = new List <SearchUsePlane>();
            using (var enumerator = Enumerable.Select(shipData, (Mem_ship obj, int idx) => new
            {
                obj,
                idx
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var      current = enumerator.get_Current();
                    Mem_ship obj3    = current.obj;
                    if (obj3.IsFight())
                    {
                        this.LostTargetOnslot.Add(obj3, new List <int>());
                        num += (int)((double)obj3.Sakuteki / list2.get_Item(current.idx));
                        if (Mst_DataManager.Instance.Mst_stype.get_Item(obj3.Stype).IsMother())
                        {
                            num4++;
                        }
                        List <int> list3 = new List <int>();
                        using (var enumerator2 = Enumerable.Select(slotData.get_Item(current.idx), (Mst_slotitem obj, int idx) => new
                        {
                            obj,
                            idx
                        }).GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                var          current2 = enumerator2.get_Current();
                                Mst_slotitem obj2     = current2.obj;
                                int          num5     = obj3.Onslot.get_Item(current2.idx);
                                if (num5 > 0)
                                {
                                    if (obj2.Api_mapbattle_type3 == 9 || obj2.Api_mapbattle_type3 == 10 || obj2.Api_mapbattle_type3 == 11 || obj2.Api_mapbattle_type3 == 41)
                                    {
                                        int   num6  = 0;
                                        int[] array = null;
                                        if (slotExperience.TryGetValue(obj3.Slot.get_Item(current2.idx), ref array))
                                        {
                                            int slotExpUpValue = this.getSlotExpUpValue(num5, array[0], obj2.Exp_rate);
                                            array[1] += slotExpUpValue;
                                            num6      = this.getAlvPlus(num5, array[0]);
                                        }
                                        num2 += num5 + num6;
                                        this.LostTargetOnslot.get_Item(obj3).Add(current2.idx);
                                        list3.Add(obj2.Id);
                                    }
                                    else if (obj2.Api_mapbattle_type3 == 6)
                                    {
                                        num3 += num5;
                                    }
                                }
                            }
                        }
                        if (list3.get_Count() > 0)
                        {
                            planes.Add(new SearchUsePlane(obj3.Rid, list3));
                        }
                    }
                }
            }
            if (num4 == 1)
            {
                num2 += 30;
            }
            else if (num4 > 1)
            {
                int num7 = (num4 - 1) * 10;
                num2 = num2 + 30 + num7;
            }
            this.BasePow = num;
            this.Attack  = num2;
            if (num3 == 0)
            {
                this.Def = 0;
            }
            else if (num3 <= 30)
            {
                this.Def = (int)(1.0 + (double)num3 / 9.0);
            }
            else if (num3 <= 120)
            {
                this.Def = (int)(2.0 + (double)num3 / 20.0);
            }
            else if (num3 > 120)
            {
                this.Def = (int)(6.0 + (double)(num3 - 120) / 40.0);
            }
        }
Exemplo n.º 19
0
        private DayBattleProductionFmt Ridatsu(int index)
        {
            this.escapeNum++;
            Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship;
            bool flag = false;

            using (List <Mem_ship> .Enumerator enumerator = this.userBaseData.ShipData.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    if (current.IsFight())
                    {
                        if (mst_ship.get_Item(current.Ship_id).Soku != 10)
                        {
                            flag = false;
                            break;
                        }
                        flag = true;
                    }
                }
            }
            DayBattleProductionFmt dayBattleProductionFmt = new DayBattleProductionFmt();

            dayBattleProductionFmt.productionKind = BattleCommand.Ridatu;
            dayBattleProductionFmt.FSPP           = this.Fspp;
            dayBattleProductionFmt.RSPP           = this.Rspp;
            dayBattleProductionFmt.TSPP           = this.Tspp;
            dayBattleProductionFmt.BoxNo          = index + 1;
            if (index == 0)
            {
                this.IsEscape = false;
                return(dayBattleProductionFmt);
            }
            int num = (int)Utils.GetRandDouble(1.0, 100.0, 1.0, 1);

            if (flag && this.escapeNum >= 2 && num <= 80)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            if (flag && this.escapeNum == 1 && num <= 50)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            if (!flag && this.escapeNum >= 2 && num <= 60)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            if (!flag && this.escapeNum == 1 && num <= 35)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            if (index >= 3)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            if (index == 2 && num <= 65)
            {
                dayBattleProductionFmt.Withdrawal = true;
                this.IsEscape = true;
                return(dayBattleProductionFmt);
            }
            this.IsEscape = false;
            return(dayBattleProductionFmt);
        }
Exemplo n.º 20
0
        private Hougeki <BattleAtackKinds_Night> getHougekiData(int atk_idx, Mem_ship attacker)
        {
            if (attacker.Get_DamageState() == DamageState.Taiha || !attacker.IsFight())
            {
                return(null);
            }
            Func <int, bool> func = null;
            BattleBaseData   battleBaseData;
            Dictionary <int, BattleShipSubInfo> dictionary;
            BattleBaseData battleBaseData2;
            Dictionary <int, BattleShipSubInfo> dictionary2;
            List <int> list;
            double     cliticalKeisu;

            if (attacker.IsEnemy())
            {
                battleBaseData  = this.E_Data;
                dictionary      = this.E_SubInfo;
                battleBaseData2 = this.F_Data;
                dictionary2     = this.F_SubInfo;
                func            = new Func <int, bool>(base.RecoveryShip);
                list            = this.fSerchLightIdxs;
                double num  = this.eValance1;
                double num2 = this.eValance2;
                cliticalKeisu = this.eValance3;
            }
            else
            {
                battleBaseData  = this.F_Data;
                dictionary      = this.F_SubInfo;
                battleBaseData2 = this.E_Data;
                dictionary2     = this.E_SubInfo;
                list            = this.eSerchLightIdxs;
                double num  = this.fValance1;
                double num2 = this.fValance2;
                cliticalKeisu = this.fValance3;
            }
            if (!this.isAttackerFromTargetKind(dictionary.get_Item(attacker.Rid)))
            {
                return(null);
            }
            Hougeki <BattleAtackKinds_Night> hougeki             = new Hougeki <BattleAtackKinds_Night>();
            KeyValuePair <int, int>          subMarineAtackKeisu = this.getSubMarineAtackKeisu(battleBaseData2.ShipData, attacker, battleBaseData.SlotData.get_Item(atk_idx), true);
            bool flag = false;

            if (subMarineAtackKeisu.get_Key() != 0)
            {
                hougeki.SpType = ((subMarineAtackKeisu.get_Key() != 1) ? BattleAtackKinds_Night.AirAttack : BattleAtackKinds_Night.Bakurai);
                hougeki.Slot_List.Add(0);
                flag = true;
            }
            BattleDamageKinds battleDamageKinds = BattleDamageKinds.Normal;
            Mem_ship          atackTarget       = base.getAtackTarget(attacker, battleBaseData2.ShipData, false, flag, true, ref battleDamageKinds);

            if (atackTarget == null)
            {
                return(null);
            }
            int deckIdx = dictionary2.get_Item(atackTarget.Rid).DeckIdx;

            if (atackTarget.Nowhp > 1 && list.get_Count() > 0 && list.get_Item(0) == deckIdx)
            {
                battleDamageKinds = BattleDamageKinds.Normal;
                atackTarget       = base.getAtackTarget(attacker, battleBaseData2.ShipData, false, flag, true, ref battleDamageKinds);
                deckIdx           = dictionary2.get_Item(atackTarget.Rid).DeckIdx;
            }
            if (!flag)
            {
                this.setSlotData(atk_idx, attacker, battleBaseData.SlotData.get_Item(atk_idx), atackTarget, hougeki);
            }
            hougeki.Attacker = attacker.Rid;
            int num3 = (hougeki.SpType != BattleAtackKinds_Night.Renzoku) ? 1 : 2;
            HashSet <BattleAtackKinds_Night> hashSet = new HashSet <BattleAtackKinds_Night>();

            hashSet.Add(BattleAtackKinds_Night.Rai_Rai);
            hashSet.Add(BattleAtackKinds_Night.Renzoku);
            hashSet.Add(BattleAtackKinds_Night.Syu_Rai);
            hashSet.Add(BattleAtackKinds_Night.Syu_Syu_Fuku);
            hashSet.Add(BattleAtackKinds_Night.Syu_Syu_Syu);
            HashSet <BattleAtackKinds_Night> hashSet2 = hashSet;

            for (int i = 0; i < num3; i++)
            {
                int soukou = atackTarget.Soukou;
                List <Mst_slotitem> list2 = battleBaseData.SlotData.get_Item(atk_idx);
                int atkPow;
                int hitProb;
                FormationDatas.GetFormationKinds battleState;
                if (flag)
                {
                    atkPow      = this.getSubmarineAttackValue(subMarineAtackKeisu, attacker, list2, battleBaseData.SlotLevel.get_Item(atk_idx));
                    hitProb     = base.getSubmarineHitProb(attacker, battleBaseData.SlotData.get_Item(atk_idx), battleBaseData.SlotLevel.get_Item(atk_idx));
                    battleState = FormationDatas.GetFormationKinds.SUBMARINE;
                }
                else
                {
                    atkPow      = this.getMidnightAttackValue(hougeki.SpType, attacker, list2, atackTarget);
                    hitProb     = this.getMidnightHitProb(hougeki.SpType, attacker, list2, list);
                    battleState = FormationDatas.GetFormationKinds.MIDNIGHT;
                }
                int             battleAvo_Midnight = base.getBattleAvo_Midnight(battleState, atackTarget, list.Contains(deckIdx));
                BattleHitStatus battleHitStatus    = this.getHitStatus(hitProb, battleAvo_Midnight, attacker, atackTarget, cliticalKeisu, false);
                if (battleHitStatus == BattleHitStatus.Miss && hashSet2.Contains(hougeki.SpType))
                {
                    battleHitStatus = BattleHitStatus.Normal;
                }
                hougeki.Target.Add(atackTarget.Rid);
                int num4 = this.setDamageValue(battleHitStatus, atkPow, soukou, attacker, atackTarget, battleBaseData2.LostFlag);
                hougeki.Damage.Add(num4);
                hougeki.Clitical.Add(battleHitStatus);
                hougeki.DamageKind.Add(battleDamageKinds);
            }
            if (func != null)
            {
                bool flag2 = func.Invoke(deckIdx);
            }
            return(hougeki);
        }
Exemplo n.º 21
0
        public void SetParametar(BattleBaseData baseData, out List <SearchUsePlane> planes)
        {
            List <Mem_ship>             shipData       = baseData.ShipData;
            List <List <Mst_slotitem> > slotData       = baseData.SlotData;
            Dictionary <int, int[]>     slotExperience = baseData.SlotExperience;
            List <double> list = new List <double>();

            list.Add(2.0);
            list.Add(5.0);
            list.Add(8.0);
            list.Add(8.0);
            list.Add(8.0);
            list.Add(8.0);
            List <double> list2 = list;
            int           num   = 0;
            int           num2  = 0;
            int           num3  = 0;
            int           num4  = 0;

            planes = new List <SearchUsePlane>();
            foreach (var item in shipData.Select((Mem_ship obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                Mem_ship obj2 = item.obj;
                if (obj2.IsFight())
                {
                    LostTargetOnslot.Add(obj2, new List <int>());
                    num += (int)((double)obj2.Sakuteki / list2[item.idx]);
                    if (Mst_DataManager.Instance.Mst_stype[obj2.Stype].IsMother())
                    {
                        num4++;
                    }
                    List <int> list3 = new List <int>();
                    foreach (var item2 in slotData[item.idx].Select((Mst_slotitem obj, int idx) => new
                    {
                        obj,
                        idx
                    }))
                    {
                        Mst_slotitem obj3 = item2.obj;
                        int          num5 = obj2.Onslot[item2.idx];
                        if (num5 > 0)
                        {
                            if (obj3.Api_mapbattle_type3 == 9 || obj3.Api_mapbattle_type3 == 10 || obj3.Api_mapbattle_type3 == 11 || obj3.Api_mapbattle_type3 == 41)
                            {
                                int   num6  = 0;
                                int[] value = null;
                                if (slotExperience.TryGetValue(obj2.Slot[item2.idx], out value))
                                {
                                    int slotExpUpValue = getSlotExpUpValue(num5, value[0], obj3.Exp_rate);
                                    value[1] += slotExpUpValue;
                                    num6      = getAlvPlus(num5, value[0]);
                                }
                                num2 += num5 + num6;
                                LostTargetOnslot[obj2].Add(item2.idx);
                                list3.Add(obj3.Id);
                            }
                            else if (obj3.Api_mapbattle_type3 == 6)
                            {
                                num3 += num5;
                            }
                        }
                    }
                    if (list3.Count > 0)
                    {
                        planes.Add(new SearchUsePlane(obj2.Rid, list3));
                    }
                }
            }
            if (num4 == 1)
            {
                num2 += 30;
            }
            else if (num4 > 1)
            {
                int num7 = (num4 - 1) * 10;
                num2 = num2 + 30 + num7;
            }
            BasePow = num;
            Attack  = num2;
            if (num3 == 0)
            {
                Def = 0;
            }
            else if (num3 <= 30)
            {
                Def = (int)(1.0 + (double)num3 / 9.0);
            }
            else if (num3 <= 120)
            {
                Def = (int)(2.0 + (double)num3 / 20.0);
            }
            else if (num3 > 120)
            {
                Def = (int)(6.0 + (double)(num3 - 120) / 40.0);
            }
        }
        private void updateRadingEscortShipExp(List <RadingResultData> radingData)
        {
            HashSet <int> radingArea = new HashSet <int>();

            if (radingData != null && radingData.get_Count() > 0)
            {
                radingData.ForEach(delegate(RadingResultData x)
                {
                    radingArea.Add(x.AreaId);
                });
            }
            Dictionary <int, int> mstLevel = ArrayMaster.GetMstLevel();

            using (Dictionary <int, Mem_esccort_deck> .ValueCollection.Enumerator enumerator = Comm_UserDatas.Instance.User_EscortDeck.get_Values().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_esccort_deck current = enumerator.get_Current();
                    if (current.Ship.Count() > 0)
                    {
                        int             num     = (!radingArea.Contains(current.Maparea_id)) ? 2 : 1;
                        List <Mem_ship> memShip = current.Ship.getMemShip();
                        using (List <Mem_ship> .Enumerator enumerator2 = memShip.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                Mem_ship current2 = enumerator2.get_Current();
                                if (current2.IsFight() && !current2.IsBlingShip())
                                {
                                    double num2 = Math.Sqrt((double)current2.Level);
                                    int    num3 = 0;
                                    if (num == 1)
                                    {
                                        num3 = (int)(num2 * (20.0 + Utils.GetRandDouble(0.0, 80.0, 1.0, 1) + 0.5));
                                    }
                                    else
                                    {
                                        num3 = (int)(num2 * (1.0 + Utils.GetRandDouble(0.0, 3.0, 1.0, 1) + 0.5));
                                    }
                                    Mem_shipBase mem_shipBase = new Mem_shipBase(current2);
                                    List <int>   list         = new List <int>();
                                    int          levelupInfo  = current2.getLevelupInfo(mstLevel, mem_shipBase.Level, mem_shipBase.Exp, ref num3, out list);
                                    mem_shipBase.Level = levelupInfo;
                                    mem_shipBase.Exp  += num3;
                                    int num4 = levelupInfo - current2.Level;
                                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = current2.Kyouka;
                                    for (int i = 0; i < num4; i++)
                                    {
                                        dictionary = current2.getLevelupKyoukaValue(current2.Ship_id, dictionary);
                                    }
                                    mem_shipBase.SetKyoukaValue(dictionary);
                                    int num5 = 0;
                                    int num6 = 0;
                                    mstLevel.TryGetValue(mem_shipBase.Level - 1, ref num5);
                                    mstLevel.TryGetValue(mem_shipBase.Level + 1, ref num6);
                                    current2.SetRequireExp(mem_shipBase.Level, mstLevel);
                                    Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id);
                                    current2.Set_ShipParam(mem_shipBase, mst_data, false);
                                }
                            }
                        }
                    }
                }
            }
        }
 protected virtual bool isValidRaigeki(Mem_ship ship)
 {
     return(ship.Get_DamageState() <= DamageState.Shouha && ship.IsFight() && ship.GetBattleBaseParam().Raig > 0);
 }