private void UpdateCondition(FatigueState state)
        {
            this.KiraPar.Stop();
            this.KiraPar.SetActive(false);
            switch (state)
            {
            case FatigueState.Exaltation:
                this.UiConditionMask.alpha = 0f;
                this.UiConditionIcon.alpha = 0f;
                this.KiraPar.SetActive(true);
                this.KiraPar.Play();
                break;

            case FatigueState.Normal:
                this.UiConditionMask.alpha = 0f;
                this.UiConditionIcon.alpha = 0f;
                break;

            case FatigueState.Light:
                this.UiConditionMask.alpha      = 1f;
                this.UiConditionIcon.alpha      = 1f;
                this.UiConditionMask.spriteName = "card-ss_fatigue_1";
                this.UiConditionIcon.spriteName = "icon_fatigue_1";
                break;

            case FatigueState.Distress:
                this.UiConditionMask.alpha      = 1f;
                this.UiConditionIcon.alpha      = 1f;
                this.UiConditionMask.spriteName = "card-ss_fatigue_2";
                this.UiConditionIcon.spriteName = "icon_fatigue_2";
                break;
            }
        }
Exemplo n.º 2
0
        public virtual void UpdateFatigue(FatigueState state, UISprite _fatigueIcon, UISprite _fatigueMask)
        {
            switch (state)
            {
            case FatigueState.Normal:
                _fatigueMask.alpha = 0f;
                _fatigueIcon.alpha = 0f;
                break;

            case FatigueState.Light:
                _fatigueMask.spriteName = "card-s_fatigue_01";
                _fatigueIcon.spriteName = "icon-s_fatigue1";
                _fatigueMask.alpha      = 1f;
                _fatigueIcon.alpha      = 1f;
                break;

            case FatigueState.Distress:
                _fatigueMask.spriteName = "card-s_fatigue_02";
                _fatigueIcon.spriteName = "icon-s_fatigue2";
                _fatigueMask.alpha      = 1f;
                _fatigueIcon.alpha      = 1f;
                break;

            case FatigueState.Exaltation:
                _fatigueMask.alpha = 0f;
                _fatigueIcon.alpha = 0f;
                break;
            }
        }
Exemplo n.º 3
0
        private void UpdateCondition(FatigueState state)
        {
            KiraPar.Stop();
            ((Component)KiraPar).SetActive(isActive: false);
            switch (state)
            {
            case FatigueState.Normal:
                UiConditionMask.alpha = 0f;
                UiConditionIcon.alpha = 0f;
                break;

            case FatigueState.Light:
                UiConditionMask.alpha      = 1f;
                UiConditionIcon.alpha      = 1f;
                UiConditionMask.spriteName = "card-ss_fatigue_1";
                UiConditionIcon.spriteName = "icon_fatigue_1";
                break;

            case FatigueState.Distress:
                UiConditionMask.alpha      = 1f;
                UiConditionIcon.alpha      = 1f;
                UiConditionMask.spriteName = "card-ss_fatigue_2";
                UiConditionIcon.spriteName = "icon_fatigue_2";
                break;

            case FatigueState.Exaltation:
                UiConditionMask.alpha = 0f;
                UiConditionIcon.alpha = 0f;
                ((Component)KiraPar).SetActive(isActive: true);
                KiraPar.Play();
                break;
            }
        }
Exemplo n.º 4
0
        protected virtual BattleHitStatus getHitStatus(int hitProb, int avoProb, Mem_ship attackShip, Mem_ship targetShip, double cliticalKeisu, bool airAttack)
        {
            double       num          = hitProb - avoProb;
            FatigueState fatigueState = targetShip.Get_FatigueState();

            if (num <= 10.0)
            {
                num = 10.0;
            }
            double num2 = 1.0;

            switch (fatigueState)
            {
            case FatigueState.Exaltation:
                num2 = 0.7;
                break;

            case FatigueState.Normal:
                num2 = 1.0;
                break;

            case FatigueState.Light:
                num2 = 1.2;
                break;

            case FatigueState.Distress:
                num2 = 1.4;
                break;
            }
            num *= num2;
            if (num >= 96.0)
            {
                num = 96.0;
            }
            double cht  = 0.0;
            double cht2 = 1.0;

            if (airAttack)
            {
                setCliticalAlv(ref num, ref cht, ref cht2, attackShip);
            }
            int    num3 = randInstance.Next(100);
            double num4 = Math.Sqrt(num) * cliticalKeisu;

            if ((double)num3 <= num4)
            {
                return(BattleHitStatus.Clitical);
            }
            if ((double)num3 > num)
            {
                return(BattleHitStatus.Miss);
            }
            return(BattleHitStatus.Normal);
        }
        protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            int num = 0;

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

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

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

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

            if (fatigueState == FatigueState.Exaltation)
            {
                num3 = 1.3;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num3 = 0.7;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num3 = 0.35;
            }
            num2 *= num3;
            return((int)num2);
        }
Exemplo n.º 6
0
        protected override int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            int num = 0;

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

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

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

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

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

            case FatigueState.Light:
                num3 = 0.7;
                break;

            case FatigueState.Distress:
                num3 = 0.35;
                break;
            }
            num2 *= num3;
            return((int)num2);
        }
Exemplo n.º 7
0
        protected virtual BattleHitStatus getHitStatus(int hitProb, int avoProb, Mem_ship attackShip, Mem_ship targetShip, double cliticalKeisu)
        {
            double       num          = (double)(hitProb - avoProb);
            FatigueState fatigueState = targetShip.Get_FatigueState();

            if (num <= 10.0)
            {
                num = 10.0;
            }
            double num2 = 1.0;

            if (fatigueState == FatigueState.Exaltation)
            {
                num2 = 0.7;
            }
            else if (fatigueState == FatigueState.Normal)
            {
                num2 = 1.0;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num2 = 1.2;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num2 = 1.4;
            }
            num *= num2;
            if (num >= 96.0)
            {
                num = 96.0;
            }
            double num3 = 0.0;
            double num4 = 1.0;
            int    num5 = r.Next(100);
            double num6 = Math.Sqrt(num) * cliticalKeisu;

            calHitRate      = num;
            calCriticalRate = num6;
            if ((double)num5 <= num6)
            {
                return(BattleHitStatus.Critical);
            }
            if ((double)num5 > num)
            {
                return(BattleHitStatus.Miss);
            }
            return(BattleHitStatus.Normal);
        }
Exemplo n.º 8
0
        protected virtual int getHougHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> slotLevel)
        {
            double     num  = 0.0;
            List <int> list = slotLevel;
            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.Current;
                    num3 += current.obj.Houm;
                    num2 += this.getHougSlotPlus_Hit(current.obj, list[current.idx]);
                }
            }
            double       num4         = Math.Sqrt((double)atk_ship.Luck * 1.5) + Math.Sqrt((double)atk_ship.Level) * 2.0 + (double)num3;
            double       num5         = this.valance2 + num4 + num2;
            FatigueState fatigueState = atk_ship.Get_FatigueState();
            double       num6         = 1.0;

            if (fatigueState == FatigueState.Exaltation)
            {
                num6 = 1.2;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num6 = 0.8;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num6 = 0.5;
            }
            num5 *= num6;
            num5  = this.getHougHitProbUpValue(num5, atk_ship, atk_slot);
            double num7 = num5 * num;

            num5 += num7;
            return((int)num5);
        }
Exemplo n.º 9
0
        private void UpdateCondition(FatigueState state)
        {
            switch (state)
            {
            case FatigueState.Exaltation:
                this.UiConditionMask.alpha = 0f;
                this.UiConditionIcon.alpha = 0f;
                this.SetKiraPar();
                break;

            case FatigueState.Normal:
                this.UiConditionMask.alpha = 0f;
                this.UiConditionIcon.alpha = 0f;
                if (this.Kira != null)
                {
                    this.Kira.SetActive(false);
                }
                break;

            case FatigueState.Light:
                this.UiConditionMask.alpha      = 1f;
                this.UiConditionIcon.alpha      = 1f;
                this.UiConditionMask.spriteName = "card-ss_fatigue_1";
                this.UiConditionIcon.spriteName = "icon_fatigue_1";
                if (this.Kira != null)
                {
                    this.Kira.SetActive(false);
                }
                break;

            case FatigueState.Distress:
                this.UiConditionMask.alpha      = 1f;
                this.UiConditionIcon.alpha      = 1f;
                this.UiConditionMask.spriteName = "card-ss_fatigue_2";
                this.UiConditionIcon.spriteName = "icon_fatigue_2";
                if (this.Kira != null)
                {
                    this.Kira.SetActive(false);
                }
                break;
            }
        }
Exemplo n.º 10
0
        private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight)
        {
            List <int> list;

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

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

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

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

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

            if (fatigueState == FatigueState.Exaltation)
            {
                num5 = 1.2;
            }
            else if (fatigueState == FatigueState.Light)
            {
                num5 = 0.8;
            }
            else if (fatigueState == FatigueState.Distress)
            {
                num5 = 0.5;
            }
            num3 *= num5;
            if (atk_ship.Stype == 5 || atk_ship.Stype == 6)
            {
                int num6 = 0;
                if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(6)))
                {
                    num6 = 10;
                }
                else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem.get_Item(50)))
                {
                    num6 = 15;
                }
                num3 += (double)num6;
            }
            if (deckSearchLight.get_Count() > 0)
            {
                num3 += 7.0;
            }
            num3 = this.getMidnightHitProbUpValue(num3, atk_ship, atk_slot);
            return((int)num3);
        }
Exemplo n.º 11
0
        protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            double                num = 0.0;
            List <int>            list;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

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

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

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

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

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

            case FatigueState.Light:
                num5 = 0.7;
                break;

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

            num4 += num6;
            return((int)num4);
        }
Exemplo n.º 12
0
        private void setResultKind()
        {
            if (mem_deck.MissionState == MissionStates.STOP)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (mst_mission.Flagship_level > 0)
            {
                FatigueState fatigueState = mem_ships[0].Get_FatigueState();
                if (fatigueState >= FatigueState.Light)
                {
                    resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
                if (mst_mission.Flagship_level > mem_ships[0].Level)
                {
                    resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
            }
            if (mst_mission.Flagship_stype1 > 0 && mst_mission.Flagship_stype1 != mem_ships[0].Stype)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (mst_mission.Tanker_num > 0 && missionTanker.Count < mst_mission.Tanker_num)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            Dictionary <int, int> dictionary = (from data in Utils.Xml_Result("mst_stype_group", "mst_stype_group", "Id")
                                                let item = new
            {
                id = int.Parse(data.Element("Id").Value),
                type = int.Parse(data.Element("Mission").Value)
            }
                                                select item).ToDictionary(obj => obj.id, value => value.type);
            IEnumerable <int>     source      = dictionary.Values.Distinct();
            Dictionary <int, int> dictionary2 = source.ToDictionary((int type) => type, (int count) => 0);
            int num  = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;
            int num5 = 0;
            int num6 = 0;
            int num7 = 0;

            foreach (Mem_ship mem_ship in mem_ships)
            {
                FatigueState fatigueState2 = mem_ship.Get_FatigueState();
                if (fatigueState2 == FatigueState.Distress)
                {
                    resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
                Dictionary <int, int> mstSlotItemNum_OrderId = mem_ship.GetMstSlotItemNum_OrderId(new HashSet <int>
                {
                    68,
                    75
                });
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[mem_ship.Ship_id];
                daihatuNum += mstSlotItemNum_OrderId[68];
                if (mstSlotItemNum_OrderId[75] > 0)
                {
                    drumShipNum++;
                }
                drumNum += mstSlotItemNum_OrderId[75];
                num7    += mem_ship.Level;
                num6    += mst_ship.Bull_max;
                num5    += mst_ship.Fuel_max;
                switch (fatigueState2)
                {
                case FatigueState.Light:
                    num2++;
                    continue;

                case FatigueState.Exaltation:
                    num++;
                    break;
                }
                num4 += mem_ship.Bull;
                num3 += mem_ship.Fuel;
                int num8 = dictionary[mem_ship.Stype];
                Dictionary <int, int> dictionary3;
                Dictionary <int, int> dictionary4 = dictionary3 = dictionary2;
                int key;
                int key2 = key = num8;
                key = dictionary3[key];
                dictionary4[key2] = key + 1;
            }
            if (dictionary2[1] < mst_mission.Stype_num1 || dictionary2[2] < mst_mission.Stype_num2 || dictionary2[3] < mst_mission.Stype_num3 || dictionary2[4] < mst_mission.Stype_num4 || dictionary2[5] < mst_mission.Stype_num5 || dictionary2[6] < mst_mission.Stype_num6 || dictionary2[7] < mst_mission.Stype_num7 || dictionary2[8] < mst_mission.Stype_num8 || dictionary2[9] < mst_mission.Stype_num9)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (mst_mission.Deck_num > 0)
            {
                int num9 = mem_ships.Count - num2;
                if (num9 < mst_mission.Deck_num)
                {
                    resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
            }
            if (num7 < mst_mission.Level)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (drumShipNum < mst_mission.Drum_ship_num || drumNum < mst_mission.Drum_total_num1)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            double num10 = num3 + num4;
            double num11 = num5 + num6;
            double num12 = num10 / num11 * 100.0;
            int    num13 = (int)(num12 + (double)randInstance.Next(20));

            if (num13 < 100)
            {
                resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (num2 > 0)
            {
                resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            if (!mst_mission.IsGreatSuccessCondition() && num < mem_ships.Count)
            {
                resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            int drumKeisu = 0;

            if (mst_mission.Drum_total_num2 > 0)
            {
                drumKeisu = ((drumNum < mst_mission.Drum_total_num2) ? (-15) : 20);
            }
            if (mst_mission.Flagship_stype2 > 0 && mst_mission.Flagship_stype2 != mem_ships[0].Stype)
            {
                resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            int checkRate = getCheckRate(num, drumKeisu);
            int num14     = randInstance.Next(100);

            if (checkRate >= num14)
            {
                resultInfo.MissionResult = MissionResultKinds.GREAT;
            }
            else
            {
                resultInfo.MissionResult = MissionResultKinds.SUCCESS;
            }
        }
Exemplo n.º 13
0
        protected virtual int getHougHitProb(BattleAtackKinds_Day kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int tekkouKind)
        {
            double num = 0.0;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;
            List <int>            list;

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

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

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

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

            case FatigueState.Light:
                num6 = 0.8;
                break;

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

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

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

            num5 += num7;
            return((int)num5);
        }
Exemplo n.º 14
0
        protected int getSubmarineHitProb(Mem_ship attackShip, List <Mst_slotitem> attackSlot, List <int> slotLevels)
        {
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

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

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

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

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

            case FatigueState.Normal:
                num5 = 1.0;
                break;

            case FatigueState.Light:
                num5 = 0.8;
                break;

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

            if (practiceFlag)
            {
                num6 *= 1.5;
            }
            return((int)num6);
        }
Exemplo n.º 15
0
        private int getMidnightHitProb(BattleAtackKinds_Night kind, Mem_ship atk_ship, List <Mst_slotitem> atk_slot, List <int> deckSearchLight)
        {
            List <int> list;

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

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

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

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

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

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

            case FatigueState.Light:
                num5 = 0.8;
                break;

            case FatigueState.Distress:
                num5 = 0.5;
                break;
            }
            num3 *= num5;
            if (atk_ship.Stype == 5 || atk_ship.Stype == 6)
            {
                int num6 = 0;
                if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[6]))
                {
                    num6 = 10;
                }
                else if (atk_slot.Contains(Mst_DataManager.Instance.Mst_Slotitem[50]))
                {
                    num6 = 15;
                }
                num3 += (double)num6;
            }
            if (deckSearchLight.Count > 0)
            {
                num3 += 7.0;
            }
            num3 = getMidnightHitProbUpValue(num3, atk_ship, atk_slot);
            return((int)num3);
        }
Exemplo n.º 16
0
        private void setResultKind()
        {
            if (this.mem_deck.MissionState == MissionStates.STOP)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (this.mst_mission.Flagship_level > 0)
            {
                FatigueState fatigueState = this.mem_ships.get_Item(0).Get_FatigueState();
                if (fatigueState >= FatigueState.Light)
                {
                    this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
                if (this.mst_mission.Flagship_level > this.mem_ships.get_Item(0).Level)
                {
                    this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
            }
            if (this.mst_mission.Flagship_stype1 > 0 && this.mst_mission.Flagship_stype1 != this.mem_ships.get_Item(0).Stype)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (this.mst_mission.Tanker_num > 0 && this.missionTanker.get_Count() < this.mst_mission.Tanker_num)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            Dictionary <int, int> dictionary = Enumerable.ToDictionary(Enumerable.Select(Enumerable.Select(Utils.Xml_Result("mst_stype_group", "mst_stype_group", "Id"), (XElement data) => new
            {
                data = data,
                item = new
                {
                    id   = int.Parse(data.Element("Id").get_Value()),
                    type = int.Parse(data.Element("Mission").get_Value())
                }
            }), <> __TranspIdent15 => < > __TranspIdent15.item), obj => obj.id, value => value.type);
            IEnumerable <int>     enumerable  = Enumerable.Distinct <int>(dictionary.get_Values());
            Dictionary <int, int> dictionary2 = Enumerable.ToDictionary <int, int, int>(enumerable, (int type) => type, (int count) => 0);
            int num  = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;
            int num5 = 0;
            int num6 = 0;
            int num7 = 0;

            using (List <Mem_ship> .Enumerator enumerator = this.mem_ships.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship     current       = enumerator.get_Current();
                    FatigueState fatigueState2 = current.Get_FatigueState();
                    if (fatigueState2 == FatigueState.Distress)
                    {
                        this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                        return;
                    }
                    Mem_ship      arg_251_0 = current;
                    HashSet <int> hashSet   = new HashSet <int>();
                    hashSet.Add(68);
                    hashSet.Add(75);
                    Dictionary <int, int> mstSlotItemNum_OrderId = arg_251_0.GetMstSlotItemNum_OrderId(hashSet);
                    Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(current.Ship_id);
                    this.daihatuNum += mstSlotItemNum_OrderId.get_Item(68);
                    if (mstSlotItemNum_OrderId.get_Item(75) > 0)
                    {
                        this.drumShipNum++;
                    }
                    this.drumNum += mstSlotItemNum_OrderId.get_Item(75);
                    num7         += current.Level;
                    num6         += mst_ship.Bull_max;
                    num5         += mst_ship.Fuel_max;
                    if (fatigueState2 == FatigueState.Light)
                    {
                        num2++;
                    }
                    else
                    {
                        if (fatigueState2 == FatigueState.Exaltation)
                        {
                            num++;
                        }
                        num4 += current.Bull;
                        num3 += current.Fuel;
                        int num8 = dictionary.get_Item(current.Stype);
                        Dictionary <int, int> dictionary3;
                        Dictionary <int, int> expr_326 = dictionary3 = dictionary2;
                        int num9;
                        int expr_32B = num9 = num8;
                        num9 = dictionary3.get_Item(num9);
                        expr_326.set_Item(expr_32B, num9 + 1);
                    }
                }
            }
            if (dictionary2.get_Item(1) < this.mst_mission.Stype_num1 || dictionary2.get_Item(2) < this.mst_mission.Stype_num2 || dictionary2.get_Item(3) < this.mst_mission.Stype_num3 || dictionary2.get_Item(4) < this.mst_mission.Stype_num4 || dictionary2.get_Item(5) < this.mst_mission.Stype_num5 || dictionary2.get_Item(6) < this.mst_mission.Stype_num6 || dictionary2.get_Item(7) < this.mst_mission.Stype_num7 || dictionary2.get_Item(8) < this.mst_mission.Stype_num8 || dictionary2.get_Item(9) < this.mst_mission.Stype_num9)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (this.mst_mission.Deck_num > 0)
            {
                int num10 = this.mem_ships.get_Count() - num2;
                if (num10 < this.mst_mission.Deck_num)
                {
                    this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                    return;
                }
            }
            if (num7 < this.mst_mission.Level)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (this.drumShipNum < this.mst_mission.Drum_ship_num || this.drumNum < this.mst_mission.Drum_total_num1)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            double num11 = (double)(num3 + num4);
            double num12 = (double)(num5 + num6);
            double num13 = num11 / num12 * 100.0;
            int    num14 = (int)(num13 + (double)this.randInstance.Next(20));

            if (num14 < 100)
            {
                this.resultInfo.MissionResult = MissionResultKinds.FAILE;
                return;
            }
            if (num2 > 0)
            {
                this.resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            if (!this.mst_mission.IsGreatSuccessCondition() && num < this.mem_ships.get_Count())
            {
                this.resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            int drumKeisu = 0;

            if (this.mst_mission.Drum_total_num2 > 0)
            {
                drumKeisu = ((this.drumNum < this.mst_mission.Drum_total_num2) ? -15 : 20);
            }
            if (this.mst_mission.Flagship_stype2 > 0 && this.mst_mission.Flagship_stype2 != this.mem_ships.get_Item(0).Stype)
            {
                this.resultInfo.MissionResult = MissionResultKinds.SUCCESS;
                return;
            }
            int checkRate = this.getCheckRate(num, drumKeisu);
            int num15     = this.randInstance.Next(100);

            if (checkRate >= num15)
            {
                this.resultInfo.MissionResult = MissionResultKinds.GREAT;
                return;
            }
            this.resultInfo.MissionResult = MissionResultKinds.SUCCESS;
            return;
        }
        protected virtual int getRaigHitProb(Mem_ship atk_ship, List <Mst_slotitem> atk_slot, int atk_pow)
        {
            double                num = 0.0;
            List <int>            list;
            BattleFormationKinds1 formation;
            BattleFormationKinds1 formation2;

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

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

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

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

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

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