示例#1
0
        public static bool IfAntiDebuff(IEffect effect, ISkill srcSkill, ISkillOwner target, bool incRoot, params int[] buffIds)
        {
            if (effect.PureFlag || !effect.DebuffFlag)
            {
                return(false);
            }
            IBoostBuff boost   = null;
            int        maxRate = SkillDefines.MAXStorePercent;
            int        rate    = 0;

            if (incRoot)
            {
                if (target.TryGetAntiDebuff(ref boost))
                {
                    rate = boost.Percent;
                    if (rate >= maxRate || rate > 0 && srcSkill.Context.RandomPercent(maxRate) <= rate)
                    {
                        return(true);
                    }
                    boost.Clear();
                }
            }
            if (null == buffIds || buffIds.Length == 0)
            {
                return(false);
            }
            if (target.TryGetAntiRate(ref boost, buffIds))
            {
                do
                {
                    var boostAnti = boost as IBoostAntiBuff;
                    if (null == boostAnti)
                    {
                        break;
                    }
                    var antiSKill = boostAnti.AntiSkillType;
                    if (null == antiSKill || antiSKill.Length == 0)
                    {
                        break;
                    }
                    int skillType = (int)srcSkill.RawSkill.SrcType;
                    for (int i = 0; i < antiSKill.Length; i++)
                    {
                        if (antiSKill[i] == skillType)
                        {
                            break;
                        }
                        else if (i == antiSKill.Length - 1)
                        {
                            return(false);
                        }
                    }
                }while (false);
                rate = boost.Percent;
                if (rate >= maxRate || rate > 0 && srcSkill.Context.RandomPercent(maxRate) <= rate)
                {
                    return(true);
                }
            }
            return(false);
        }