22 return rand() % dice_size + 1;
25bool roll_hit(
const int attacker_dex,
const int defender_dex) {
30 return attacker_roll + (attacker_dex / 2) > defender_roll + (defender_dex / 2);
36 for (
int i = 0; i < ability->roll_amount; i++) {
48 if (damage < character->current_resources.health) {
49 character->current_resources.health -= damage;
51 character->current_resources.health = 0;
57 character->current_stats = character->base_stats;
Exposes functions for working with abilities.
Exposes functions for working working with the character.
const char * dice_size_to_string(const dice_size_t size)
Converts a dice size enum to a string representation.
bool roll_hit(const int attacker_dex, const int defender_dex)
Rolls a D20 to determine if an attack hits.
int roll_dice(dice_size_t dice_size)
Rolls given dice size and returns the result.
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 * damage_type_to_string(const damage_type_t type)
Converts a damage type enum to a string representation.
int roll_damage(const ability_t *ability)
Rolls damage based on the ability's roll amount and dice size.
Exposes functions for working with damage.
Header file for logging functionality of the game.