Task 1 – Refactoring to a pure function
Steve’s tower defense game calculates damage based on a global difficulty modifier. Refactor this function to make it pure:
public double _difficultyModifier = 1.0; public double CalculateDamage(Tower tower, Enemy enemy) { return tower.BaseDamage * enemy.DamageMultiplier * _difficultyModifier; }