This repository has been archived by the owner on Nov 28, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ObjectType.h
375 lines (302 loc) · 9.89 KB
/
ObjectType.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
#ifndef OBJECTCLASS_H
#define OBJECTCLASS_H
#include <stdlib.h>
#include "Attack.h"
/* Various types of objects in the game.
ObjectType is the most general classification of an object,
ObjectIlk is a more specific subclassification.
*/
extern shGlyph ObjectGlyphs[];
enum shThingSize
{ /* creature size */
kFine, /* 6 in or less */
kDiminutive,
kTiny,
kSmall,
kMedium,
kLarge,
kHuge,
kGigantic,
kColossal
};
enum shMaterialType //borrowed from Nethack
{
kLiquid,
kWax,
kVegetable,
kFleshy,
kPaper,
kCloth,
kPlastic,
kLeather,
kWood,
kBone,
kIron,
kBrass,
kTin,
kBronze,
kLead,
kSteel,
kAluminum,
kTitanium,
kCarbonFiber,
kPlasteel,
kAdamantium,
kEndurium,
kDepletedUranium,
kCopper,
kSilver,
kElectrum,
kGold,
kPlatinum,
kMithril,
kSilicon,
kGlass,
kCrystal,
kGem,
kMineral,
kRock,
};
enum shIntrinsics {
kTelepathy = 0x1,
kMotionDetection = 0x2,
kRadiationDetection = 0x4,
kScent = 0x8,
kXRayVision = 0x10,
kReflection = 0x20,
kAutoSearching = 0x40,
kTranslation = 0x80, /* babel fish */
kHealthMonitoring = 0x100,
kRadiationProcessing = 0x200,
kCrazyIvan = 0x400,
kAutoRegeneration = 0x800,
kLightSource = 0x1000,
kPerilSensing = 0x2000,
kBlind = 0x4000,
kShielded = 0x8000, /* protected by a shield generator */
kBugSensing = 0x10000, /* software engineer */
kFlying = 0x20000,
kLucky = 0x40000,
kNarcolepsy = 0x80000,
kBrainShielded = 0x100000,
kScary = 0x200000,
kAcidBlood = 0x400000,
kMultiplier = 0x800000,
kAirSupply = 0x1000000, /* has air supply */
kBreathless = 0x2000000, /* doesn't need to breathe */
kCanSwim = 0x4000000, /* can swim */
kNightVision = 0x8000000,
};
/* low 8 bits reserved for objectilk, high 24 bits for derived ilks */
enum shObjectIlkFlags {
kMergeable = 0x1,
kChargeable = 0x2,
kIdentified = 0x4,
kEnhanceable = 0x8,
kBugProof = 0x10,
kUsuallyBuggy = 0x20,
kUnique = 0x40,
kIndestructible = 0x80,
};
struct shObjectDescData {
char mDesc[40];
shColor mColor;
};
extern shObjectDescData CanisterData[30];
extern shObjectDescData ImplantData[30];
extern shObjectDescData FloppyData[30];
extern shObjectDescData RayGunData[30];
extern shObjectDescData JumpsuitData[30];
extern shObjectDescData BeltData[5];
void randomizeIlkNames ();
extern shVector <shObjectIlk *> ObjectIlks;
struct shObjectIlk
{
int mId;
shObjectType mType;
struct shObjectIlk *mParent; // parent ilk, useful for isA ()
// e.g. bullet is parent of silver bullet
const char *mName; /* precise name, e.g. "canister of restoration */
const char *mAppearance; /* ignorant description, e.g. "green canister" */
const char *mVagueName; /* blind name, e.g. "canister" */
const char *mUserName; /* name given by user, e.g.: "tastes like crap" */
shGlyph mGlyph;
shMaterialType mMaterial;
int mCost; /* cost in shop */
int mFlags;
int mCarriedIntrinsics; /* conferred to the carrier */
int mWornIntrinsics; /* conferred only when worn */
int mWieldedIntrinsics; /* conferred only when wielded */
int mActiveIntrinsics; /* conferred only when active */
int mProbability; /* relative probability when randomly generating;
-1 indicates an abstract ilk */
int mWeight; // in grams
shThingSize mSize;// physical size / unwieldiness.
int mHardness;
int mHP; // base HP
int mEnergyUse; /* for items that continuously use energy (e.g. geiger
counters, flashlights), ticks per cell consumed
for items that use energy in bursts (e.g. weapons),
cells consumed per use */
//constructor:
shObjectIlk () {
mId = ObjectIlks.add (this);
mFlags = 0; mCarriedIntrinsics = 0; mWornIntrinsics = 0;
mWieldedIntrinsics = 0; mActiveIntrinsics = 0;
mVagueName = NULL; mUserName = NULL;
}
int isA (shObjectIlk *ilk);
char *getRayGunColor (); /* kludgey, not reentrant*/
};
struct shWeaponIlk : shObjectIlk
{
int mRange; // in ft, 0 indicates melee weapon
int mThreatRange;
int mToHitBonus;
int mCriticalMultiplier;
shObjectIlk *mAmmoType;
int mAmmoBurst; /* no of rounds of ammo /energy cells consumed per burst */
shSkillCode mSkill;
shAttack mAttack;
//constructor:
shWeaponIlk (const char *name, const char *vaguename,
const char *appearance,
shColor color,
shSkillCode skill,
shWeaponIlk *parent,
shMaterialType material, int flags, int weight,
shThingSize size, int hardness, int hp,
shObjectIlk *ammo, int ammoburst,
int hitbonus,
shAttack::Type atktype, shAttack::Effect atkeffect,
int range, int radius, shEnergyType entype,
int numdice, int dicesides, int atktime,
shEnergyType entype2, int numdice2,
int cost, int prob);
};
struct shRayGunIlk : shObjectIlk
{
shAttack mAttack;
shRayGunIlk (const char *name, const char *appearance, shColor color,
int flags,
shAttack::Type atktype, shEnergyType entype,
int numdice, int dicesides, int cost, int prob);
};
struct shImplantIlk : shObjectIlk
{
enum Site {
kFrontalLobe,
kParietalLobe,
kOccipitalLobe,
kTemporalLobe,
kCerebellum,
kLeftEar,
kRightEyeball,
kMaxSite,
kAnyEar,
kAnyEye,
kAnyBrain,
};
Site mSite;
int mPsiModifier;
shImplantIlk (const char *name, const char *vaguename,
const char *appearance,
shColor color,
shMaterialType material, int flags,
Site site, int intrinsics,
int psimodifier,
int cost, int prob);
};
const char *describeImplantSite (shImplantIlk::Site site);
enum shArmorFlags {
kPowered = 0x100, /* the weight of worn powered armor doesn't encumber */
};
struct shArmorIlk : shObjectIlk
{
char mArmorBonus;
char mResistances[kMaxEnergyType]; /* resistances granted by this armor */
int mEquipSpeed; //ms to don or doff armor
char mSpeedPenalty; //in % - 100% penalty == movement takes twice as long
int mPsiModifier;
int mToHitModifier;
int mDamageModifier;
//constructor:
shArmorIlk (const char *name, const char *vaguename,
const char *appearance,
shColor color,
shArmorIlk *parent,
shMaterialType material, int flags, int weight,
shThingSize size, int hardness, int hp, int psimod, int bonus,
shEnergyType specialtype, int specialbonus,
int equipspeed, int speedpenalty, int cost, int prob);
};
struct shDeviceIlk : shObjectIlk
{
shMonsterIlk *mWreckIlk;
shDeviceIlk (const char *name, const char *vaguename,
const char *appearance,
shColor color, shDeviceIlk *parent,
int cost, shMaterialType material, int flags, int weight,
shThingSize size, int hardness, int hp,
int prov);
};
typedef int shToolFunc (shObject *tool); /* returns ms elapsed */
struct shToolIlk : shObjectIlk
{
shToolFunc *mUseFunc;
shToolIlk (const char *name, const char *vaguename,
const char *appearance,
shColor color, shToolIlk *parent,
int cost, shMaterialType material, int flags, int weight,
shThingSize size, int hardness, int hp,
int energyuse, shToolFunc *usefunc,
int prob);
};
extern shToolIlk *EnergyTank;
extern shToolIlk *PowerPlant;
int makeRepair (shObject *tool);
typedef int shCanisterFunc (shObject *canister); /* returns ms elapsed */
typedef int shCanisterUseFunc (shObject *canister);
struct shCanisterIlk : shObjectIlk
{
shCanisterUseFunc *mUseFunc;
shCanisterFunc *mQuaffFunc;
shCanisterFunc *mExplodeFunc;
shCanisterIlk (const char *name, const char *appearance, int flags,
shCanisterUseFunc *usefunc,
shCanisterFunc *quafffunc,
shCanisterFunc *explodefunc,
int cost,
int prob);
};
typedef int shFloppyDiskFunc (shObject *computer, shObject *disk);
struct shFloppyDiskIlk : shObjectIlk
{
shFloppyDiskFunc *mUseFunc;
shFloppyDiskIlk (const char *name, const char *appearance,
shFloppyDiskFunc *usefunc,
int cost, int prob);
};
shObjectIlk *pickAnIlk (shVector <shObjectIlk *> *ilks);
extern shObjectIlk WreckIlk;
extern shObjectIlk MoneyIlk;
extern shVector <shObjectIlk *> WeaponIlks;
extern shVector <shObjectIlk *> ArmorIlks;
extern shVector <shObjectIlk *> ToolIlks;
extern shVector <shObjectIlk *> CanisterIlks;
extern shVector <shObjectIlk *> FloppyDiskIlks;
extern shVector <shObjectIlk *> ImplantIlks;
extern shVector <shObjectIlk *> ArtifactIlks;
extern shVector <shObjectIlk *> RayGunIlks;
extern shObjectIlk EnergyCellIlk;
extern shToolIlk *Computer;
extern shToolIlk *MasterKey;
extern shToolIlk *LockPick;
extern shArmorIlk *shHelmet;
extern shArmorIlk *shGoggles;
extern shArmorIlk *shBodyArmor;
extern shArmorIlk *shJumpsuit;
extern shArmorIlk *shBelt;
#define BZ
#define PCT
#endif