Browse Source

Added new variables to character

remotes/origin/encIntegration
János 2 years ago
parent
commit
0320602a0a
  1. 24
      src/c/character.c
  2. 14
      src/c/character.h

24
src/c/character.c

@ -66,6 +66,30 @@ int calculateStatIncrease (Character *character, int amount) {
return character->level*amount;
}
void setCharacterMaxHealthPoints (Character *character, int newMaxHealthPoints){
character->maxHealthPoints = newMaxHealthPoints;
}
int getCharacterMaxHealthPoints (Character *character){
return character->maxHealthPoints;
}
void setCharacterAttack (Character *character, int newAttack){
character->attack = newAttack;
}
int getCharacterAttack (Character *character){
return character->attack;
}
void setCharacterArmor (Character *character, int newArmor){
character->armor = newArmor;
}
int getCharacterArmor (Character *character){
return character->armor;
}
void increaseStat (Character *character, int stat, int amount) {
switch (stat)
{

14
src/c/character.h

@ -2,7 +2,7 @@
#define CHARACTER_H
typedef struct {
int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp;
int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp,attack,armor,maxHealthPoints;
char name [50];
} Character;
@ -42,5 +42,17 @@ void increaseStat (Character *character, int stat, int amount);
int calculateStatIncrease (Character *character, int amount);
void setCharacterMaxHealthPoints (Character *character, int newMaxHealthPoints);
int getCharacterMaxHealthPoints (Character *character);
void setCharacterAttack (Character *character, int newAttack);
int getCharacterAttack (Character *character);
void setCharacterArmor (Character *character, int newArmor);
int getCharacterArmor (Character *character);
void levelUp (Character *character);
#endif
Loading…
Cancel
Save