Esempio n. 1
0
        protected virtual void ApplyAttrs(Attr[] attrs, float[] values, bool oneOff)
        {
            if (attrs == null)
            {
                return;
            }

            EntityProperty property = this.owner.property;
            int            count    = attrs.Length;

            for (int i = 0; i < count; i++)
            {
                Attr  attr  = attrs[i];
                float value = values[i];
                switch (attr)
                {
                case Attr.Hp:
                case Attr.Mana:
                case Attr.Ap:
                case Attr.Ad:
                case Attr.Armor:
                case Attr.ArmorPen:
                case Attr.ArmorPenFlat:
                case Attr.MagicResist:
                case Attr.MagicPen:
                case Attr.MagicPenFlat:
                {
                    float oldValue, newValue;
                    property.Add(attr, value, out oldValue, out newValue);
                    if (!oneOff)
                    {
                        this._deltaf.Add(attr, newValue - oldValue);
                    }
                }
                break;

                case Attr.Repelling:
                case Attr.Stunned:
                case Attr.IgnoreVolumetric:
                case Attr.FreezeFactor:
                case Attr.Stealth:
                case Attr.ImmuneDisables:
                case Attr.Charmed:
                {
                    int oldValue, newValue;
                    property.Add(attr, ( int )value, out oldValue, out newValue);
                    if (!oneOff)
                    {
                        this._deltai.Add(attr, newValue - oldValue);
                    }
                }
                break;

                case Attr.MoveSpeedFactor:
                {
                    float oldValue, newValue;
                    property.Mul(attr, value, out oldValue, out newValue);
                    if (!oneOff)
                    {
                        this._deltaf.Add(attr, newValue - oldValue);
                    }
                }
                break;
                }
            }
        }