| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#ifndef __creature_h__ |
| 19 |
#define __creature_h__ |
| 20 |
|
| 21 |
#include "grammar.h" |
| 22 |
|
| 23 |
#include "glbdef.h" |
| 24 |
#include "intrinsic.h" |
| 25 |
#include "mobref.h" |
| 26 |
#include "name.h" |
| 27 |
#include "speed.h" |
| 28 |
#include "map.h" |
| 29 |
|
| 30 |
class ITEM; |
| 31 |
class SRAMSTREAM; |
| 32 |
class MOB; |
| 33 |
|
| 34 |
|
| 35 |
void mob_init(); |
| 36 |
|
| 37 |
|
| 38 |
void ai_init(); |
| 39 |
void ai_reset(); |
| 40 |
|
| 41 |
|
| 42 |
void ai_save(SRAMSTREAM &os); |
| 43 |
void ai_load(SRAMSTREAM &is); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
u8 action_packStripButton(ACTION_NAMES action); |
| 51 |
u8 action_packStripButton(SPELL_NAMES spell); |
| 52 |
void action_unpackStripButton(u8 value, ACTION_NAMES &action, SPELL_NAMES &spell); |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
SPRITE_NAMES action_spriteFromStripButton(u8 value, int *grey = 0); |
| 57 |
void action_indexToOverlayPos(int index, int &x, int &y); |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
extern u16 glbKillCount[NUM_MOBS]; |
| 63 |
|
| 64 |
|
| 65 |
#define MOBINV_WIDTH 12 |
| 66 |
#define MOBINV_HEIGHT 8 |
| 67 |
|
| 68 |
|
| 69 |
#define AI_DIRTY_INVENTORY 0x8000 |
| 70 |
#define AI_HAS_THROWABLE 0x4000 |
| 71 |
#define AI_HAS_ATTACKWAND 0x2000 |
| 72 |
#define AI_HAS_EDIBLE 0x1000 |
| 73 |
#define AI_LAST_HIT_LOC 0x03ff |
| 74 |
|
| 75 |
|
| 76 |
#define AI_FSM_NORMAL 0 |
| 77 |
#define AI_FSM_ATTACK 1 |
| 78 |
#define AI_FSM_GUARD 2 |
| 79 |
#define AI_FSM_STAY 3 |
| 80 |
#define AI_FSM_JUSTBORN 4 |
| 81 |
|
| 82 |
|
| 83 |
#define INTRINSIC_FROM_ITEM 1 |
| 84 |
#define INTRINSIC_FROM_PERMAMENT 2 |
| 85 |
#define INTRINSIC_FROM_TEMPORARY 4 |
| 86 |
|
| 87 |
class INTRINSIC_COUNTER |
| 88 |
{ |
| 89 |
public: |
| 90 |
#ifdef STRESS_TEST |
| 91 |
~INTRINSIC_COUNTER() |
| 92 |
{ |
| 93 |
|
| 94 |
if (glbCurLevel) |
| 95 |
glbCurLevel->verifyCounterGone(this); |
| 96 |
} |
| 97 |
#endif |
| 98 |
INTRINSIC_NAMES myIntrinsic; |
| 99 |
int myTurns; |
| 100 |
INTRINSIC_COUNTER *myNext; |
| 101 |
|
| 102 |
MOBREF myInflictor; |
| 103 |
}; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
class MOB |
| 109 |
{ |
| 110 |
private: |
| 111 |
MOB(); |
| 112 |
public: |
| 113 |
~MOB(); |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
static void init(); |
| 118 |
|
| 119 |
|
| 120 |
static void saveGlobal(SRAMSTREAM &os); |
| 121 |
static void loadGlobal(SRAMSTREAM &is); |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
static MOB *getAvatar(); |
| 126 |
static void setAvatar(MOB *mob); |
| 127 |
|
| 128 |
static void saveAvatar(SRAMSTREAM &os); |
| 129 |
static void loadAvatar(SRAMSTREAM &is); |
| 130 |
|
| 131 |
|
| 132 |
MOB *getNext() { return myNext; } |
| 133 |
void setNext(MOB *mob) { myNext = mob; } |
| 134 |
|
| 135 |
bool isAvatar() const { return getAvatar() == this; } |
| 136 |
|
| 137 |
static bool isAvatarOnFreshSquare() { return ourAvatarOnFreshSquare; } |
| 138 |
static void setAvatarOnFreshSquare(bool fresh) |
| 139 |
{ ourAvatarOnFreshSquare = fresh; } |
| 140 |
|
| 141 |
|
| 142 |
bool isPolymorphed() const { return !myBaseType.isNull(); } |
| 143 |
|
| 144 |
|
| 145 |
MOB *getBaseType() const { return myBaseType.getMob(); } |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
const MOBREF &getMobRef() const { return myOwnRef; } |
| 151 |
|
| 152 |
|
| 153 |
void alertMobGone(MOB *mob); |
| 154 |
|
| 155 |
|
| 156 |
void clearReferences(); |
| 157 |
|
| 158 |
static MOB *create(MOB_NAMES definition); |
| 159 |
|
| 160 |
|
| 161 |
void buildAscensionKit(); |
| 162 |
|
| 163 |
|
| 164 |
static MOB *load(SRAMSTREAM &is); |
| 165 |
|
| 166 |
|
| 167 |
void save(SRAMSTREAM &os); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
bool verifyMob() const; |
| 172 |
|
| 173 |
|
| 174 |
bool verifyCounterGone(INTRINSIC_COUNTER *counter) const; |
| 175 |
|
| 176 |
|
| 177 |
static MOB_NAMES chooseNPC(int threatlevel); |
| 178 |
|
| 179 |
|
| 180 |
static MOB *createNPC(int threatlevel); |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
void makeUnique(); |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
bool canMove(int nx, int ny, bool checkitem, |
| 190 |
bool allowdoor = false, |
| 191 |
bool checksafety = false) const; |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
bool canMoveDelta(int dx, int dy, bool checkitem, |
| 199 |
bool allowdoor = false, |
| 200 |
bool checksafety = false) const; |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
bool canSense(const MOB *mob, bool checklos = true, bool onlysight = false) const; |
| 213 |
|
| 214 |
|
| 215 |
SENSE_NAMES getSenseType(const MOB *mob) const; |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
MOVE_NAMES getMoveType() const; |
| 220 |
|
| 221 |
int getX() const { return myX; } |
| 222 |
int getY() const { return myY; } |
| 223 |
int getDLevel() const { return myDLevel; } |
| 224 |
void setDLevel(int d) { myDLevel = d; } |
| 225 |
int getTile() const; |
| 226 |
int getTileLL() const; |
| 227 |
int getTileLR() const; |
| 228 |
int getTileUR() const; |
| 229 |
|
| 230 |
MOB_NAMES getDefinition() const { return (MOB_NAMES) myDefinition; } |
| 231 |
void setOrigDefinition(MOB_NAMES origdefn) { myOrigDefinition = origdefn; } |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
void changeDefinition(MOB_NAMES newdefn, bool reset); |
| 236 |
|
| 237 |
MOBTYPE_NAMES getMobType() const { return (MOBTYPE_NAMES) glb_mobdefs[myDefinition].mobtype; } |
| 238 |
|
| 239 |
const MOB_DEF &defn() const { return defn(getDefinition()); } |
| 240 |
static const MOB_DEF &defn(MOB_NAMES mob) { return glb_mobdefs[mob]; } |
| 241 |
|
| 242 |
int getHP() const { return myHP; } |
| 243 |
int getMaxHP() const { return myMaxHP; } |
| 244 |
void incrementMaxHP(int amount); |
| 245 |
void setMinimalHP() { myHP = 1; } |
| 246 |
void setMaximalHP() { myHP = myMaxHP; } |
| 247 |
void forceHP(int hp) { myMaxHP = myHP = hp; } |
| 248 |
int getHitDie() const { return myHitDie / 2; } |
| 249 |
void incrementHitDie(int amount) { myHitDie += amount*2; } |
| 250 |
int getExpLevel() const { return myExpLevel; } |
| 251 |
int getMP() const { return myMP; } |
| 252 |
int getMaxMP() const { return myMaxMP; } |
| 253 |
void incrementMaxMP(int amount); |
| 254 |
int getMagicDie() const { return myMagicDie / 2; } |
| 255 |
void incrementMagicDie(int amount) { myMagicDie += amount*2; } |
| 256 |
int getExp() const { return myExp; } |
| 257 |
|
| 258 |
int getStrength() const |
| 259 |
{ return glb_mobdefs[myDefinition].strength; } |
| 260 |
int getSmarts() const |
| 261 |
{ return glb_mobdefs[myDefinition].smarts; } |
| 262 |
SIZE_NAMES getSize() const { return (SIZE_NAMES) |
| 263 |
glb_mobdefs[myDefinition].size; } |
| 264 |
|
| 265 |
|
| 266 |
int getAC() const; |
| 267 |
|
| 268 |
|
| 269 |
int calcScore(bool haswon) const; |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
int rollAC(MOB *attacker) const; |
| 274 |
|
| 275 |
MATERIAL_NAMES getMaterial() const |
| 276 |
{ return (MATERIAL_NAMES) glb_mobdefs[myDefinition].material; } |
| 277 |
|
| 278 |
bool hasBreathAttack() const; |
| 279 |
ATTACK_NAMES getBreathAttack() const; |
| 280 |
bool isBreathAttackCharged() const; |
| 281 |
int getBreathRange() const; |
| 282 |
const char *getBreathSubstance() const; |
| 283 |
|
| 284 |
bool isTalkative() const; |
| 285 |
|
| 286 |
void submergeItemEffects(SQUARE_NAMES tile); |
| 287 |
|
| 288 |
bool hasItem(ITEM_NAMES def) const; |
| 289 |
|
| 290 |
|
| 291 |
bool isLight() const; |
| 292 |
int getLightRadius() const; |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
bool canMoveDiabolically() const; |
| 297 |
|
| 298 |
bool canResurrectFromCorpse() const; |
| 299 |
bool isBoneless() const; |
| 300 |
bool isBloodless() const; |
| 301 |
|
| 302 |
void setAIFSM(int fsm) { myAIFSM = fsm; } |
| 303 |
void setAITarget(MOB *mob) { myAITarget.setMob(mob); } |
| 304 |
void clearAITarget() { myAITarget.setMob(0); } |
| 305 |
MOB *getAITarget() const { return myAITarget.getMob(); } |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
MOB *getMaster() const; |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
bool isSlave(const MOB *owner) const; |
| 315 |
|
| 316 |
|
| 317 |
void makeSlaveOf(const MOB *owner); |
| 318 |
|
| 319 |
|
| 320 |
bool hasCommonMaster(const MOB *other) const; |
| 321 |
|
| 322 |
bool hasIntrinsic(INTRINSIC_NAMES intrinsic, bool allowitem=true) const; |
| 323 |
|
| 324 |
|
| 325 |
int intrinsicFromWhat(INTRINSIC_NAMES intrinsic) const; |
| 326 |
|
| 327 |
|
| 328 |
const char *intrinsicFromWhatLetter(INTRINSIC_NAMES intrinsic) const; |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
bool hasSkill(SKILL_NAMES skill, bool allowitem=true, bool ignoreamnesia=false) const; |
| 333 |
bool hasSpell(SPELL_NAMES spell, bool allowitem=true, bool ignoreamnesia=false) const; |
| 334 |
|
| 335 |
|
| 336 |
bool skillProc(SKILL_NAMES skill) const; |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
bool canLearnSkill(SKILL_NAMES skill, bool explain=false) const; |
| 341 |
int getUsedSkillSlots() const; |
| 342 |
int getFreeSkillSlots() const; |
| 343 |
bool canLearnSpell(SPELL_NAMES spell, bool explain=false) const; |
| 344 |
int getUsedSpellSlots() const; |
| 345 |
int getFreeSpellSlots() const; |
| 346 |
|
| 347 |
void clearDeathIntrinsics(bool silent); |
| 348 |
|
| 349 |
bool canDigest(ITEM *item) const; |
| 350 |
bool safeToDigest(ITEM *item) const; |
| 351 |
|
| 352 |
bool canFly() const; |
| 353 |
|
| 354 |
|
| 355 |
bool isWearing(MATERIAL_NAMES material) const; |
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
void sortInventoryBySlot(); |
| 360 |
|
| 361 |
|
| 362 |
void setIntrinsic(INTRINSIC_NAMES intrinsic); |
| 363 |
|
| 364 |
void mergeIntrinsicsFromString(const char *rawstr); |
| 365 |
|
| 366 |
void clearIntrinsic(INTRINSIC_NAMES intrinsic, bool silent=false); |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
void setTimedIntrinsic(MOB *inflictor, |
| 374 |
INTRINSIC_NAMES intrinsic, int turns, |
| 375 |
bool quiet = false); |
| 376 |
|
| 377 |
int getAttackBonus(const ATTACK_DEF *attack, ATTACKSTYLE_NAMES style); |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
int getSecondWeaponChance() const; |
| 383 |
|
| 384 |
|
| 385 |
ATTITUDE_NAMES getAttitude(const MOB *appraisee) const; |
| 386 |
|
| 387 |
AI_NAMES getAI() const |
| 388 |
{ return (AI_NAMES) glb_mobdefs[myDefinition].ai; } |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
bool move(int nx, int ny, bool interlevel = false); |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
bool doHeartbeat(); |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
void findRandomValidMove(int &dx, int &dy, MOB *owner); |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
void applyConfusion(int &dx, int &dy); |
| 413 |
void applyConfusionNoSelf(int &dx, int &dy); |
| 414 |
void applyConfusion(int &dx, int &dy, int &dz); |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
int calculateFoesSurrounding() const; |
| 419 |
|
| 420 |
|
| 421 |
bool validMovePhase(PHASE_NAMES phase); |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
bool doMovePrequel(); |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
void doAI(); |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
bool aiMoveInDirection(int dx, int dy, int distx, int disty, |
| 444 |
MOB *target); |
| 445 |
|
| 446 |
|
| 447 |
void aiDecayKnowledgeBase(); |
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
bool aiCanTargetResist(MOB *target, ELEMENT_NAMES element) const; |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
void aiNoteThatTargetHasIntrinsic(MOB *target, INTRINSIC_NAMES intrinsic); |
| 457 |
|
| 458 |
void aiNoteThatTargetCanResist(MOB *target, ELEMENT_NAMES element); |
| 459 |
|
| 460 |
void aiTrulyNoteThatTargetCanResist(MOB *target, ELEMENT_NAMES element); |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
bool aiUseInventory(); |
| 465 |
|
| 466 |
|
| 467 |
bool aiBePackrat(); |
| 468 |
|
| 469 |
|
| 470 |
bool aiEatStuff(); |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
bool aiDoFleeMelee(MOB *target); |
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
bool aiDoBattlePrep(int diffx, int diffy); |
| 480 |
|
| 481 |
|
| 482 |
bool aiDoUrgentMoves(); |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
bool aiDoRangedAttack(int dx, int dy, int range); |
| 489 |
bool aiDoThrownAttack(int dx, int dy, int range); |
| 490 |
bool aiDoWandAttack(int dx, int dy, int range); |
| 491 |
bool aiDoSpellAttack(int dx, int dy, int range); |
| 492 |
|
| 493 |
|
| 494 |
bool aiDoHealSelf(); |
| 495 |
bool aiDoCurePoisonSelf(); |
| 496 |
|
| 497 |
|
| 498 |
bool aiDoDouseSelf(); |
| 499 |
|
| 500 |
|
| 501 |
bool aiDoFreezeMySquare(); |
| 502 |
|
| 503 |
|
| 504 |
bool aiDoEscapeMySquare(); |
| 505 |
|
| 506 |
|
| 507 |
bool aiDoStopStoningSelf(); |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
bool aiDoMouse(); |
| 513 |
|
| 514 |
|
| 515 |
bool aiIsItemCooler(ITEM *item, ITEMSLOT_NAMES slot); |
| 516 |
bool aiIsItemThrowable(ITEM *item, MOB *target = 0) const; |
| 517 |
bool aiIsItemZapAttack(ITEM *item) const; |
| 518 |
|
| 519 |
bool aiIsPoisoned() const; |
| 520 |
|
| 521 |
bool aiWillOpenDoors() const; |
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
bool actionBump(int dx, int dy); |
| 531 |
|
| 532 |
|
| 533 |
bool actionBreathe(int dx, int dy); |
| 534 |
|
| 535 |
|
| 536 |
static bool meltRocksCBStatic(int x, int y, bool final, void *data); |
| 537 |
|
| 538 |
|
| 539 |
static bool areaAttackCBStatic(int x, int y, bool final, void *data); |
| 540 |
|
| 541 |
|
| 542 |
static bool zapCallbackStatic(int x, int y, bool final, void *data); |
| 543 |
|
| 544 |
|
| 545 |
bool actionSwap(int dx, int dy); |
| 546 |
|
| 547 |
|
| 548 |
bool actionTalk(int dx, int dy); |
| 549 |
|
| 550 |
|
| 551 |
bool actionSleep(); |
| 552 |
|
| 553 |
|
| 554 |
bool actionPush(int dx, int dy); |
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
bool actionWalk(int dx, int dy, bool spacewalk = false); |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
bool actionJump(int dx, int dy); |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
bool actionMagicDoorEffect(int x, int y); |
| 568 |
|
| 569 |
|
| 570 |
bool actionOpen(int dx, int dy); |
| 571 |
|
| 572 |
|
| 573 |
bool actionClose(int dx, int dy); |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
bool searchSquare(int x, int y, bool isaction); |
| 583 |
|
| 584 |
|
| 585 |
bool actionSearch(); |
| 586 |
|
| 587 |
|
| 588 |
bool actionAttack(int dx, int dy, int multiplierbonus = 0); |
| 589 |
|
| 590 |
|
| 591 |
bool actionClimb(); |
| 592 |
bool actionClimbUp(); |
| 593 |
bool actionClimbDown(); |
| 594 |
|
| 595 |
bool actionDig(int dx, int dy, int dz, int range, bool magical); |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
bool actionPickUp(ITEM *item, ITEM **newitem = 0); |
| 602 |
|
| 603 |
bool actionDrop(int ix, int iy); |
| 604 |
|
| 605 |
|
| 606 |
bool actionSort(); |
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
bool actionEat(int ix, int iy); |
| 611 |
|
| 612 |
|
| 613 |
bool actionThrow(int ix, int iy, int dx, int dy, int dz); |
| 614 |
|
| 615 |
|
| 616 |
bool actionFire(int dx, int dy, int dz); |
| 617 |
|
| 618 |
|
| 619 |
bool actionQuiver(int ix, int iy); |
| 620 |
|
| 621 |
|
| 622 |
bool ableToZap(int ix, int iy, int dx, int dy, int dz, bool quiet); |
| 623 |
|
| 624 |
|
| 625 |
bool actionZap(int ix, int iy, int dx, int dy, int dz); |
| 626 |
|
| 627 |
|
| 628 |
bool actionCast(SPELL_NAMES spell, int dx, int dy, int dz); |
| 629 |
|
| 630 |
|
| 631 |
bool ableToRead(int ix, int iy, bool quiet); |
| 632 |
|
| 633 |
|
| 634 |
bool actionRead(int ix, int iy); |
| 635 |
|
| 636 |
|
| 637 |
bool actionDip(int potionx, int potiony, int ix, int iy); |
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
bool actionPray(); |
| 642 |
|
| 643 |
|
| 644 |
bool actionPossess(MOB *mob, int duration); |
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
bool actionReleasePossession(bool systemshock = false); |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
bool actionTeleport(bool allowcontrol=true, bool givecontrol=false, |
| 657 |
int xloc=-1, int yloc=-1); |
| 658 |
|
| 659 |
bool actionForget(SPELL_NAMES spell, SKILL_NAMES skill); |
| 660 |
|
| 661 |
|
| 662 |
void rebuildAppearance(); |
| 663 |
|
| 664 |
|
| 665 |
void rebuildWornIntrinsic(); |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
void determineClassiness(int *dressiness = 0); |
| 671 |
|
| 672 |
|
| 673 |
bool ableToEquip(int ix, int iy, ITEMSLOT_NAMES slot, bool quiet); |
| 674 |
|
| 675 |
|
| 676 |
bool actionEquip(int ix, int iy, ITEMSLOT_NAMES slot, bool quiet=false); |
| 677 |
|
| 678 |
|
| 679 |
bool ableToDequip(ITEMSLOT_NAMES slot, bool quiet); |
| 680 |
|
| 681 |
|
| 682 |
bool actionDequip(ITEMSLOT_NAMES slot, bool quiet = false); |
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
int getWeaponSkillLevel(const ITEM *weapon, |
| 687 |
ATTACKSTYLE_NAMES attackstyle) const; |
| 688 |
int getArmourSkillLevel(const ITEM *armour) const; |
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
void noteAttacker(MOB *src); |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
bool receiveAttack(ATTACK_NAMES attack, MOB *src, ITEM *weapon, |
| 702 |
ITEM *launcher, |
| 703 |
ATTACKSTYLE_NAMES style, |
| 704 |
bool *actuallyhit = 0, int multiplier = 0); |
| 705 |
bool receiveAttack(const ATTACK_DEF *attack, MOB *src, ITEM *weapon, |
| 706 |
ITEM *launcher, |
| 707 |
ATTACKSTYLE_NAMES style, |
| 708 |
bool *actuallyhit = 0, int multiplier = 0); |
| 709 |
bool receiveDamage(ATTACK_NAMES attack, MOB *src, |
| 710 |
ITEM *weapon, |
| 711 |
ITEM *launcher, |
| 712 |
ATTACKSTYLE_NAMES style, |
| 713 |
int multiplier = 1, |
| 714 |
int damage_reduction = 0); |
| 715 |
bool receiveDamage(const ATTACK_DEF *attack, MOB *src, |
| 716 |
ITEM *weapon, |
| 717 |
ITEM *launcher, |
| 718 |
ATTACKSTYLE_NAMES style, |
| 719 |
int multiplier = 1, |
| 720 |
int damage_reduction = 0); |
| 721 |
void receiveDeathExp(int explevel); |
| 722 |
void receiveExp(int exp); |
| 723 |
|
| 724 |
void wipeExp(); |
| 725 |
|
| 726 |
|
| 727 |
|
| 728 |
void receiveArmourEnchant(ITEMSLOT_NAMES slot, int bonus, bool shudder); |
| 729 |
|
| 730 |
|
| 731 |
void receiveWeaponEnchant(int bonus, bool shudder); |
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
void receiveCurse(bool onlyequip, bool forceany); |
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
void receiveUncurse(bool doall); |
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
bool receiveHeal(int hp, MOB *src, bool vampiric = false); |
| 746 |
bool receiveMana(int mp, MOB *src); |
| 747 |
bool receiveCure(); |
| 748 |
bool receiveSlowPoison(); |
| 749 |
|
| 750 |
SPELL_NAMES findSpell(GOD_NAMES god, int *numspell = 0) const; |
| 751 |
SKILL_NAMES findSkill(GOD_NAMES god, int *numskill = 0) const; |
| 752 |
|
| 753 |
void learnSpell(SPELL_NAMES spell, int duration = -1); |
| 754 |
void learnSkill(SKILL_NAMES skill, int duration = -1); |
| 755 |
|
| 756 |
|
| 757 |
bool canCastSpell(SPELL_NAMES spell); |
| 758 |
|
| 759 |
|
| 760 |
int spellCastability(SPELL_NAMES spell); |
| 761 |
void gainLevel(); |
| 762 |
|
| 763 |
|
| 764 |
void cancelSpell(SPELL_NAMES spell); |
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
void pietyGainLevel(); |
| 775 |
|
| 776 |
void pietyKill(MOB *mob, ATTACKSTYLE_NAMES style); |
| 777 |
void pietyEat(ITEM *item, int foodval); |
| 778 |
void pietyDress(INTRINSIC_NAMES intrinsic); |
| 779 |
void pietyZapWand(ITEM *wand); |
| 780 |
void pietySurrounded(int numenemy); |
| 781 |
void pietyHeal(int amount, bool self, bool enemy, bool vampiric); |
| 782 |
void pietyCastSpell(SPELL_NAMES spell); |
| 783 |
void pietyCreateTrap(); |
| 784 |
void pietyFindSecret(); |
| 785 |
void pietyAttack(MOB *mob, const ATTACK_DEF *attack, |
| 786 |
ATTACKSTYLE_NAMES style); |
| 787 |
|
| 788 |
void pietyMakeNoise(int noise); |
| 789 |
|
| 790 |
void pietyIdentify(ITEM_NAMES itemdef); |
| 791 |
|
| 792 |
|
| 793 |
void pietyBreak(ITEM *item); |
| 794 |
|
| 795 |
|
| 796 |
void pietyReport(); |
| 797 |
|
| 798 |
|
| 799 |
void pietyAnnounceWhimOfXom(); |
| 800 |
|
| 801 |
|
| 802 |
void pietyRungods(); |
| 803 |
|
| 804 |
|
| 805 |
void pietyGrant(GOD_NAMES god, int amount, bool forbidden = false); |
| 806 |
|
| 807 |
|
| 808 |
void pietyTransgress(GOD_NAMES god); |
| 809 |
|
| 810 |
|
| 811 |
void pietyPunish(GOD_NAMES god); |
| 812 |
|
| 813 |
|
| 814 |
void pietyBoon(GOD_NAMES god); |
| 815 |
|
| 816 |
|
| 817 |
bool pietyBoonValid(BOON_NAMES boon); |
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
void reportMessage(const char *str) const; |
| 822 |
inline void reportMessage(BUF buf) const |
| 823 |
{ reportMessage(buf.buffer()); } |
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
void formatAndReport(const char *str); |
| 841 |
void formatAndReport(const char *str, const char *b1, const char *b2 = 0, const char *b3 = 0); |
| 842 |
inline void formatAndReport(const char *str, BUF b1) |
| 843 |
{ formatAndReport(str, b1.buffer()); } |
| 844 |
void formatAndReport(const char *str, const MOB *mob, const char *b1 = 0, const char *b2 = 0, const char *b3 = 0); |
| 845 |
inline void formatAndReport(const char *str, const MOB *mob, BUF b1) |
| 846 |
{ formatAndReport(str, mob, b1.buffer()); } |
| 847 |
void formatAndReport(const char *str, const ITEM *item, const char *b1 = 0, const char *b2 = 0, const char *b3 = 0); |
| 848 |
inline void formatAndReport(const char *str, const ITEM *item, BUF b1) |
| 849 |
{ formatAndReport(str, item, b1.buffer()); } |
| 850 |
void formatAndReportExplicit(const char *str, const MOB *mob, const ITEM *item, const char *b1 = 0, const char *b2 = 0, const char *b3 = 0); |
| 851 |
inline void formatAndReportExplicit(const char *str, const MOB *mob, const ITEM *item, BUF b1) |
| 852 |
{ formatAndReportExplicit(str, mob, item, b1.buffer()); } |
| 853 |
|
| 854 |
static BUF formatToString(const char *str, const MOB *self, const ITEM *selfitem, const MOB *mob, const ITEM *item, const char *b1 = 0, const char *b2 = 0, const char *b3 = 0); |
| 855 |
static BUF formatToString(const char *str, const MOB *self, const ITEM *selfitem, const MOB *mob, const ITEM *item, BUF b1, BUF b2, BUF b3); |
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
BUF conjugate(const char *infinitive, bool past=false) const; |
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
VERB_PERSON getPerson() const; |
| 864 |
VERB_PERSON getGender() const; |
| 865 |
|
| 866 |
|
| 867 |
const char *getPronoun() const; |
| 868 |
|
| 869 |
|
| 870 |
const char *getPossessive() const; |
| 871 |
|
| 872 |
|
| 873 |
const char *getOwnership() const; |
| 874 |
|
| 875 |
|
| 876 |
const char *getReflexive() const; |
| 877 |
|
| 878 |
|
| 879 |
const char *getAccusative() const; |
| 880 |
|
| 881 |
|
| 882 |
BUF getName(bool usearticle = true, bool usedefinite = true, |
| 883 |
bool forcevisible = false, bool neverpronoun = false) const; |
| 884 |
|
| 885 |
|
| 886 |
BUF getDescription() const; |
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
void viewDescription() const; |
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
void characterDump(bool ondeath, bool didwin, bool savefile, int truetime = -1); |
| 896 |
|
| 897 |
void pageCharacterDump(bool ondeath, bool didwin, int truetime = -1); |
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
bool hasMovedLastTurn() const; |
| 902 |
void getLastMoveDirection(int &dx, int &dy) const; |
| 903 |
void resetLastMoveDirection() const; |
| 904 |
void flagLastMoveAsOld() const; |
| 905 |
|
| 906 |
|
| 907 |
void christen(const char *name); |
| 908 |
void christen(BUF buf) |
| 909 |
{ christen(buf.buffer()); } |
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
int smartsCheck(int smarts); |
| 920 |
int strengthCheck(int str); |
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
|
| 925 |
|
| 926 |
bool acquireItem(ITEM *item, int sx, int sy, ITEM **newitem = 0); |
| 927 |
bool acquireItem(ITEM *item, ITEM **newitem = 0); |
| 928 |
|
| 929 |
bool findItemSlot(int &sx, int &sy) const; |
| 930 |
|
| 931 |
ITEM *getItem(int sx, int sy) const; |
| 932 |
|
| 933 |
|
| 934 |
ITEM *randomItem() const; |
| 935 |
|
| 936 |
ITEM *dropItem(int sx, int sy); |
| 937 |
|
| 938 |
|
| 939 |
void destroyInventory(); |
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
void reverseInventory(); |
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
void dropOneRing(); |
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
ITEM *getEquippedItem(ITEMSLOT_NAMES slot) const; |
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
bool hasAnyEquippedItems() const; |
| 956 |
|
| 957 |
bool hasSlot(ITEMSLOT_NAMES slot) const; |
| 958 |
|
| 959 |
const char *getSlotName(ITEMSLOT_NAMES slot) const; |
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
ITEM *getSourceOfIntrinsic(INTRINSIC_NAMES intrinsic) const; |
| 964 |
|
| 965 |
|
| 966 |
MOB *getInflictorOfIntrinsic(INTRINSIC_NAMES intrinsic) const; |
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
bool actionPolymorph(bool allowcontrol = true, |
| 972 |
bool forcecontrol = false, |
| 973 |
MOB_NAMES newdef = MOB_NONE); |
| 974 |
|
| 975 |
|
| 976 |
bool actionUnPolymorph(bool silent = false, |
| 977 |
bool systemshock = false); |
| 978 |
|
| 979 |
|
| 980 |
bool actionPetrify(); |
| 981 |
|
| 982 |
|
| 983 |
bool actionUnPetrify(); |
| 984 |
|
| 985 |
HUNGER_NAMES getHungerLevel() const; |
| 986 |
|
| 987 |
void starve(int foodval); |
| 988 |
void feed(int foodval); |
| 989 |
|
| 990 |
|
| 991 |
void systemshock(); |
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
bool attemptLifeSaving(const char *deathmsg); |
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
void triggerAsDeath(ATTACK_NAMES attack, MOB *src, ITEM *weapon, bool becameitem); |
| 1009 |
void triggerAsDeath(const ATTACK_DEF *attack, MOB *src, ITEM *weapon, bool becameitem); |
| 1010 |
|
| 1011 |
|
| 1012 |
void makeNoise(int noiselevel); |
| 1013 |
|
| 1014 |
void makeEquipNoise(ITEMSLOT_NAMES slot); |
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
int getNoiseLevel(const MOB *observer) const; |
| 1021 |
|
| 1022 |
protected: |
| 1023 |
|
| 1024 |
INTRINSIC_COUNTER *getCounter(INTRINSIC_NAMES intrinsic) const; |
| 1025 |
void removeCounter(INTRINSIC_NAMES intrinsic); |
| 1026 |
INTRINSIC_COUNTER *addCounter(MOB *inflictor, |
| 1027 |
INTRINSIC_NAMES intrinsic, int turns); |
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
u8 myDefinition, myOrigDefinition; |
| 1033 |
u8 myX, myY, myExpLevel; |
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
u8 myHitDie, myMagicDie; |
| 1038 |
|
| 1039 |
|
| 1040 |
u8 myNoiseLevel; |
| 1041 |
|
| 1042 |
u8 myDLevel; |
| 1043 |
|
| 1044 |
u8 myGender; |
| 1045 |
|
| 1046 |
|
| 1047 |
u8 myAIFSM; |
| 1048 |
|
| 1049 |
MOBREF myOwnRef; |
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
MOBREF myBaseType; |
| 1054 |
|
| 1055 |
|
| 1056 |
u16 myAIState; |
| 1057 |
|
| 1058 |
|
| 1059 |
u16 myFoodLevel; |
| 1060 |
|
| 1061 |
|
| 1062 |
short myHP, myMaxHP; |
| 1063 |
short myMP, myMaxMP; |
| 1064 |
short myExp; |
| 1065 |
MOB *myNext; |
| 1066 |
|
| 1067 |
|
| 1068 |
MOBREF myAITarget; |
| 1069 |
|
| 1070 |
NAME myName; |
| 1071 |
|
| 1072 |
ITEM *myInventory; |
| 1073 |
|
| 1074 |
INTRINSIC myIntrinsic; |
| 1075 |
INTRINSIC *myWornIntrinsic; |
| 1076 |
|
| 1077 |
INTRINSIC_COUNTER *myCounters; |
| 1078 |
|
| 1079 |
static s8 ourAvatarDx, ourAvatarDy; |
| 1080 |
|
| 1081 |
static SPELL_NAMES ourZapSpell; |
| 1082 |
static ATTACK_NAMES ourEffectAttack; |
| 1083 |
static int ourFireBallCount; |
| 1084 |
static bool ourAvatarOnFreshSquare; |
| 1085 |
static bool ourAvatarMoveOld; |
| 1086 |
}; |
| 1087 |
|
| 1088 |
#endif |