예제 #1
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;
            }
        }
        protected virtual int getRaigAttackValue(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship)
        {
            int num = 150;
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;
            List <int>            list;

            if (!atk_ship.IsEnemy())
            {
                formation       = this.F_Data.Formation;
                battleFormation = this.F_Data.BattleFormation;
                list            = this.F_Data.SlotLevel.get_Item(this.F_SubInfo.get_Item(atk_ship.Rid).DeckIdx);
                BattleFormationKinds1 formation2 = this.E_Data.Formation;
            }
            else
            {
                formation       = this.E_Data.Formation;
                battleFormation = this.E_Data.BattleFormation;
                list            = this.E_Data.SlotLevel.get_Item(this.E_SubInfo.get_Item(atk_ship.Rid).DeckIdx);
                BattleFormationKinds1 formation2 = this.F_Data.Formation;
            }
            double num2 = 0.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 += this.getSlotPlus_Attack(current.obj, list.get_Item(current.idx));
                }
            }
            double num3 = this.valance1 + (double)atk_ship.Raig + num2;
            double formationParamBattle = this.formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.RAIGEKI, battleFormation);
            double formationParamF      = this.formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.RAIGEKI, formation);

            num3 = num3 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num4        = 1.0;

            if (damageState == DamageState.Tyuuha)
            {
                num4 = 0.8;
            }
            else if (damageState == DamageState.Taiha)
            {
                num4 = 0.0;
            }
            num3 *= num4;
            if (num3 > (double)num)
            {
                num3 = (double)num + Math.Sqrt(num3 - (double)num);
            }
            return((int)num3);
        }
예제 #3
0
        protected virtual int getRaigAttackValue(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship)
        {
            int num = 150;
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;
            List <int>            list;

            if (!atk_ship.IsEnemy())
            {
                formation       = F_Data.Formation;
                battleFormation = F_Data.BattleFormation;
                list            = F_Data.SlotLevel[F_SubInfo[atk_ship.Rid].DeckIdx];
                BattleFormationKinds1 formation2 = E_Data.Formation;
            }
            else
            {
                formation       = E_Data.Formation;
                battleFormation = E_Data.BattleFormation;
                list            = E_Data.SlotLevel[E_SubInfo[atk_ship.Rid].DeckIdx];
                BattleFormationKinds1 formation3 = F_Data.Formation;
            }
            double num2 = 0.0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num2 += getSlotPlus_Attack(item.obj, list[item.idx]);
            }
            double num3 = valance1 + (double)atk_ship.Raig + num2;
            double formationParamBattle = formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.RAIGEKI, battleFormation);
            double formationParamF      = formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.RAIGEKI, formation);

            num3 = num3 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num4        = 1.0;

            switch (damageState)
            {
            case DamageState.Tyuuha:
                num4 = 0.8;
                break;

            case DamageState.Taiha:
                num4 = 0.0;
                break;
            }
            num3 *= num4;
            if (num3 > (double)num)
            {
                num3 = (double)num + Math.Sqrt(num3 - (double)num);
            }
            return((int)num3);
        }
예제 #4
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);
 }
예제 #5
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);
        }
예제 #6
0
        protected override int getRaigAttackValue(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship)
        {
            int    num  = 150;
            double num2 = valance1 + (double)atk_ship.Raig;
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;

            if (!atk_ship.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;
            }
            double formationParamBattle = formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.RAIGEKI, battleFormation);
            double formationParamF      = formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.RAIGEKI, formation);

            num2 = num2 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num3        = 1.0;

            switch (damageState)
            {
            case DamageState.Tyuuha:
                num3 = 0.8;
                break;

            case DamageState.Taiha:
                num3 = 0.0;
                break;
            }
            num2 *= num3;
            if (num2 > (double)num)
            {
                num2 = (double)num + Math.Sqrt(num2 - (double)num);
            }
            return((int)num2);
        }
예제 #7
0
        private double getLovHoseiDamageKeisu(Mem_ship targetShip, int damage)
        {
            if (targetShip.IsEnemy())
            {
                return(1.0);
            }
            double      randDouble   = Utils.GetRandDouble(1.0, 100.0, 1.0, 1);
            DamageState damageState  = targetShip.Get_DamageState();
            DamageState damageState2 = Mem_ship.Get_DamageState(targetShip.Nowhp - damage, targetShip.Maxhp);

            if (targetShip.Lov >= 330)
            {
                if (randDouble <= 70.0)
                {
                    if (damageState == DamageState.Normal && damageState2 == DamageState.Tyuuha)
                    {
                        return(0.5);
                    }
                    if (damageState == DamageState.Normal && damageState2 == DamageState.Taiha)
                    {
                        return(0.5);
                    }
                }
                return(1.0);
            }
            if (targetShip.Lov >= 200)
            {
                if (randDouble <= 60.0 && damageState == DamageState.Normal && damageState2 == DamageState.Taiha)
                {
                    return(0.55);
                }
                return(1.0);
            }
            if (targetShip.Lov >= 100)
            {
                if (randDouble <= 50.0 && damageState == DamageState.Normal && damageState2 == DamageState.Taiha)
                {
                    return(0.6);
                }
                return(1.0);
            }
            return(1.0);
        }
예제 #8
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));
        }
예제 #9
0
        protected DamageState_Battle _GetDmgState(int hp)
        {
            if (hp <= 0)
            {
                return(DamageState_Battle.Gekichin);
            }
            switch (Mem_ship.Get_DamageState(hp, MaxHp))
            {
            case DamageState.Taiha:
                return(DamageState_Battle.Taiha);

            case DamageState.Tyuuha:
                return(DamageState_Battle.Tyuuha);

            case DamageState.Shouha:
                return(DamageState_Battle.Shouha);

            default:
                return(DamageState_Battle.Normal);
            }
        }
        protected DamageState_Battle _GetDmgState(int hp)
        {
            if (hp <= 0)
            {
                return(DamageState_Battle.Gekichin);
            }
            DamageState damageState = Mem_ship.Get_DamageState(hp, this.MaxHp);

            if (damageState == DamageState.Taiha)
            {
                return(DamageState_Battle.Taiha);
            }
            if (damageState == DamageState.Tyuuha)
            {
                return(DamageState_Battle.Tyuuha);
            }
            if (damageState == DamageState.Shouha)
            {
                return(DamageState_Battle.Shouha);
            }
            return(DamageState_Battle.Normal);
        }
예제 #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));
     }
 }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
0
        public HashSet <IsGoCondition> ValidStart(int deck_rid, int mission_id, int tankerNum)
        {
            HashSet <IsGoCondition> ret         = new HashSet <IsGoCondition>();
            Mst_mission2            mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, out mst_mission))
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
            }
            else
            {
                if (mission_id != -1 && mission_id != -2)
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck[deck_rid].Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData[1] : supportResistedData[0]);
            }
            Mem_deck value = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, out value))
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (value.Ship.Count() == 0)
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (value.MissionState != 0)
            {
                ret.Add(IsGoCondition.Mission);
            }
            if (value.IsActionEnd)
            {
                ret.Add(IsGoCondition.ActionEndDeck);
                return(ret);
            }
            Mem_ship value2 = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(value.Ship[0], out value2))
            {
                ret.Add(IsGoCondition.Invalid);
                return(ret);
            }
            if (value2.Get_DamageState() == DamageState.Taiha)
            {
                ret.Add(IsGoCondition.FlagShipTaiha);
            }
            Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.Values.FirstOrDefault((Mem_deck x) => (x.Mission_id == mission_id) ? true : false);

            if (mem_deck != null)
            {
                ret.Add(IsGoCondition.OtherDeckMissionRunning);
            }
            int destroy_ship = 0;

            value.Ship.getMemShip().ForEach(delegate(Mem_ship deck_ship)
            {
                if (deck_ship.Stype == 2)
                {
                    destroy_ship++;
                }
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[deck_ship.Ship_id];
                if (deck_ship.Fuel <= 0 || deck_ship.Bull <= 0)
                {
                    ret.Add(IsGoCondition.NeedSupply);
                }
                if (mst_mission.IsSupportMission() && (deck_ship.Fuel < mst_ship.Fuel_max || deck_ship.Bull < mst_ship.Bull_max))
                {
                    ret.Add(IsGoCondition.ReqFullSupply);
                }
                if (Comm_UserDatas.Instance.User_ndock.Values.Any((Mem_ndock ndock) => ndock.Ship_id == deck_ship.Rid))
                {
                    ret.Add(IsGoCondition.HasRepair);
                }
                if (deck_ship.IsBlingShip())
                {
                    ret.Add(IsGoCondition.HasBling);
                }
            });
            if (mst_mission.IsSupportMission() && destroy_ship < 2)
            {
                ret.Add(IsGoCondition.NecessaryStype);
            }
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (freeTanker.Count < tankerNum)
            {
                ret.Add(IsGoCondition.Tanker);
            }
            return(ret);
        }
예제 #15
0
        private int getMidnightAttackValue(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship)
        {
            int        num = 300;
            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 num2 = 0.0;
            int    num3 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                Mst_slotitem obj2 = item.obj;
                if (IsAtapSlotItem(obj2.Api_mapbattle_type3))
                {
                    num3++;
                }
                num2 += getSlotPlus_Attack(obj2, list[item.idx]);
            }
            double num4 = atk_ship.IsEnemy() ? eValance1 : fValance1;
            double num5;

            if (Mst_DataManager.Instance.Mst_stype[def_ship.Stype].IsLandFacillity(Mst_DataManager.Instance.Mst_ship[def_ship.Ship_id].Soku))
            {
                num5  = num4 + (double)atk_ship.Houg + num2;
                num5 *= getLandFacciilityKeisu(atk_slot);
                num5 += (double)getAtapKeisu(num3);
            }
            else
            {
                num5 = num4 + (double)atk_ship.Houg + (double)atk_ship.Raig + num2;
            }
            num5 *= spAttackKeisu[kind];
            DamageState damageState = atk_ship.Get_DamageState();
            double      num6        = 1.0;

            switch (damageState)
            {
            case DamageState.Tyuuha:
                num6 = 0.7;
                break;

            case DamageState.Taiha:
                num6 = 0.4;
                break;
            }
            num5 *= num6;
            if (num5 > (double)num)
            {
                num5 = (double)num + Math.Sqrt(num5 - (double)num);
            }
            return((int)num5);
        }
예제 #16
0
        protected virtual int getHougAttackValue(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship, int tekkouKind)
        {
            int                   num = 150;
            List <int>            list;
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;

            if (atk_ship.IsEnemy())
            {
                int deckIdx = E_SubInfo[atk_ship.Rid].DeckIdx;
                list            = E_Data.SlotLevel[deckIdx];
                formation       = E_Data.Formation;
                battleFormation = E_Data.BattleFormation;
                BattleFormationKinds1 formation2 = F_Data.Formation;
            }
            else
            {
                int deckIdx2 = F_SubInfo[atk_ship.Rid].DeckIdx;
                list            = F_Data.SlotLevel[deckIdx2];
                formation       = F_Data.Formation;
                battleFormation = F_Data.BattleFormation;
                BattleFormationKinds1 formation3 = E_Data.Formation;
            }
            double num2 = 0.0;
            int    num3 = 0;
            int    num4 = 0;
            int    num5 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                Mst_slotitem obj2 = item.obj;
                if (IsAtapSlotItem(obj2.Api_mapbattle_type3))
                {
                    num5++;
                }
                num3 += obj2.Baku;
                num4 += obj2.Raig;
                num2 += getHougSlotPlus_Attack(obj2, list[item.idx]);
            }
            double num6 = valance1 + (double)atk_ship.Houg + num2;

            if (Mst_DataManager.Instance.Mst_stype[def_ship.Stype].IsLandFacillity(Mst_DataManager.Instance.Mst_ship[def_ship.Ship_id].Soku))
            {
                num6 *= getLandFacciilityKeisu(atk_slot);
                num6 += (double)getAtapKeisu(num5);
                num4  = 0;
            }
            if (kind == BattleAtackKinds_Day.AirAttack)
            {
                int airAtackPow = getAirAtackPow(num3, num4);
                num6 += (double)airAtackPow;
                num6  = 25.0 + (double)(int)(num6 * 1.5);
            }
            double formationParamBattle = formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.HOUGEKI, battleFormation);
            double formationParamF      = formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.HOUGEKI, formation);

            num6 = num6 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num7        = 1.0;

            switch (damageState)
            {
            case DamageState.Tyuuha:
                num7 = 0.7;
                break;

            case DamageState.Taiha:
                num7 = 0.4;
                break;
            }
            num6 *= num7;
            num6 += getHougItemAtackHosei(atk_ship, atk_slot);
            if (num6 > (double)num)
            {
                num6 = (double)num + Math.Sqrt(num6 - (double)num);
            }
            Dictionary <BattleAtackKinds_Day, double> dictionary = new Dictionary <BattleAtackKinds_Day, double>();

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

            if (dictionary2.ContainsKey(kind))
            {
                num6 *= dictionary2[kind];
            }
            num6 *= getTekkouKeisu_Attack(tekkouKind);
            return((int)num6);
        }
예제 #17
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));
        }
예제 #18
0
        protected override int getHougAttackValue(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship, int tekkouKind)
        {
            int num  = 150;
            int num2 = 0;
            int num3 = 0;

            foreach (var item in atk_slot.Select((Mst_slotitem obj, int idx) => new
            {
                obj,
                idx
            }))
            {
                num2 += item.obj.Baku;
                num3 += item.obj.Raig;
            }
            double num4 = valance1 + (double)atk_ship.Houg;

            if (Mst_DataManager.Instance.Mst_stype[def_ship.Stype].IsLandFacillity(Mst_DataManager.Instance.Mst_ship[def_ship.Ship_id].Soku))
            {
                num4 *= getLandFacciilityKeisu(atk_slot);
                num3  = 0;
            }
            if (kind == BattleAtackKinds_Day.AirAttack)
            {
                int airAtackPow = getAirAtackPow(num2, num3);
                num4 += (double)airAtackPow;
                num4  = 25.0 + (double)(int)(num4 * 1.5);
            }
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;

            if (!atk_ship.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;
            }
            double formationParamBattle = formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.HOUGEKI, battleFormation);
            double formationParamF      = formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.HOUGEKI, formation);

            num4 = num4 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num5        = 1.0;

            switch (damageState)
            {
            case DamageState.Tyuuha:
                num5 = 0.7;
                break;

            case DamageState.Taiha:
                num5 = 0.4;
                break;
            }
            num4 *= num5;
            if (num4 > (double)num)
            {
                num4 = (double)num + Math.Sqrt(num4 - (double)num);
            }
            return((int)num4);
        }
        public HashSet <IsGoCondition> ValidStart(int deck_rid, int mission_id, int tankerNum)
        {
            HashSet <IsGoCondition> ret         = new HashSet <IsGoCondition>();
            Mst_mission2            mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, ref mst_mission))
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
            }
            else
            {
                if (mission_id != -1 && mission_id != -2)
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck.get_Item(deck_rid).Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData.get_Item(1) : supportResistedData.get_Item(0));
            }
            Mem_deck mem_deck = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, ref mem_deck))
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (mem_deck.Ship.Count() == 0)
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (mem_deck.MissionState != MissionStates.NONE)
            {
                ret.Add(IsGoCondition.Mission);
            }
            if (mem_deck.IsActionEnd)
            {
                ret.Add(IsGoCondition.ActionEndDeck);
                return(ret);
            }
            Mem_ship mem_ship = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(mem_deck.Ship[0], ref mem_ship))
            {
                ret.Add(IsGoCondition.Invalid);
                return(ret);
            }
            if (mem_ship.Get_DamageState() == DamageState.Taiha)
            {
                ret.Add(IsGoCondition.FlagShipTaiha);
            }
            Mem_deck mem_deck2 = Enumerable.FirstOrDefault <Mem_deck>(Comm_UserDatas.Instance.User_deck.get_Values(), (Mem_deck x) => x.Mission_id == mission_id);

            if (mem_deck2 != null)
            {
                ret.Add(IsGoCondition.OtherDeckMissionRunning);
            }
            int destroy_ship = 0;

            mem_deck.Ship.getMemShip().ForEach(delegate(Mem_ship deck_ship)
            {
                if (deck_ship.Stype == 2)
                {
                    destroy_ship++;
                }
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(deck_ship.Ship_id);
                if (deck_ship.Fuel <= 0 || deck_ship.Bull <= 0)
                {
                    ret.Add(IsGoCondition.NeedSupply);
                }
                if (mst_mission.IsSupportMission() && (deck_ship.Fuel < mst_ship.Fuel_max || deck_ship.Bull < mst_ship.Bull_max))
                {
                    ret.Add(IsGoCondition.ReqFullSupply);
                }
                if (Enumerable.Any <Mem_ndock>(Comm_UserDatas.Instance.User_ndock.get_Values(), (Mem_ndock ndock) => ndock.Ship_id == deck_ship.Rid))
                {
                    ret.Add(IsGoCondition.HasRepair);
                }
                if (deck_ship.IsBlingShip())
                {
                    ret.Add(IsGoCondition.HasBling);
                }
            });
            if (mst_mission.IsSupportMission() && destroy_ship < 2)
            {
                ret.Add(IsGoCondition.NecessaryStype);
            }
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (freeTanker.get_Count() < tankerNum)
            {
                ret.Add(IsGoCondition.Tanker);
            }
            return(ret);
        }
        private void repairShipAutoRecovery(DeckShips deck)
        {
            int             num  = 86;
            int             num2 = 19;
            List <Mem_ship> list = deck.getMemShip();

            if (Enumerable.Count <Mem_ship>(list) == 0)
            {
                return;
            }
            if (list.get_Item(0).Stype != num2)
            {
                return;
            }
            DamageState damageState = list.get_Item(0).Get_DamageState();

            if (damageState == DamageState.Tyuuha || damageState == DamageState.Taiha)
            {
                return;
            }
            if (list.get_Item(0).ExistsNdock())
            {
                return;
            }
            if (list.get_Item(0).IsBlingShip())
            {
                return;
            }
            Mem_material mem_material  = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Fuel);
            Mem_material mem_material2 = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel);

            if (mem_material.Value == 0 && mem_material2.Value == 0)
            {
                return;
            }
            Mem_ship      arg_C7_0 = list.get_Item(0);
            HashSet <int> hashSet  = new HashSet <int>();

            hashSet.Add(num);
            Dictionary <int, int> mstSlotItemNum_OrderId = arg_C7_0.GetMstSlotItemNum_OrderId(hashSet);
            int num3 = mstSlotItemNum_OrderId.get_Item(num);

            list = Enumerable.ToList <Mem_ship>(Enumerable.Take <Mem_ship>(list, num3 + 2));
            using (List <Mem_ship> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    if (current.Nowhp < current.Maxhp)
                    {
                        DamageState damageState2 = current.Get_DamageState();
                        if (damageState2 != DamageState.Tyuuha && damageState2 != DamageState.Taiha)
                        {
                            if (!current.ExistsNdock())
                            {
                                if (!current.IsBlingShip())
                                {
                                    int    ndockTimeSpan = current.GetNdockTimeSpan();
                                    int    num4          = ndockTimeSpan * 30;
                                    int    num5          = 30;
                                    double num6          = (double)num5 / (double)num4;
                                    Dictionary <enumMaterialCategory, int> ndockMaterialNum = current.GetNdockMaterialNum();
                                    int num7 = (int)Math.Ceiling((double)ndockMaterialNum.get_Item(enumMaterialCategory.Fuel) * num6);
                                    int num8 = (int)Math.Ceiling((double)ndockMaterialNum.get_Item(enumMaterialCategory.Steel) * num6);
                                    if (mem_material.Value >= num7 && mem_material2.Value >= num8)
                                    {
                                        double num9  = (double)(current.Maxhp - current.Nowhp) * num6;
                                        int    num10 = (num9 >= 1.0) ? ((int)num9) : ((int)Math.Ceiling(num9));
                                        current.SubHp(-num10);
                                        mem_material.Sub_Material(num7);
                                        mem_material2.Sub_Material(num8);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        private List <RadingDamageData> getRadingDamage(int area, RadingKind kind, Mst_radingrate rateRecord, List <Mem_ship> targetShips, out int deckPow, out List <Mem_ship> deleteShips)
        {
            List <Mem_ship> list = Enumerable.ToList <Mem_ship>(targetShips);
            int             ec   = 0;
            double          ad1  = 0.0;
            double          ad2  = 0.0;

            list.ForEach(delegate(Mem_ship ship)
            {
                if (ship.IsEscortDeffender())
                {
                    ec++;
                }
                Ship_GrowValues battleBaseParam = ship.GetBattleBaseParam();
                int num11 = ship.Taiku - battleBaseParam.Taiku;
                ad1       = ad1 + Math.Sqrt((double)battleBaseParam.Taiku) + (double)num11;
                int num12 = ship.Taisen - battleBaseParam.Taisen;
                ad2       = ad2 + Math.Sqrt((double)battleBaseParam.Taisen) + (double)num12;
            });
            int[]  radingValues = rateRecord.GetRadingValues(kind);
            double num          = (kind != RadingKind.AIR_ATTACK) ? ad2 : ad1;
            int    num2         = radingValues[0];
            int    num3         = radingValues[1];

            deckPow     = (int)num;
            deleteShips = new List <Mem_ship>();
            if (list.get_Count() == 0)
            {
                return(new List <RadingDamageData>());
            }
            RadingResultData radingResultData = new RadingResultData();

            radingResultData.DeckAttackPow = (int)num;
            double num4 = (double)num3 - Math.Sqrt((double)ec);
            int    num5 = (num4 >= 1.0) ? ((int)Utils.GetRandDouble(0.0, num4, 0.1, 1)) : 0;
            List <RadingDamageData>       list2      = new List <RadingDamageData>();
            Dictionary <int, DamageState> dictionary = Enumerable.ToDictionary(Enumerable.Select(list, (Mem_ship x) => new
            {
                rid   = x.Rid,
                state = x.Get_DamageState()
            }), key => key.rid, val => val.state);

            for (int i = 0; i < num5; i++)
            {
                if (list.get_Count() == 0)
                {
                    return(list2);
                }
                RadingDamageData radingDamageData = new RadingDamageData();
                double           num6             = (double)(num3 * 5) - num / 5.0 - Math.Sqrt(num);
                int      num7     = (int)Utils.GetRandDouble(0.0, (double)(list.get_Count() - 1), 1.0, 1);
                Mem_ship mem_ship = list.get_Item(num7);
                radingDamageData.Rid = mem_ship.Rid;
                if (num6 <= 0.0)
                {
                    radingDamageData.Damage      = false;
                    radingDamageData.DamageState = DamagedStates.None;
                }
                else
                {
                    int taik = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id).Taik;
                    int num8 = (int)((double)taik * Utils.GetRandDouble(1.0, num6, 1.0, 1) / 100.0) + 1;
                    int num9 = mem_ship.Nowhp - num8;
                    if (num9 <= 0)
                    {
                        if (this.basicInstance.Difficult != DifficultKind.SHI)
                        {
                            num9 = 1;
                        }
                        else if (dictionary.get_Item(mem_ship.Rid) != DamageState.Taiha)
                        {
                            num9 = 1;
                        }
                        else
                        {
                            num9 = 0;
                        }
                    }
                    int num10 = mem_ship.Nowhp - num9;
                    if (num10 > 0)
                    {
                        DamageState damageState = mem_ship.Get_DamageState();
                        radingDamageData.Damage = true;
                        if (num9 == 0)
                        {
                            int[] array = mem_ship.FindRecoveryItem();
                            if (array[0] == -1)
                            {
                                radingDamageData.DamageState = DamagedStates.Gekichin;
                                list.Remove(mem_ship);
                                deleteShips.Add(mem_ship);
                            }
                            else
                            {
                                mem_ship.SubHp(num10);
                                mem_ship.UseRecoveryItem(array, false);
                                radingDamageData.DamageState = ((array[1] != 43) ? DamagedStates.Youin : DamagedStates.Megami);
                                dictionary.set_Item(mem_ship.Rid, DamageState.Normal);
                            }
                        }
                        else
                        {
                            mem_ship.SubHp(num10);
                            DamageState damageState2 = mem_ship.Get_DamageState();
                            if (damageState != damageState2)
                            {
                                if (damageState2 == DamageState.Taiha)
                                {
                                    radingDamageData.DamageState = DamagedStates.Taiha;
                                }
                                else if (damageState2 == DamageState.Shouha)
                                {
                                    radingDamageData.DamageState = DamagedStates.Shouha;
                                }
                                else if (damageState2 == DamageState.Tyuuha)
                                {
                                    radingDamageData.DamageState = DamagedStates.Tyuuha;
                                }
                            }
                            else
                            {
                                radingDamageData.DamageState = DamagedStates.None;
                            }
                        }
                    }
                    else
                    {
                        radingDamageData.Damage      = false;
                        radingDamageData.DamageState = DamagedStates.None;
                    }
                }
                list2.Add(radingDamageData);
            }
            return(list2);
        }
예제 #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[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;
                }
            }
        }
예제 #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
        private void updateShip(BattleWinRankKinds rank, int mvpShip, SerializableDictionary <int, int> getShipExp, out SerializableDictionary <int, List <int> > lvupInfo)
        {
            lvupInfo = new SerializableDictionary <int, List <int> >();
            List <Mem_ship> shipData = F_Data.ShipData;
            int             count    = shipData.Count;
            bool            flag     = true;
            double          num      = 1.0;
            double          num2     = 0.0;

            if (!practiceFlag)
            {
                flag = E_Data.ShipData.Exists((Mem_ship x) => (!Mst_DataManager.Instance.Mst_stype[x.Stype].IsSubmarine()) ? true : false);
                if (!flag)
                {
                    num  = 0.25;
                    num2 = 0.5;
                }
            }
            Dictionary <int, int> dictionary = mst_shiplevel;

            for (int i = 0; i < count; i++)
            {
                Mem_ship     mem_ship     = shipData[i];
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
                Mst_ship     mst_ship     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                int          addExp       = getShipExp[mem_ship.Rid];
                List <int>   lvupInfo2    = null;
                int          levelupInfo  = mem_ship.getLevelupInfo(dictionary, mem_shipBase.Level, mem_shipBase.Exp, ref addExp, out lvupInfo2);
                lvupInfo.Add(mem_ship.Rid, lvupInfo2);
                if (!mem_ship.Escape_sts)
                {
                    mem_shipBase.Level = levelupInfo;
                    mem_shipBase.Exp  += addExp;
                    mem_shipBase.Fuel -= mst_ship.Use_fuel;
                    if (mem_shipBase.Fuel < 0)
                    {
                        mem_shipBase.Fuel = 0;
                    }
                    int num3 = mst_ship.Use_bull;
                    if (battleKinds == ExecBattleKinds.DayToNight)
                    {
                        num3 = (int)Math.Ceiling((double)num3 * 1.5);
                    }
                    num3 = (int)((double)num3 * num + num2);
                    if (!flag && num3 <= 0)
                    {
                        num3 = 1;
                    }
                    mem_shipBase.Bull -= num3;
                    if (mem_shipBase.Bull < 0)
                    {
                        mem_shipBase.Bull = 0;
                    }
                    setCondSubValue(ref mem_shipBase.Cond);
                    bool mvp   = (mvpShip == mem_ship.Rid) ? true : false;
                    bool flag2 = (F_SubInfo[mem_ship.Rid].DeckIdx == 0) ? true : false;
                    setCondBonus(rank, flag2, mvp, ref mem_shipBase.Cond);
                    int num4 = levelupInfo - mem_ship.Level;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = mem_ship.Kyouka;
                    for (int j = 0; j < num4; j++)
                    {
                        dictionary2 = mem_ship.getLevelupKyoukaValue(mem_ship.Ship_id, dictionary2);
                    }
                    mem_shipBase.SetKyoukaValue(dictionary2);
                    if (mem_ship.Get_DamageState() >= DamageState.Tyuuha)
                    {
                        clothBrokenIds.Add(mem_ship.Ship_id);
                    }
                    if (practiceFlag)
                    {
                        mem_shipBase.Nowhp = F_Data.StartHp[i];
                    }
                    else if (mem_shipBase.Nowhp <= 0)
                    {
                        deleteTargetShip.Add(mem_ship);
                    }
                    int value  = 0;
                    int value2 = 0;
                    dictionary.TryGetValue(mem_shipBase.Level - 1, out value);
                    dictionary.TryGetValue(mem_shipBase.Level + 1, out value2);
                    mem_ship.SetRequireExp(mem_shipBase.Level, dictionary);
                    mem_ship.SumLovToBattle(rank, flag2, mvp, F_Data.StartHp[i], mem_ship.Nowhp);
                    mem_shipBase.Lov = mem_ship.Lov;
                    mem_ship.Set_ShipParam(mem_shipBase, mst_ship, enemy_flag: false);
                }
            }
        }
예제 #25
0
        private int getMidnightAttackValue(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship)
        {
            int        num = 300;
            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 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();
                    Mst_slotitem obj2    = current.obj;
                    if (base.IsAtapSlotItem(obj2.Api_mapbattle_type3))
                    {
                        num3++;
                    }
                    num2 += this.getSlotPlus_Attack(obj2, list.get_Item(current.idx));
                }
            }
            double num4 = atk_ship.IsEnemy() ? this.eValance1 : this.fValance1;
            bool   flag = Mst_DataManager.Instance.Mst_stype.get_Item(def_ship.Stype).IsLandFacillity(Mst_DataManager.Instance.Mst_ship.get_Item(def_ship.Ship_id).Soku);
            double num5;

            if (flag)
            {
                num5  = num4 + (double)atk_ship.Houg + num2;
                num5 *= this.getLandFacciilityKeisu(atk_slot);
                num5 += (double)base.getAtapKeisu(num3);
            }
            else
            {
                num5 = num4 + (double)atk_ship.Houg + (double)atk_ship.Raig + num2;
            }
            num5 *= this.spAttackKeisu.get_Item(kind);
            DamageState damageState = atk_ship.Get_DamageState();
            double      num6        = 1.0;

            if (damageState == DamageState.Tyuuha)
            {
                num6 = 0.7;
            }
            else if (damageState == DamageState.Taiha)
            {
                num6 = 0.4;
            }
            num5 *= num6;
            if (num5 > (double)num)
            {
                num5 = (double)num + Math.Sqrt(num5 - (double)num);
            }
            return((int)num5);
        }
예제 #26
0
        protected bool CanAirAtack_DamageState(Mem_ship ship)
        {
            DamageState damageState = (ship.Stype != 18) ? DamageState.Tyuuha : DamageState.Taiha;

            return((ship.Get_DamageState() < damageState) ? true : false);
        }
예제 #27
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;
                    }
                }
            }
        }
예제 #28
0
        public bool IsDamaged()
        {
            DamageState damageState = _mem_data.Get_DamageState();

            return(damageState == DamageState.Tyuuha || damageState == DamageState.Taiha);
        }
예제 #29
0
        protected override int getHougAttackValue(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, Mem_ship def_ship, int tekkouKind)
        {
            int num  = 150;
            int num2 = 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();
                    num2 += current.obj.Baku;
                    num3 += current.obj.Raig;
                }
            }
            double num4 = this.valance1 + (double)atk_ship.Houg;
            bool   flag = Mst_DataManager.Instance.Mst_stype.get_Item(def_ship.Stype).IsLandFacillity(Mst_DataManager.Instance.Mst_ship.get_Item(def_ship.Ship_id).Soku);

            if (flag)
            {
                num4 *= this.getLandFacciilityKeisu(atk_slot);
                num3  = 0;
            }
            if (kind == BattleAtackKinds_Day.AirAttack)
            {
                int airAtackPow = this.getAirAtackPow(num2, num3);
                num4 += (double)airAtackPow;
                num4  = 25.0 + (double)((int)(num4 * 1.5));
            }
            BattleFormationKinds1 formation;
            BattleFormationKinds2 battleFormation;

            if (!atk_ship.IsEnemy())
            {
                formation       = this.F_Data.Formation;
                battleFormation = this.F_Data.BattleFormation;
                BattleFormationKinds1 formation2 = this.E_Data.Formation;
            }
            else
            {
                formation       = this.E_Data.Formation;
                battleFormation = this.E_Data.BattleFormation;
                BattleFormationKinds1 formation2 = this.F_Data.Formation;
            }
            double formationParamBattle = this.formationData.GetFormationParamBattle(FormationDatas.GetFormationKinds.HOUGEKI, battleFormation);
            double formationParamF      = this.formationData.GetFormationParamF1(FormationDatas.GetFormationKinds.HOUGEKI, formation);

            num4 = num4 * formationParamBattle * formationParamF;
            DamageState damageState = atk_ship.Get_DamageState();
            double      num5        = 1.0;

            if (damageState == DamageState.Tyuuha)
            {
                num5 = 0.7;
            }
            else if (damageState == DamageState.Taiha)
            {
                num5 = 0.4;
            }
            num4 *= num5;
            if (num4 > (double)num)
            {
                num4 = (double)num + Math.Sqrt(num4 - (double)num);
            }
            return((int)num4);
        }
예제 #30
0
        private List <RadingDamageData> getRadingDamage(int area, RadingKind kind, Mst_radingrate rateRecord, List <Mem_ship> targetShips, out int deckPow, out List <Mem_ship> deleteShips)
        {
            List <Mem_ship> list = targetShips.ToList();
            int             ec   = 0;
            double          ad3  = 0.0;
            double          ad2  = 0.0;

            list.ForEach(delegate(Mem_ship ship)
            {
                if (ship.IsEscortDeffender())
                {
                    ec++;
                }
                Ship_GrowValues battleBaseParam = ship.GetBattleBaseParam();
                int num9  = ship.Taiku - battleBaseParam.Taiku;
                ad3       = ad3 + Math.Sqrt(battleBaseParam.Taiku) + (double)num9;
                int num10 = ship.Taisen - battleBaseParam.Taisen;
                ad2       = ad2 + Math.Sqrt(battleBaseParam.Taisen) + (double)num10;
            });
            int[]  radingValues = rateRecord.GetRadingValues(kind);
            double num          = (kind != RadingKind.AIR_ATTACK) ? ad2 : ad3;
            int    num11        = radingValues[0];
            int    num2         = radingValues[1];

            deckPow     = (int)num;
            deleteShips = new List <Mem_ship>();
            if (list.Count == 0)
            {
                return(new List <RadingDamageData>());
            }
            RadingResultData radingResultData = new RadingResultData();

            radingResultData.DeckAttackPow = (int)num;
            double num3 = (double)num2 - Math.Sqrt(ec);
            int    num4 = (!(num3 < 1.0)) ? ((int)Utils.GetRandDouble(0.0, num3, 0.1, 1)) : 0;
            List <RadingDamageData>       list2      = new List <RadingDamageData>();
            Dictionary <int, DamageState> dictionary = (from x in list
                                                        select new
            {
                rid = x.Rid,
                state = x.Get_DamageState()
            }).ToDictionary(key => key.rid, val => val.state);

            for (int i = 0; i < num4; i++)
            {
                if (list.Count == 0)
                {
                    return(list2);
                }
                RadingDamageData radingDamageData = new RadingDamageData();
                double           num5             = (double)(num2 * 5) - num / 5.0 - Math.Sqrt(num);
                int      index    = (int)Utils.GetRandDouble(0.0, list.Count - 1, 1.0, 1);
                Mem_ship mem_ship = list[index];
                radingDamageData.Rid = mem_ship.Rid;
                if (num5 <= 0.0)
                {
                    radingDamageData.Damage      = false;
                    radingDamageData.DamageState = DamagedStates.None;
                }
                else
                {
                    int taik = Mst_DataManager.Instance.Mst_ship[mem_ship.Ship_id].Taik;
                    int num6 = (int)((double)taik * Utils.GetRandDouble(1.0, num5, 1.0, 1) / 100.0) + 1;
                    int num7 = mem_ship.Nowhp - num6;
                    if (num7 <= 0)
                    {
                        num7 = ((basicInstance.Difficult != DifficultKind.SHI) ? 1 : ((dictionary[mem_ship.Rid] != DamageState.Taiha) ? 1 : 0));
                    }
                    int num8 = mem_ship.Nowhp - num7;
                    if (num8 > 0)
                    {
                        DamageState damageState = mem_ship.Get_DamageState();
                        radingDamageData.Damage = true;
                        if (num7 == 0)
                        {
                            int[] array = mem_ship.FindRecoveryItem();
                            if (array[0] == -1)
                            {
                                radingDamageData.DamageState = DamagedStates.Gekichin;
                                list.Remove(mem_ship);
                                deleteShips.Add(mem_ship);
                            }
                            else
                            {
                                mem_ship.SubHp(num8);
                                mem_ship.UseRecoveryItem(array, flagShipRecovery: false);
                                radingDamageData.DamageState = ((array[1] != 43) ? DamagedStates.Youin : DamagedStates.Megami);
                                dictionary[mem_ship.Rid]     = DamageState.Normal;
                            }
                        }
                        else
                        {
                            mem_ship.SubHp(num8);
                            DamageState damageState2 = mem_ship.Get_DamageState();
                            if (damageState != damageState2)
                            {
                                switch (damageState2)
                                {
                                case DamageState.Taiha:
                                    radingDamageData.DamageState = DamagedStates.Taiha;
                                    break;

                                case DamageState.Shouha:
                                    radingDamageData.DamageState = DamagedStates.Shouha;
                                    break;

                                case DamageState.Tyuuha:
                                    radingDamageData.DamageState = DamagedStates.Tyuuha;
                                    break;
                                }
                            }
                            else
                            {
                                radingDamageData.DamageState = DamagedStates.None;
                            }
                        }
                    }
                    else
                    {
                        radingDamageData.Damage      = false;
                        radingDamageData.DamageState = DamagedStates.None;
                    }
                }
                list2.Add(radingDamageData);
            }
            return(list2);
        }