1 /*-------------------------------------------------------------------------------
2 
3 	BARONY
4 	File: stat.hpp
5 	Desc: header for stat.cpp (contains Stat class definition)
6 
7 	Copyright 2013-2016 (c) Turning Wheel LLC, all rights reserved.
8 	See LICENSE for details.
9 
10 -------------------------------------------------------------------------------*/
11 
12 #pragma once
13 
14 #include "main.hpp"
15 
16 #ifdef USE_FMOD
17 #include "fmod.h"
18 #endif
19 
20 class Item;
21 //enum Item;
22 //enum Status;
23 //enum Category;
24 
25 typedef enum
26 {
27 	NOTHING,
28 	HUMAN,
29 	RAT,
30 	GOBLIN,
31 	SLIME,
32 	TROLL,
33 	OCTOPUS,
34 	SPIDER,
35 	GHOUL,
36 	SKELETON,
37 	SCORPION,
38 	CREATURE_IMP, //Because Apple so unkindly is already using the IMP keyword.
39 	BUGBEAR,
40 	GNOME,
41 	DEMON,
42 	SUCCUBUS,
43 	MIMIC,
44 	LICH,
45 	MINOTAUR,
46 	DEVIL,
47 	SHOPKEEPER,
48 	KOBOLD,
49 	SCARAB,
50 	CRYSTALGOLEM,
51 	INCUBUS,
52 	VAMPIRE,
53 	SHADOW,
54 	COCKATRICE,
55 	INSECTOID,
56 	GOATMAN,
57 	AUTOMATON,
58 	LICH_ICE,
59 	LICH_FIRE
60 } Monster;
61 #define NUMMONSTERS 33
62 extern int kills[NUMMONSTERS];
63 
64 // effects
65 static const int EFF_ASLEEP = 0;
66 static const int EFF_POISONED = 1;
67 static const int EFF_STUNNED = 2;
68 static const int EFF_CONFUSED = 3;
69 static const int EFF_DRUNK = 4;
70 static const int EFF_INVISIBLE = 5;
71 static const int EFF_BLIND = 6;
72 static const int EFF_GREASY = 7;
73 static const int EFF_MESSY = 8;
74 static const int EFF_FAST = 9;
75 static const int EFF_PARALYZED = 10;
76 static const int EFF_LEVITATING = 11;
77 static const int EFF_TELEPATH = 12;
78 static const int EFF_VOMITING = 13;
79 static const int EFF_BLEEDING = 14;
80 static const int EFF_SLOW = 15;
81 static const int EFF_MAGICRESIST = 16;
82 static const int EFF_MAGICREFLECT = 17;
83 static const int NUMEFFECTS = 40;
84 
85 // proficiencies
86 static const int PRO_LOCKPICKING = 0;   // base attribute: dex
87 static const int PRO_STEALTH = 1;       // base attribute: dex
88 static const int PRO_TRADING = 2;       // base attribute: chr
89 static const int PRO_APPRAISAL = 3;     // base attribute: per
90 static const int PRO_SWIMMING = 4;      // base attribute: con
91 static const int PRO_LEADERSHIP = 5;    // base attribute: chr
92 static const int PRO_SPELLCASTING = 6;  // base attribute: int
93 static const int PRO_MAGIC = 7;         // base attribute: int
94 static const int PRO_RANGED = 8;        // base attribute: dex
95 static const int PRO_SWORD = 9;         // base attribute: str
96 static const int PRO_MACE = 10;         // base attribute: str
97 static const int PRO_AXE = 11;          // base attribute: str
98 static const int PRO_POLEARM = 12;      // base attribute: str
99 static const int PRO_SHIELD = 13;       // base attribute: con
100 static const int NUMPROFICIENCIES = 14;
101 
102 #define NUMCATEGORIES 13
103 
104 typedef enum
105 {
106 	MALE,
107 	FEMALE
108 } sex_t;
109 
110 class Stat
111 {
112 public:
113 	Monster type;
114 	sex_t sex;
115 	Uint32 appearance;
116 	char name[128];
117 	char obituary[128];
118 	Uint32 poisonKiller; // uid of the entity which killed me via burning/poison
119 
120 	// attributes
121 	Sint32 HP, MAXHP, OLDHP;
122 	Sint32 MP, MAXMP;
123 	Sint32 STR, DEX, CON, INT, PER, CHR;
124 	Sint32 EXP, LVL;
125 	Sint32 GOLD, HUNGER;
126 
127 	// skills and effects
128 	Sint32 PROFICIENCIES[NUMPROFICIENCIES];
129 	bool EFFECTS[NUMEFFECTS];
130 	Sint32 EFFECTS_TIMERS[NUMEFFECTS];
131 	bool defending;
132 
133 	// group think
134 	Uint32 leader_uid;
135 	list_t FOLLOWERS;
136 	int stache_x1, stache_x2;
137 	int stache_y1, stache_y2;
138 
139 	// equipment
140 	list_t inventory;
141 	Item* helmet;
142 	Item* breastplate;
143 	Item* gloves;
144 	Item* shoes;
145 	Item* shield;
146 	Item* weapon;
147 	Item* cloak;
148 	Item* amulet;
149 	Item* ring;
150 	Item* mask;
151 
152 	// misc
153 #ifdef USE_FMOD
154 	FMOD_CHANNEL* monster_sound; //TODO: Do?
155 #else
156 	void* monster_sound;
157 #endif
158 	int monster_idlevar;
159 
160 	list_t magic_effects; //Makes things like the invisibility spell work.
161 	Stat();
162 	~Stat();
163 	void clearStats();
164 	void freePlayerEquipment();
165 	Stat* copyStats();
166 	void printStats();
167 };
168 
169 extern Stat* stats[MAXPLAYERS];