'g'o should not miss items in corners anymore
[k8-i-v-a-n.git] / src / game / char.h
blob34d86101e10916d85e2de29de4b0b14d2d80da93
1 /*
2 * Iter Vehemens ad Necem (IVAN)
3 * Copyright (C) Timo Kiviluoto
4 * Released under the GNU General
5 * Public License
7 * See LICENSING which should be included
8 * along with this file for more details
11 #ifndef __CHAR_H__
12 #define __CHAR_H__
14 #include "itemset.h"
15 #include "script.h"
16 #include "wskill.h"
17 #include "fesave.h"
18 #include "feparse.h"
19 #include "festring.h"
22 #define CHAR_PERSONAL_PRONOUN GetPersonalPronoun(true).CStr()
23 #define CHAR_POSSESSIVE_PRONOUN GetPossessivePronoun(true).CStr()
24 #define CHAR_OBJECT_PRONOUN GetObjectPronoun(true).CStr()
25 #define CHAR_PERSONAL_PRONOUN_THIRD_PERSON_VIEW GetPersonalPronoun(false).CStr()
26 #define CHAR_POSSESSIVE_PRONOUN_THIRD_PERSON_VIEW GetPossessivePronoun(false).CStr()
27 #define CHAR_OBJECT_PRONOUN_THIRD_PERSON_VIEW GetObjectPronoun(false).CStr()
29 class go;
30 class team;
31 class wsquare;
32 class cweaponskill;
33 class action;
34 class characterprototype;
35 class web;
36 class mindworm;
38 struct homedata;
39 struct trapdata;
40 struct blitdata;
43 typedef std::vector<std::pair<double, int> > blockvector;
44 typedef truth (item::*sorter)(ccharacter *) const;
45 typedef truth (character::*petmanagementfunction) ();
46 typedef character *(*characterspawner) (int, int);
47 typedef character *(*charactercloner) (ccharacter *);
49 // for GeneralHasItem
50 typedef truth (*ItemCheckerCB) (item *i);
53 inline int APBonus (int Attribute) { return Attribute >= 10 ? 90 + Attribute : 50 + Attribute * 5; }
55 struct expid {
56 bool operator < (expid) const;
57 int ActID, SrcID;
61 inline bool expid::operator < (expid E) const { return ActID != E.ActID ? ActID < E.ActID : SrcID < E.SrcID; }
63 inline outputfile &operator << (outputfile &SaveFile, const expid &Value) { SaveFile.writeSimple<decltype(Value)>(Value); return SaveFile; }
64 inline inputfile &operator >> (inputfile &SaveFile, expid &Value) { SaveFile.readSimple<decltype(Value)>(Value); return SaveFile; }
67 typedef std::map<expid, double> expmodifiermap;
70 struct characterdatabase : public databasebase {
71 typedef characterprototype prototype;
72 void InitDefaults (const characterprototype *NewProtoType, int NewConfig, cfestring &acfgstrname);
73 truth AllowRandomInstantiation () const { return CanBeGenerated && !IsUnique; }
74 void PostProcess ();
75 const prototype *ProtoType;
76 double NaturalExperience[ATTRIBUTES];
77 feuLong Flags;
78 truth IsAbstract;
79 truth CanRead;
80 truth CanBeGenerated;
81 truth CanOpen;
82 truth IsUnique;
83 truth IsNameable;
84 truth IsPolymorphable;
85 truth CanUseEquipment;
86 truth CanKick;
87 truth CanTalk;
88 truth CanBeWished;
89 truth CreateDivineConfigurations;
90 truth CreateGolemMaterialConfigurations;
91 truth CanBeCloned;
92 truth CanZap;
93 truth HasALeg;
94 truth IgnoreDanger;
95 truth IsExtraCoward;
96 truth SpillsBlood;
97 truth HasEyes;
98 truth HasHead;
99 truth CanThrow;
100 truth UsesNutrition;
101 truth BodyPartsDisappearWhenSevered;
102 truth CanBeConfused;
103 truth CanApply;
104 truth BiteCapturesBodyPart;
105 truth IsPlant;
106 truth DestroysWalls;
107 truth IsRooted;
108 truth HasSecondaryMaterial;
109 truth IsImmuneToLeprosy;
110 truth AutomaticallySeen;
111 truth CanHear;
112 truth WillCarryItems;
113 truth Sweats;
114 truth IsImmuneToItemTeleport;
115 truth AlwaysUseMaterialAttributes;
116 truth IsEnormous;
117 truth IsExtraFragile;
118 truth AllowUnconsciousness;
119 truth CanChoke;
120 truth IsImmuneToStickiness;
121 truth ForceCustomStandVerb;
122 truth VomittingIsUnhealthy;
123 int DefaultEndurance;
124 int DefaultPerception;
125 int DefaultIntelligence;
126 int DefaultWisdom;
127 int DefaultWillPower;
128 int DefaultCharisma;
129 int DefaultMana;
130 int DefaultArmStrength;
131 int DefaultLegStrength;
132 int DefaultDexterity;
133 int DefaultAgility;
134 sLong DefaultMoney;
135 int TotalSize;
136 int Sex;
137 int CriticalModifier;
138 festring StandVerb;
139 int Frequency;
140 int EnergyResistance;
141 int FireResistance;
142 int PoisonResistance;
143 int ElectricityResistance;
144 int AcidResistance;
145 int SoundResistance;
146 int ConsumeFlags;
147 sLong TotalVolume;
148 packv2 HeadBitmapPos;
149 packv2 TorsoBitmapPos;
150 packv2 ArmBitmapPos;
151 packv2 LegBitmapPos;
152 packv2 RightArmBitmapPos;
153 packv2 LeftArmBitmapPos;
154 packv2 RightLegBitmapPos;
155 packv2 LeftLegBitmapPos;
156 packv2 GroinBitmapPos;
157 packcol16 ClothColor;
158 packcol16 SkinColor;
159 packcol16 CapColor;
160 packcol16 HairColor;
161 packcol16 EyeColor;
162 packcol16 TorsoMainColor;
163 packcol16 BeltColor;
164 packcol16 BootColor;
165 packcol16 TorsoSpecialColor;
166 packcol16 ArmMainColor;
167 packcol16 GauntletColor;
168 packcol16 ArmSpecialColor;
169 packcol16 LegMainColor;
170 packcol16 LegSpecialColor;
171 col24 BaseEmitation;
172 truth UsesLongArticle;
173 festring Adjective;
174 truth UsesLongAdjectiveArticle;
175 festring NameSingular;
176 festring NamePlural;
177 festring PostFix;
178 int ArticleMode;
179 int BaseUnarmedStrength;
180 int BaseBiteStrength;
181 int BaseKickStrength;
182 int AttackStyle;
183 sLong ClassStates;
184 sLong WhatThrowItemTypesToThrow;
185 fearray<festring> Alias;
186 contentscript<item> Helmet;
187 contentscript<item> Amulet;
188 contentscript<item> Cloak;
189 contentscript<item> BodyArmor;
190 contentscript<item> Belt;
191 contentscript<item> RightWielded;
192 contentscript<item> LeftWielded;
193 contentscript<item> RightRing;
194 contentscript<item> LeftRing;
195 contentscript<item> RightGauntlet;
196 contentscript<item> LeftGauntlet;
197 contentscript<item> RightBoot;
198 contentscript<item> LeftBoot;
199 int AttributeBonus;
200 fearray<sLong> KnownCWeaponSkills;
201 fearray<sLong> CWeaponSkillHits;
202 int RightSWeaponSkillHits;
203 int LeftSWeaponSkillHits;
204 int PanicLevel;
205 fearray<contentscript<item> > Inventory;
206 int DangerModifier;
207 festring DefaultName;
208 fearray<festring> FriendlyReplies;
209 fearray<festring> HostileReplies;
210 int FleshMaterial;
211 festring DeathMessage;
212 int HPRequirementForGeneration;
213 int DayRequirementForGeneration;
214 int AttackWisdomLimit;
215 int AttachedGod;
216 packv2 WieldedPosition;
217 int NaturalSparkleFlags;
218 int MoveType;
219 int BloodMaterial;
220 int VomitMaterial;
221 int PolymorphIntelligenceRequirement;
222 feuLong DefaultCommandFlags;
223 feuLong ConstantCommandFlags;
224 festring ForceVomitMessage;
225 int SweatMaterial;
226 fearray<festring> ScienceTalkAdjectiveAttribute;
227 fearray<festring> ScienceTalkSubstantiveAttribute;
228 fearray<festring> ScienceTalkPrefix;
229 fearray<festring> ScienceTalkName;
230 int ScienceTalkPossibility;
231 int ScienceTalkIntelligenceModifier;
232 int ScienceTalkWisdomModifier;
233 int ScienceTalkCharismaModifier;
234 int ScienceTalkIntelligenceRequirement;
235 int ScienceTalkWisdomRequirement;
236 int ScienceTalkCharismaRequirement;
237 int DisplacePriority;
238 festring RunDescriptionLineOne;
239 festring RunDescriptionLineTwo;
240 truth AllowPlayerToChangeEquipment;
241 int TamingDifficulty;
242 truth IsMasochist;
243 truth IsSadist;
244 truth IsCatacombCreature;
245 truth CreateUndeadConfigurations;
246 truth UndeadVersions;
247 int UndeadAttributeModifier;
248 int UndeadVolumeModifier;
249 truth UndeadCopyMaterials;
250 truth CanBeGeneratedOnlyInTheCatacombs;
251 truth IsAlcoholic;
252 truth IsImmuneToWhipOfThievery;
253 truth IsRangedAttacker;
254 int WhatCategoryToThrow;
255 int WhatWeaponConfigToThrow;
256 fearray<int> AllowedDungeons;
257 fearray<festring> LevelTags;
258 fearray<festring> HomeLevel;
259 int NaturalTeam;
263 class characterprototype {
264 friend class databasecreator<character>;
265 friend class protosystem;
266 public:
267 characterprototype (const characterprototype *, characterspawner, charactercloner, cchar *);
268 virtual ~characterprototype () {}
270 character *Spawn (int Config=0, int SpecialFlags=0) const { return Spawner(Config, SpecialFlags); }
271 character *SpawnAndLoad(inputfile &) const;
272 character *Clone(ccharacter *Char) const { return Cloner(Char); }
273 int GetIndex () const { return Index; }
274 inline cchar *GetTypeID () const { return ClassID; }
275 inline truth IsOfType (cchar *tname) const { return (tname ? (strcmp(tname, ClassID) == 0) : false); }
276 inline truth IsOfType (cfestring &tname) const { return (tname.Compare(ClassID) == 0); }
277 const characterprototype *GetBase() const { return Base; }
278 cchar *GetClassID () const { return ClassID; }
279 int CreateSpecialConfigurations (characterdatabase **, int, int);
280 const characterdatabase *ChooseBaseForConfig (characterdatabase ** TempConfig, int, int) { return *TempConfig; }
281 const characterdatabase *const *GetConfigData () const { return ConfigData; }
282 int GetConfigSize () const { return ConfigSize; }
284 private:
285 int Index;
286 const characterprototype *Base;
287 characterdatabase **ConfigData;
288 characterdatabase **ConfigTable[CONFIG_TABLE_SIZE];
289 int ConfigSize;
290 characterspawner Spawner;
291 charactercloner Cloner;
292 cchar *ClassID;
294 public:
295 EventHandlerMap mOnEvents;
299 class character : public entity, public id {
300 friend class databasecreator<character>;
301 friend class corpse;
303 public:
304 typedef characterprototype prototype;
305 typedef characterdatabase database;
307 public:
308 character ();
309 character (ccharacter &);
310 virtual ~character ();
312 public:
313 virtual void Save (outputfile &) const;
314 virtual void Load (inputfile &);
315 virtual truth CanWield () const { return false; }
316 virtual truth Catches(item *) { return false; }
317 truth CheckDeath (cfestring &, character * =0, feuLong =0);
318 truth DodgesFlyingItem (item *, double);
319 virtual truth Hit (character *, v2, int, int=0)=0;
320 truth ReadItem (item *);
321 truth TestForPickup (item *) const;
322 void ThrowItem (int, item *);
323 truth TryMove (v2, truth, truth);
324 truth TryToAddToInventory (item *);
325 truth HasEncryptedScroll () const;
326 truth HasHeadOfElpuri () const;
327 truth HasGoldenEagleShirt () const;
328 truth HasPetrussNut () const;
329 truth HasCurdledBlood() const;
330 truth HasOmmelBlood() const;
331 truth CurdleOmmelBlood() const;
332 truth RemoveCurdledOmmelBlood();
333 truth RemoveEncryptedScroll ();
334 truth RemoveHeadOfElpuri ();
335 truth RemoveMondedrPass ();
336 truth RemoveRingOfThieves ();
337 truth RemoveShadowVeil();
338 truth HasShadowVeil() const;
339 truth HasLostRubyFlamingSword() const;
340 truth IsPlayer () const { return Flags & C_PLAYER; }
341 truth Engrave (cfestring &What);
342 void AddScoreEntry (cfestring &, double = 1.0, truth = true) const;
343 sLong GetAP () const { return AP; }
344 sLong GetNP () const { return NP; }
345 stack *GetStack () const { return Stack; }
346 int GetBurdenState () const { return BurdenState; }
347 truth MakesBurdened (sLong What) const { return sLong(GetCarryingStrength()) * 2500 < What; }
348 virtual int TakeHit (character *, item *, bodypart *, v2, double, double, int, int, int, truth, truth);
349 int GetLOSRange () const;
350 int GetLOSRangeSquare () const { return GetLOSRange() * GetLOSRange(); }
351 int GetESPRange () const { return GetAttribute(INTELLIGENCE) / 3; }
352 int GetESPRangeSquare () const { return GetESPRange() * GetESPRange(); }
353 int GetTeleportRange () const { return GetAttribute(INTELLIGENCE); }
354 int GetTeleportRangeSquare () const { return GetTeleportRange() * GetTeleportRange(); }
355 void AddMissMessage (ccharacter *) const;
356 void AddPrimitiveHitMessage (ccharacter *, cfestring &, cfestring &, int) const;
357 void AddWeaponHitMessage (ccharacter *, citem *, int, truth = false) const;
358 virtual void BeTalkedTo ();
359 void ReceiveDarkness (sLong);
360 void Die (character *Killer=0, cfestring &Msg=CONST_S(""), feuLong DeathFlags=0);
361 void HasBeenHitByItem (character *, item *, int, double, int);
362 void Hunger ();
363 void Move (v2, truth, truth = false);
364 virtual truth MoveRandomly ();
365 void ReceiveNutrition (sLong);
366 void ReceiveOmmelUrine (sLong);
367 void ReceivePepsi (sLong);
368 void ReceiveSchoolFood (sLong);
369 void Regenerate ();
370 void SetAP (sLong What) { AP = What; }
371 void SetNP (sLong);
372 void Vomit (v2, int, truth = true);
373 virtual void Be ();
374 truth Polymorph (character *, int);
375 void BeKicked (character *, item *, bodypart *, v2, double, double, int, int, truth, truth);
376 void FallTo (character *, v2);
377 truth CheckCannibalism (cmaterial *) const;
378 void ActivateTemporaryState (sLong What) { TemporaryState |= What; }
379 void DeActivateTemporaryState (sLong What) { TemporaryState &= ~What; }
380 void ActivateEquipmentState (sLong What) { EquipmentState |= What; }
381 void DeActivateEquipmentState (sLong What) { EquipmentState &= ~What; }
382 truth TemporaryStateIsActivated (sLong What) const;
383 truth EquipmentStateIsActivated (sLong What) const { return EquipmentState & What; }
384 truth StateIsActivated (sLong What) const;
385 truth LoseConsciousness (int, truth = false);
386 void SetTemporaryStateCounter (sLong, int);
387 void DeActivateVoluntaryAction (cfestring & = CONST_S(""));
388 void ActionAutoTermination ();
389 team *GetTeam () const { return Team; }
390 void SetTeam (team *);
391 void ChangeTeam (team *);
392 virtual int GetMoveEase () const;
393 double GetDodgeValue () const { return DodgeValue; }
394 sLong GetMoney () const { return Money; }
395 void SetMoney (sLong What) { Money = What; }
396 void EditMoney (sLong What) { Money += What; }
397 int GetCurrentSweatMaterial() const { return CurrentSweatMaterial; }
398 void SetInitialSweatMaterial(int What) { CurrentSweatMaterial = What; }
399 void EditCurrentSweatMaterial(int What) { CurrentSweatMaterial = What; }
400 truth Displace (character *, truth = false);
401 truth CheckStarvationDeath (cfestring &);
402 void ShowNewPosInfo () const;
403 void Hostility (character *);
404 stack *GetGiftStack () const;
405 truth MoveRandomlyInRoom ();
406 void ReceiveKoboldFlesh (sLong);
407 truth ChangeRandomAttribute (int);
408 int RandomizeReply (sLong &, int);
409 virtual void CreateInitialEquipment (int);
410 void DisplayInfo (festring &);
411 virtual truth SpecialEnemySightedReaction (character *) { return false; }
412 void TestWalkability ();
413 void EditAP (sLong);
414 void EditNP (sLong);
415 void SetSize (int);
416 virtual int GetSize () const;
417 torso *GetTorso () const { return static_cast<torso *>(*BodyPartSlot[TORSO_INDEX]); }
418 humanoidtorso *GetHumanoidTorso() const { return static_cast<humanoidtorso *>(*BodyPartSlot[TORSO_INDEX]); }
419 void SetTorso (torso *What) { SetBodyPart(TORSO_INDEX, What); }
420 bodypart *GetBodyPart (int I) const { return static_cast<bodypart *>(*BodyPartSlot[I]); }
421 void SetBodyPart (int, bodypart *);
422 void SetMainMaterial (material *, int = 0);
423 void ChangeMainMaterial (material *, int = 0);
424 void SetSecondaryMaterial (material *, int = 0);
425 void ChangeSecondaryMaterial (material *, int = 0);
426 void DoDetecting ();
427 void RestoreHP ();
428 void RestoreLivingHP ();
429 void RestoreStamina () { Stamina = MaxStamina; }
430 virtual truth ReceiveDamage (character *Damager, int Damage, int Type, int TargetFlags=ALL, int Direction=8,
431 truth Divide=false, truth PenetrateArmor=false, truth Critical=false, truth ShowMsg=true);
432 virtual int ReceiveBodyPartDamage (character *, int, int, int, int = 8, truth = false, truth = false, truth = true, truth = false);
433 virtual truth BodyPartIsVital (int) const { return true; }
434 void RestoreBodyParts ();
435 cfestring &GetAssignedName () const { return AssignedName; }
436 void SetAssignedName (cfestring &What) { AssignedName = What; }
437 festring GetDescription (int) const;
438 festring GetPersonalPronoun (truth = true) const;
439 festring GetPossessivePronoun (truth = true) const;
440 festring GetObjectPronoun (truth = true) const;
441 virtual truth BodyPartCanBeSevered (int) const;
442 virtual void AddName (festring &, int) const;
443 void ReceiveHeal (sLong);
444 virtual item *GetMainWielded () const { return 0; }
445 virtual item *GetSecondaryWielded () const { return 0; }
446 int GetHungerState () const;
447 truth ConsumeItem (item *, cfestring &);
448 virtual truth CanConsume (material *) const;
449 action *GetAction () const { return Action; }
450 void SetAction (action *What) { Action = What; }
451 virtual void SwitchToDig (item *, v2) {}
452 virtual void SetRightWielded (item *) {}
453 virtual void SetLeftWielded (item *) {}
454 truth IsPassableSquare (int x, int y) const;
455 truth IsPassableSquare (cv2 xy) const { return IsPassableSquare(xy.X, xy.Y); }
456 truth IsInCorridor (int x, int y, int moveDir) const;
457 inline truth IsInCorridor (cv2 pos, int moveDir) const { return IsInCorridor(pos.X, pos.Y, moveDir); }
458 inline truth IsInCorridor (int moveDir) const { return IsInCorridor(GetPos(), moveDir); }
459 void CountPossibleMoveDirs (cv2 pos, int *odirs, int *ndirs, int exclideDir=-1) const;
460 int CheckCorridorMove (v2 &moveVector, cv2 pos, int moveDir, truth *markAsTurn) const; // -1: not in corridor; return new moveDir and moveVector
461 cv2 GetDiagonalForDirs (int moveDir, int newDir) const;
462 truth IsInTunnelDeadEnd () const;
463 truth IsDangerousSquare (v2 pos) const;
464 void MarkAdjacentItemsAsSeen (v2 pos);
465 truth HasInterestingItemsAt (v2 pos);
466 void GoOn (go *Go, truth FirstStep=false);
467 virtual truth CheckKick () const;
468 virtual int OpenMultiplier () const { return 2; }
469 virtual int CloseMultiplier () const { return 2; }
470 virtual truth CheckThrow () const;
471 virtual truth CheckOffer () const { return true; }
472 int GetTemporaryStateCounter (sLong) const;
473 void EditTemporaryStateCounter (sLong, int);
474 static truth AllowDamageTypeBloodSpill (int);
475 int GetResistance (int) const;
476 virtual int GetGlobalResistance (int Type) const { return GetResistance(Type); }
477 virtual cchar *GetEquipmentName (int) const;
478 virtual bodypart *GetBodyPartOfEquipment (int) const { return 0; }
479 virtual item *GetEquipment (int) const { return 0; }
480 virtual int GetEquipments () const { return 0; }
481 virtual sorter EquipmentSorter (int) const { return 0; }
482 virtual void SetEquipment (int, item *) {}
483 truth IsESPBlockedByEquipment () const;
484 void AddHealingLiquidConsumeEndMessage () const;
485 void AddSchoolFoodConsumeEndMessage () const;
486 void AddSchoolFoodHitMessage () const;
487 void AddOmmelConsumeEndMessage () const;
488 void AddPepsiConsumeEndMessage () const;
489 void AddFrogFleshConsumeEndMessage () const;
490 void AddKoboldFleshConsumeEndMessage () const;
491 void AddKoboldFleshHitMessage () const;
492 void AddBoneConsumeEndMessage () const;
493 void AddBlackUnicornConsumeEndMessage () const;
494 void AddGrayUnicornConsumeEndMessage () const;
495 void AddWhiteUnicornConsumeEndMessage () const;
496 void AddOmmelBoneConsumeEndMessage () const;
497 void AddLiquidHorrorConsumeEndMessage() const;
498 void AddAlienFleshConsumeEndMessage() const;
499 void PrintInfo () const;
500 virtual item *SevereBodyPart (int, truth = false, stack * = 0);
501 virtual truth TryToRiseFromTheDead ();
502 virtual truth RaiseTheDead (character *);
503 bodypart *CreateBodyPart (int, int = 0);
504 virtual truth EquipmentIsAllowed (int) const { return true; }
505 truth CanUseEquipment (int) const;
506 const database *GetDataBase () const { return DataBase; }
507 void SetParameters (int) {}
508 virtual double GetNaturalExperience (int) const;
509 DATA_BASE_VALUE(const prototype *, ProtoType);
510 DATA_BASE_VALUE(int, Config);
511 DATA_BASE_VALUE(int, DefaultEndurance);
512 DATA_BASE_VALUE(int, DefaultPerception);
513 DATA_BASE_VALUE(int, DefaultIntelligence);
514 DATA_BASE_VALUE(int, DefaultWisdom);
515 DATA_BASE_VALUE(int, DefaultWillPower);
516 DATA_BASE_VALUE(int, DefaultCharisma);
517 DATA_BASE_VALUE(int, DefaultMana);
518 DATA_BASE_VALUE(int, DefaultArmStrength);
519 DATA_BASE_VALUE(int, DefaultLegStrength);
520 DATA_BASE_VALUE(int, DefaultDexterity);
521 DATA_BASE_VALUE(int, DefaultAgility);
522 DATA_BASE_VALUE(sLong, DefaultMoney);
523 DATA_BASE_VALUE(int, TotalSize);
524 DATA_BASE_TRUTH(CanRead);
525 DATA_BASE_VALUE(int, Sex);
526 DATA_BASE_TRUTH(CanBeGenerated);
527 DATA_BASE_VALUE(int, CriticalModifier);
528 DATA_BASE_TRUTH(CanOpen);
529 DATA_BASE_VALUE(int, EnergyResistance);
530 DATA_BASE_VALUE(int, FireResistance);
531 DATA_BASE_VALUE(int, PoisonResistance);
532 DATA_BASE_VALUE(int, ElectricityResistance);
533 DATA_BASE_VALUE(int, AcidResistance);
534 DATA_BASE_VALUE(int, SoundResistance);
535 DATA_BASE_VALUE(int, ConsumeFlags);
536 DATA_BASE_VALUE(sLong, TotalVolume);
537 virtual DATA_BASE_VALUE(v2, HeadBitmapPos);
538 virtual DATA_BASE_VALUE(v2, TorsoBitmapPos);
539 virtual DATA_BASE_VALUE(v2, ArmBitmapPos);
540 virtual DATA_BASE_VALUE(v2, LegBitmapPos);
541 virtual DATA_BASE_VALUE(v2, RightArmBitmapPos);
542 virtual DATA_BASE_VALUE(v2, LeftArmBitmapPos);
543 virtual DATA_BASE_VALUE(v2, RightLegBitmapPos);
544 virtual DATA_BASE_VALUE(v2, LeftLegBitmapPos);
545 virtual DATA_BASE_VALUE(v2, GroinBitmapPos);
546 virtual DATA_BASE_VALUE(col16, ClothColor);
547 virtual DATA_BASE_VALUE(col16, SkinColor);
548 virtual DATA_BASE_VALUE(col16, CapColor);
549 virtual DATA_BASE_VALUE(col16, HairColor);
550 virtual DATA_BASE_VALUE(col16, EyeColor);
551 virtual DATA_BASE_VALUE(col16, TorsoMainColor);
552 virtual DATA_BASE_VALUE(col16, BeltColor);
553 virtual DATA_BASE_VALUE(col16, BootColor);
554 virtual DATA_BASE_VALUE(col16, TorsoSpecialColor);
555 virtual DATA_BASE_VALUE(col16, ArmMainColor);
556 virtual DATA_BASE_VALUE(col16, GauntletColor);
557 virtual DATA_BASE_VALUE(col16, ArmSpecialColor);
558 virtual DATA_BASE_VALUE(col16, LegMainColor);
559 virtual DATA_BASE_VALUE(col16, LegSpecialColor);
560 virtual DATA_BASE_TRUTH(IsNameable);
561 virtual DATA_BASE_VALUE(col24, BaseEmitation); // devirtualize ASAP
562 DATA_BASE_TRUTH(UsesLongArticle);
563 DATA_BASE_VALUE(cfestring&, Adjective);
564 DATA_BASE_TRUTH(UsesLongAdjectiveArticle);
565 DATA_BASE_VALUE(cfestring&, NameSingular);
566 DATA_BASE_VALUE(cfestring&, NamePlural);
567 DATA_BASE_VALUE(cfestring&, PostFix);
568 DATA_BASE_VALUE(int, ArticleMode);
569 DATA_BASE_TRUTH(CanZap);
570 virtual DATA_BASE_TRUTH(IsPolymorphable);
571 DATA_BASE_VALUE(int, BaseUnarmedStrength);
572 DATA_BASE_VALUE(int, BaseBiteStrength);
573 DATA_BASE_VALUE(int, BaseKickStrength);
574 DATA_BASE_VALUE(int, AttackStyle);
575 DATA_BASE_TRUTH(CanUseEquipment);
576 DATA_BASE_TRUTH(CanKick);
577 DATA_BASE_TRUTH(CanTalk);
578 DATA_BASE_TRUTH(CanBeWished);
579 DATA_BASE_VALUE(sLong, ClassStates);
580 DATA_BASE_VALUE(sLong, WhatThrowItemTypesToThrow);
581 DATA_BASE_VALUE(const fearray<festring>&, Alias);
582 DATA_BASE_TRUTH(CreateGolemMaterialConfigurations);
583 DATA_BASE_VALUE(const fearray<sLong>&, KnownCWeaponSkills);
584 DATA_BASE_VALUE(const fearray<sLong>&, CWeaponSkillHits);
585 DATA_BASE_VALUE(int, RightSWeaponSkillHits);
586 DATA_BASE_VALUE(int, LeftSWeaponSkillHits);
587 DATA_BASE_VALUE(int, PanicLevel);
588 DATA_BASE_TRUTH(CanBeCloned);
589 DATA_BASE_VALUE(cfestring&, DefaultName);
590 DATA_BASE_VALUE(const fearray<festring>&, FriendlyReplies);
591 DATA_BASE_VALUE(const fearray<festring>&, HostileReplies);
592 DATA_BASE_VALUE(int, FleshMaterial);
593 virtual DATA_BASE_TRUTH(HasALeg);
594 virtual DATA_BASE_VALUE(cfestring&, DeathMessage);
595 DATA_BASE_VALUE(int, HPRequirementForGeneration);
596 DATA_BASE_TRUTH(IsExtraCoward);
597 DATA_BASE_TRUTH(SpillsBlood);
598 DATA_BASE_TRUTH(HasEyes);
599 virtual DATA_BASE_TRUTH(HasHead);
600 DATA_BASE_TRUTH(CanThrow);
601 DATA_BASE_TRUTH(UsesNutrition);
602 DATA_BASE_VALUE(int, AttackWisdomLimit);
603 DATA_BASE_TRUTH(IsUnique);
604 DATA_BASE_VALUE(int, AttachedGod);
605 DATA_BASE_TRUTH(BodyPartsDisappearWhenSevered);
606 DATA_BASE_VALUE(int, Frequency);
607 DATA_BASE_TRUTH(CanBeConfused);
608 DATA_BASE_TRUTH(CanApply);
609 DATA_BASE_VALUE(v2, WieldedPosition);
610 virtual DATA_BASE_VALUE(int, NaturalSparkleFlags);
611 DATA_BASE_TRUTH(IgnoreDanger);
612 DATA_BASE_TRUTH(BiteCapturesBodyPart);
613 DATA_BASE_TRUTH(IsPlant);
614 DATA_BASE_TRUTH(DestroysWalls);
615 DATA_BASE_TRUTH(IsRooted);
616 DATA_BASE_VALUE(int, BloodMaterial);
617 DATA_BASE_VALUE(int, VomitMaterial);
618 DATA_BASE_TRUTH(AutomaticallySeen);
619 DATA_BASE_VALUE(feuLong, DefaultCommandFlags);
620 DATA_BASE_TRUTH(WillCarryItems);
621 DATA_BASE_VALUE(int, SweatMaterial);
622 DATA_BASE_TRUTH(Sweats);
623 DATA_BASE_TRUTH(IsImmuneToItemTeleport);
624 DATA_BASE_TRUTH(AlwaysUseMaterialAttributes);
625 DATA_BASE_TRUTH(IsEnormous);
626 DATA_BASE_VALUE(const fearray<festring>&, ScienceTalkAdjectiveAttribute);
627 DATA_BASE_VALUE(const fearray<festring>&, ScienceTalkSubstantiveAttribute);
628 DATA_BASE_VALUE(const fearray<festring>&, ScienceTalkPrefix);
629 DATA_BASE_VALUE(const fearray<festring>&, ScienceTalkName);
630 DATA_BASE_VALUE(int, ScienceTalkPossibility);
631 DATA_BASE_VALUE(int, ScienceTalkIntelligenceModifier);
632 DATA_BASE_VALUE(int, ScienceTalkWisdomModifier);
633 DATA_BASE_VALUE(int, ScienceTalkCharismaModifier);
634 DATA_BASE_VALUE(int, ScienceTalkIntelligenceRequirement);
635 DATA_BASE_VALUE(int, ScienceTalkWisdomRequirement);
636 DATA_BASE_VALUE(int, ScienceTalkCharismaRequirement);
637 DATA_BASE_TRUTH(IsExtraFragile);
638 DATA_BASE_TRUTH(IsImmuneToStickiness);
639 DATA_BASE_VALUE(festring, ForceVomitMessage);
640 DATA_BASE_TRUTH(CanChoke);
641 DATA_BASE_VALUE(int, DisplacePriority);
642 DATA_BASE_VALUE(cfestring&, RunDescriptionLineOne);
643 DATA_BASE_VALUE(cfestring&, RunDescriptionLineTwo);
644 DATA_BASE_TRUTH(ForceCustomStandVerb);
645 DATA_BASE_TRUTH(VomittingIsUnhealthy);
646 DATA_BASE_TRUTH(AllowPlayerToChangeEquipment);
647 DATA_BASE_VALUE(int, TamingDifficulty);
648 DATA_BASE_TRUTH(IsMasochist);
649 DATA_BASE_TRUTH(IsSadist);
650 DATA_BASE_TRUTH(IsCatacombCreature);
651 DATA_BASE_TRUTH(CreateUndeadConfigurations);
652 DATA_BASE_TRUTH(UndeadVersions);
653 DATA_BASE_VALUE(int, UndeadAttributeModifier);
654 DATA_BASE_VALUE(int, UndeadVolumeModifier);
655 DATA_BASE_TRUTH(UndeadCopyMaterials);
656 DATA_BASE_TRUTH(CanBeGeneratedOnlyInTheCatacombs);
657 DATA_BASE_TRUTH(IsAlcoholic);
658 DATA_BASE_TRUTH(IsImmuneToWhipOfThievery);
659 DATA_BASE_TRUTH(IsRangedAttacker);
660 DATA_BASE_VALUE(int, WhatCategoryToThrow);
661 DATA_BASE_VALUE(int, WhatWeaponConfigToThrow);
662 DATA_BASE_VALUE(const fearray<int>&, AllowedDungeons);
663 DATA_BASE_VALUE(const fearray<festring>&, LevelTags);
664 DATA_BASE_VALUE(const fearray<festring>&, HomeLevel);
665 DATA_BASE_VALUE(int, NaturalTeam);
666 int GetType () const { return GetProtoType()->GetIndex(); }
667 inline cchar *GetTypeID () const { return GetProtoType()->GetClassID(); }
668 inline truth IsOfType (cchar *tname) const { return (tname ? (strcmp(tname, GetProtoType()->GetClassID()) == 0) : false); }
669 inline truth IsOfType (cfestring &tname) const { return (tname.Compare(GetProtoType()->GetClassID()) == 0); }
670 void TeleportRandomly (truth = false);
671 truth TeleportNear (character *);
672 virtual void InitSpecialAttributes () {}
673 virtual void Kick (lsquare *, int, truth = false) = 0;
674 virtual int GetAttribute (int, truth = true) const;
675 virtual truth EditAttribute (int, int);
676 virtual void EditExperience (int, double, double);
677 truth RawEditAttribute (double &, int) const;
678 void DrawPanel (truth) const;
679 virtual int DrawStats (truth) const = 0;
680 virtual int GetCarryingStrength () const = 0;
681 static truth DamageTypeAffectsInventory (int);
682 virtual int GetRandomStepperBodyPart () const;
683 entity *GetMotherEntity () const { return MotherEntity; }
684 void SetMotherEntity (entity *What) { MotherEntity = What; }
685 virtual int CheckForBlock (character *, item *, double, int, int, int);
686 int CheckForBlockWithArm (character *, item *, arm *, double, int, int, int);
687 void AddBlockMessage (ccharacter *, citem *, cfestring &, truth) const;
688 character *GetPolymorphBackup () const { return PolymorphBackup; }
689 void SetPolymorphBackup (character *What) { PolymorphBackup = What; }
690 cweaponskill *GetCWeaponSkill (int I) const { return &CWeaponSkill[I]; }
691 virtual truth AddSpecialSkillInfo (felist &) const { return false; }
692 virtual truth CheckBalance (double);
693 sLong GetStateAPGain (sLong) const;
694 virtual sLong GetMoveAPRequirement (int) const;
695 virtual void SignalEquipmentAdd (int);
696 virtual void SignalEquipmentRemoval (int, citem *);
697 void BeginTemporaryState (sLong, int);
698 void GainIntrinsic (sLong);
699 void HandleStates ();
700 void PrintBeginPolymorphControlMessage () const;
701 void PrintEndPolymorphControlMessage () const;
702 void PrintBeginLifeSaveMessage () const;
703 void PrintEndLifeSaveMessage () const;
704 void PrintBeginLycanthropyMessage () const;
705 void PrintEndLycanthropyMessage () const;
706 void PrintBeginVampirismMessage () const;
707 void PrintEndVampirismMessage () const;
708 void PrintBeginHasteMessage () const;
709 void PrintEndHasteMessage () const;
710 void PrintBeginSlowMessage () const;
711 void PrintEndSlowMessage () const;
712 void PrintBeginSearchingMessage () const;
713 void PrintEndSearchingMessage () const;
714 void PrintBeginHiccupsMessage () const;
715 void PrintEndHiccupsMessage () const;
716 void EndPolymorph ();
717 void PrintBeginPolymorphLockMessage () const;
718 void PrintEndPolymorphLockMessage () const;
719 void PolymorphLockHandler ();
720 void PrintBeginRegenerationMessage () const;
721 void PrintEndRegenerationMessage () const;
722 void PrintBeginDiseaseImmunityMessage () const;
723 void PrintEndDiseaseImmunityMessage () const;
724 void PrintBeginTeleportLockMessage () const;
725 void PrintEndTeleportLockMessage () const;
726 void PrintBeginSwimmingMessage () const;
727 void PrintEndSwimmingMessage () const;
728 void TeleportLockHandler ();
729 character *ForceEndPolymorph ();
730 void LycanthropyHandler ();
731 void SearchingHandler ();
732 void SaveLife ();
733 void BeginInvisibility ();
734 void BeginInfraVision ();
735 void BeginESP ();
736 void EndInvisibility ();
737 void EndInfraVision ();
738 void EndESP ();
739 void HiccupsHandler ();
740 void VampirismHandler ();
741 void BeginEthereality();
742 void EndEthereality ();
743 void BeginSwimming ();
744 void EndSwimming ();
745 character *PolymorphRandomly (int, int, int);
746 virtual truth EquipmentEasilyRecognized (int) const { return true; }
747 void StartReading (item *, sLong);
748 void DexterityAction (int);
749 void IntelligenceAction (int);
750 virtual void SWeaponSkillTick () {}
751 void PrintBeginInvisibilityMessage () const;
752 void PrintEndInvisibilityMessage () const;
753 void PrintBeginInfraVisionMessage () const;
754 void PrintEndInfraVisionMessage () const;
755 void PrintBeginESPMessage () const;
756 void PrintEndESPMessage () const;
757 void PrintBeginEtherealityMessage() const;
758 void PrintEndEtherealityMessage() const;
759 truth CanBeSeenByPlayer (truth = false, truth = false) const;
760 truth CanBeSeenBy (ccharacter *, truth = false, truth = false) const;
761 void AttachBodyPart (bodypart *);
762 truth HasAllBodyParts () const;
763 bodypart *FindRandomOwnBodyPart (truth) const;
764 bodypart *GenerateRandomBodyPart ();
765 void PrintBeginPoisonedMessage () const;
766 void PrintEndPoisonedMessage () const;
767 truth IsWarm () const;
768 truth IsWarmBlooded() const;
769 void CalculateEquipmentState ();
770 void Draw (blitdata &) const;
771 virtual void DrawBodyParts (blitdata &) const;
772 god *GetMasterGod () const;
773 void PoisonedHandler ();
774 void PrintBeginTeleportMessage () const;
775 void PrintEndTeleportMessage () const;
776 void TeleportHandler ();
777 void DetectHandler ();
778 void PrintEndTeleportControlMessage () const;
779 void PrintBeginTeleportControlMessage () const;
780 void PrintBeginDetectMessage () const;
781 void PrintEndDetectMessage () const;
782 void PolymorphHandler ();
783 void PrintEndPolymorphMessage () const;
784 void PrintBeginPolymorphMessage () const;
785 virtual void DisplayStethoscopeInfo (character *) const;
786 virtual truth CanUseStethoscope (truth) const;
787 virtual truth IsUsingArms () const;
788 virtual truth IsUsingLegs () const;
789 virtual truth IsUsingHead () const;
790 dungeon *GetDungeon () const { return static_cast<level *>(GetSquareUnder()->GetArea())->GetDungeon(); }
791 level *GetLevel () const { return static_cast<level *>(GetSquareUnder()->GetArea()); }
792 area *GetArea () const { return GetSquareUnder()->GetArea(); }
793 virtual square *GetNeighbourSquare (int) const;
794 virtual lsquare *GetNeighbourLSquare (int) const;
795 //virtual wsquare *GetNeighbourWSquare (int) const;
796 stack *GetStackUnder (int I = 0) const { return static_cast<lsquare *>(GetSquareUnder(I))->GetStack(); }
797 square *GetNearSquare (v2 Pos) const { return GetSquareUnder()->GetArea()->GetSquare(Pos); }
798 square *GetNearSquare (int x, int y) const { return GetSquareUnder()->GetArea()->GetSquare(x, y); }
799 lsquare *GetNearLSquare (v2 Pos) const { return static_cast<lsquare *>(GetSquareUnder()->GetArea()->GetSquare(Pos)); }
800 lsquare *GetNearLSquare (int x, int y) const { return static_cast<lsquare *>(GetSquareUnder()->GetArea()->GetSquare(x, y)); }
801 wsquare *GetNearWSquare (v2) const;
802 wsquare *GetNearWSquare (int, int) const;
803 v2 GetPos (int I = 0) const { return GetSquareUnder(I)->GetPos(); }
804 square *GetSquareUnder (int I = 0) const { return !MotherEntity ? SquareUnder[I] : MotherEntity->GetSquareUnderEntity(I); }
805 virtual square *GetSquareUnderEntity (int I = 0) const { return GetSquareUnder(I); }
806 lsquare *GetLSquareUnder (int I = 0) const { return static_cast<lsquare *>(GetSquareUnder(I)); }
807 int GetRandomNonVitalBodyPart () const;
808 void TeleportSomePartsAway (int);
809 virtual void SignalVolumeAndWeightChange ();
810 virtual void SignalBodyPartVolumeAndWeightChange () {}
811 void CalculateVolumeAndWeight ();
812 sLong GetVolume () const { return Volume; }
813 sLong GetBodyVolume () const { return BodyVolume; }
814 sLong GetWeight () const { return Weight; }
815 sLong GetCarriedWeight () const { return CarriedWeight; }
816 virtual void SignalEmitationIncrease (col24);
817 virtual void SignalEmitationDecrease (col24);
818 void CalculateEmitation ();
819 void CalculateAll ();
820 void CalculateHP ();
821 void CalculateMaxHP ();
822 int GetHP () const { return HP; }
823 int GetMaxHP () const { return MaxHP; }
824 void CalculateBodyPartMaxHPs (feuLong = MAY_CHANGE_HPS|CHECK_USABILITY);
825 truth IsInitializing () const { return Flags & C_INITIALIZING; }
826 truth IsInNoMsgMode () const { return Flags & C_IN_NO_MSG_MODE; }
827 truth ActivateRandomState (int, int, sLong = 0);
828 sLong GetRandomState (int) const;
829 truth GainRandomIntrinsic (int);
830 virtual void CalculateBattleInfo () = 0;
831 void CalculateBurdenState ();
832 virtual void CalculateDodgeValue ();
833 virtual void CalculateBodyParts () { BodyParts = 1; }
834 virtual void CalculateAllowedWeaponSkillCategories ();
835 int GetBodyParts () const { return BodyParts; }
836 int GetAllowedWeaponSkillCategories () const { return AllowedWeaponSkillCategories; }
837 double GetRelativeDanger (ccharacter *, truth = false) const;
838 double GetTimeToDie (ccharacter *, int, double, truth, truth) const;
839 virtual double GetTimeToKill (ccharacter *, truth) const = 0;
840 virtual void AddSpecialEquipmentInfo (festring &, int) const {}
841 virtual festring GetBodyPartName (int, truth = false) const;
842 item *SearchForItem (feuLong) const;
843 truth SearchForItem (citem *) const;
844 item *SearchForItem (const sweaponskill *) const;
845 truth ContentsCanBeSeenBy (ccharacter *) const;
846 festring GetBeVerb () const;
847 virtual void CreateBlockPossibilityVector (blockvector &, double) const {}
848 virtual truth SpecialUnarmedEffect (character *, v2, int, int, truth) { return false; }
849 virtual truth SpecialKickEffect (character *, v2, int, int, truth) { return false; }
850 virtual truth SpecialBiteEffect (character* Victim, v2 HitPos, int BodyPartIndex, int Direction, truth BlockedByArmour, truth Critical, int DoneDamage) { return false; }
851 truth HitEffect (character *, item *, v2, int, int, int, truth, truth Critical, int DoneDamage);
852 void WeaponSkillHit (item *, int, int);
853 character *Duplicate (feuLong = 0);
854 room *GetRoom (int I=0) const { return GetLSquareUnder(I)->GetRoom(); }
855 truth TryToEquip (item *);
856 truth TryToConsume (item *);
857 void UpdateESPLOS () const;
858 int GetCWeaponSkillLevel (citem *) const;
859 virtual int GetSWeaponSkillLevel (citem *) const { return 0; }
860 void PrintBeginPanicMessage () const;
861 void PrintEndPanicMessage () const;
862 void CheckPanic (int);
863 character *DuplicateToNearestSquare (character *, feuLong = 0);
864 virtual void SignalSpoil (material *m = 0);
865 virtual void SignalSpoilLevelChange (material *m = 0);
866 virtual truth UseMaterialAttributes () const = 0;
867 truth IsPolymorphed () const { return Flags & C_POLYMORPHED; }
868 truth IsInBadCondition () const { return HP * 3 < MaxHP; }
869 truth IsInBadCondition (int HP) const { return HP * 3 < MaxHP; }
870 int GetCondition () const;
871 void UpdatePictures ();
872 truth CanHeal () const;
873 void SetGoingTo (v2);
874 int GetRelation (ccharacter *) const;
875 truth CalculateAttributeBonuses ();
876 void ApplyEquipmentAttributeBonuses (item *);
877 void ReceiveAntidote (sLong);
878 void AddAntidoteConsumeEndMessage () const;
879 truth IsDead () const;
880 void AddOriginalBodyPartID (int, feuLong);
881 void AddToInventory (const fearray<contentscript<item> > &, int);
882 truth HasHadBodyPart (citem *) const;
883 void ProcessAndAddMessage (festring) const;
884 virtual truth CheckZap ();
885 void SetEndurance (int);
886 void SetPerception (int);
887 void SetIntelligence (int);
888 void SetWisdom (int);
889 void SetWillPower (int);
890 void SetCharisma (int);
891 void SetMana (int);
892 void DamageAllItems (character *, int, int);
893 truth Equips (citem *) const;
894 void PrintBeginConfuseMessage () const;
895 void PrintEndConfuseMessage () const;
896 v2 ApplyStateModification (v2) const;
897 void AddConfuseHitMessage () const;
898 item *SelectFromPossessions (cfestring &, sorter = 0);
899 truth SelectFromPossessions (itemvector &, cfestring &, int, sorter = 0);
900 truth EquipsSomething (sorter = 0);
901 truth CheckTalk ();
902 virtual truth CanCreateBodyPart (int) const { return true; }
903 virtual truth HandleCharacterBlockingTheWay (character *, v2, int) { return false; }
904 virtual festring& ProcessMessage (festring &) const;
905 virtual truth IsHumanoid () const { return false; }
906 virtual truth IsHuman () const { return false; }
907 truth IsOnGround () const;
908 virtual truth CheckIfEquipmentIsNotUsable (int) const { return false; }
909 virtual truth MoveTowardsHomePos ();
910 virtual void SetWayPoints (const fearray<packv2> &) {}
911 int HasSomethingToEquipAt (int chosen, truth equippedIsTrue); // counter
912 feuLong HasSomethingToEquipAtRecentTime (int chosen, truth equippedIsTrue); // returns 0, 1 or pickup time
913 int TryToChangeEquipment (stack *, stack *, int); // number of items worn (is this the right word?)
914 void PrintBeginParasitizedMessage () const;
915 void PrintEndParasitizedMessage () const;
916 void ParasitizedHandler ();
917 truth CanFollow () const;
918 truth LeftOversAreUnique () const;
919 virtual festring GetKillName () const;
920 festring GetPanelName () const;
921 virtual void AddSpecialStethoscopeInfo (felist &) const = 0;
922 virtual item *GetPairEquipment (int) const { return 0; }
923 bodypart *HealHitPoint ();
924 void CreateHomeData ();
925 room *GetHomeRoom () const;
926 truth HomeDataIsValid () const;
927 void SetHomePos (v2);
928 void RemoveHomeData ();
929 feuLong GetID () const { return ID; }
930 void AddESPConsumeMessage () const;
931 const std::list<feuLong> &GetOriginalBodyPartID (int) const;
932 void GetHitByExplosion (const explosion *, int);
933 truth CanBePoisoned () const { return TorsoIsAlive(); }
934 truth CanBeParasitized () const { return TorsoIsAlive(); }
935 void SortAllItems (const sortdata &);
936 character *GetRandomNeighbourEnemy () const;
937 void Search(int);
938 character *GetRandomNeighbour (int = (HOSTILE|UNCARING|FRIEND)) const;
939 virtual truth IsRetreating () const;
940 virtual truth IsMushroom () const { return false; }
941 void ResetStates ();
942 virtual head *Behead () { return 0; }
943 void PrintBeginGasImmunityMessage () const;
944 void PrintEndGasImmunityMessage () const;
945 void ShowAdventureInfo () const;
946 virtual truth BoundToUse (citem *, int) const { return false; }
947 virtual truth IsBananaGrower () const { return false; }
948 virtual int GetRandomApplyBodyPart () const;
949 #ifdef WIZARD
950 virtual void AddAttributeInfo (festring &) const;
951 virtual void AddAttackInfo (felist &) const = 0;
952 virtual void AddDefenceInfo (felist &) const;
953 virtual void DetachBodyPart ();
954 #endif
955 void ReceiveHolyBanana (sLong);
956 void AddHolyBananaConsumeEndMessage () const;
957 void ReceiveHolyMango (sLong);
958 void AddHolyMangoConsumeEndMessage () const;
959 truth IsHomeLevel (level *lvl) const;
960 virtual truth PreProcessForBone ();
961 truth PostProcessForBone (double &, int &);
962 truth PostProcessForBone ();
963 virtual void FinalProcessForBone ();
964 virtual truth EditAllAttributes (int);
965 virtual void SetSoulID (feuLong);
966 virtual truth SuckSoul (character *) { return false; }
967 virtual truth MustBeRemovedFromBone () const;
968 truth TorsoIsAlive () const { return GetTorso()->IsAlive(); }
969 truth PictureUpdatesAreForbidden () const { return Flags & C_PICTURE_UPDATES_FORBIDDEN; }
970 virtual int GetUsableArms () const { return 0; }
971 truth IsPet () const;
972 virtual void PutTo (v2);
973 void PutTo (lsquare *);
974 truth PutNear (v2, truth allowFail=false);
975 truth PutNearNoTeleport (v2);
976 truth PutToOrNear (v2, truth allowFail=false);
977 truth PutToOrNearNoTeleport (v2);
978 virtual void Remove ();
979 truth IsSmall () const { return SquaresUnder == 1; }
980 truth IsOver (v2) const;
981 truth IsOver (citem *) const;
982 truth SquareUnderCanBeSeenByPlayer (truth) const;
983 truth SquareUnderCanBeSeenBy (ccharacter *, truth) const;
984 int GetDistanceSquareFrom (ccharacter *) const;
985 virtual truth CanTheoreticallyMoveOn (const lsquare *) const;
986 virtual truth CanMoveOn (const lsquare *) const;
987 virtual truth CanMoveOn (const square *) const;
988 truth CanMoveOn (const olterrain *) const;
989 truth CanMoveOn (const oterrain *) const;
990 truth IsMainPos (v2 What) const { return GetPos() == What; }
991 virtual void CalculateSquaresUnder () { SquaresUnder = 1; }
992 int GetSquaresUnder () const { return SquaresUnder; }
993 virtual int GetSquareIndex (v2) const { return 0; }
994 virtual int GetNeighbourSquares () const { return 8; }
995 virtual int GetExtendedNeighbourSquares () const { return 9; }
996 virtual int CalculateNewSquaresUnder (lsquare **, v2) const;
997 virtual truth IsFreeForMe (square *) const;
998 void SendNewDrawRequest () const;
999 square *GetNaturalNeighbourSquare (int I) const { return character::GetNeighbourSquare(I); }
1000 lsquare *GetNaturalNeighbourLSquare (int I) const { return character::GetNeighbourLSquare(I); }
1001 void SignalStepFrom (lsquare **);
1002 virtual void SpecialBodyDefenceEffect (character *, bodypart *, int) {}
1003 virtual int GetSumOfAttributes () const;
1004 truth IsGoingSomeWhere () const { return GoingTo != ERROR_V2; }
1005 virtual truth CreateRoute ();
1006 void TerminateGoingTo ();
1007 virtual truth IsSpy () const { return false; } // does CallForAttention() if true
1008 truth CheckForFood (int);
1009 truth CheckForFoodInSquare (v2);
1010 virtual truth CheckIfSatiated () { return GetNP() > SATIATED_LEVEL; }
1011 virtual void SignalNaturalGeneration () {}
1012 virtual truth IsBunny () const { return false; }
1013 virtual truth IsSpider () const { return false; }
1014 void SetConfig (int, int = 0);
1015 bodypartslot *GetBodyPartSlot (int I) { return &BodyPartSlot[I]; }
1016 virtual truth CheckConsume (cfestring &) const;
1017 virtual int GetTameSymbolSquareIndex () const { return 0; }
1018 virtual int GetFlySymbolSquareIndex () const { return 0; }
1019 virtual int GetSwimmingSymbolSquareIndex () const { return 0; }
1020 virtual int GetUnconsciousSymbolSquareIndex () const { return 0; }
1021 virtual truth PlaceIsIllegal (v2 Pos, v2 Illegal) const { return Pos == Illegal; }
1022 liquid *CreateBlood (sLong) const;
1023 void SpillFluid (character *, liquid*, int = 0);
1024 virtual void StayOn (liquid *);
1025 virtual head *GetVirtualHead () const { return 0; }
1026 truth IsAlly (ccharacter *) const;
1027 virtual truth CanVomit () const { return TorsoIsAlive(); }
1028 feuLong GetLastAcidMsgMin () const { return LastAcidMsgMin; }
1029 void SetLastAcidMsgMin (feuLong What) { LastAcidMsgMin = What; }
1030 virtual truth AllowSpoil () const { return false; }
1031 void Disappear (corpse *, cchar *, truth (item::*)() const);
1032 void ResetSpoiling ();
1033 virtual character *GetLeader () const;
1034 int GetMoveType () const;
1035 virtual truth IsSumoWrestler () const { return false; }
1036 void InitMaterials (const materialscript *, const materialscript *, truth) {}
1037 item *SearchForItem (ccharacter *, sorter) const;
1038 virtual character *CreateZombie () const { return 0; }
1039 virtual festring GetZombieDescription () const;
1040 virtual truth CanAttack () const { return true; }
1041 truth DetectMaterial (cmaterial *) const;
1042 truth CheckIfTooScaredToHit (ccharacter *) const;
1043 void PrintBeginLevitationMessage () const;
1044 void PrintEndLevitationMessage () const;
1045 void EditDealExperience (sLong);
1046 int RawEditExperience (double &, double, double, double) const;
1047 virtual void LeprosyHandler ();
1048 virtual void TryToInfectWithLeprosy (ccharacter *);
1049 void PrintBeginLeprosyMessage () const;
1050 void PrintEndLeprosyMessage () const;
1051 void SignalGeneration ();
1052 void CheckIfSeen ();
1053 void SignalSeen ();
1054 truth HasBeenSeen () const;
1055 int GetPolymorphIntelligenceRequirement () const;
1056 void RemoveAllItems ();
1057 int CalculateWeaponSkillHits (ccharacter *) const;
1058 void DonateEquipmentTo (character *);
1059 void ReceivePeaSoup (sLong);
1060 void AddPeaSoupConsumeEndMessage () const;
1061 void CalculateMaxStamina ();
1062 void EditStamina (int, truth);
1063 void RegenerateStamina ();
1064 void BeginPanic ();
1065 void EndPanic ();
1066 int GetTirednessState () const;
1067 int GetStamina () const { return Stamina; }
1068 int GetMaxStamina () const { return MaxStamina; }
1069 void SetGenerationDanger (double What) { GenerationDanger = What; }
1070 double GetGenerationDanger () const { return GenerationDanger; }
1071 void ReceiveBlackUnicorn (sLong);
1072 void ReceiveGrayUnicorn (sLong);
1073 void ReceiveWhiteUnicorn (sLong);
1074 void DecreaseStateCounter (sLong, int);
1075 truth IsImmuneToLeprosy () const;
1076 bodypart *SearchForOriginalBodyPart (int) const;
1077 void SetLifeExpectancy (int, int);
1078 virtual void DuplicateEquipment (character *, feuLong);
1079 virtual void SignalDisappearance ();
1080 virtual truth HornOfFearWorks () const;
1081 virtual truth CanHear () const;
1082 void BeginLeprosy ();
1083 void EndLeprosy ();
1084 void ReceiveOmmelCerumen (sLong);
1085 void ReceiveOmmelSweat (sLong);
1086 void ReceiveOmmelTears (sLong);
1087 void ReceiveOmmelSnot (sLong);
1088 void ReceiveOmmelBone (sLong);
1089 truth IsSameAs (ccharacter *) const;
1090 feuLong GetCommandFlags () const;
1091 void SetCommandFlags (feuLong What) { CommandFlags = What; }
1092 feuLong GetPossibleCommandFlags () const;
1093 feuLong GetConstantCommandFlags () const;
1094 virtual truth AllowEquipment (citem *, int) const { return true; }
1095 truth ChatMenu ();
1096 truth ChangePetEquipment ();
1097 truth TakePetItems ();
1098 truth GivePetItems ();
1099 truth IssuePetCommands ();
1100 truth ChatIdly ();
1101 truth EquipmentScreen (stack *, stack *);
1102 feuLong GetManagementFlags () const;
1103 cchar *GetVerbalBurdenState () const;
1104 col16 GetVerbalBurdenStateColor () const;
1105 virtual int GetAttributeAverage () const;
1106 virtual cfestring& GetStandVerb () const;
1107 virtual truth CheckApply () const;
1108 virtual truth CanForceVomit () const { return CanVomit(); }
1109 void EndLevitation ();
1110 virtual truth CanMove () const;
1111 void CalculateEnchantments ();
1112 truth GetNewFormForPolymorphWithControl (character *&);
1113 liquid *CreateSweat (sLong) const;
1114 truth IsTemporary () const;
1115 truth TeleportRandomItem (truth);
1116 truth HasClearRouteTo (v2) const;
1117 virtual truth IsTransparent () const;
1118 void SignalPossibleTransparencyChange ();
1119 int GetCursorData () const;
1120 void TryToName ();
1121 double GetSituationDanger (ccharacter *, v2, v2, truth) const;
1122 virtual void ModifySituationDanger (double &) const;
1123 void LycanthropySituationDangerModifier (double &) const;
1124 void PoisonedSituationDangerModifier (double &) const;
1125 void PolymorphingSituationDangerModifier (double &) const;
1126 void PanicSituationDangerModifier (double &) const;
1127 void ConfusedSituationDangerModifier (double &) const;
1128 void ParasitizedSituationDangerModifier (double &) const;
1129 void LeprosySituationDangerModifier (double &) const;
1130 void HiccupsSituationDangerModifier (double &) const;
1131 void VampirismSituationDangerModifier (double &) const;
1132 truth TryToTalkAboutScience ();
1133 truth IsUsingWeaponOfCategory (int) const;
1134 virtual truth IsKamikazeDwarf () const { return false; }
1135 void AddRandomScienceName (festring &) const;
1136 truth IsStuck () const { return !!TrapData; }
1137 festring GetTrapDescription () const;
1138 truth TryToUnStickTraps (v2);
1139 void RemoveTrap (feuLong);
1140 void AddTrap (feuLong, feuLong);
1141 truth IsStuckToTrap (feuLong) const;
1142 void RemoveTraps ();
1143 void RemoveTraps (int);
1144 int RandomizeHurtBodyPart (feuLong) const;
1145 virtual int RandomizeTryToUnStickBodyPart (feuLong) const { return NONE_INDEX; }
1146 truth BodyPartIsStuck (int) const;
1147 void PrintAttribute (cchar *, int, int, int) const;
1148 virtual truth AllowUnconsciousness () const;
1149 truth CanPanic () const;
1150 int GetRandomBodyPart (feuLong = ALL_BODYPART_FLAGS) const;
1151 virtual truth CanChokeOnWeb (web *) const { return CanChoke(); }
1152 virtual truth BrainsHurt () const { return false; }
1153 truth IsSwimming () const;
1154 truth IsAnimated () const;
1155 virtual truth IsPlayerKind () const { return false; }
1156 truth HasBodyPart (sorter) const;
1157 truth PossessesItem (sorter) const;
1158 truth MoreThanOnePossessesItem (sorter) const;
1159 item *FirstPossessesItem (sorter Sorter) const;
1160 truth IsFlying () const { return GetMoveType() & FLY; }
1161 virtual cchar *GetRunDescriptionLine (int) const;
1162 void VomitAtRandomDirection (int);
1163 virtual truth SpecialSaveLife () { return false; }
1164 void RemoveLifeSavers ();
1165 virtual ccharacter *FindCarrier () const;
1166 virtual cchar *GetNormalDeathMessage () const;
1167 virtual bool IsConscious () const;
1168 void ForcePutNear (v2);
1169 void PrintBeginFearlessMessage() const;
1170 void PrintEndFearlessMessage() const;
1171 void BeginFearless();
1172 void EndFearless();
1173 virtual void ApplySpecialAttributeBonuses () {}
1174 void ReceiveMustardGas (int, sLong);
1175 void ReceiveMustardGasLiquid (int, sLong);
1176 truth IsBadPath (v2) const;
1177 double &GetExpModifierRef (expid);
1178 truth ForgetRandomThing ();
1179 void ApplyAllGodsKnownBonus ();
1180 item *GiveMostExpensiveItem (character *);
1181 void ReceiveItemAsPresent (item *);
1182 item *FindMostExpensiveItem () const;
1183 truth ReceiveSirenSong (character *Siren);
1184 character *GetNearestEnemy () const;
1185 truth IsInfectedByMindWorm () const { return !CounterToMindWormHatch; }
1186 void SetCounterToMindWormHatch (int What) { CounterToMindWormHatch = What; }
1187 truth MindWormCanPenetrateSkull (mindworm *) const;
1188 truth CanTameWithDulcis (const character *) const;
1189 truth CanTameWithLyre (const character *) const;
1190 truth CanTameWithScroll (const character *) const;
1191 truth CanTameWithResurrection (const character*) const;
1192 truth IsCharmable () const { return GetTamingDifficulty() != NO_TAMING; }
1193 truth CheckSadism ();
1194 virtual truth CheckThrowItemOpportunity ();
1195 virtual truth CheckAIZapOpportunity ();
1196 virtual truth CheckInventoryForItemToThrow (item *);
1197 virtual truth HasSadistAttackMode () const { return IsUsingLegs(); }
1198 truth CheckForBeverage ();
1199 void Haste ();
1200 void Slow ();
1201 virtual void SurgicallyDetachBodyPart ();
1202 truth IsAllowedInDungeon (int dunIndex);
1204 inline cchar *GetClassID () const { return (FindProtoType() ? FindProtoType()->GetClassID() : ""); }
1205 virtual const prototype *FindProtoType () const { return &ProtoType; }
1207 // aconfig == -1: any
1208 virtual item *findFirstEquippedItem (cfestring &aclassname, int aconfig=-1) const;
1209 virtual item *findFirstInventoryItem (cfestring &aclassname, int aconfig=-1) const;
1210 virtual item *findFirstItem (cfestring &aclassname, int aconfig=-1) const;
1212 protected:
1213 static truth DamageTypeDestroysBodyPart (int);
1214 virtual void LoadSquaresUnder ();
1215 virtual bodypart *MakeBodyPart (int) const;
1216 virtual void SpecialTurnHandler () {}
1217 void Initialize (int, int);
1218 virtual void PostConstruct () {}
1219 void LoadDataBaseStats ();
1220 virtual v2 GetBodyPartBitmapPos (int, truth = false) const;
1221 virtual col16 GetBodyPartColorA (int, truth = false) const;
1222 virtual col16 GetBodyPartColorB (int, truth = false) const;
1223 virtual col16 GetBodyPartColorC (int, truth = false) const;
1224 virtual col16 GetBodyPartColorD (int, truth = false) const;
1225 virtual int GetBodyPartSparkleFlags (int) const;
1226 virtual sLong GetBodyPartSize (int, int) const;
1227 virtual sLong GetBodyPartVolume (int) const;
1228 void UpdateBodyPartPicture (int I, truth);
1229 int ChooseBodyPartToReceiveHit (double, double);
1230 virtual void CreateBodyParts (int);
1231 virtual material *CreateBodyPartMaterial (int, sLong) const;
1232 virtual truth ShowClassDescription () const { return true; }
1233 void SeekLeader (ccharacter *);
1234 virtual truth CheckForUsefulItemsOnGround (truth = true);
1235 truth CheckForDoors ();
1236 truth CheckForEnemies (truth, truth, truth, truth = false);
1237 truth FollowLeader (character *);
1238 void StandIdleAI ();
1239 virtual void CreateCorpse (lsquare *);
1240 void GetPlayerCommand ();
1241 virtual void GetAICommand ();
1242 truth MoveTowardsTarget (truth);
1243 virtual cchar *FirstPersonUnarmedHitVerb () const;
1244 virtual cchar *FirstPersonCriticalUnarmedHitVerb () const;
1245 virtual cchar *ThirdPersonUnarmedHitVerb () const;
1246 virtual cchar *ThirdPersonCriticalUnarmedHitVerb () const;
1247 virtual cchar *FirstPersonKickVerb () const;
1248 virtual cchar *FirstPersonCriticalKickVerb () const;
1249 virtual cchar *ThirdPersonKickVerb () const;
1250 virtual cchar *ThirdPersonCriticalKickVerb () const;
1251 virtual cchar *FirstPersonBiteVerb () const;
1252 virtual cchar *FirstPersonCriticalBiteVerb () const;
1253 virtual cchar *ThirdPersonBiteVerb () const;
1254 virtual cchar *ThirdPersonCriticalBiteVerb () const;
1255 virtual cchar *UnarmedHitNoun () const;
1256 virtual cchar *KickNoun () const;
1257 virtual cchar *BiteNoun () const;
1258 virtual truth AttackIsBlockable (int) const { return true; }
1259 virtual truth AttackMayDamageArmor () const { return true; }
1260 virtual int GetSpecialBodyPartFlags (int) const { return ST_NORMAL; }
1261 virtual int GetBodyPartWobbleData (int) const { return 0; }
1262 virtual int ModifyBodyPartHitPreference (int, int Modifier) const { return Modifier; }
1263 virtual int ModifyBodyPartToHitChance (int, int Chance) const { return Chance; }
1264 virtual truth CanPanicFromSeveredBodyPart () const { return true; }
1265 virtual void SpecialBodyPartSeverReaction () {}
1266 truth AttackAdjacentEnemyAI ();
1267 double RandomizeBabyExperience (double);
1268 static truth IsLimbIndex (int);
1269 virtual truth AllowExperience () const { return true; }
1271 truth GeneralHasItem (ItemCheckerCB chk, truth checkContainers=false) const;
1272 int GeneralRemoveItem (ItemCheckerCB chk, truth allItems=false, truth checkContainers=false); // return count
1274 public:
1275 static const prototype ProtoType;
1276 stack *Stack;
1277 sLong NP, AP;
1278 sLong TemporaryState;
1279 int TemporaryStateCounter[STATES];
1280 team *Team;
1281 v2 GoingTo;
1282 sLong Money;
1283 int CurrentSweatMaterial;
1284 bodypartslot *BodyPartSlot;
1285 festring AssignedName;
1286 action *Action;
1287 const database *DataBase;
1288 double BaseExperience[BASE_ATTRIBUTES];
1289 std::list<feuLong> *OriginalBodyPartID;
1290 entity *MotherEntity;
1291 character *PolymorphBackup;
1292 cweaponskill *CWeaponSkill;
1293 sLong EquipmentState;
1294 square **SquareUnder;
1295 sLong Volume;
1296 sLong Weight;
1297 sLong CarriedWeight;
1298 sLong BodyVolume;
1299 int HP;
1300 int MaxHP;
1301 int BurdenState;
1302 double DodgeValue;
1303 int AllowedWeaponSkillCategories;
1304 int BodyParts;
1305 sLong RegenerationCounter;
1306 int AttributeBonus[BASE_ATTRIBUTES];
1307 int CarryingBonus;
1308 homedata *HomeData;
1309 feuLong ID;
1310 int SquaresUnder;
1311 std::vector<v2> Route;
1312 std::set<v2> Illegal;
1313 feuLong LastAcidMsgMin;
1314 int Stamina;
1315 int MaxStamina;
1316 int BlocksSinceLastTurn;
1317 double GenerationDanger;
1318 feuLong CommandFlags;
1319 feuLong WarnFlags;
1320 int ScienceTalks;
1321 trapdata *TrapData;
1322 expmodifiermap ExpModifierMap;
1323 int CounterToMindWormHatch;
1325 int mPrevMoveDir;
1329 #ifdef __FILE_OF_STATIC_CHARACTER_PROTOTYPE_DEFINITIONS__
1330 #define CHARACTER_PROTO(name, base)\
1331 template<> const characterprototype\
1332 name##sysbase::ProtoType(&base::ProtoType,\
1333 (characterspawner)(&name##sysbase::Spawn),\
1334 (charactercloner)(&name##sysbase::Clone), #name);
1335 #else
1336 #define CHARACTER_PROTO(name, base)
1337 #endif
1340 #define CHARACTER(name, base)\
1341 class name;\
1342 typedef sysbase<name, base, characterprototype> name##sysbase;\
1343 CHARACTER_PROTO(name, base)\
1344 class name : public name##sysbase
1347 #endif