| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#ifndef __item_h__ |
| 17 |
#define __item_h__ |
| 18 |
|
| 19 |
#include "glbdef.h" |
| 20 |
#include "grammar.h" |
| 21 |
#include "mobref.h" |
| 22 |
#include "name.h" |
| 23 |
|
| 24 |
class SRAMSTREAM; |
| 25 |
|
| 26 |
class MOB; |
| 27 |
class INTRINSIC; |
| 28 |
class INTRINSIC_COUNTER; |
| 29 |
class MAP; |
| 30 |
class ARTIFACT; |
| 31 |
|
| 32 |
|
| 33 |
void item_init(); |
| 34 |
|
| 35 |
class ITEM |
| 36 |
{ |
| 37 |
private: |
| 38 |
ITEM(); |
| 39 |
public: |
| 40 |
~ITEM(); |
| 41 |
|
| 42 |
static ITEM *create(ITEM_NAMES definition, bool allowartifact = true, |
| 43 |
bool nocurse = false); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
static ITEM_NAMES lookupMagicItem(MAGICTYPE_NAMES magictype, |
| 48 |
int magicclass); |
| 49 |
|
| 50 |
static ITEM *createMagicItem(MAGICTYPE_NAMES magictype, |
| 51 |
int magicclass, |
| 52 |
bool allowartifact = true, |
| 53 |
bool nocurse = false); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
ITEM *createClone() const; |
| 59 |
|
| 60 |
|
| 61 |
static ITEM *createRandom(bool allowartifact = true); |
| 62 |
|
| 63 |
static ITEM *createRandomType(ITEMTYPE_NAMES type, |
| 64 |
bool allowartifact = true); |
| 65 |
static ITEM *createRandomFromTable(int *table, int max_prob, |
| 66 |
bool allowartifact = true); |
| 67 |
|
| 68 |
|
| 69 |
static ITEM *createCorpse(MOB *mob); |
| 70 |
|
| 71 |
|
| 72 |
static ITEM *createStatue(MOB *mob); |
| 73 |
|
| 74 |
static ITEM *load(SRAMSTREAM &is); |
| 75 |
|
| 76 |
static BUF buildAttackName(const ATTACK_DEF *attack); |
| 77 |
|
| 78 |
static void loadGlobal(SRAMSTREAM &is); |
| 79 |
static void saveGlobal(SRAMSTREAM &is); |
| 80 |
|
| 81 |
|
| 82 |
static void init(); |
| 83 |
|
| 84 |
void save(SRAMSTREAM &os); |
| 85 |
|
| 86 |
|
| 87 |
bool verifyMob() const; |
| 88 |
|
| 89 |
|
| 90 |
bool verifyCounterGone(INTRINSIC_COUNTER *counter) const; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
bool doHeartbeat(MAP *map, MOB *owner); |
| 95 |
|
| 96 |
void setPos(int x, int y); |
| 97 |
int getX() const { return myX; } |
| 98 |
int getY() const { return myY; } |
| 99 |
int getEnchantment() const { return myEnchantment; } |
| 100 |
void enchant(int delta); |
| 101 |
|
| 102 |
|
| 103 |
void makeArtifact(const char *name = 0); |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
void makeVanilla(); |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
bool resurrect(MAP *map, MOB *resser, int x, int y); |
| 116 |
bool raiseZombie(MAP *map, MOB *raiser); |
| 117 |
bool raiseSkeleton(MAP *map, MOB *raiser); |
| 118 |
|
| 119 |
bool petrify(MAP *map, MOB *petrifier); |
| 120 |
bool unpetrify(MAP *map, MOB *unpetrifier); |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
ITEM *polymorph(MOB *polyer); |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
bool doBreak(int dc, MOB *breaker, MOB *owner, |
| 136 |
MAP *map, int x, int y); |
| 137 |
|
| 138 |
|
| 139 |
void renameType(const char *newname); |
| 140 |
|
| 141 |
|
| 142 |
void rename(const char *newname); |
| 143 |
void rename(BUF buf); |
| 144 |
|
| 145 |
|
| 146 |
const char *getPersonalName() const; |
| 147 |
|
| 148 |
ITEM *getNext() const { return myNext; } |
| 149 |
void setNext(ITEM *item) { myNext = item; } |
| 150 |
|
| 151 |
|
| 152 |
MATERIAL_NAMES getMaterial() const; |
| 153 |
ATTACK_NAMES getAttackName() const; |
| 154 |
ATTACK_NAMES getThrownAttackName() const; |
| 155 |
const ATTACK_DEF *getAttack() const; |
| 156 |
const ATTACK_DEF *getThrownAttack() const; |
| 157 |
|
| 158 |
bool requiresLauncher() const; |
| 159 |
bool canLaunchThis(ITEM *launcher) const; |
| 160 |
|
| 161 |
SKILL_NAMES getAttackSkill() const; |
| 162 |
SKILL_NAMES getSpecialSkill() const; |
| 163 |
|
| 164 |
MOB *getCorpseMob() const; |
| 165 |
MOB *getStatueMob() const; |
| 166 |
|
| 167 |
SIZE_NAMES getSize() const; |
| 168 |
|
| 169 |
int getNoiseLevel() const; |
| 170 |
|
| 171 |
|
| 172 |
int calcAverageDamage() const; |
| 173 |
|
| 174 |
ITEM_NAMES getDefinition() const |
| 175 |
{ return (ITEM_NAMES) myDefinition; } |
| 176 |
void setDefinition(ITEM_NAMES def) |
| 177 |
{ myDefinition = def; } |
| 178 |
ITEMTYPE_NAMES getItemType() const; |
| 179 |
|
| 180 |
const ITEM_DEF &defn() const { return defn(getDefinition()); } |
| 181 |
static const ITEM_DEF &defn(ITEM_NAMES item) { return glb_itemdefs[item]; } |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
bool isCarryIntrinsic() const; |
| 186 |
|
| 187 |
|
| 188 |
bool isFullyIdentified() const; |
| 189 |
|
| 190 |
bool isIdentified() const; |
| 191 |
|
| 192 |
bool isKnownCursed() const; |
| 193 |
|
| 194 |
|
| 195 |
bool isKnownNotCursed() const; |
| 196 |
|
| 197 |
bool isKnownEnchant() const; |
| 198 |
|
| 199 |
bool isKnownCharges() const; |
| 200 |
|
| 201 |
bool isKnownPoison() const; |
| 202 |
|
| 203 |
bool isKnownClass() const; |
| 204 |
|
| 205 |
|
| 206 |
void markIdentified(bool silent = false); |
| 207 |
|
| 208 |
|
| 209 |
void markClassKnown(bool silent = false); |
| 210 |
|
| 211 |
void markEnchantKnown(); |
| 212 |
|
| 213 |
void markCursedKnown(); |
| 214 |
|
| 215 |
void markNotCursedKnown(bool isknown=true); |
| 216 |
|
| 217 |
void markChargesKnown(); |
| 218 |
void clearChargesKnown(); |
| 219 |
|
| 220 |
void markPoisonKnown(); |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
bool isInventory() const; |
| 225 |
void setInventory(bool isinventory); |
| 226 |
|
| 227 |
void makeCursed(); |
| 228 |
void makeBlessed(); |
| 229 |
bool isCursed() const; |
| 230 |
bool isBlessed() const; |
| 231 |
|
| 232 |
bool isArmor() const; |
| 233 |
bool isWeapon() const; |
| 234 |
bool isBoots() const; |
| 235 |
bool isHelmet() const; |
| 236 |
bool isShield() const; |
| 237 |
bool isJacket() const; |
| 238 |
bool isRing() const; |
| 239 |
bool isAmulet() const; |
| 240 |
bool isPassable() const; |
| 241 |
bool isQuivered() const; |
| 242 |
bool isFavorite() const; |
| 243 |
bool isMapped() const; |
| 244 |
bool isArtifact() const; |
| 245 |
|
| 246 |
|
| 247 |
const ARTIFACT *getArtifact() const; |
| 248 |
|
| 249 |
|
| 250 |
bool dissolve(MOB *dissolver = 0, bool *interesting = 0); |
| 251 |
|
| 252 |
|
| 253 |
bool canDissolve() const; |
| 254 |
|
| 255 |
|
| 256 |
bool ignite(MOB *igniter = 0, bool *interesting = 0); |
| 257 |
|
| 258 |
|
| 259 |
bool electrify(int points, MOB *shocker, bool *interesting); |
| 260 |
|
| 261 |
|
| 262 |
bool canBurn() const; |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
bool douse(MOB *douser = 0, bool *interesting = 0); |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
int getStackOrder() const; |
| 273 |
void markMapped(bool mapstatus=true); |
| 274 |
void markQuivered(bool isquivered=true); |
| 275 |
void markFavorite(bool isfavorite=true); |
| 276 |
bool isBelowGrade() const; |
| 277 |
void markBelowGrade(bool belowgrade=true); |
| 278 |
|
| 279 |
void makePoisoned(POISON_NAMES poison, int charges); |
| 280 |
bool isPoisoned() const; |
| 281 |
void applyPoison(MOB *src, MOB *target, bool force=false); |
| 282 |
|
| 283 |
|
| 284 |
bool isLight() const; |
| 285 |
int getLightRadius() const; |
| 286 |
TILE_NAMES getTile() const; |
| 287 |
MINI_NAMES getMiniTile() const; |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
int getStackCount() const { return myStackCount; } |
| 292 |
|
| 293 |
bool canMerge(ITEM *item) const; |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
void mergeStack(ITEM *item); |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
ITEM *splitStack(int count=1); |
| 302 |
|
| 303 |
|
| 304 |
void splitAndDeleteStack(int count=1); |
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
void setStackCount(int newcount) { myStackCount = newcount; } |
| 309 |
|
| 310 |
int getAC() const; |
| 311 |
int getCoolness() const; |
| 312 |
int getWeight() const; |
| 313 |
|
| 314 |
int getCharges() const; |
| 315 |
|
| 316 |
|
| 317 |
void addCharges(int morecharges); |
| 318 |
void useCharge(); |
| 319 |
void setAsPreserved(); |
| 320 |
|
| 321 |
MAGICTYPE_NAMES getMagicType() const; |
| 322 |
int getMagicClass() const; |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
void buildIntrinsicTable(INTRINSIC *&intrinsic) const; |
| 327 |
|
| 328 |
bool hasIntrinsic(INTRINSIC_NAMES intrinsic) const; |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
static const char *getItemName(ITEM_NAMES item, bool forceid=false); |
| 333 |
|
| 334 |
|
| 335 |
const char *getRawName(bool idclass=false) const; |
| 336 |
BUF getName(bool article=true, bool shortname=false, |
| 337 |
bool neverpronoun=false, |
| 338 |
bool idclass=false, |
| 339 |
bool forcesingle=false) const; |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
void formatAndReport(MOB *owner, const char *str); |
| 345 |
void formatAndReport(const char *str); |
| 346 |
|
| 347 |
|
| 348 |
static void viewDiscoveries(); |
| 349 |
|
| 350 |
void viewDescription() const; |
| 351 |
|
| 352 |
void pageDescription(bool brief) const; |
| 353 |
|
| 354 |
|
| 355 |
const char *getPronoun() const; |
| 356 |
|
| 357 |
|
| 358 |
const char *getPossessive() const; |
| 359 |
|
| 360 |
|
| 361 |
const char *getReflexive() const; |
| 362 |
|
| 363 |
|
| 364 |
const char *getAccusative() const; |
| 365 |
|
| 366 |
BUF conjugate(const char *infinitive, bool past=false) const; |
| 367 |
|
| 368 |
|
| 369 |
VERB_PERSON getPerson() const; |
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
bool actionDip(MOB *dipper, ITEM *dippee, |
| 379 |
ITEM *&newpotion, ITEM *&newitem); |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
bool actionZap(MOB *zapper, |
| 388 |
int dx, int dy, int dz); |
| 389 |
|
| 390 |
|
| 391 |
bool zapCallback(int x, int y); |
| 392 |
static bool zapCallbackStatic(int x, int y, bool final, |
| 393 |
void *data); |
| 394 |
|
| 395 |
|
| 396 |
bool grenadeCallback(int x, int y); |
| 397 |
static bool grenadeCallbackStatic(int x, int y, bool final, |
| 398 |
void *data); |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
static void setZapper(MOB *mob) { ourZapper.setMob(mob); } |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
bool randomTeleport(MAP *map, bool mapownsitem, |
| 407 |
MOB *teleporter); |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
bool fallInHole(MAP * curLevel, bool mapownsitem, |
| 412 |
MOB *dropper); |
| 413 |
|
| 414 |
protected: |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
u8 myDefinition; |
| 420 |
u8 myStackCount; |
| 421 |
u8 myX, myY; |
| 422 |
s8 myEnchantment; |
| 423 |
u8 myCharges; |
| 424 |
u8 myPoison; |
| 425 |
u8 myPoisonCharges; |
| 426 |
ITEMFLAG1_NAMES myFlag1; |
| 427 |
|
| 428 |
MOBREF myCorpseMob; |
| 429 |
|
| 430 |
NAME myName; |
| 431 |
|
| 432 |
ITEM *myNext; |
| 433 |
|
| 434 |
static MOBREF ourZapper; |
| 435 |
}; |
| 436 |
|
| 437 |
#endif |