DungeonCrawl
|
Implements damage rolling, hit checks, and damage application logic. More...
#include "damage.h"
#include "../character/character.h"
#include "../logging/logger.h"
#include "ability.h"
#include <stdlib.h>
Go to the source code of this file.
Functions | |
int | roll_dice (const dice_size_t dice_size) |
Rolls given dice size and returns the result. | |
bool | roll_hit (const int attacker_dex, const int defender_dex) |
Rolls a D20 to determine if an attack hits. | |
int | roll_damage (const ability_t *ability) |
Rolls damage based on the ability's roll amount and dice size. | |
int | deal_damage (character_t *character, damage_type_t damage_type, const int damage) |
Deals damage to a character based on the damage type and amount. | |
void | reset_current_stats (character_t *character) |
Resets the current stats of a character to their base values. | |
const char * | dice_size_to_string (const dice_size_t size) |
Converts a dice size enum to a string representation. | |
const char * | damage_type_to_string (const damage_type_t type) |
Converts a damage type enum to a string representation. |
Implements damage rolling, hit checks, and damage application logic.
Definition in file damage.c.
const char * damage_type_to_string | ( | damage_type_t | type | ) |
Converts a damage type enum to a string representation.
type | The damage type to convert. |
Definition at line 78 of file damage.c.
int deal_damage | ( | character_t * | character, |
damage_type_t | damage_type, | ||
int | damage ) |
Deals damage to a character based on the damage type and amount.
character | Pointer to the character receiving damage. |
damage_type | The type of damage being dealt. |
damage | The amount of damage to be dealt. |
Definition at line 42 of file damage.c.
const char * dice_size_to_string | ( | dice_size_t | size | ) |
Converts a dice size enum to a string representation.
size | The dice size to convert. |
Definition at line 61 of file damage.c.
void reset_current_stats | ( | character_t * | character | ) |
int roll_damage | ( | const ability_t * | ability | ) |
Rolls damage based on the ability's roll amount and dice size.
ability | Pointer to the ability used for rolling damage. |
Definition at line 33 of file damage.c.
int roll_dice | ( | const dice_size_t | dice_size | ) |
bool roll_hit | ( | int | attacker_dex, |
int | defender_dex ) |
Rolls a D20 to determine if an attack hits.
attacker_dex | The dexterity of the attacker. |
defender_dex | The dexterity of the defender. |