diff --git a/src/c/encounter.c b/src/c/encounter.c index a1d13b1..620b698 100644 --- a/src/c/encounter.c +++ b/src/c/encounter.c @@ -51,13 +51,11 @@ int playerDamaged(enemy* enemy, Character* character) void enemyHeal(enemy *enemy, int healAmount) { - int currentHealth = getEnemyHealth(enemy); - int maxHealth = getEnemyMaxHealth(enemy); - if (currentHealth + healAmount > maxHealth) + if (getEnemyHealth(enemy) + healAmount > getEnemyMaxHealth(enemy)) { - healAmount = maxHealth - currentHealth; + healAmount = getEnemyMaxHealth(enemy) - getEnemyHealth(enemy); } - setEnemyHealth(enemy, currentHealth + healAmount); + setEnemyHealth(enemy, getEnemyHealth(enemy) + healAmount); } void enemyDamaged(enemy *enemy, int damage)