DungeonCrawl
Loading...
Searching...
No Matches
loot_generation.c
Go to the documentation of this file.
1
5#include "loot_generation.h"
6
7#include <stdlib.h>
8
9
10void generate_loot(character_t* c, gear_table_t* gear_table, potion_table_t* potion_table, int rolls) {
11 for (int i = 0; i < rolls; i++) {
12 int gear_index = rand() % MAX_GEARS;
13 int potion_index = rand() % MAX_POTION_TYPES;
14 add_gear(c, gear_table->gears[gear_index]);
15 add_potion(c, &potion_table->potions[potion_index]);
16 }
17}
void add_gear(character_t *character, gear_t *gear)
Adds gear to a character's inventory.
Definition character.c:156
void add_potion(character_t *character, potion_t *potion)
Adds a potion to a character's inventory.
Definition character.c:242
void generate_loot(character_t *c, gear_table_t *gear_table, potion_table_t *potion_table, int rolls)
Generates loot for a character by randomly selecting a number of gear and potions.
Exposes functions for loot generation.