41 lines
1.1 KiB
C
41 lines
1.1 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 (dynamically recomputed) */
|
|
fighter_stat_model_t stat_model;
|
|
/* Experience level, total to next level, current points (within level) */
|
|
int xp_level;
|
|
int xp_to_next_level;
|
|
int xp_current;
|
|
/* Inventory */
|
|
int inventory[9];
|
|
/* Current equipped items */
|
|
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 under hypothetical equips */
|
|
fighter_stat_model_t player_compute_stats(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);
|