diff --git a/src/c/encounter.c b/src/c/encounter.c index 54a5067..0f96c8c 100644 --- a/src/c/encounter.c +++ b/src/c/encounter.c @@ -119,6 +119,7 @@ int fight(Character *character, enemy* enemy) } if (playerAlive(getCharacterHealthPoints(character))) { + setCharacterExp(character, getCharacterExp(character) + getEnemyExp(enemy)); return 1; } else @@ -201,4 +202,11 @@ int getEnemyHealPotions(enemy* enemy) void setEnemyHealPotions(enemy* enemy, int newPotions) { enemy->healPotions = newPotions; +} + +int getEnemyExp(enemy* enemy){ + return enemy->exp; +} +void setEnemyExp(enemy* enemy, int newExp){ + enemy->exp = newExp; } \ No newline at end of file diff --git a/src/c/encounter.h b/src/c/encounter.h index e5ca6d2..5e1eef8 100644 --- a/src/c/encounter.h +++ b/src/c/encounter.h @@ -9,6 +9,7 @@ typedef struct enemy{ int armor; int maxHealth; int healPotions; + int exp; } enemy; @@ -42,4 +43,7 @@ int getEnemyDamage(enemy* enemy); int getEnemyHealPotions(enemy* enemy); void setEnemyHealPotions(enemy* enemy, int newPotions); +int getEnemyExp(enemy* enemy); +void setEnemyExp(enemy* enemy, int newExp); + #endif \ No newline at end of file