Esempio n. 1
0
        public bool CheckEnableBuffTarget(Unit target)
        {
            if (this.param == null)
            {
                return(false);
            }
            bool flag = true;

            if (this.param.sex != ESex.Unknown)
            {
                flag &= this.param.sex == target.UnitParam.sex;
            }
            if (this.param.elem != 0)
            {
                int num = 1 << (int)(target.Element - 1 & (EElement)31);
                flag &= (this.param.elem & num) == num;
            }
            if (!string.IsNullOrEmpty(this.param.job) && target.Job != null)
            {
                flag &= this.param.job == target.Job.Param.origin;
            }
            if (!string.IsNullOrEmpty(this.param.buki) && target.Job != null)
            {
                flag &= this.param.job == target.Job.Param.buki;
            }
            if (!string.IsNullOrEmpty(this.param.birth))
            {
                flag &= this.param.birth == (string)target.UnitParam.birth;
            }
            if (!string.IsNullOrEmpty(this.param.un_group))
            {
                UnitGroupParam unitGroup = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetUnitGroup(this.param.un_group);

                if (unitGroup != null)
                {
                    flag &= unitGroup.IsInGroup(target.UnitParam.iname);
                }
            }
            if (this.param.custom_targets != null && this.param.cond == ESkillCondition.CardSkill)
            {
                flag &= this.CheckCustomTarget(target);
            }
            return(flag);
        }
Esempio n. 2
0
        public bool IsMatchUnitGroup(string unit_iname)
        {
            if (string.IsNullOrEmpty(this.unit_group))
            {
                return(true);
            }
            UnitGroupParam unitGroup = MonoSingleton <GameManager> .Instance.MasterParam.GetUnitGroup(this.unit_group);

            if (unitGroup == null)
            {
                return(true);
            }
            bool flag = unitGroup.IsInGroup(unit_iname);

            if (this.units_conditions_type == EUseConditionsType.NotMatch)
            {
                return(!flag);
            }
            return(flag);
        }
Esempio n. 3
0
        private bool CheckCustomTarget(Unit target)
        {
            foreach (string customTarget1 in this.param.custom_targets)
            {
                if (!string.IsNullOrEmpty(customTarget1))
                {
                    CustomTargetParam customTarget2 = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetCustomTarget(customTarget1);

                    if (customTarget2 != null)
                    {
                        if (customTarget2.units != null)
                        {
                            bool flag = false;
                            foreach (string unit in customTarget2.units)
                            {
                                if (target.UnitParam.iname == unit)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                continue;
                            }
                        }
                        if (customTarget2.jobs != null)
                        {
                            if (target.Job != null)
                            {
                                bool flag = false;
                                foreach (string job in customTarget2.jobs)
                                {
                                    if (target.Job.JobID == job)
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                        if (customTarget2.unit_groups != null)
                        {
                            bool flag = false;
                            foreach (string unitGroup1 in customTarget2.unit_groups)
                            {
                                UnitGroupParam unitGroup2 = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetUnitGroup(unitGroup1);

                                if (unitGroup2 == null)
                                {
                                    Debug.LogWarning((object)"存在しないユニットグループ識別子が設定されている : CustomTarget");
                                }
                                else if (unitGroup2.IsInGroup(target.UnitParam.iname))
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                continue;
                            }
                        }
                        if (customTarget2.job_groups != null)
                        {
                            if (target.Job != null)
                            {
                                bool flag = false;
                                foreach (string jobGroup1 in customTarget2.job_groups)
                                {
                                    JobGroupParam jobGroup2 = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetJobGroup(jobGroup1);

                                    if (jobGroup2 == null)
                                    {
                                        Debug.LogWarning((object)"存在しないジョブグループ識別子が設定されている : CustomTarget");
                                    }
                                    else if (jobGroup2.IsInGroup(target.Job.JobID))
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    continue;
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                        JobData[] jobs = target.UnitData.Jobs;
                        if ((string.IsNullOrEmpty(customTarget2.first_job) || jobs != null && jobs.Length >= 1 && !(jobs[0].JobID != customTarget2.first_job)) && (string.IsNullOrEmpty(customTarget2.second_job) || jobs != null && jobs.Length >= 2 && !(jobs[1].JobID != customTarget2.second_job)) && ((string.IsNullOrEmpty(customTarget2.third_job) || jobs != null && jobs.Length >= 3 && !(jobs[2].JobID != customTarget2.third_job)) && ((customTarget2.sex == ESex.Unknown || customTarget2.sex == target.UnitParam.sex) && (customTarget2.birth_id == 0 || customTarget2.birth_id == target.UnitParam.birthID))))
                        {
                            if (customTarget2.element != 0)
                            {
                                int num = 1 << (int)(target.Element - 1 & (EElement)31);
                                if ((customTarget2.element & num) != num)
                                {
                                    continue;
                                }
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }