From 8b4b35b46138df882b991db83fd4cd38f481f431 Mon Sep 17 00:00:00 2001 From: Kai Kehres Date: Sat, 21 Jan 2023 16:45:11 +0100 Subject: [PATCH] prod: Added new stats exp and maxExp and added their getter and setter no Unittest as that is apparently not neccessary for them --- src/c/character.c | 16 ++++++++++++++++ src/c/character.h | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/c/character.c b/src/c/character.c index cb8f3b8..779e795 100644 --- a/src/c/character.c +++ b/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; } diff --git a/src/c/character.h b/src/c/character.h index 633d3e1..c7ee567 100644 --- a/src/c/character.h +++ b/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);