private void BuffTicker()
    {
        if (Buffs.Count == 0)
        {
            return;
        }

        for (int i = 0; i < Buffs.Count; i++)
        {
            Buff modded = new Buff
            {
                type       = Buffs[i].type,
                percentage = Buffs[i].percentage,
                duration   = Buffs[i].duration - 1.0f
            };

            if (modded.duration <= 0.0f)
            {
                Buffs.RemoveAt(i);
            }
            else
            {
                Buffs[i] = modded;
            }
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Calls the OnEnd() method of the buff at the given index from the buff list, and removes it from the buff list.
        /// At the end Recalucates the Attributes of the Entity.
        /// </summary>
        /// <param name="buffIndex">The index of the buff in the buff list</param>
        public void RemoveBuff(int buffIndex)
        {
            //Remove buff effects
            Buffs[buffIndex].OnEnd(this);
            Buffs.RemoveAt(buffIndex);

            CalculateResources();
        }
Exemplo n.º 3
0
    public bool RemoveBuff(BuffFacade b, bool IsApply = true)
    {
        int index = Buffs.IndexOf(b);

        Debug.Log("Buff unit remove");
        if (index == -1)
        {
            return(false);
        }
        else
        {
            if (IsApply)
            {
                Debuff(index);
            }
            Buffs.RemoveAt(index);
            Buffed.RemoveAt(index);
        }
        Debug.Log("Buff unit remove " + index);
        return(true);
    }
Exemplo n.º 4
0
        public override void Despawn()
        {
            if (Node != null)
            {
                Envir.Heroes.Remove(this);
                CurrentMap.RemoveObject(this);

                for (int i = Buffs.Count - 1; i >= 0; i--)
                {
                    var buff = Buffs[i];
                    buff.Caster   = null;
                    buff.ObjectID = 0;

                    if (buff.Properties.HasFlag(BuffProperty.RemoveOnExit))
                    {
                        Buffs.RemoveAt(i);
                    }
                }

                base.Despawn();
            }
        }