DungeonCrawl
|
Implementation of the combat mode. More...
#include "combat_mode.h"
#include "../character/character.h"
#include "../character/level.h"
#include "../common.h"
#include "../game.h"
#include "../io/input/input_handler.h"
#include "../io/io_handler.h"
#include "../io/output/common/output_handler.h"
#include "../io/output/media/media_files.h"
#include "../io/output/specific/combat_output.h"
#include "../local/local_handler.h"
#include "ability.h"
#include "local/combat_mode_local.h"
#include <stdlib.h>
#include <unistd.h>
Go to the source code of this file.
Functions | |
void | collect_ability_menu_options (ability_t *abilities[], const int count) |
Collects all the options for abilities in the abilities menu for displaying. | |
void | collect_potion_menu_options (potion_t *potions[], const int count) |
Collects all the options for potions in the potion menu for displaying. | |
void | use_ability (character_t *attacker, character_t *target, const ability_t *ability) |
Use an ability on a target character. | |
void | use_potion (character_t *player, const character_t *monster, potion_t *potion) |
Use a potion on a target character. | |
bool | consume_ability_resource (character_t *attacker, const ability_t *ability) |
Consumes the mana or stamina resource of the attacker character. | |
ability_t * | get_random_ability (const character_t *character) |
Get a random ability from the character's abilities. | |
int | init_combat_mode () |
Initialize the combat mode. | |
combat_result_t | start_combat (character_t *player, character_t *monster) |
Starts the loop for combat between the player and the monster. | |
internal_combat_state_t | combat_menu (const character_t *player, const character_t *monster) |
Collects the menu options for the ability menu. | |
internal_combat_state_t | ability_menu (character_t *player, character_t *monster) |
Collects the menu options for the ability menu. | |
internal_combat_state_t | potion_menu (character_t *player, character_t *monster) |
Collects the menu options for the potion menu. | |
void | invoke_potion_effect (character_t *character, potion_t *potion) |
Invoke the effect of a potion on a character. | |
void | shutdown_combat_mode () |
Shuts down the combat mode and frees allocated memory resources. |
Variables | |
vector2d_t | combat_view_anchor = {1, 1} |
internal_combat_state_t | combat_state = COMBAT_MENU |
int | ability_count = 0 |
int | potion_count = 0 |
char ** | ability_menu_options = NULL |
char ** | potion_menu_options = NULL |
Implementation of the combat mode.
Definition in file combat_mode.c.
internal_combat_state_t ability_menu | ( | character_t * | player, |
character_t * | monster ) |
Collects the menu options for the ability menu.
abilities | Pointer to the player character. |
monster | Pointer to the monster character. |
Definition at line 209 of file combat_mode.c.
void collect_ability_menu_options | ( | ability_t * | abilities[], |
const int | count ) |
Collects all the options for abilities in the abilities menu for displaying.
abilities | An array of abilities. |
count | Ammount of abilities in the array. |
Definition at line 444 of file combat_mode.c.
void collect_potion_menu_options | ( | potion_t * | potions[], |
const int | count ) |
Collects all the options for potions in the potion menu for displaying.
potions | An array of potions. |
count | Ammount of potions in the array. |
Definition at line 482 of file combat_mode.c.
internal_combat_state_t combat_menu | ( | const character_t * | player, |
const character_t * | monster ) |
Collects the menu options for the ability menu.
player | Pointer to the player character. |
monster | Pointer to the monster character. |
Definition at line 156 of file combat_mode.c.
bool consume_ability_resource | ( | character_t * | attacker, |
const ability_t * | ability ) |
Consumes the mana or stamina resource of the attacker character.
attacker | Pointer to the attacker character. |
ability | Pointer to the ability to be used. |
Definition at line 419 of file combat_mode.c.
ability_t * get_random_ability | ( | const character_t * | character | ) |
Get a random ability from the character's abilities.
character | Pointer to the character whose abilities are to be used. |
Definition at line 382 of file combat_mode.c.
int init_combat_mode | ( | ) |
Initialize the combat mode.
Definition at line 67 of file combat_mode.c.
void invoke_potion_effect | ( | character_t * | character, |
potion_t * | potion ) |
Invoke the effect of a potion on a character.
character | Pointer to the character which uses the potion. |
potion | Pointer to which potion to be used. |
Definition at line 387 of file combat_mode.c.
internal_combat_state_t potion_menu | ( | character_t * | player, |
character_t * | monster ) |
Collects the menu options for the potion menu.
abilities | Pointer to the player character. |
monster | Pointer to the monster character. |
Definition at line 262 of file combat_mode.c.
void shutdown_combat_mode | ( | void | ) |
Shuts down the combat mode and frees allocated memory resources.
Definition at line 511 of file combat_mode.c.
combat_result_t start_combat | ( | character_t * | player, |
character_t * | monster ) |
Starts the loop for combat between the player and the monster.
player | Pointer to the player character. |
monster | Pointer to the monster character. |
Definition at line 107 of file combat_mode.c.
void use_ability | ( | character_t * | attacker, |
character_t * | target, | ||
const ability_t * | ability ) |
Use an ability on a target character.
attacker | Pointer to the attacker character. |
target | Pointer to the target character. |
ability | Pointer to the ability to be used. |
Definition at line 320 of file combat_mode.c.
void use_potion | ( | character_t * | player, |
const character_t * | monster, | ||
potion_t * | potion ) |
Use a potion on a target character.
player | Pointer to the player character. |
monster | Pointer to the monster character. |
potion | Pointer to the potion to be used. |
Definition at line 369 of file combat_mode.c.
int ability_count = 0 |
Definition at line 31 of file combat_mode.c.
char** ability_menu_options = NULL |
Definition at line 34 of file combat_mode.c.
internal_combat_state_t combat_state = COMBAT_MENU |
Definition at line 29 of file combat_mode.c.
vector2d_t combat_view_anchor = {1, 1} |
Definition at line 28 of file combat_mode.c.
int potion_count = 0 |
Definition at line 32 of file combat_mode.c.
char** potion_menu_options = NULL |
Definition at line 35 of file combat_mode.c.