Exemple #1
0
 IBoostBuff CreateBoostBuff(IBoostEffect effect)
 {
     if (null == effect)
     {
         return(null);
     }
     if (effect.BoostType == EnumBoostType.AntiRate)
     {
         if (effect.Times > 0)
         {
             return(new BoostAntiBuff(effect.Point * effect.Times, effect.Percent * effect.Times, effect.AntiSkillType));
         }
         else
         {
             return(new BoostAntiBuff(effect.Point, effect.Percent, effect.AntiSkillType));
         }
     }
     if (effect.Times > 0)
     {
         return(new BoostBuff(effect.Point * effect.Times, effect.Percent * effect.Times));
     }
     else
     {
         return(new BoostBuff(effect.Point, effect.Percent));
     }
 }
Exemple #2
0
        protected override bool OnSetWaitBuffEnd(EnumBuffLast lastType)
        {
            int          lastVal = (int)lastType;
            IBoostEffect item    = null;

            for (int i = lstBoost.Count - 1; i >= 0; i--)
            {
                item = lstBoost[i];
                if (item.InvalidFlag ||
                    item.TimeEnd <= (short)EnumBuffLast.TillWaitEnd && item.TimeEnd == lastVal)
                {
                    lstBoost.RemoveAt(i);
                    if (this._syncFlag)
                    {
                        this._syncFlag = false;
                    }
                }
            }
            ISkill skill = null;

            for (int i = lstToSkill.Count - 1; i >= 0; i--)
            {
                skill = lstToSkill[i];
                ((IBoostCore)skill).SetWaitBuffEnd(lastType);
                if (!skill.WaitingFlag)
                {
                    lstToSkill.RemoveAt(i);
                }
            }
            return(true);
        }
Exemple #3
0
 public bool RemoveBoost(IBoostEffect inBoost)
 {
     if (lstBoost.Remove(inBoost))
     {
         this._syncFlag = false;
     }
     return(true);
 }
Exemple #4
0
 protected virtual bool UnEffectTarget(IBoostEffect effect, ISkill srcSkill, ISkillPlayer caster, List <T> targets)
 {
     if (null != effect.SrcModelSetting && null != caster)
     {
         effect.RemoveShowModel(srcSkill, caster, false);
     }
     foreach (var target in targets)
     {
         target.RemoveBoost(effect);
     }
     return(true);
 }
Exemple #5
0
 public bool AddBoost(IBoostEffect inBoost)
 {
     if (null == inBoost || inBoost.InvalidFlag)
     {
         return(false);
     }
     if (lstBoost.IndexOf(inBoost) < 0)
     {
         lstBoost.Add(inBoost);
     }
     if (inBoost.TimeEnd <= (short)EnumBuffLast.TillWaitEnd)
     {
         this.SetWaitingFlag((EnumBuffLast)inBoost.TimeEnd, true);
     }
     this._syncFlag = false;
     return(true);
 }
Exemple #6
0
 bool PlusBoostBuff(IBoostBuff dstBuff, IBoostEffect effect)
 {
     if (null == dstBuff || null == effect)
     {
         return(false);
     }
     if (effect.Times > 0)
     {
         dstBuff.Point   += effect.Point * effect.Times;
         dstBuff.Percent += effect.Percent * effect.Times;
     }
     else
     {
         dstBuff.Point   += effect.Point;
         dstBuff.Percent += effect.Percent;
     }
     return(true);
 }
Exemple #7
0
        public bool SyncBuff(bool forceFlag)
        {
            if (!forceFlag && this.SyncFlag)
            {
                return(true);
            }
            this.Clear();
            short        minTimeEnd = 0;
            short        maxTimeEnd = 0;
            IBoostEffect item       = null;
            short        timeEnd    = 0;

            for (int i = lstBoost.Count - 1; i >= 0; i--)
            {
                item = lstBoost[i];
                if (item.InvalidFlag)
                {
                    lstBoost.RemoveAt(i);
                    continue;
                }
                timeEnd = item.TimeEnd;
                if (timeEnd <= (short)EnumBuffLast.TillWaitEnd)
                {
                    this.SetWaitingFlag((EnumBuffLast)timeEnd, true);
                }
                else
                {
                    if (minTimeEnd == 0 || timeEnd < minTimeEnd)
                    {
                        minTimeEnd = timeEnd;
                    }
                    if (timeEnd > maxTimeEnd)
                    {
                        maxTimeEnd = timeEnd;
                    }
                }
                PlusBuff(item);
            }
            this._nextSyncTime = minTimeEnd;
            this._lastSyncTime = maxTimeEnd;
            this._syncFlag     = true;
            return(true);
        }
Exemple #8
0
        bool PlusBuff(IBoostEffect effect)
        {
            if (null == effect)
            {
                return(false);
            }
            int[] keys;
            switch (effect.BoostType)
            {
            case EnumBoostType.SkillCD:
            case EnumBoostType.SkillRate:
            case EnumBoostType.PureBuff:
            case EnumBoostType.AntiDebuff:
                keys = new int[] { CastKey(effect.BoostType, 0) };
                break;

            default:
                int cnt = effect.BuffId.Length;
                keys = new int[cnt];
                for (int i = 0; i < cnt; i++)
                {
                    keys[i] = CastKey(effect.BoostType, effect.BuffId[i]);
                }
                break;
            }
            IBoostBuff inBuff;

            foreach (int key in keys)
            {
                if (dicBuff.TryGetValue(key, out inBuff))
                {
                    PlusBoostBuff(inBuff, effect);
                }
                else
                {
                    dicBuff[key] = CreateBoostBuff(effect);
                }
            }
            return(true);
        }
Exemple #9
0
 public bool RemoveBoost(IBoostEffect inBoost)
 {
     return(this.boostCore.RemoveBoost(inBoost));
 }
Exemple #10
0
 public bool AddBoost(IBoostEffect inBoost)
 {
     return(this.boostCore.AddBoost(inBoost));
 }
Exemple #11
0
 protected override bool EffectTarget(IBoostEffect effect, ISkill srcSkill, ISkillPlayer caster, List <ISkillManager> targets)
 {
     return(effect.EffectManager(srcSkill, caster, targets));
 }
Exemple #12
0
 protected abstract bool EffectTarget(IBoostEffect effect, ISkill srcSkill, ISkillPlayer caster, List <T> targets);