public void AddHealth(Specific_LifeEffect effect, Game game) { if (this.Health + effect.AmountToGain < this.MaxHealth) { this.Health = this.Health + effect.AmountToGain; } else { this.Health = this.MaxHealth; } // the game will check for death later }
public void AddHealth(Specific_LifeEffect effect, Game game) { if (effect.AmountToGain < 0) { GameTrigger_Factory.TriggerAll <Specific_LifeEffect>(this.beforeReceivingDamage_Triggers, effect, this.ControllerID, game); } this.Health += effect.AmountToGain; // check for death if (this.Health <= 0) { this.Destroy(effect, game); } this.Health = Math.Min(this.Health, this.originalHealth); }