DungeonCrawl
|
Implements character functionallity. More...
#include "character.h"
#include "../combat/ability.h"
#include "../common.h"
#include "../logging/logger.h"
#include <stdio.h>
Go to the source code of this file.
Functions | |
character_t * | init_character (memory_pool_t *memory_pool, const character_type_t type, const char *name) |
Initializes a new character. | |
void | free_character (memory_pool_t *memory_pool, character_t *character) |
Frees the memory allocated for a character. | |
void | set_character_stats (character_t *character, int strength, int intelligence, int dexterity, int constitution) |
Sets the stats for a character. | |
void | set_stats (stats_t *stats, int strength, int intelligence, int dexterity, int constitution) |
Sets the stats for a character. | |
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. | |
void | set_character_dmg_modifier (character_t *character, damage_type_t type, int value) |
Sets the damage modifier for a character. | |
void | add_ability (character_t *character, ability_t *ability) |
Adds an ability to a character. | |
void | remove_ability (character_t *character, const ability_t *ability) |
Removes an ability from a character. | |
void | add_gear (character_t *character, gear_t *gear) |
Adds gear to a character's inventory. | |
void | remove_gear (character_t *character, gear_t *gear) |
Removes a gear item from a character's inventory. | |
void | remove_equipped_gear (character_t *character, gear_slot_t slot) |
Removes the gear equipped in a specific slot of a character. | |
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. | |
void | add_potion (character_t *character, potion_t *potion) |
Adds a potion to a character's inventory. | |
void | remove_potion (character_t *character, potion_t *potion) |
Removes a potion from a character's inventory. | |
void | equip_gear (character_t *character, gear_t *gear) |
Equips a gear item to a character. | |
void | unequip_gear (character_t *character, const gear_slot_t slot) |
Unequips a gear item from a character and adds it to the character's inventory. | |
void | set_initial_xp (character_t *character, int xp) |
sets initial xp for a character | |
void | set_level (character_t *character, int level) |
Sets the level for a character. | |
void | set_xp_reward (character_t *character, int xp_reward) |
Sets the XP reward for a character. | |
void | set_skill_points (character_t *character, int skill_points) |
Sets the skill points for a character. | |
void | reset_player_stats (character_t *player) |
Resets the player stats to their base values. |
Implements character functionallity.
Definition in file character.c.
void add_ability | ( | character_t * | character, |
ability_t * | ability ) |
Adds an ability to a character.
character | Pointer to the character |
ability | Pointer to the ability to add |
Definition at line 127 of file character.c.
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.
character | Pointer to the character. |
gear | Pointer to the equipped gear to add. |
Definition at line 216 of file character.c.
void add_gear | ( | character_t * | character, |
gear_t * | gear ) |
Adds gear to a character's inventory.
character | Pointer to the character |
gear | Pointer to the gear to add |
Definition at line 156 of file character.c.
void add_potion | ( | character_t * | character, |
potion_t * | potion ) |
Adds a potion to a character's inventory.
character | Pointer to the character |
potion | Pointer to the potion to add |
Definition at line 242 of file character.c.
void equip_gear | ( | character_t * | character, |
gear_t * | gear ) |
Equips a gear item to a character.
character | Pointer to the character |
gear | Pointer to the gear item to equip |
Definition at line 272 of file character.c.
void free_character | ( | memory_pool_t * | memory_pool, |
character_t * | character ) |
Frees the memory allocated for a character.
memory_pool | Pointer to the memory pool used for allocation |
character | Pointer to the character to be freed |
Definition at line 60 of file character.c.
character_t * init_character | ( | memory_pool_t * | memory_pool, |
character_type_t | type, | ||
const char * | name ) |
Initializes a new character.
memory_pool | Pointer to the memory pool for dynamic allocation |
type | The type of the character (e.g., player, enemy) |
name | The name of the character |
Definition at line 13 of file character.c.
void remove_ability | ( | character_t * | character, |
const ability_t * | ability ) |
Removes an ability from a character.
character | Pointer to the character |
ability | Pointer to the ability to remove |
Definition at line 139 of file character.c.
void remove_equipped_gear | ( | character_t * | character, |
gear_slot_t | slot ) |
Removes the gear equipped in a specific slot of a character.
character | Pointer to the character whose gear is to be removed. |
slot | The slot from which the gear should be removed. |
Definition at line 187 of file character.c.
void remove_gear | ( | character_t * | character, |
gear_t * | gear ) |
Removes a gear item from a character's inventory.
character | Pointer to the character |
gear | Pointer to the gear item to remove |
Definition at line 169 of file character.c.
void remove_potion | ( | character_t * | character, |
potion_t * | potion ) |
Removes a potion from a character's inventory.
character | Pointer to the character |
potion | Pointer to the potion to remove |
Definition at line 254 of file character.c.
void reset_player_stats | ( | character_t * | player | ) |
Resets the player stats to their base values.
player | Pointer to the player character |
Definition at line 320 of file character.c.
void set_character_dmg_modifier | ( | character_t * | character, |
damage_type_t | type, | ||
int | value ) |
Sets the damage modifier for a character.
character | Pointer to the character to set the damage modifier for |
type | The type of damage to modify |
value | The value of the damage modifier |
Definition at line 115 of file character.c.
void set_character_stats | ( | character_t * | character, |
int | strength, | ||
int | intelligence, | ||
int | dexterity, | ||
int | constitution ) |
Sets the stats for a character.
c | Pointer to the character to set stats for |
strength | Strength value |
intelligence | Intelligence value |
dexterity | Dexterity value |
constitution | Constitution value |
Definition at line 66 of file character.c.
void set_initial_xp | ( | character_t * | character, |
int | xp ) |
sets initial xp for a character
character | Pointer to the character |
xp | The initial xp value |
Definition at line 300 of file character.c.
void set_level | ( | character_t * | character, |
int | level ) |
Sets the level for a character.
character | Pointer to the character |
level | The level value |
Definition at line 305 of file character.c.
void set_skill_points | ( | character_t * | character, |
int | skill_points ) |
Sets the skill points for a character.
character | Pointer to the character |
skill_points | How many skill points the character has |
Definition at line 315 of file character.c.
void set_stats | ( | stats_t * | stats, |
int | strength, | ||
int | intelligence, | ||
int | dexterity, | ||
int | constitution ) |
Sets the stats for a character.
stats | Pointer to the stats structure to set |
strength | Strength value |
intelligence | Intelligence value |
dexterity | Dexterity value |
constitution | Constitution value |
Definition at line 77 of file character.c.
void set_xp_reward | ( | character_t * | character, |
int | xp_reward ) |
Sets the XP reward for a character.
character | Pointer to the character |
xp_reward | The XP reward value |
Definition at line 310 of file character.c.
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.
character | Pointer to the character |
slot | The slot to unequip from |
Definition at line 292 of file character.c.
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.
current_resources | Pointer to the current resources structure to update |
max_resources | Pointer to the max resources structure to update |
base_stats | Pointer to the base stats structure |
Definition at line 86 of file character.c.