Ejemplo n.º 1
0
        public Buff AddBuffStack(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority)
        {
            int  num = this.FindBuff(buffType.BuffID);
            Buff buff;

            if (num < 0)
            {
                buff = new Buff(buffType, armorType, visualPriority);
                buff.AddStack();
                this.Buffs.Add(buff);
                if (this.sleepState == BuffSleepState.Sleeping)
                {
                    this.sleepState = BuffSleepState.Awake;
                }
                this.SendBuffEvent(EventId.AddedBuff, buff);
            }
            else
            {
                buff = this.Buffs[num];
                if (buffType.Lvl > buff.BuffType.Lvl)
                {
                    buff.UpgradeBuff(buffType);
                }
                buff.AddStack();
            }
            this.OnBuffStackAdded();
            return(buff);
        }
Ejemplo n.º 2
0
 public BuffComponent()
 {
     this.buildingLoadedEvent = EventId.BuildingViewReady;
     this.troopLoadedEvent    = EventId.TroopViewReady;
     this.Buffs         = new List <Buff>();
     this.buffRetryList = new List <Buff>();
     this.miter         = new MutableIterator();
     this.niter         = new MutableIterator();
     this.oiter         = new MutableIterator();
     this.sleepState    = BuffSleepState.Sleeping;
 }
Ejemplo n.º 3
0
 private void RemoveBuffAt(int index)
 {
     this.OnRemovingBuff(this.Buffs[index]);
     this.Buffs.RemoveAt(index);
     this.miter.OnRemove(index);
     this.niter.OnRemove(index);
     this.oiter.OnRemove(index);
     if (this.Buffs.Count == 0 && this.sleepState == BuffSleepState.Awake)
     {
         this.sleepState = BuffSleepState.Sleeping;
     }
 }
Ejemplo n.º 4
0
 public void Die()
 {
     if (this.sleepState == BuffSleepState.Dead)
     {
         return;
     }
     this.oiter.Init(this.Buffs);
     while (this.oiter.Active())
     {
         this.OnRemovingBuff(this.Buffs[this.oiter.Index]);
         this.oiter.Next();
     }
     this.oiter.Reset();
     this.Buffs.Clear();
     this.sleepState = BuffSleepState.Dead;
     this.miter.Reset();
     this.niter.Reset();
 }
Ejemplo n.º 5
0
        public Buff AddBuffStack(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority, SmartEntity originator)
        {
            int  num = this.FindBuff(buffType.BuffID);
            Buff buff;

            if (num < 0)
            {
                buff = new Buff(buffType, armorType, visualPriority);
                buff.AddStack();
                this.Buffs.Add(buff);
                if (this.sleepState == BuffSleepState.Sleeping)
                {
                    this.sleepState = BuffSleepState.Awake;
                }
                if (!buff.BuffData.ContainsKey("originator"))
                {
                    buff.BuffData.Add("originator", originator);
                }
                else
                {
                    buff.BuffData["originator"] = originator;
                }
                this.SendBuffEvent(EventId.AddedBuff, buff);
            }
            else
            {
                buff = this.Buffs[num];
                if (buffType.Lvl > buff.BuffType.Lvl)
                {
                    buff.UpgradeBuff(buffType);
                }
                buff.BuffData["originator"] = originator;
                buff.AddStack();
            }
            this.OnBuffStackAdded();
            return(buff);
        }
Ejemplo n.º 6
0
        public bool IsBuffPrevented(BuffTypeVO buffType)
        {
            BuffSleepState buffSleepState = this.sleepState;

            if (buffSleepState == BuffSleepState.Sleeping)
            {
                return(false);
            }
            if (buffSleepState != BuffSleepState.Dead)
            {
                int i     = 0;
                int count = this.Buffs.Count;
                while (i < count)
                {
                    if (this.Buffs[i].BuffType.PreventTags.Overlaps(buffType.Tags))
                    {
                        return(true);
                    }
                    i++;
                }
                return(false);
            }
            return(true);
        }