Browse Source

player gets exp after combat

remotes/origin/encIntegration
János 2 years ago
parent
commit
89a76a1a36
  1. 8
      src/c/encounter.c
  2. 4
      src/c/encounter.h

8
src/c/encounter.c

@ -119,6 +119,7 @@ int fight(Character *character, enemy* enemy)
} }
if (playerAlive(getCharacterHealthPoints(character))) if (playerAlive(getCharacterHealthPoints(character)))
{ {
setCharacterExp(character, getCharacterExp(character) + getEnemyExp(enemy));
return 1; return 1;
} }
else else
@ -201,4 +202,11 @@ int getEnemyHealPotions(enemy* enemy)
void setEnemyHealPotions(enemy* enemy, int newPotions) void setEnemyHealPotions(enemy* enemy, int newPotions)
{ {
enemy->healPotions = newPotions; enemy->healPotions = newPotions;
}
int getEnemyExp(enemy* enemy){
return enemy->exp;
}
void setEnemyExp(enemy* enemy, int newExp){
enemy->exp = newExp;
} }

4
src/c/encounter.h

@ -9,6 +9,7 @@ typedef struct enemy{
int armor; int armor;
int maxHealth; int maxHealth;
int healPotions; int healPotions;
int exp;
} enemy; } enemy;
@ -42,4 +43,7 @@ int getEnemyDamage(enemy* enemy);
int getEnemyHealPotions(enemy* enemy); int getEnemyHealPotions(enemy* enemy);
void setEnemyHealPotions(enemy* enemy, int newPotions); void setEnemyHealPotions(enemy* enemy, int newPotions);
int getEnemyExp(enemy* enemy);
void setEnemyExp(enemy* enemy, int newExp);
#endif #endif
Loading…
Cancel
Save