Пример #1
0
        static bool GetValueCore(out int point, out int percent, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            point   = 0;
            percent = 0;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpValue:
                if (owner.TryGetAmpValue(ref boost, buffIds))
                {
                    point   = boost.Point;
                    percent = boost.Percent;
                }
                break;

            case EnumBoostType.EaseValue:
                if (owner.TryGetEaseValue(ref boost, buffIds))
                {
                    point   = boost.Point;
                    percent = boost.Percent;
                }
                break;
            }
            return(point != 0 || percent != 0);
        }
Пример #2
0
        static bool GetRateCore(out int rate, int inRate, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            rate = inRate;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpRate:
                if (owner.TryGetAmpRate(ref boost, buffIds))
                {
                    rate = Convert.ToInt32(inRate + boost.Point + inRate * boost.AsPercent);
                }
                break;

            case EnumBoostType.EaseRate:
                if (owner.TryGetEaseRate(ref boost, buffIds))
                {
                    rate = Convert.ToInt32(inRate + boost.Point + inRate * boost.AsPercent);
                }
                break;

            case EnumBoostType.AntiRate:
                if (owner.TryGetAntiRate(ref boost, buffIds))
                {
                    rate = boost.Percent;
                }
                return(rate > 0);
            }
            return(rate != inRate);
        }
Пример #3
0
        static bool GetLastCore(out int last, int inLast, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            last = inLast;
            if (last <= 0)
            {
                return(false);
            }
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpLast:
                if (owner.TryGetAmpLast(ref boost, buffIds))
                {
                    last = Convert.ToInt16(last + boost.Point + last * boost.AsPercent);
                }
                break;

            case EnumBoostType.EaseLast:
                if (owner.TryGetEaseLast(ref boost, buffIds))
                {
                    last = Convert.ToInt16(last + boost.Point + last * boost.AsPercent);
                }
                break;
            }
            return(last != inLast);
        }
Пример #4
0
 public BoostEffect(ISkill srcSkill, int[] buffId, EnumBoostType boostType,
                    bool mainFlag, bool pureFlag, bool debuffFlag)
     : base(EnumBuffType.Boost, buffId, mainFlag, pureFlag, debuffFlag)
 {
     this.SrcSkill  = srcSkill;
     this.BoostType = boostType;
 }
Пример #5
0
        bool TryGetBuffCore(ref IBoostBuff buff, EnumBoostType boostType, params int[] buffIds)
        {
            SyncBuff(false);
            if (dicBuff.Count == 0)
            {
                return(null != buff && buff.ValuedFlag);
            }
            switch (boostType)
            {
            case EnumBoostType.SkillCD:
            case EnumBoostType.SkillRate:
            case EnumBoostType.PureBuff:
            case EnumBoostType.AntiDebuff:
                buffIds = new int[] { 0 };
                break;

            default:
                if (null == buffIds || buffIds.Length == 0)
                {
                    return(null != buff && buff.ValuedFlag);
                }
                break;
            }
            IBoostBuff inBuff;
            int        key = 0;

            foreach (var buffId in buffIds)
            {
                key = CastKey(boostType, buffId);
                if (dicBuff.TryGetValue(key, out inBuff))
                {
                    if (null == buff)
                    {
                        buff = inBuff.Clone();
                    }
                    else
                    {
                        buff.PlusBuff(inBuff);
                    }
                }
            }
            return(null != buff && buff.ValuedFlag);
        }
Пример #6
0
 int CastKey(EnumBoostType boostType, int buffId)
 {
     return((int)boostType * 100000 + buffId);
 }
Пример #7
0
        static bool GetValueCore(out int point, out int percent, int inPoint, int inPercent, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            point   = inPoint;
            percent = inPercent;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpValue:
                if (owner.TryGetAmpValue(ref boost, buffIds))
                {
                    if (point != 0)
                    {
                        point = Convert.ToInt32(inPoint + boost.Point + inPoint * boost.AsPercent);
                    }
                    if (percent != 0)
                    {
                        percent = Convert.ToInt32(inPercent + boost.Point + inPercent * boost.AsPercent);
                    }
                }
                break;

            case EnumBoostType.EaseValue:
                if (owner.TryGetEaseValue(ref boost, buffIds))
                {
                    if (point != 0)
                    {
                        point = Convert.ToInt32(inPoint + boost.Point + inPoint * boost.AsPercent);
                    }
                    if (percent != 0)
                    {
                        percent = Convert.ToInt32(inPercent + boost.Point + inPercent * boost.AsPercent);
                    }
                }
                break;
            }
            return(point != inPoint || percent != inPercent);
        }