Пример #1
0
        private void ExecuteRestorePrecentageStatus(RestorePercentageStatus status, IFighter fighter)
        {
            if (fighter == null)
            {
                throw new ArgumentException("RestorePercentageStatus somehow given to something that is not an IFighter!");
            }

            int restoreAmount;

            switch (status.RestorationType)
            {
            case RestorationType.Health:
                restoreAmount = (int)(fighter.MaxHealth * status.Percentage);
                fighter.Heal(restoreAmount);
                break;

            case RestorationType.Mana:
                restoreAmount = (int)(fighter.MaxMana * status.Percentage);
                fighter.RestoreMana(restoreAmount);
                break;
            }
        }