Browse Source

prod: Added new stats exp and maxExp and added their getter and setter no Unittest as that is apparently not neccessary for them

remotes/origin/characterStats
Kai Kehres 2 years ago
parent
commit
8b4b35b461
  1. 16
      src/c/character.c
  2. 10
      src/c/character.h

16
src/c/character.c

@ -46,6 +46,22 @@ int getCharacterLevel (Character *character) {
return character->level;
}
void setCharacterExp (Character *character, int newExp) {
character->exp = newExp;
}
int getCharacterExp (Character *character) {
return character->exp;
}
void setCharacterMaxExp (Character *character, int newMaxExp) {
character->maxExp = newMaxExp;
}
int getCharacterMaxExp (Character *character) {
return character->maxExp;
}
int calculateStatIncrease (Character *character, int amount) {
return character->level*amount;
}

10
src/c/character.h

@ -2,7 +2,7 @@
#define CHARACTER_H
typedef struct {
int strength,dexterity,intelligence,healthPoints,manaPoints,level;
int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp;
char name [50];
} Character;
@ -30,6 +30,14 @@ void setCharacterLevel (Character *character, int newLevel);
int getCharacterLevel (Character *character);
void setCharacterExp (Character *character, int newExp);
int getCharacterExp (Character *character);
void setCharacterMaxExp (Character *character, int newMaxExp);
int getCharacterMaxExp (Character *character);
void increaseStat (Character *character, int stat, int amount);
int calculateStatIncrease (Character *character, int amount);
Loading…
Cancel
Save