-
Notifications
You must be signed in to change notification settings - Fork 813
/
Copy pathmonstdat.h
344 lines (324 loc) · 5.92 KB
/
monstdat.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
/**
* @file monstdat.h
*
* Interface of all monster data.
*/
#pragma once
#include <cstdint>
#include <vector>
#include "cursor.h"
#include "textdat.h"
namespace devilution {
enum class MonsterAIID : int8_t {
Zombie,
Fat,
SkeletonMelee,
SkeletonRanged,
Scavenger,
Rhino,
GoatMelee,
GoatRanged,
Fallen,
Magma,
SkeletonKing,
Bat,
Gargoyle,
Butcher,
Succubus,
Sneak,
Storm,
FireMan,
Gharbad,
Acid,
AcidUnique,
Golem,
Zhar,
Snotspill,
Snake,
Counselor,
Mega,
Diablo,
Lazarus,
LazarusSuccubus,
Lachdanan,
Warlord,
FireBat,
Torchant,
HorkDemon,
Lich,
ArchLich,
Psychorb,
Necromorb,
BoneDemon,
Invalid = -1,
};
enum class MonsterClass : uint8_t {
Undead,
Demon,
Animal,
};
enum monster_resistance : uint8_t {
// clang-format off
RESIST_MAGIC = 1 << 0,
RESIST_FIRE = 1 << 1,
RESIST_LIGHTNING = 1 << 2,
IMMUNE_MAGIC = 1 << 3,
IMMUNE_FIRE = 1 << 4,
IMMUNE_LIGHTNING = 1 << 5,
IMMUNE_ACID = 1 << 7,
// clang-format on
};
enum monster_treasure : uint16_t {
// clang-format off
T_MASK = 0xFFF,
T_NODROP = 0x4000, // monster doesn't drop any loot
T_UNIQ = 0x8000, // use combined with unique item's ID - for example butcher's cleaver = T_UNIQ+UITEM_CLEAVE
// clang-format on
};
enum class MonsterAvailability : uint8_t {
Never,
Always,
Retail,
};
struct MonsterData {
std::string name;
std::string soundSuffix;
std::string trnFile;
uint16_t spriteId;
MonsterAvailability availability;
uint16_t width;
uint16_t image;
bool hasSpecial;
bool hasSpecialSound;
int8_t frames[6];
int8_t rate[6];
int8_t minDunLvl;
int8_t maxDunLvl;
int8_t level;
uint16_t hitPointsMinimum;
uint16_t hitPointsMaximum;
MonsterAIID ai;
/**
* @brief Denotes monster's abilities defined in @p monster_flag as bitflags
* For usage, see @p MonstersData in monstdat.cpp
*/
uint16_t abilityFlags;
uint8_t intelligence;
uint8_t toHit;
int8_t animFrameNum;
uint8_t minDamage;
uint8_t maxDamage;
uint8_t toHitSpecial;
int8_t animFrameNumSpecial;
uint8_t minDamageSpecial;
uint8_t maxDamageSpecial;
uint8_t armorClass;
MonsterClass monsterClass;
/** Using monster_resistance as bitflags */
uint8_t resistance;
/** Using monster_resistance as bitflags */
uint8_t resistanceHell;
SelectionRegion selectionRegion;
/** Using monster_treasure */
uint16_t treasure;
uint16_t exp;
[[nodiscard]] const char *spritePath() const;
[[nodiscard]] const char *soundPath() const
{
return !soundSuffix.empty() ? soundSuffix.c_str() : spritePath();
}
[[nodiscard]] bool hasAnim(size_t index) const
{
return frames[index] != 0;
}
};
enum _monster_id : int16_t {
MT_NZOMBIE,
MT_BZOMBIE,
MT_GZOMBIE,
MT_YZOMBIE,
MT_RFALLSP,
MT_DFALLSP,
MT_YFALLSP,
MT_BFALLSP,
MT_WSKELAX,
MT_TSKELAX,
MT_RSKELAX,
MT_XSKELAX,
MT_RFALLSD,
MT_DFALLSD,
MT_YFALLSD,
MT_BFALLSD,
MT_NSCAV,
MT_BSCAV,
MT_WSCAV,
MT_YSCAV,
MT_WSKELBW,
MT_TSKELBW,
MT_RSKELBW,
MT_XSKELBW,
MT_WSKELSD,
MT_TSKELSD,
MT_RSKELSD,
MT_XSKELSD,
MT_INVILORD,
MT_SNEAK,
MT_STALKER,
MT_UNSEEN,
MT_ILLWEAV,
MT_LRDSAYTR,
MT_NGOATMC,
MT_BGOATMC,
MT_RGOATMC,
MT_GGOATMC,
MT_FIEND,
MT_BLINK,
MT_GLOOM,
MT_FAMILIAR,
MT_NGOATBW,
MT_BGOATBW,
MT_RGOATBW,
MT_GGOATBW,
MT_NACID,
MT_RACID,
MT_BACID,
MT_XACID,
MT_SKING,
MT_CLEAVER,
MT_FAT,
MT_MUDMAN,
MT_TOAD,
MT_FLAYED,
MT_WYRM,
MT_CAVSLUG,
MT_DVLWYRM,
MT_DEVOUR,
MT_NMAGMA,
MT_YMAGMA,
MT_BMAGMA,
MT_WMAGMA,
MT_HORNED,
MT_MUDRUN,
MT_FROSTC,
MT_OBLORD,
MT_BONEDMN,
MT_REDDTH,
MT_LTCHDMN,
MT_UDEDBLRG,
MT_INCIN,
MT_FLAMLRD,
MT_DOOMFIRE,
MT_HELLBURN,
MT_STORM,
MT_RSTORM,
MT_STORML,
MT_MAEL,
MT_BIGFALL,
MT_WINGED,
MT_GARGOYLE,
MT_BLOODCLW,
MT_DEATHW,
MT_MEGA,
MT_GUARD,
MT_VTEXLRD,
MT_BALROG,
MT_NSNAKE,
MT_RSNAKE,
MT_BSNAKE,
MT_GSNAKE,
MT_NBLACK,
MT_RTBLACK,
MT_BTBLACK,
MT_RBLACK,
MT_UNRAV,
MT_HOLOWONE,
MT_PAINMSTR,
MT_REALWEAV,
MT_SUCCUBUS,
MT_SNOWWICH,
MT_HLSPWN,
MT_SOLBRNR,
MT_COUNSLR,
MT_MAGISTR,
MT_CABALIST,
MT_ADVOCATE,
MT_GOLEM,
MT_DIABLO,
MT_DARKMAGE,
MT_HELLBOAR,
MT_STINGER,
MT_PSYCHORB,
MT_ARACHNON,
MT_FELLTWIN,
MT_HORKSPWN,
MT_VENMTAIL,
MT_NECRMORB,
MT_SPIDLORD,
MT_LASHWORM,
MT_TORCHANT,
MT_HORKDMN,
MT_DEFILER,
MT_GRAVEDIG,
MT_TOMBRAT,
MT_FIREBAT,
MT_SKLWING,
MT_LICH,
MT_CRYPTDMN,
MT_HELLBAT,
MT_BONEDEMN,
MT_ARCHLICH,
MT_BICLOPS,
MT_FLESTHNG,
MT_REAPER,
MT_NAKRUL,
NUM_MTYPES,
MT_INVALID = -1,
};
/**
* @brief Defines if and how a group of monsters should be spawned with the unique monster
*/
enum class UniqueMonsterPack : uint8_t {
/**
* @brief Don't spawn a group of monsters with the unique monster
*/
None,
/**
* @brief Spawn a group of monsters that are independent from the unique monster
*/
Independent,
/**
* @brief Spawn a group of monsters that are leashed to the unique monster
*/
Leashed,
};
struct UniqueMonsterData {
_monster_id mtype;
std::string mName;
std::string mTrnName;
uint8_t mlevel;
uint16_t mmaxhp;
MonsterAIID mAi;
uint8_t mint;
uint8_t mMinDamage;
uint8_t mMaxDamage;
/** Using monster_resistance as bitflags */
uint16_t mMagicRes;
/**
* @brief Defines if and how a group of monsters should be spawned with the unique monster
*/
UniqueMonsterPack monsterPack;
uint8_t customToHit;
uint8_t customArmorClass;
_speech_id mtalkmsg;
};
extern std::vector<MonsterData> MonstersData;
extern const _monster_id MonstConvTbl[];
extern std::vector<UniqueMonsterData> UniqueMonstersData;
void LoadMonsterData();
/**
* @brief Returns the number of the monster sprite files.
*
* Different monsters can use the same sprite with different TRNs, these count as 1.
*/
size_t GetNumMonsterSprites();
} // namespace devilution