DungeonCrawl
Loading...
Searching...
No Matches
damage.h
Go to the documentation of this file.
1
5#ifndef DAMAGE_H
6#define DAMAGE_H
7
9#include "ability_fw.h"
10
11#define DAMAGE_TYPE_COUNT 2
12
13typedef enum damage_type_t {
14 PHYSICAL,
15 MAGICAL
16} damage_type_t;
17
18typedef enum dice_size_t {
19 D6 = 6,
20 D8 = 8,
21 D10 = 10,
22 D12 = 12,
23 D20 = 20
24} dice_size_t;
25
26typedef struct damage_resistance_t {
27 damage_type_t type;
28 int value;
30
37bool roll_hit(int attacker_dex, int defender_dex);
43int roll_damage(const ability_t* ability);
51int deal_damage(character_t* character, damage_type_t damage_type, int damage);
52
57void reset_current_stats(character_t* character);
63const char* dice_size_to_string(dice_size_t size);
64
70const char* damage_type_to_string(damage_type_t type);
71
72#endif//DAMAGE_H
Exposes a forward struct for abilites.
Exposes a forward strucht for the character type.
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.
Definition damage.c:42
const char * damage_type_to_string(damage_type_t type)
Converts a damage type enum to a string representation.
Definition damage.c:78
void reset_current_stats(character_t *character)
Resets the current stats of a character to their base stats.
Definition damage.c:56
const char * dice_size_to_string(dice_size_t size)
Converts a dice size enum to a string representation.
Definition damage.c:61
int roll_damage(const ability_t *ability)
Rolls damage based on the ability's roll amount and dice size.
Definition damage.c:33
bool roll_hit(int attacker_dex, int defender_dex)
Rolls a D20 to determine if an attack hits.
Definition damage.c:25