Ejemplo n.º 1
0
        public float GetValue(D3EntityAttribute attribute)
        {
            if (!this.attributes.ContainsKey(attribute))
            {
                return 0.0f;
            }

            return this.attributes[attribute];
        }
Ejemplo n.º 2
0
        public float AddValue(D3EntityAttribute attribute, float value, float max)
        {
            if (value > max)
            {
                value = max;
            }

            if (!this.attributes.ContainsKey(attribute))
            {
                this.attributes.Add(attribute, value);
                return value;
            }

            if (this.attributes[attribute] + value > max)
            {
                value -= (this.attributes[attribute] + value) - max;
            }

            this.attributes[attribute] += value;
            return value;
        }
Ejemplo n.º 3
0
        public float RemoveValue(D3EntityAttribute attribute, float value)
        {
            if (value <= 0.0f || !this.attributes.ContainsKey(attribute))
            {
                return 0.0f;
            }

            if (value > this.attributes[attribute])
            {
                value = this.attributes[attribute];
            }

            this.attributes[attribute] -= value;
            return value;
        }
Ejemplo n.º 4
0
        public void SetValue(D3EntityAttribute attribute, float value)
        {
            if (!this.attributes.ContainsKey(attribute))
            {
                this.attributes.Add(attribute, value);
                return;
            }

            this.attributes[attribute] = value;
        }