-
Notifications
You must be signed in to change notification settings - Fork 1
/
battleSystem.h
178 lines (155 loc) · 4.29 KB
/
battleSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef PLAYER_H_INCLUDED
#define PLAYER_H_INCLUDED
#include "warper.h"
//#defines
#define WARPER_MAX_LEVEL 50
#define WARPER_MAX_STAT_LEVEL 100
//enum definitions
enum warperClass
{
classNone,
classAttacker,
classShooter, //maybe rename this one
classTechnomancer
};
enum warperStatus
{
statusNone,
statusHacked, /**< unable to use attack with anything other than basic attacks, and movement is restricted to walking */
statusBleed, /**< damage over time (damage at the start of each turn) */
statusSlow, /**< reduces stamina by 25-ish % */
statusExposed /**< crits are easier (maybe use this, maybe not) */
};
enum warperObjective
{
objectiveNone,
objectiveDefeat,
objectiveRetreat,
objectiveRescue,
objectiveCapture
};
enum warperItemType
{
itemMisc,
itemMelee,
itemRanged,
itemMagic,
itemConsumable,
itemStory
};
enum warperWeaponAttribute
{
attrNone,
attrTough,
attrOptimized,
attrLucky
};
//struct definitions
typedef struct _node
{
int x;
int y;
void* lastNode;
bool visited;
double distance;
bool initialized;
} node;
typedef struct _warperStats
{
int hp;
int attack;
int speed;
int tp;
int techAffinity;
int luck;
int statPts;
} warperStats;
typedef struct _warperBattleData
{
int curHp;
enum warperStatus status;
int statusStrength;
int staminaLeft;
int energyLeft;
bool teleportedOrAttacked;
} warperBattleData;
typedef struct _warperWeaponStats
{
int power;
int weight;
int reach;
enum warperWeaponAttribute attribute;
} warperWeaponStats;
typedef struct _warperItem
{
enum warperItemType itemType;
int id;
char* name;
int count;
warperWeaponStats weaponStats;
} warperItem;
typedef struct _warperUnit
{
cSprite* sprite;
char* name;
int level;
int exp;
int maxHp;
int maxStamina;
int maxEnergy;
enum warperClass classType;
warperItem* weapon;
warperStats stats;
warperBattleData battleData;
} warperUnit;
typedef struct _warperTeam
{
warperUnit** units;
int unitsSize;
warperItem* inventory;
int inventorySize;
int money;
} warperTeam;
typedef struct _warperBattle
{
enum warperObjective objective;
bool isPlayerTurn;
} warperBattle;
typedef struct _warperAttackCheck
{
int damage;
enum warperStatus status;
double hitChance;
double critChance;
double statusChance;
} warperAttackCheck;
typedef struct _warperAttackResult
{
int damage;
enum warperStatus status;
bool crit;
bool miss;
} warperAttackResult;
//function prototypes
void initWarperTeam(warperTeam* team, warperUnit** units, int unitsSize, warperItem* inventory, int inventorySize, int money);
void destroyWarperTeam(warperTeam* team, bool freeUnits);
void initNode(node* nodePtr, int x, int y, node* lastNode, bool visited, double distance);
node* BreadthFirst(warperTilemap tilemap, const int startX, const int startY, const int endX, const int endY, int* lengthOfPath, const bool drawDebug, cCamera* camera);
node* offsetBreadthFirst(warperTilemap tilemap, int startX, int startY, int endX, int endY, int finderWidth, int finderHeight, cDoubleRect* customCollisions, int customCollisionLength, int* lengthOfPath, const bool drawDebug, cCamera* camera);
void calculateStats(warperUnit* unit, bool setBattleStats);
warperAttackCheck checkAttack(warperUnit* attackingUnit, warperUnit* defendingUnit, double distance);
warperAttackResult doAttack(warperUnit* attackingUnit, warperUnit* defendingUnit, warperAttackCheck checkResult);
void finishBattle(warperTeam* team, warperTeam* enemyTeam, warperBattle battle);
void addExp(warperUnit* unit, int exp);
void initTestWarperTeams(warperTilemap tilemap, warperTeam* playerTeam, warperTeam* enemyTeam);
#define STATUS_NAME_ARR {"None", "Hacked", "Wounded", "Slowed", "Exposed"}
#define MISC_ITEM_NAME_ARR {"Misc Item 1"}
#define MELEE_ITEM_NAME_ARR {"Training Sword"}
#define RANGED_ITEM_NAME_ARR {"Training Blaster"}
#define MAGIC_ITEM_NAME_ARR {"Training Crypto- + Grimoire/Tome = Cryptoire/Cryptome"}
#define CONSUMABLE_ITEM_NAME_ARR {"Consumable 1"}
#define STORY_ITEM_NAME_ARR {"Story Item 1"}
#define MELEE_WEAPON_STATS_ARR {}
#define RANGED_WEAPON_STATS_ARR {}
#define MAGIC_WEAPON_STATS_ARR {}
#endif // PLAYER_H_INCLUDED