DungeonCrawl
Loading...
Searching...
No Matches
character.h
Go to the documentation of this file.
1
5#ifndef CHARACTER_H
6#define CHARACTER_H
7
9#include "../combat/damage.h"
10#include "../common.h"
11#include "../item/gear.h"
12#include "../item/potion.h"
14#include "../stats/stats.h"
15
16#define MAX_ABILITY_LIMIT 20
17#define MAX_GEAR_LIMIT 20
18#define MAX_POTION_LIMIT 20
19
20typedef enum {
21 PLAYER,
22 MONSTER,
23 BOSS
24} character_type_t;
25
26typedef struct character_t {
27 character_type_t type;
28 char name[MAX_NAME_LENGTH];
29
30 stats_t base_stats;
31 stats_t current_stats;
32
33 resources_t max_resources;
34 resources_t current_resources;
35
36 damage_resistance_t resistance[DAMAGE_TYPE_COUNT];
37 defenses_t defenses;
38
39 ability_t* abilities[MAX_ABILITY_LIMIT];
40 ability_t* base_attack;
41 int ability_count;
42
43 potion_t* potion_inventory[MAX_POTION_LIMIT];
44 int potion_count;
45
46 gear_t* gear_inventory[MAX_GEAR_LIMIT];
47 int gear_count;
48
49 gear_t* equipment[MAX_SLOT];
50
51 int level;
52 int xp;
53 int xp_reward;
54 int skill_points;
56
64character_t* init_character(memory_pool_t* memory_pool, character_type_t type, const char* name);
65
71void free_character(memory_pool_t* memory_pool, character_t* character);
72
81void set_character_stats(character_t* character, int strength, int intelligence, int dexterity, int constitution);
82
91void set_stats(stats_t* stats, int strength, int intelligence, int dexterity, int constitution);
92
99void update_character_resources(resources_t* current_resources, resources_t* max_resources, stats_t* base_stats);
100
107void set_character_dmg_modifier(character_t* character, damage_type_t type, int value);
108
114void add_ability(character_t* character, ability_t* ability);
115
121void remove_ability(character_t* character, const ability_t* ability);
122
128void add_potion(character_t* character, potion_t* potion);
129
135void remove_potion(character_t* character, potion_t* potion);
136
142void add_gear(character_t* character, gear_t* gear);
143
149void remove_gear(character_t* character, gear_t* gear);
150
157void remove_equipped_gear(character_t* character, gear_slot_t slot);
158
166bool add_equipped_gear(character_t* character, gear_t* gear);
167
173void equip_gear(character_t* character, gear_t* gear);
174
180void unequip_gear(character_t* character, gear_slot_t slot);
181
186void reset_current_stats(character_t* character);
187
193void set_level(character_t* character, int level);
194
200void set_xp_reward(character_t* character, int xp_reward);
201
207void set_initial_xp(character_t* character, int xp);
208
214void set_skill_points(character_t* character, int skill_points);
215
220void reset_player_stats(character_t* player);
221
222#endif//CHARACTER_H
Exposes a forward struct for abilites.
void add_gear(character_t *character, gear_t *gear)
Adds gear to a character's inventory.
Definition character.c:156
void equip_gear(character_t *character, gear_t *gear)
Equips a gear item to a character.
Definition character.c:272
void update_character_resources(resources_t *current_resources, resources_t *max_resources, stats_t *base_stats)
Updates the character's resources based on their stats.
Definition character.c:86
void set_character_stats(character_t *character, int strength, int intelligence, int dexterity, int constitution)
Sets the stats for a character.
Definition character.c:66
void set_stats(stats_t *stats, int strength, int intelligence, int dexterity, int constitution)
Sets the stats for a character.
Definition character.c:77
void add_potion(character_t *character, potion_t *potion)
Adds a potion to a character's inventory.
Definition character.c:242
bool add_equipped_gear(character_t *character, gear_t *gear)
Adds an equipped gear in a specific slot of a character without updating stats and abilities.
Definition character.c:216
void free_character(memory_pool_t *memory_pool, character_t *character)
Frees the memory allocated for a character.
Definition character.c:60
void set_character_dmg_modifier(character_t *character, damage_type_t type, int value)
Sets the damage modifier for a character.
Definition character.c:115
character_t * init_character(memory_pool_t *memory_pool, character_type_t type, const char *name)
Initializes a new character.
Definition character.c:13
void reset_player_stats(character_t *player)
Resets the player stats to their base values.
Definition character.c:320
void remove_gear(character_t *character, gear_t *gear)
Removes a gear item from a character's inventory.
Definition character.c:169
void remove_potion(character_t *character, potion_t *potion)
Removes a potion from a character's inventory.
Definition character.c:254
void set_skill_points(character_t *character, int skill_points)
Sets the skill points for a character.
Definition character.c:315
void reset_current_stats(character_t *character)
Resets the current stats of a character to their base values.
Definition damage.c:56
void remove_equipped_gear(character_t *character, gear_slot_t slot)
Removes the gear equipped in a specific slot of a character.
Definition character.c:187
void add_ability(character_t *character, ability_t *ability)
Adds an ability to a character.
Definition character.c:127
void set_xp_reward(character_t *character, int xp_reward)
Sets the XP reward for a character.
Definition character.c:310
void unequip_gear(character_t *character, gear_slot_t slot)
Unequips a gear item from a character and adds it to the character's inventory.
Definition character.c:292
void remove_ability(character_t *character, const ability_t *ability)
Removes an ability from a character.
Definition character.c:139
void set_level(character_t *character, int level)
Sets the level for a character.
Definition character.c:305
void set_initial_xp(character_t *character, int xp)
sets initial xp for a character
Definition character.c:300
Defines common macros, types, and global variables for color schemes and utilities.
Exposes functions for working with damage.
Exposes functions for working with gear.
Exposes functions for working with the memory management.
Exposes functions for working with potions.
Exposes functions for working with stats.
Definition gear.h:32