2022-10-16 15:13:33 +00:00
|
|
|
// playerdata.h: Header file containing data structures for player data and function
|
|
|
|
// prototypes for interacting with said data.
|
|
|
|
#ifndef PLAYERDATA_H
|
|
|
|
#define PLAYERDATA_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdbool.h>
|
2022-10-23 16:07:13 +00:00
|
|
|
#include "areadata.h"
|
2022-10-16 15:13:33 +00:00
|
|
|
#include "constants.h"
|
2022-11-13 00:23:42 +00:00
|
|
|
#include "linkedlist.h"
|
|
|
|
|
|
|
|
// Let the compiler know there will be structs defined elsewhere:
|
|
|
|
typedef struct playerPath playerPath;
|
|
|
|
typedef struct playerArea playerArea;
|
2022-11-29 21:04:36 +00:00
|
|
|
typedef struct list list;
|
|
|
|
typedef struct listNode listNode;
|
2022-10-16 15:13:33 +00:00
|
|
|
|
|
|
|
typedef struct statBlock
|
|
|
|
{
|
|
|
|
// Levelling:
|
|
|
|
int level;
|
|
|
|
long experience;
|
|
|
|
|
|
|
|
// Health:
|
|
|
|
int currentHealth;
|
|
|
|
int maxHealth;
|
|
|
|
|
|
|
|
// Core Stats:
|
|
|
|
int wits;
|
|
|
|
int intellect;
|
|
|
|
int strength;
|
|
|
|
int endurance;
|
|
|
|
int dexerity;
|
|
|
|
|
|
|
|
// Character Building:
|
|
|
|
int specPoints;
|
|
|
|
int skillPoints;
|
|
|
|
} statBlock;
|
|
|
|
|
|
|
|
typedef struct playerSkill
|
|
|
|
{
|
|
|
|
char skillName[32];
|
|
|
|
int skillPoints;
|
|
|
|
int skillModifier;
|
|
|
|
bool trainedSkill;
|
|
|
|
} playerSkill;
|
|
|
|
|
|
|
|
typedef struct playerInfo
|
|
|
|
{
|
|
|
|
char playerName[32];
|
|
|
|
playerArea * currentArea;
|
|
|
|
statBlock * stats;
|
2022-11-29 21:04:36 +00:00
|
|
|
list * skills;
|
2022-10-16 15:13:33 +00:00
|
|
|
} playerInfo;
|
|
|
|
|
|
|
|
typedef enum coreStat
|
|
|
|
{
|
|
|
|
WITS,
|
|
|
|
INTELLECT,
|
|
|
|
STRENGTH,
|
|
|
|
ENDURANCE,
|
|
|
|
DEXERITY,
|
|
|
|
INVALID
|
|
|
|
} coreStat;
|
|
|
|
|
|
|
|
// Create a new skill and add it to the global skill list:
|
2022-11-29 21:04:36 +00:00
|
|
|
listNode * createSkill(list * globalSkillList, char * skillName, int skillNameLength, bool trainedSkill);
|
2022-10-16 15:13:33 +00:00
|
|
|
|
|
|
|
// Take a skill and add it to the player's skill list:
|
2022-11-29 21:04:36 +00:00
|
|
|
int takeSkill(list * globalSkillList, char * skillName, int skillNameLength, playerInfo * targetPlayer);
|
|
|
|
int takeSkillbyID(list * globalSkillList, int skillID, playerInfo * targetPlayer);
|
2022-10-16 15:13:33 +00:00
|
|
|
|
|
|
|
// Take a string containing a core stat name and return the core stat:
|
|
|
|
coreStat getCoreStatFromString(char * string, int stringLength);
|
|
|
|
|
|
|
|
// Deallocate a player:
|
|
|
|
int deallocatePlayer(playerInfo * playerToDeallocate);
|
2022-10-23 16:07:13 +00:00
|
|
|
|
2022-10-16 15:13:33 +00:00
|
|
|
#endif
|