public float GetValue(D3EntityAttribute attribute) { if (!this.attributes.ContainsKey(attribute)) { return 0.0f; } return this.attributes[attribute]; }
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; }
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; }
public void SetValue(D3EntityAttribute attribute, float value) { if (!this.attributes.ContainsKey(attribute)) { this.attributes.Add(attribute, value); return; } this.attributes[attribute] = value; }