42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
//---
|
|
// player: Dynamic player information
|
|
//---
|
|
|
|
#pragma once
|
|
|
|
#include "comp/entity.h"
|
|
#include "comp/mechanical.h"
|
|
#include "comp/fighter.h"
|
|
#include <stdbool.h>
|
|
|
|
typedef struct player_data {
|
|
/* Associated entity */
|
|
entity_t *entity;
|
|
/* Mechanical limits (dynamically recomputed) */
|
|
mechanical_limits_t mechanical_limits;
|
|
/* Fighter model */
|
|
fighter_stats_t stats, stats_growth;
|
|
/* Experience level, total to next level, current points (within level) */
|
|
int xp_level;
|
|
int xp_to_next_level;
|
|
int xp_current;
|
|
/* Inventory */
|
|
int inventory[8];
|
|
/* IDs of inventory slots holding currently-equipped item for each kind of
|
|
equipment (-1 if none equipped) */
|
|
int equipment[3];
|
|
|
|
} player_data_t;
|
|
|
|
/* Add XP points to a player. Returns true if levels up */
|
|
bool player_add_xp(entity_t *p, int points);
|
|
|
|
/* Compute player's statistics growth under hypothetical equips */
|
|
fighter_stats_t player_compute_growth(entity_t *e, int *equips);
|
|
|
|
/* Compute player's skills under hypothetical equips */
|
|
void player_compute_skills(entity_t *e, int *equips, int *skills);
|
|
|
|
/* Put an item into the player's inventory. false if inventory is full */
|
|
bool player_give_item(entity_t *p, int item);
|