World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Player.cpp
См. документацию.
2 
3 #include <algorithm>
4 #include <functional>
5 
6 #include "Engine/Engine.h"
7 #include "Engine/Localization.h"
9 
10 #include "../Autonotes.h"
11 #include "../Awards.h"
12 #include "../Events.h"
13 #include "../Events2D.h"
14 #include "../Graphics/Outdoor.h"
15 #include "../Graphics/Viewport.h"
16 #include "../LOD.h"
17 #include "../Party.h"
18 #include "../Tables/PlayerFrameTable.h"
19 #include "../Tables/StorylineTextTable.h"
20 #include "../TurnEngine/TurnEngine.h"
21 #include "Actor.h"
22 
23 #include "../Graphics/DecalBuilder.h"
24 #include "../OurMath.h"
25 #include "../Spells/CastSpellInfo.h"
26 #include "../stru123.h"
27 #include "../stru298.h"
28 #include "ObjectList.h"
29 #include "SpriteObject.h"
30 
31 #include "IO/Mouse.h"
32 
34 
35 #include "GUI/GUIWindow.h"
36 #include "GUI/UI/UIGame.h"
37 #include "GUI/UI/UIStatusBar.h"
38 
40 
41 // should be injected in Player but Party struct size cant be altered
45 
47 
49 
50 // Race Stat Points Bonus/ Penalty
52  unsigned char uBaseValue;
53  unsigned char uMaxValue;
54  unsigned char uDroppedStep;
55  unsigned char uBaseStep;
56 };
57 
59  StatTable[4][7] = // [human , elf, goblin, dwarf] [might, int, per , end,
60  // acc, speed, luck]
61  {{
62  {11, 25, 1, 1},
63  {11, 25, 1, 1},
64  {11, 25, 1, 1},
65  {9, 25, 1, 1},
66  {11, 25, 1, 1},
67  {11, 25, 1, 1},
68  {9, 25, 1, 1},
69  },
70  {
71  {7, 15, 2, 1},
72  {14, 30, 1, 2},
73  {11, 25, 1, 1},
74  {7, 15, 2, 1},
75  {14, 30, 1, 2},
76  {11, 25, 1, 1},
77  {9, 20, 1, 1},
78  },
79  {
80  {14, 30, 1, 2},
81  {7, 15, 2, 1},
82  {7, 15, 2, 1},
83  {11, 25, 1, 1},
84  {11, 25, 1, 1},
85  {14, 30, 1, 2},
86  {9, 20, 1, 1},
87  },
88  {{14, 30, 1, 2},
89  {11, 25, 1, 1},
90  {11, 25, 1, 1},
91  {14, 30, 1, 2},
92  {7, 15, 2, 1},
93  {7, 15, 2, 1},
94  {9, 20, 1, 1}}};
95 
96 std::array<int, 5> StealingMasteryBonuses = {
97  0, 100, 200, 300,
98  500}; // dword_4EDEA0 //the zeroth element isn't accessed, it just
99  // helps avoid -1 indexing, originally 4 element array off by one
100 std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100,
101  200}; // dword_4EDEB4
102 std::array<int, 5> StealingEnchantmentBonusForSkill = {
103  0, 2, 4, 6,
104  10}; // dword_4EDEC4 //the zeroth element isn't accessed, it just
105  // helps avoid -1 indexing, originally 4 element array off by one
106 
107 // available skills per class ( 9 classes X 37 skills )
108 // 0 - not available
109 // 1 - available
110 // 2 - primary skill
111 unsigned char pSkillAvailabilityPerClass[9][37] = { // byte[] @ MM7.exe::004ED820
112  {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
113  0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
114  {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115  0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0},
116  {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117  0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0},
118  {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0,
119  0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
120  {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0,
121  0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
122  {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123  0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
124  {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2,
125  0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
126  {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1,
127  0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
128  {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0,
129  0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these
130  // are started
131  // at 4ED94C,
132  // but needs to
133  // be here
134 };
135 
136 unsigned char pEquipTypeToBodyAnchor[21] = { // 4E8398
137  1, // EQUIP_SINGLE_HANDED
138  1, // EQUIP_TWO_HANDED
139  2, // EQUIP_BOW
140  3, // EQUIP_ARMOUR
141  0, // EQUIP_SHIELD
142  4, // EQUIP_HELMET
143  5, // EQUIP_BELT
144  6, // EQUIP_CLOAK
145  7, // EQUIP_GAUNTLETS
146  8, // EQUIP_BOOTS
147  10, // EQUIP_RING
148  9, // EQUIP_AMULET
149  1, // EQUIP_WAND
150  0, // EQUIP_REAGENT
151  0, // EQUIP_POTION
152  0, // EQUIP_SPELL_SCROLL
153  0, // EQUIP_BOOK
154  0, // EQUIP_MESSAGE_SCROLL
155  0, // EQUIP_GOLD
156  0, // EQUIP_GEM
157  0 // EQUIP_NONE
158 };
159 
160 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30,
161  25, 20, 20, 0, 0, 0};
162 unsigned char pBaseManaByClass[12] = {0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0};
163 unsigned char pBaseHealthPerLevelByClass[36] = {
164  5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4,
165  6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3};
166 unsigned char pBaseManaPerLevelByClass[36] = {
167  0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2,
168  3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6};
169 
170 unsigned char pConditionAttributeModifier[7][19] = {
171  {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100,
172  100, 100, 100}, // Might
173  {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100,
174  100, 1, 100}, // Intelligence
175  {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100,
176  100, 1, 100}, // Willpower
177  {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100,
178  100, 100, 100}, // Endurance
179  {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100,
180  100, 50, 100}, // Accuracy
181  {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100,
182  100, 50, 100}, // Speed
183  {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
184  100, 100, 100, 100}}; // Luck
185 
186 unsigned char pAgingAttributeModifier[7][4] = {
187  {100, 75, 40, 10}, // Might
188  {100, 150, 100, 10}, // Intelligence
189  {100, 150, 100, 10}, // Willpower
190  {100, 75, 40, 10}, // Endurance
191  {100, 100, 40, 10}, // Accuracy
192  {100, 100, 40, 10}, // Speed
193  {100, 100, 100, 100}}; // Luck
194 
195 unsigned int pAgeingTable[4] = {50, 100, 150, 0xFFFF};
196 
197 std::array<unsigned int, 18> pConditionImportancyTable = {
198  {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}};
199 
200 short param_to_bonus_table[29] = {
201  500, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100, 75, 50, 40,
202  35, 30, 25, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0};
203 signed int parameter_to_bonus_value[29] = {
204  30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8,
205  7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6};
206 
208  100, // PLAYER_SKILL_STAFF && Unarmed withoud skill
209  90, // PLAYER_SKILL_SWORD && Unarmed with skill
210  60, // PLAYER_SKILL_DAGGER
211  100, // PLAYER_SKILL_AXE
212  80, // PLAYER_SKILL_SPEAR
213  100, // PLAYER_SKILL_BOW
214  80, // PLAYER_SKILL_MACE
215  30, // PLAYER_SKILL_BLASTER
216  10, // PLAYER_SKILL_SHIELD
217  10, // PLAYER_SKILL_LEATHER
218  20, // PLAYER_SKILL_CHAIN
219  30 // PLAYER_SKILL_PLATE
220 };
221 
222 //----- (00490913) --------------------------------------------------------
224  int CurrentStatValue = 50;
225  int RemainingStatPoints = 50;
226  int raceId;
227  int StatBaseValue;
228  int PenaltyMult;
229  int BonusMult;
230 
231  for (int playerNum = 0; playerNum < 4; playerNum++) {
232  raceId = pParty->pPlayers[playerNum].GetRace();
233 
234  for (int statNum = 0; statNum <= 6; statNum++) {
235  switch (statNum) {
236  case 0:
237  CurrentStatValue = pParty->pPlayers[playerNum].uMight;
238  break;
239  case 1:
240  CurrentStatValue =
241  pParty->pPlayers[playerNum].uIntelligence;
242  break;
243  case 2:
244  CurrentStatValue = pParty->pPlayers[playerNum].uWillpower;
245  break;
246  case 3:
247  CurrentStatValue = pParty->pPlayers[playerNum].uEndurance;
248  break;
249  case 4:
250  CurrentStatValue = pParty->pPlayers[playerNum].uAccuracy;
251  break;
252  case 5:
253  CurrentStatValue = pParty->pPlayers[playerNum].uSpeed;
254  break;
255  case 6:
256  CurrentStatValue = pParty->pPlayers[playerNum].uLuck;
257  break;
258  }
259 
260  StatBaseValue = StatTable[raceId][statNum].uBaseValue;
261 
262  if (CurrentStatValue >=
263  StatBaseValue) { // bonus or penalty increase
264  PenaltyMult = StatTable[raceId][statNum].uDroppedStep;
265  BonusMult = StatTable[raceId][statNum].uBaseStep;
266  } else { // less than base
267  PenaltyMult = StatTable[raceId][statNum].uBaseStep;
268  BonusMult = StatTable[raceId][statNum].uDroppedStep;
269  }
270 
271  RemainingStatPoints +=
272  PenaltyMult * (StatBaseValue - CurrentStatValue) / BonusMult;
273  }
274  }
275 
276  return RemainingStatPoints;
277 }
278 
279 //----- (00427730) --------------------------------------------------------
281  if (engine->config->debug_all_magic) return true;
282  if (sMana >= uRequiredMana) { // enough mana
283  sMana -= uRequiredMana; // removes mana
284  return true;
285  }
286 
287  // not enough mana
288  pAudioPlayer->PlaySound(SOUND_spellfail0201, 0, 0, -1, 0, 0);
289  return false;
290 }
291 
292 //----- (004BE2DD) --------------------------------------------------------
293 void Player::SalesProcess(unsigned int inventory_idnx, int item_index, int _2devent_idx) {
294  float shop_mult = p2DEvents[_2devent_idx - 1].fPriceMultiplier;
295  int sell_price = GetPriceSell(pOwnItems[item_index], shop_mult);
296 
297  // remove item and add gold
298  RemoveItemAtInventoryIndex(inventory_idnx);
299  Party::AddGold(sell_price);
300 }
301 
302 //----- (0043EEF3) --------------------------------------------------------
304  signed int item_idx;
305  signed int item_id;
306 
307  // scan through all equipped items
308  for (int i = 0; i < 16; ++i) {
309  item_idx = pEquipment.pIndices[i];
310 
311  if (item_idx) {
312  item_id = pOwnItems[item_idx - 1].uItemID;
313 
314  if (item_id != ITEM_BLASTER &&
315  item_id != ITEM_LASER_RIFLE) // soemthing other than blaster&
316  // blaster rifle
317  return false;
318  }
319  }
320 
321  return true; // nothing or just blaster equipped
322 }
323 
324 //----- (004B8040) --------------------------------------------------------
326  unsigned int
327  condition) { // PS - CHECK ?? is this the intedned behavior - RETURN
328  // NUMBER OF DAYS CONDITION HAS BEEN ACTIVE FOR
329 
330  if (this->conditions_times[condition].Valid() == false) return 0;
331 
332  GameTime playtime = pParty->GetPlayingTime();
333  GameTime condtime = this->conditions_times[condition];
334  GameTime diff = playtime - condtime;
335 
336  return diff.GetDays() + 1;
337 }
338 
339 //----- (004B807C) --------------------------------------------------------
340 int Player::GetTempleHealCostModifier(float price_multi) {
341  unsigned int conditionIdx = GetMajorConditionIdx(); // get worse condition
342  int conditionTimeMultiplier = 1;
343  int baseConditionMultiplier =
344  1; // condition good unless otherwise , base price for health and mana
345  int high_mult;
346  int result;
347 
348  if (conditionIdx >= 14 &&
349  conditionIdx <= 16) { // dead, petri, erad - serious
350  if (conditionIdx <= 15)
351  baseConditionMultiplier = 5; // dead or petri
352  else
353  baseConditionMultiplier = 10; // erad
354 
355  conditionTimeMultiplier = GetConditionDaysPassed(conditionIdx);
356  } else if (conditionIdx < 14) { // all other conditions
357  for (int i = 0; i <= 13; i++) {
358  high_mult = GetConditionDaysPassed(i);
359 
360  if (high_mult >
361  conditionTimeMultiplier) // get worst other condition
362  conditionTimeMultiplier = high_mult;
363  }
364  }
365 
366  result = (int)((double)conditionTimeMultiplier *
367  (double)baseConditionMultiplier *
368  price_multi); // calc heal price
369 
370  if (result < 1) // min cost
371  result = 1;
372 
373  if (result > 10000) // max cost
374  result = 10000;
375 
376  return result;
377 }
378 
379 //----- (004B8102) --------------------------------------------------------
380 int Player::GetPriceSell(ItemGen itemx, float price_multiplier) {
381  int uRealValue = itemx.GetValue();
382  signed int result =
383  (signed int)(((double)uRealValue / (price_multiplier + 2.0)) +
384  uRealValue * GetMerchant() / 100);
385 
386  if (result > uRealValue) result = uRealValue;
387 
388  if (itemx.IsBroken()) result = 1;
389 
390  if (result < 1) result = 1;
391 
392  return result;
393 }
394 
395 //----- (004B8142) --------------------------------------------------------
396 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) {
397  uint price =
398  (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
399 
400  if (price < uRealValue) // price should always be at least item value
401  price = uRealValue;
402 
403  return price;
404 }
405 
406 //----- (004B8179) --------------------------------------------------------
407 int Player::GetPriceIdentification(float price_multiplier) {
408  signed int basecost = (price_multiplier * 50.0);
409  int actcost = basecost * (100 - GetMerchant()) / 100;
410 
411  if (actcost < basecost / 3) // minimum price
412  actcost = basecost / 3;
413 
414  if (actcost > 1)
415  return actcost;
416  else
417  return 1;
418 }
419 
420 //----- (004B81C3) --------------------------------------------------------
421 int Player::GetPriceRepair(int uRealValue, float price_multiplier) {
422  signed int basecost = (uRealValue / (6.0 - price_multiplier));
423  int actcost = basecost * (100 - GetMerchant()) / 100;
424 
425  if (actcost < basecost / 3) // min price
426  actcost = basecost / 3;
427 
428  if (actcost > 1)
429  return actcost;
430  else
431  return 1;
432 }
433 
434 //----- (004B8213) --------------------------------------------------------
435 int Player::GetBaseSellingPrice(int uRealValue, float price_multiplier) {
436  signed int basecost = (uRealValue / (price_multiplier + 2.0));
437 
438  if (basecost < 1) // min price
439  basecost = 1;
440 
441  return basecost;
442 }
443 
444 //----- (004B8233) --------------------------------------------------------
445 int Player::GetBaseBuyingPrice(int uRealValue, float price_multiplier) {
446  signed int basecost = uRealValue * price_multiplier;
447 
448  if (basecost < 1) // min price
449  basecost = 1;
450 
451  return basecost;
452 }
453 
454 //----- (004B824B) --------------------------------------------------------
455 int Player::GetBaseIdentifyPrice(float price_multiplier) {
456  signed int basecost = price_multiplier * 50.0;
457 
458  if (basecost < 1) // min price
459  basecost = 1;
460 
461  return basecost;
462 }
463 
464 //----- (004B8265) --------------------------------------------------------
465 int Player::GetBaseRepairPrice(int uRealValue, float price_multiplier) {
466  signed int basecost = (uRealValue / (6.0 - price_multiplier));
467 
468  if (basecost < 1) // min price
469  basecost = 1;
470 
471  return basecost;
472 }
473 
474 //----- (004B6FF9) --------------------------------------------------------
476  if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() &&
478  return false; // fully healthy
479  } else {
481  if ((window_SpeakInHouse->par1C == 78 ||
482  window_SpeakInHouse->par1C == 81 ||
483  window_SpeakInHouse->par1C == 82))
484  return false; // zombie cant be healed at these tmeples
485  else
486  return true;
487  } else {
488  return true;
489  }
490  }
491 }
492 
494  int inventory_index = this->GetItemListAtInventoryIndex(inout_item_cell);
495 
496  if (!inventory_index) {
497  return nullptr;
498  }
499 
500  return &this->pInventoryItemList[inventory_index - 1];
501 }
502 
503 //----- (00421E75) --------------------------------------------------------
504 unsigned int Player::GetItemListAtInventoryIndex(int inout_item_cell) {
505  int cell_idx = inout_item_cell;
506  if (cell_idx > 125 || cell_idx < 0) return 0;
507 
508  int inventory_index = this->pInventoryMatrix[cell_idx];
509  if (inventory_index < 0) { // not pointed to main item cell so redirect
510  inventory_index = this->pInventoryMatrix[-1 - inventory_index];
511  }
512 
513  return inventory_index; // returns item list position + 1
514 }
515 
516 //----- (004160CA) --------------------------------------------------------
517 void Player::ItemsPotionDmgBreak(int enchant_count) {
518  int avalible_items = 0;
519 
520  __int16 item_index_tabl[138]; // table holding items
521  memset(item_index_tabl, 0, sizeof(item_index_tabl)); // set to zero
522 
523  for (int i = 0; i < 138; ++i) { // scan through and log in table
524  if ((pOwnItems[i].uItemID > 0) && (pOwnItems[i].uItemID <= 134))
525  item_index_tabl[avalible_items++] = i;
526  }
527 
528  if (avalible_items) { // is there anything to break
529  if (enchant_count) {
530  for (int i = 0; i < enchant_count; ++i) {
531  int indexbreak =
532  item_index_tabl[rand() % avalible_items]; // random item
533 
534  if (!(pInventoryItemList[indexbreak].uAttributes &
535  ITEM_HARDENED)) // if its not hardened
536  pInventoryItemList[indexbreak].uAttributes |=
537  ITEM_BROKEN; // break it
538  }
539  } else {
540  for (int i = 0; i < avalible_items; ++i) { // break everything
541  pInventoryItemList[item_index_tabl[i]].uAttributes |=
542  ITEM_BROKEN;
543  }
544  }
545  }
546 }
547 
548 //----- (00492C0B) --------------------------------------------------------
550  if (this->IsAsleep() || this->IsParalyzed() || this->IsUnconcious() ||
551  this->IsDead() || this->IsPertified() || this->IsEradicated())
552 
553  return false;
554  else
555  return true;
556 }
557 
558 //----- (00492C40) --------------------------------------------------------
561 }
562 
563 //----- (00492C4E) --------------------------------------------------------
564 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) {
565  switch (uItemID) {
567  case ITEM_RELIC_OLD_NICK:
568  case ITEM_RELIC_TWILIGHT:
569  return pParty->IsPartyEvil();
570  break;
571 
573  case ITEM_RELIC_JUSTICE:
574  return pParty->IsPartyGood();
575  break;
576 
578  return IsRaceGoblin();
579  break;
580 
582  return IsRaceHuman();
583  break;
584 
586  return IsRaceElf();
587  break;
588 
590  return IsRaceDwarf();
591  break;
592 
594  return IsMale();
595  break;
596 
598  return IsFemale();
599  break;
600 
601  case ITEM_WETSUIT:
603  break;
604 
605  default:
606  return 1;
607  break;
608  }
609 }
610 
611 //----- (00492D65) --------------------------------------------------------
612 void Player::SetCondition(unsigned int uConditionIdx, int blockable) {
613  if (conditions_times[uConditionIdx]) // cant get the same condition twice
614  return;
615 
616  if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx,
617  blockable)) { // block check
618  return;
619  }
620 
621  switch (uConditionIdx) { // conditions noises
622  case Condition_Cursed:
623  PlaySound(SPEECH_30, 0);
624  break;
625  case Condition_Weak:
626  PlaySound(SPEECH_25, 0);
627  break;
628  case Condition_Sleep:
629  break; // nosound
630  case Condition_Fear:
631  PlaySound(SPEECH_26, 0);
632  break;
633  case Condition_Drunk:
634  PlaySound(SPEECH_31, 0);
635  break;
636  case Condition_Insane:
637  PlaySound(SPEECH_29, 0);
638  break;
639 
643  PlaySound(SPEECH_27, 0);
644  break;
645 
649  PlaySound(SPEECH_28, 0);
650  break;
651 
652  case Condition_Paralyzed:
653  break; // nosound
654 
656  PlaySound(SPEECH_32, 0);
657  if (sHealth > 0) sHealth = 0;
658  break;
659 
660  case Condition_Dead:
661  PlaySound(SPEECH_33, 0);
662  if (sHealth > 0) sHealth = 0;
663  if (sMana > 0) sMana = 0;
664  break;
665 
666  case Condition_Pertified:
667  PlaySound(SPEECH_34, 0);
668  break;
669 
671  PlaySound(SPEECH_35, 0);
672  if (sHealth > 0) sHealth = 0;
673  if (sMana > 0) sMana = 0;
674  break;
675 
676  case Condition_Zombie:
678  IsZombie() || !IsDead()) // cant zombified
679  return;
680 
681  conditions_times.fill(GameTime(0));
682  sHealth = GetMaxHealth();
683  sMana = 0;
686 
687  if (IsMale()) {
688  uCurrentFace = 23;
689  uVoiceID = 23;
690  } else {
691  uCurrentFace = 24;
692  uVoiceID = 24;
693  }
694 
695  PlaySound(SPEECH_99, 0);
696  break;
697  }
698 
699  int players_before = 0;
700  for (int i = 1; i < 5;
701  ++i) { // count active players veofre activating condition
702  if (pPlayers[i]->CanAct()) ++players_before;
703  }
704 
705  conditions_times[uConditionIdx] =
706  pParty->GetPlayingTime(); // set ocndition
707 
708  int remainig_player = 0; // who is left now
709  int players_after = 0;
710  for (int i = 1; i < 5; ++i) {
711  if (pPlayers[i]->CanAct()) {
712  remainig_player = i;
713  ++players_after;
714  }
715  }
716 
717  if ((players_before == 2) &&
718  (players_after ==
719  1)) // if was 2 and now down to 1 - "its just you and me now"
720  pPlayers[remainig_player]->PlaySound(
721  SPEECH_107, 0); //скорее всего обнадёжывающий возглас последнего
722 
723  return;
724 }
725 
726 //----- (00492528) --------------------------------------------------------
727 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) {
728  auto img = assets->GetImage_ColorKey(pItemsTable->pItems[uItemID].pIconName,
729  0x7FF);
730  unsigned int slotWidth = GetSizeInInventorySlots(img->GetWidth());
731  unsigned int slotHeight = GetSizeInInventorySlots(img->GetHeight());
732 
733  Assert(slotHeight > 0 && slotWidth > 0,
734  "Items should have nonzero dimensions");
735  if ((slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH &&
736  (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT) {
737  for (unsigned int x = 0; x < slotWidth; x++) {
738  for (unsigned int y = 0; y < slotHeight; y++) {
739  if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0) {
740  return false;
741  }
742  }
743  }
744  return true;
745  }
746  return false;
747 }
748 
749 //----- (004925E6) --------------------------------------------------------
751  for (int i = 0; i < 126; i++) {
752  if (pInventoryItemList[i].uItemID == ITEM_NULL) {
753  return i; // space at i
754  }
755  }
756 
757  return -1; // no room
758 }
759 
760 //----- (00492600) --------------------------------------------------------
761 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) {
762  signed int freeSlot = FindFreeInventoryListSlot();
763 
764  if (freeSlot == -1) { // no room
765  if (uActiveCharacter)
766  pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
767 
768  return 0;
769  } else { // place items
770  PutItemArInventoryIndex(uItemID, freeSlot, uSlot);
771  this->pInventoryItemList[freeSlot].uItemID = uItemID;
772  }
773 
774  return freeSlot + 1; // return slot no + 1
775 }
776 
777 //----- (00492700) --------------------------------------------------------
778 int Player::HasSkill(unsigned int uSkillType) {
779  if (uSkillType >= 37 || this->pActiveSkills[uSkillType]) {
780  return 1;
781  } else {
782  GameUI_StatusBar_OnEvent(localization->FormatString(67, this->pName)); // *** does not have the skill
783  return 0;
784  }
785 }
786 
787 //----- (00492745) --------------------------------------------------------
788 void Player::WearItem(unsigned int uItemID) {
789  int item_body_anch;
790  int item_indx;
791  item_indx = FindFreeInventoryListSlot();
792 
793  if (item_indx != -1) {
794  pInventoryItemList[item_indx].uItemID = uItemID;
795  item_body_anch =
796  pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType];
797  pEquipment.pIndices[item_body_anch] = item_indx + 1;
798  pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1;
799  }
800 }
801 
802 //----- (004927A8) --------------------------------------------------------
803 int Player::AddItem(int index, unsigned int uItemID) {
804  if (index == -1) { // no location specified - search for space
805  for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) {
806  for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) {
807  if (CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord,
808  uItemID)) { // found space
809  return CreateItemInInventory(
810  ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID);
811  }
812  }
813  }
814 
815  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
816  return 0; // no space cant add item
817  }
818 
819  if (!CanFitItem(index, uItemID)) {
820  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
821  return 0; // cant fit item
822  }
823 
824  return CreateItemInInventory(index, uItemID); // return location
825 }
826 
827 //----- (00492826) --------------------------------------------------------
828 int Player::AddItem2(int index, ItemGen* Src) { // are both required - check
830 
831  if (index == -1) { // no loaction specified
832  for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) {
833  for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) {
834  if (CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord,
835  Src->uItemID)) { // found space
836  return CreateItemInInventory2(
837  ycoord * INVETORYSLOTSWIDTH + xcoord, Src);
838  }
839  }
840  }
841 
842  return 0;
843  }
844 
845  if (!CanFitItem(index, Src->uItemID)) return 0;
846 
847  return CreateItemInInventory2(index, Src);
848 }
849 
850 //----- (0049289C) --------------------------------------------------------
852  ItemGen* Src) { // are both required - check
853  signed int freeSlot = FindFreeInventoryListSlot();
854  int result;
855 
856  if (freeSlot == -1) { // no room
857  result = 0;
858  } else {
859  PutItemArInventoryIndex(Src->uItemID, freeSlot, index);
860  memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen));
861  result = freeSlot + 1;
862  }
863 
864  return result;
865 }
866 
867 //----- (0049298B) --------------------------------------------------------
869  int uItemID, int itemListPos,
870  int index) { // originally accepted ItemGen* but needed only its uItemID
871 
872  auto img = assets->GetImage_ColorKey(pItemsTable->pItems[uItemID].pIconName,
873  0x7FF);
874  unsigned int slot_width = GetSizeInInventorySlots(img->GetWidth());
875  unsigned int slot_height = GetSizeInInventorySlots(img->GetHeight());
876 
877  if (slot_width > 0) {
878  int* pInvPos = &pInventoryMatrix[index];
879  for (unsigned int i = 0; i < slot_height; i++) {
880  memset32(pInvPos, -1 - index,
881  slot_width); // TODO(_): try to come up with a better
882  // solution. negative values are used when
883  // drawing the inventory - nothing is drawn
884  pInvPos += INVETORYSLOTSWIDTH;
885  }
886  }
887 
888  pInventoryMatrix[index] = itemListPos + 1;
889 }
890 
891 //----- (00492A36) --------------------------------------------------------
893  ItemGen* item_in_slot = this->GetItemAtInventoryIndex(index);
894 
895  auto img = assets->GetImage_ColorKey(item_in_slot->GetIconName(), 0x7FF);
896  unsigned int slot_width = GetSizeInInventorySlots(img->GetWidth());
897  unsigned int slot_height = GetSizeInInventorySlots(img->GetHeight());
898 
899  item_in_slot->Reset(); // must get img details before reset
900 
901  int inventory_index = this->pInventoryMatrix[index];
902  if (inventory_index < 0) { // not pointed to main item cell so redirect
903  index = (-1 - inventory_index);
904  }
905 
906  if (slot_width > 0) {
907  int* pInvPos = &pInventoryMatrix[index];
908  for (unsigned int i = 0; i < slot_height; i++) {
909  memset32(pInvPos, 0, slot_width);
910  pInvPos += INVETORYSLOTSWIDTH;
911  }
912  }
913 }
914 
915 //----- (0049107D) --------------------------------------------------------
918  int multiplier =
920 
921  return multiplier * skill;
922 }
923 
924 //----- (004910A8) --------------------------------------------------------
927  int multiplier =
929 
930  return multiplier * skill;
931 }
932 
933 //----- (004910D3) --------------------------------------------------------
936  int skillmaster = GetActualSkillMastery(PLAYER_SKILL_ITEM_ID);
937  int multiplier =
939 
941  skillmaster == 4) // always identify
942  return true;
943 
944  // check item level against skill
945  bool result = (multiplier * skill) >=
946  pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
947 
948  return result;
949 }
950 
951 //----- (00491151) --------------------------------------------------------
954  int skillmaster = GetActualSkillMastery(PLAYER_SKILL_REPAIR);
955  int multiplier =
957  ITEM_EQUIP_TYPE equipType = pItem->GetItemEquipType();
958 
959  if (CheckHiredNPCSpeciality(Smith) && equipType <= 2 ||
960  CheckHiredNPCSpeciality(Armorer) && equipType >= 3 && equipType <= 9 ||
961  CheckHiredNPCSpeciality(Alchemist) && equipType >= 9)
962  return true; // check against hired help
963 
964  if (skillmaster == 4) // gm repair
965  return true;
966 
967  // check item level against skill
968  bool result = (multiplier * skill) >=
969  pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
970 
971  return result;
972 }
973 
974 //----- (004911F3) --------------------------------------------------------
977  int skillmaster = GetActualSkillMastery(PLAYER_SKILL_MERCHANT);
978  int multiplier =
980 
981  if (skillmaster == 4) // gm merchant
982  return 10000;
983 
984  int rep = pParty->GetPartyReputation();
985  int bonus = multiplier * skill;
986 
987  if (bonus == 0) // no skill so trading on rep alone
988  return -rep;
989 
990  return bonus - rep + 7;
991 }
992 
993 //----- (0049125A) --------------------------------------------------------
997  int multiplier =
999 
1000  if (skillmaster == 4) // gm percept
1001  return 10000;
1002 
1003  return multiplier * skill;
1004 }
1005 
1006 //----- (004912B0) --------------------------------------------------------
1010  int multiplier =
1012 
1013  if (skillmaster == 4) // gm disarm
1014  return 10000;
1015 
1016  if (HasEnchantedItemEquipped(35)) // item has increased disarm
1017  multiplier++;
1018 
1019  return multiplier * skill;
1020 }
1021 
1022 //----- (00491317) --------------------------------------------------------
1025  int multiplier =
1027 
1028  return multiplier * skill + 9;
1029 }
1030 
1031 //----- (0048C855) --------------------------------------------------------
1034 }
1035 
1036 //----- (0048C86C) --------------------------------------------------------
1038  return this->uIntelligence +
1040 }
1041 
1042 //----- (0048C883) --------------------------------------------------------
1045 }
1046 
1047 //----- (0048C89A) --------------------------------------------------------
1050 }
1051 
1052 //----- (0048C8B1) --------------------------------------------------------
1055 }
1056 
1057 //----- (0048C8C8) --------------------------------------------------------
1060 }
1061 
1062 //----- (0048C8DF) --------------------------------------------------------
1065 }
1066 
1067 //----- (0048C8F6) --------------------------------------------------------
1070 }
1071 
1072 //----- (0048C90D) --------------------------------------------------------
1074  return uLevel + sLevelModifier +
1077 }
1078 
1079 //----- (0048C93C) --------------------------------------------------------
1083 }
1084 
1085 //----- (0048C9C2) --------------------------------------------------------
1090 }
1091 
1092 //----- (0048CA3F) --------------------------------------------------------
1096 }
1097 
1098 //----- (0048CABC) --------------------------------------------------------
1102 }
1103 
1104 //----- (0048CB39) --------------------------------------------------------
1108 }
1109 
1110 //----- (0048CBB6) --------------------------------------------------------
1114 }
1115 
1116 //----- (0048CC33) --------------------------------------------------------
1118  signed int npc_luck_bonus = 0;
1119 
1120  if (CheckHiredNPCSpeciality(Fool)) npc_luck_bonus = 5;
1121 
1122  if (CheckHiredNPCSpeciality(ChimneySweep)) npc_luck_bonus += 20;
1123 
1124  if (CheckHiredNPCSpeciality(Psychic)) npc_luck_bonus += 10;
1125 
1127  &Player::uLuckBonus) +
1128  npc_luck_bonus;
1129 }
1130 
1131 //----- (new function) --------------------------------------------------------
1133  unsigned short Player::*attrValue,
1134  unsigned short Player::*attrBonus) {
1135  uint uActualAge = this->sAgeModifier + GetBaseAge();
1136  uint uAgeingMultiplier = 100;
1137 
1138  for (uint i = 0; i < 4; ++i) {
1139  if (uActualAge >=
1140  pAgeingTable[i]) // is the player old enough to need attrib adjust
1141  uAgeingMultiplier = pAgingAttributeModifier[attrId][i];
1142  else
1143  break;
1144  }
1145 
1146  uchar uConditionMult = pConditionAttributeModifier
1147  [attrId][GetMajorConditionIdx()]; // weak from disease or poison ect
1148  int magicBonus = GetMagicalBonus(attrId);
1149  int itemBonus = GetItemsBonus(attrId);
1150 
1151  return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 +
1152  magicBonus + itemBonus + this->*attrBonus;
1153 }
1154 
1155 //----- (0048CCF5) --------------------------------------------------------
1156 int Player::GetActualAttack(bool onlyMainHandDmg) {
1157  int parbonus = GetParameterBonus(
1158  GetActualAccuracy()); // bonus points for steps of accuracy level
1159  int atkskillbonus = GetSkillBonus(
1160  CHARACTER_ATTRIBUTE_ATTACK); // bonus for skill with weapon
1161  int weapbonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK,
1162  onlyMainHandDmg); // how good is weapon
1163 
1164  return parbonus + atkskillbonus + weapbonus +
1166  this->_some_attack_bonus;
1167 }
1168 
1169 //----- (0048CD45) --------------------------------------------------------
1171  int parbonus = GetParameterBonus(GetActualMight());
1172  int weapbonus = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN) + parbonus;
1173  int atkskillbonus =
1175 
1176  int result = _melee_dmg_bonus +
1178  atkskillbonus;
1179 
1180  if (result < 1) result = 1;
1181 
1182  return result;
1183 }
1184 
1185 //----- (0048CD90) --------------------------------------------------------
1187  int parbonus = GetParameterBonus(GetActualMight());
1188  int weapbonus = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX) + parbonus;
1189  int atkskillbonus =
1191 
1192  int result = this->_melee_dmg_bonus +
1194  atkskillbonus;
1195 
1196  if (result < 1) result = 1;
1197 
1198  return result;
1199 }
1200 
1201 //----- (0048CDDB) --------------------------------------------------------
1202 int Player::CalculateMeleeDamageTo(bool ignoreSkillBonus, bool ignoreOffhand,
1203  unsigned int uTargetActorID) {
1204  int mainWpnDmg = 0;
1205  int offHndWpnDmg = 0;
1206 
1207  if (IsUnarmed()) { // no weapons
1208  mainWpnDmg = rand() % 3 + 1;
1209  } else {
1210  if (HasItemEquipped(EQUIP_TWO_HANDED)) { // misleading - checks main
1211  // hand has something
1212  ItemGen* mainHandItemGen = this->GetMainHandItem();
1213  int itemId = mainHandItemGen->uItemID;
1214  bool addOneDice = false;
1215  if (pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR &&
1216  !this->pEquipment
1217  .uShield) // using spear in two hands adds a dice roll
1218  addOneDice = true;
1219 
1221  mainHandItemGen, uTargetActorID, addOneDice);
1222  }
1223 
1224  if (!ignoreOffhand) {
1225  if (this->HasItemEquipped(
1226  EQUIP_SINGLE_HANDED)) { // has second hand got a weapon
1227  // that not a shield
1228  ItemGen* offHandItemGen =
1229  (ItemGen*)&this
1230  ->pInventoryItemList[this->pEquipment.uShield - 1];
1231 
1232  if (offHandItemGen->GetItemEquipType() != EQUIP_SHIELD) {
1233  offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(
1234  offHandItemGen, uTargetActorID, false);
1235  }
1236  }
1237  }
1238  }
1239 
1240  int dmgSum = mainWpnDmg + offHndWpnDmg;
1241 
1242  if (!ignoreSkillBonus) {
1243  int mightBonus = GetParameterBonus(GetActualMight());
1244  int mightAndSkillbonus =
1246  dmgSum += this->_melee_dmg_bonus +
1248  mightAndSkillbonus;
1249  }
1250 
1251  if (dmgSum < 1) dmgSum = 1;
1252 
1253  return dmgSum;
1254 }
1255 
1257  unsigned int uTargetActorID,
1258  bool addOneDice) {
1259  int itemId = weapon->uItemID;
1260  int diceCount = pItemsTable->pItems[itemId].uDamageDice;
1261 
1262  if (addOneDice) diceCount++;
1263 
1264  int diceSides = pItemsTable->pItems[itemId].uDamageRoll;
1265  int diceResult = 0;
1266 
1267  for (int i = 0; i < diceCount; i++) { // roll dice
1268  diceResult += rand() % diceSides + 1;
1269  }
1270 
1271  int totalDmg =
1272  pItemsTable->pItems[itemId].uDamageMod + diceResult; // add modifer
1273 
1274  if (uTargetActorID > 0) { // if an actor has been provided
1275  int enchType =
1276  weapon->special_enchantment; // check against enchantments
1277 
1278  if (MonsterStats::BelongsToSupertype(uTargetActorID,
1280  (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE ||
1281  itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE)) {
1282  totalDmg *= 2; // double damage vs undead
1284  uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) &&
1285  (enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) {
1286  totalDmg *= 2; // double damage vs devils
1287  } else if (MonsterStats::BelongsToSupertype(uTargetActorID,
1289  (enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) {
1290  totalDmg *= 2; // double damage vs dragons
1291  } else if (MonsterStats::BelongsToSupertype(uTargetActorID,
1293  (enchType == 63 || itemId == ITEM_RELIC_OLD_NICK)) {
1294  totalDmg *= 2; // double damage vs elf
1295  } else if (MonsterStats::BelongsToSupertype(uTargetActorID,
1297  (enchType == 65)) {
1298  totalDmg *= 2; // double damage vs titan
1299  }
1300  }
1301 
1303  pItemsTable->pItems[itemId].uSkillType == 2 &&
1304  rand() % 100 < 10) // master dagger
1305  totalDmg *= 3; // triple damage backstab
1306 
1307  return totalDmg;
1308 }
1309 
1310 //----- (0048D0B9) --------------------------------------------------------
1312  int result;
1313  int weapbonus;
1314  int skillbonus;
1315 
1316  ItemGen* mainHandItem = GetMainHandItem();
1317 
1318  if (mainHandItem != nullptr &&
1319  (mainHandItem->uItemID < ITEM_BLASTER ||
1320  mainHandItem->uItemID > ITEM_LASER_RIFLE)) { // no blasters
1323  skillbonus =
1325  result = this->_ranged_atk_bonus +
1327  skillbonus;
1328  } else {
1329  result = GetActualAttack(true);
1330  }
1331 
1332  return result;
1333 }
1334 
1335 //----- (0048D124) --------------------------------------------------------
1338  int skillbonus =
1340  int result = this->_ranged_dmg_bonus +
1342  skillbonus;
1343 
1344  if (result < 0) // cant be less than 0
1345  result = 0;
1346 
1347  return result;
1348 }
1349 
1350 //----- (0048D191) --------------------------------------------------------
1353  int skillbonus =
1355  int result = this->_ranged_dmg_bonus +
1357  skillbonus;
1358 
1359  if (result < 0) result = 0;
1360 
1361  return result;
1362 }
1363 
1364 //----- (0048D1FE) --------------------------------------------------------
1365 int Player::CalculateRangedDamageTo(int uMonsterInfoID) {
1366  if (!HasItemEquipped(EQUIP_BOW)) // no bow
1367  return 0;
1368 
1369  ItemGen* bow =
1370  (ItemGen*)&this->pInventoryItemList[this->pEquipment.uBow - 1];
1371  int itemenchant = bow->special_enchantment;
1372 
1373  signed int dmgperroll = pItemsTable->pItems[bow->uItemID].uDamageRoll;
1374  int damagefromroll = 0;
1375  int damage = 0;
1376 
1377  for (int i = 0; i < pItemsTable->pItems[bow->uItemID].uDamageDice;
1378  i++) { // roll damage dice
1379  damagefromroll += ((rand() % dmgperroll) + 1);
1380  }
1381 
1382  damage = pItemsTable->pItems[bow->uItemID].uDamageMod +
1383  damagefromroll; // total damage
1384 
1385  if (uMonsterInfoID) { // check against bow enchantments
1386  if (itemenchant == 64 &&
1388  uMonsterInfoID,
1389  MONSTER_SUPERTYPE_UNDEAD)) { // double damage vs undead
1390  damage *= 2;
1391  } else if (itemenchant == 39 &&
1393  uMonsterInfoID,
1394  MONSTER_SUPERTYPE_KREEGAN)) { // double vs devils
1395  damage *= 2;
1396  } else if (itemenchant == 40 &&
1398  uMonsterInfoID,
1399  MONSTER_SUPERTYPE_DRAGON)) { // double vs dragons
1400  damage *= 2;
1401  } else if (itemenchant == 63 &&
1403  uMonsterInfoID,
1404  MONSTER_SUPERTYPE_ELF)) { // double vs elf
1405  damage *= 2;
1406  }
1407  }
1408 
1409  return damage + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS);
1410 }
1411 
1412 //----- (0048D2EA) --------------------------------------------------------
1414  int min_damage;
1415  int max_damage;
1416 
1417  ItemGen* mainHandItem = GetMainHandItem();
1418 
1419  if (mainHandItem != nullptr && (mainHandItem->uItemID >= ITEM_WAND_FIRE) &&
1420  (mainHandItem->uItemID <= ITEM_WAND_INCENERATION)) {
1421  return String(localization->GetString(595)); // Wand
1422  } else if (mainHandItem != nullptr &&
1423  (mainHandItem->uItemID == ITEM_BLASTER ||
1424  mainHandItem->uItemID == ITEM_LASER_RIFLE)) {
1425  min_damage =
1428  } else {
1429  min_damage = GetMeleeDamageMinimal(); // weapons
1430  max_damage = GetMeleeDamageMaximal();
1431  }
1432 
1433  if (min_damage == max_damage) {
1434  return StringPrintf("%d", min_damage); // build string
1435  } else {
1436  return StringPrintf("%d - %d", min_damage, max_damage); // build string
1437  }
1438 }
1439 
1440 //----- (0048D396) --------------------------------------------------------
1442  int min_damage;
1443  int max_damage;
1444 
1445  ItemGen* mainHandItem = GetMainHandItem();
1446 
1447  if (mainHandItem != nullptr && (mainHandItem->uItemID >= 135) &&
1448  (mainHandItem->uItemID <= 159)) {
1449  return String(localization->GetString(595)); // Wand
1450  } else if (mainHandItem != nullptr &&
1451  (mainHandItem->uItemID == ITEM_BLASTER ||
1452  mainHandItem->uItemID == ITEM_LASER_RIFLE)) {
1453  min_damage =
1456  } else {
1457  min_damage = GetRangedDamageMin(); // weaposn
1458  max_damage = GetRangedDamageMax();
1459  }
1460 
1461  if (max_damage > 0) {
1462  if (min_damage == max_damage) {
1463  return StringPrintf("%d", min_damage); // build string
1464  } else {
1465  return StringPrintf("%d - %d", min_damage,
1466  max_damage); // build string
1467  }
1468  } else {
1469  return String("N/A"); // no bow equipped
1470  }
1471 }
1472 
1473 //----- (0048D45A) --------------------------------------------------------
1475  int lvl = this->uLevel + 1;
1476  int neededExp = ((lvl * (lvl - 1)) / 2 * 1000);
1477  return this->uExperience >= neededExp;
1478 }
1479 
1480 //----- (0048D498) --------------------------------------------------------
1482  if (CanTrainToNextLevel())
1484  else
1486 }
1487 
1488 //----- (0048D4B3) --------------------------------------------------------
1490  if (classType == PLAYER_CLASS_LICH &&
1491  (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND ||
1492  dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY ||
1493  dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT)) // TODO(_): determine if spirit
1494  // resistance should be handled
1495  // by body res. modifier
1496  return 0; // liches are not affected by self magics
1497 
1498  int resist_value = 0;
1499 
1500  switch (dmg_type) { // get resistance
1501  case DMGT_FIRE:
1503  break;
1504  case DMGT_ELECTR:
1506  break;
1507  case DMGT_COLD:
1508  resist_value =
1510  break;
1511  case DMGT_EARTH:
1512  resist_value =
1514  break;
1515 
1516  case DMGT_SPIRIT:
1517  resist_value =
1519  break;
1520  case DMGT_MIND:
1522  break;
1523  case DMGT_BODY:
1525  break;
1526  }
1527 
1528  int player_luck = GetActualLuck();
1529  signed int res_rand_divider =
1530  GetParameterBonus(player_luck) + resist_value + 30;
1531 
1532  if (GetParameterBonus(player_luck) + resist_value > 0) {
1533  for (int i = 0; i < 4; i++) {
1534  if (rand() % res_rand_divider >= 30)
1535  dmg /= 2; // damage reduction on successful check
1536  else
1537  break;
1538  }
1539  }
1540 
1541  ItemGen* equippedArmor = GetArmorItem();
1542  if ((dmg_type == DMGT_PHISYCAL) &&
1543  (equippedArmor != nullptr)) { // physical damage and wearing armour
1544  if (!equippedArmor->IsBroken()) { // armour isnt broken
1545  int armor_skill = equippedArmor->GetPlayerSkillType();
1546 
1547  if (armor_skill == PLAYER_SKILL_PLATE) {
1549  3) // master and above half incoming damage
1550  return dmg / 2;
1551  }
1552 
1553  if (armor_skill == PLAYER_SKILL_CHAIN) {
1555  4) // gm cahin reducing damage
1556  return dmg * 2 / 3;
1557  }
1558  }
1559  }
1560 
1561  return dmg;
1562 }
1563 
1564 //----- (0048D62C) --------------------------------------------------------
1566  return GetNthEquippedIndexItem(uEquipSlot)->GetItemEquipType();
1567 }
1568 
1569 //----- (0048D651) --------------------------------------------------------
1571  return (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(uEquipSlot)
1572  ->GetPlayerSkillType();
1573 }
1574 
1575 //----- (0048D676) --------------------------------------------------------
1577  return !HasItemEquipped(EQUIP_TWO_HANDED) &&
1580 }
1581 
1582 //----- (0048D6AA) --------------------------------------------------------
1584  uint i = pEquipment.pIndices[uEquipIndex];
1585  if (i)
1586  return !pOwnItems[i - 1].IsBroken();
1587  else
1588  return false;
1589 }
1590 
1591 //----- (0048D6D0) --------------------------------------------------------
1592 bool Player::HasEnchantedItemEquipped(int uEnchantment) {
1593  for (uint i = 0; i < 16; ++i) { // search over equipped inventory
1594  if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
1595  GetNthEquippedIndexItem(i)->special_enchantment == uEnchantment)
1596  return true; // check item equipped and is enchanted
1597  }
1598 
1599  return false; // no echanted items equipped
1600 }
1601 
1602 //----- (0048D709) --------------------------------------------------------
1603 bool Player::WearsItem(int item_id, ITEM_EQUIP_TYPE equip_type) {
1604  // check aginst specific item and slot
1605  return (HasItemEquipped(equip_type) &&
1606  GetNthEquippedIndexItem(equip_type)->uItemID == item_id);
1607 }
1608 
1609 bool Player::WearsItemAnyWhere(int item_id) {
1610  for (int i = 0; i < 16; i++) { // check over equipped inventory
1611  if (WearsItem(item_id, (ITEM_EQUIP_TYPE)i)) {
1612  return true; // foudn item
1613  }
1614  }
1615 
1616  return false; // item not equipped
1617 }
1618 
1619 //----- (0048D76C) --------------------------------------------------------
1621  ItemGen* itemToSteal, int extraStealDifficulty, int reputation,
1622  int extraStealFine,
1623  int* fineIfFailed) { // returns an int, but is the return value is compared
1624  // to zero, so might change to bool
1625 
1626  // fineiffailed is changed!
1627 
1628  if (!itemToSteal || !CanAct()) {
1629  return 0; // no item or cant act - no stealing
1630  } else {
1631  unsigned int stealskill =
1633  unsigned int stealmaster =
1635  unsigned int itemvalue = itemToSteal->GetValue();
1636  int equiptype = itemToSteal->GetItemEquipType();
1637 
1638  if (equiptype == EQUIP_SINGLE_HANDED || equiptype == EQUIP_TWO_HANDED ||
1639  equiptype == EQUIP_BOW)
1640  itemvalue *= 3;
1641 
1642  int currMaxItemValue = StealingRandomBonuses[rand() % 5] +
1643  stealskill * StealingMasteryBonuses[stealmaster];
1644  *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue;
1645 
1646  if (extraStealFine) {
1647  *fineIfFailed += 500;
1648  }
1649 
1650  if (rand() % 100 >= 5) {
1651  if (*fineIfFailed > currMaxItemValue) {
1652  if (*fineIfFailed - currMaxItemValue < 500) {
1653  return 1; // fail with item
1654  } else {
1655  return 0; // failed no item
1656  }
1657  } else {
1658  return 2; // perfect crime
1659  }
1660  } else {
1661  return 0; // failed no item
1662  }
1663  }
1664 }
1665 
1666 //----- (0048D88B) --------------------------------------------------------
1668  unsigned int uActorID, int _steal_perm,
1669  int reputation) { // returns not used - should luck attribute affect
1670 
1671  Actor* actroPtr;
1672  actroPtr = &pActors[uActorID];
1673 
1674  if (!actroPtr || !CanAct()) { // no actor to steal from or player cant act
1675  return 0;
1676  }
1677 
1678  if (!actroPtr->ActorHasItem()) // if actor does not have an item
1679  actroPtr->SetRandomGoldIfTheresNoItem(); // add some gold
1680 
1681  unsigned int stealskill = this->GetActualSkillLevel(PLAYER_SKILL_STEALING);
1682  unsigned int stealingMastery =
1684  int currMaxItemValue = StealingRandomBonuses[rand() % 5] +
1685  stealskill * StealingMasteryBonuses[stealingMastery];
1686  int fineIfFailed =
1687  actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation);
1688 
1689  if (rand() % 100 < 5 || fineIfFailed > currMaxItemValue ||
1690  actroPtr->ActorEnemy()) { // busted
1691  Actor::AggroSurroundingPeasants(uActorID, 1);
1693  376, this->pName)); // %s was caught stealing!
1694  return 0; // no item fail
1695  } else {
1696  int random = rand();
1697 
1698  if (random % 100 >= 70) { // stealing gold
1699  if (actroPtr->ActorHasItems[3].GetItemEquipType() !=
1700  EQUIP_GOLD) { // no gold to steal fail
1702  377, this->pName)); // %s failed to steal anything
1703  return 1;
1704  }
1705 
1706  unsigned int enchBonusSum = 0; // how much to steal
1707  for (int i = 0; i < stealskill; i++)
1708  enchBonusSum +=
1709  rand() % StealingEnchantmentBonusForSkill[stealingMastery] +
1710  1; // add random stealing bonuses
1711 
1712  int* enchTypePtr;
1713  enchTypePtr = (int*)&actroPtr->ActorHasItems[3]
1714  .special_enchantment; // this is the amount of
1715  // gold the actor has
1716 
1717  if ((int)enchBonusSum >= *enchTypePtr) { // steal all the gold
1718  enchBonusSum = *enchTypePtr;
1719  actroPtr->ActorHasItems[3].uItemID = ITEM_NULL;
1720  *enchTypePtr = 0;
1721  } else {
1722  *enchTypePtr -= enchBonusSum; // steal some of the gold
1723  }
1724 
1725  if (enchBonusSum) {
1726  pParty->PartyFindsGold(enchBonusSum, 2);
1728  302, this->pName, enchBonusSum)); // %s stole %d gold
1729  } else {
1731  377, this->pName)); // %s failed to steal anything
1732  }
1733 
1734  return 2; // stole gold
1735  } else if (random % 100 >= 40) { // stealing an item
1736  ItemGen tempItem;
1737  tempItem.Reset();
1738 
1739  int randslot = rand() % 4;
1740  unsigned int carriedItemId =
1741  actroPtr
1742  ->uCarriedItemID; // carried items are special items the
1743  // ncp carries (ie lute from bard)
1744 
1745  if (carriedItemId != 0 ||
1746  actroPtr->ActorHasItems[randslot].uItemID != 0 &&
1747  actroPtr->ActorHasItems[randslot].GetItemEquipType() !=
1748  EQUIP_GOLD) { // check we have an item to steal
1749  if (carriedItemId != 0) { // load item into tempitem
1750  actroPtr->uCarriedItemID = 0;
1751  tempItem.uItemID = carriedItemId;
1752  if (pItemsTable->pItems[carriedItemId].uEquipType ==
1753  EQUIP_WAND)
1754  tempItem.uNumCharges =
1755  rand() % 6 +
1756  pItemsTable->pItems[carriedItemId].uDamageMod + 1;
1757  else if (pItemsTable->pItems[carriedItemId].uEquipType ==
1758  EQUIP_POTION &&
1759  carriedItemId != ITEM_POTION_BOTTLE)
1760  tempItem.uEnchantmentType = 2 * rand() % 4 + 2;
1761  } else {
1762  ItemGen* itemToSteal = &actroPtr->ActorHasItems[randslot];
1763  memcpy(&tempItem, itemToSteal, sizeof(tempItem));
1764  itemToSteal->Reset();
1765  carriedItemId = tempItem.uItemID;
1766  }
1767 
1768  if (carriedItemId !=
1769  0) { // looks odd in current context, but avoids accessing
1770  // zeroth element of pItemsTable->pItems
1771 
1773  304, // Official //TODO: add a normal
1774  // "%d stole %d" message
1775  this->pName,
1776  pItemsTable->pItems[carriedItemId].pUnidentifiedName));
1777 
1778  pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem(); // drop or place picked item
1779 
1780  memcpy(
1781  &pParty->pPickedItem, &tempItem,
1782  sizeof(ItemGen)); // copy item in to mouse picked item
1783  mouse->SetCursorBitmapFromItemID(carriedItemId);
1784  return 2; // stole item
1785  }
1786  }
1787  }
1788 
1790  377, this->pName)); // %s failed to steal anything
1791  return 1;
1792  }
1793 }
1794 
1795 //----- (0048DBB9) --------------------------------------------------------
1796 void Player::Heal(int amount) {
1797  if (!IsEradicated() && !IsDead()) { // cant heal
1798  int max_health = GetMaxHealth();
1799 
1800  if (IsZombie()) // zombie health is halved
1801  max_health /= 2;
1802 
1803  sHealth += amount; // add health
1804  if (sHealth > max_health) // limits check
1805  sHealth = max_health;
1806 
1807  if (IsUnconcious()) {
1808  if (sHealth > 0) { // wake up if health rises above 0
1809  SetUnconcious(GameTime(0));
1810  }
1811  }
1812  }
1813 }
1814 
1815 //----- (0048DC1E) --------------------------------------------------------
1816 int Player::ReceiveDamage(signed int amount, DAMAGE_TYPE dmg_type) {
1817  SetAsleep(GameTime(0)); // wake up if asleep
1818  signed int recieved_dmg = CalculateIncommingDamage(dmg_type, amount); // get damage
1819  // for no damage cheat - moved from elsewhere
1820  if (!engine->config->NoDamage()) {
1821  sHealth -= recieved_dmg; // reduce health
1822  }
1823 
1824  if (sHealth < 1) { // player unconscious or if too hurt - dead
1825  if ((sHealth + uEndurance +
1827  1) ||
1830  } else {
1832  }
1833 
1834  if (sHealth <= -10) { // break armor if health has dropped below -10
1835  ItemGen* equippedArmor = GetArmorItem();
1836  if (equippedArmor != nullptr) { // check there is some armor
1837  if (!(equippedArmor->uAttributes &
1838  ITEM_HARDENED)) { // if its not hardened
1839  equippedArmor->SetBroken(); // break it
1840  }
1841  }
1842  }
1843  }
1844 
1845  if (recieved_dmg && CanAct()) PlaySound(SPEECH_24, 0); // oww
1846 
1847  return recieved_dmg;
1848 }
1849 
1850 //----- (0048DCF6) --------------------------------------------------------
1852  int attType,
1853  struct Actor* pActor) { // long function - consider breaking into two??
1854 
1855  SPECIAL_ATTACK_TYPE attTypeCast = (SPECIAL_ATTACK_TYPE)attType;
1856 
1857  int statcheck;
1858  int statcheckbonus;
1859  int luckstat = GetActualLuck();
1860  signed int itemstobreakcounter = 0;
1861  char itemstobreaklist[140];
1862  ItemGen* itemtocheck = nullptr;
1863  ItemGen* itemtobreak = nullptr;
1864  unsigned int itemtostealinvindex = 0;
1865 
1866  switch (attTypeCast) {
1867  case SPECIAL_ATTACK_CURSE:
1868  statcheck = GetActualWillpower();
1869  statcheckbonus = GetParameterBonus(statcheck);
1870  break;
1871 
1872  case SPECIAL_ATTACK_WEAK:
1873  case SPECIAL_ATTACK_SLEEP:
1874  case SPECIAL_ATTACK_DRUNK:
1879  case SPECIAL_ATTACK_AGING:
1880  statcheck = GetActualEndurance();
1881  statcheckbonus = GetParameterBonus(statcheck);
1882  break;
1883 
1884  case SPECIAL_ATTACK_INSANE:
1886  case SPECIAL_ATTACK_FEAR:
1887  statcheckbonus =
1889  break;
1890 
1892  statcheckbonus =
1894  break;
1895 
1899  case SPECIAL_ATTACK_DEAD:
1901  statcheckbonus =
1903  break;
1904 
1906  statcheckbonus = (GetParameterBonus(GetActualIntelligence()) +
1908  2;
1909  break;
1910 
1912  for (int i = 0; i < 138; i++) {
1913  itemtocheck = &this->pInventoryItemList[i];
1914 
1915  if (itemtocheck->uItemID > 0 && itemtocheck->uItemID <= 134 &&
1916  !itemtocheck->IsBroken())
1917  itemstobreaklist[itemstobreakcounter++] = i;
1918  }
1919 
1920  if (!itemstobreakcounter) return 0;
1921 
1922  itemtobreak = &this->pInventoryItemList
1923  [itemstobreaklist[rand() % itemstobreakcounter]];
1924  statcheckbonus =
1925  3 * (pItemsTable->pItems[itemtobreak->uItemID].uMaterial +
1926  itemtobreak->GetDamageMod());
1927  break;
1928 
1930  for (int i = 0; i < 16; i++) {
1931  if (HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
1932  if (i == EQUIP_ARMOUR)
1933  itemstobreaklist[itemstobreakcounter++] =
1934  this->pEquipment.uArmor - 1;
1935 
1936  if ((i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) &&
1938  EQUIP_SHIELD)
1939  itemstobreaklist[itemstobreakcounter++] =
1940  this->pEquipment.pIndices[i] - 1;
1941  }
1942  }
1943 
1944  if (!itemstobreakcounter) return 0;
1945 
1946  itemtobreak = &this->pInventoryItemList
1947  [itemstobreaklist[rand() % itemstobreakcounter]];
1948  statcheckbonus =
1949  3 * (pItemsTable->pItems[itemtobreak->uItemID].uMaterial +
1950  itemtobreak->GetDamageMod());
1951  break;
1952 
1954  for (int i = 0; i < 16; i++) {
1955  if (HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
1956  if (i == EQUIP_BOW)
1957  itemstobreaklist[itemstobreakcounter++] =
1958  (unsigned char)(this->pEquipment.uBow) - 1;
1959 
1960  if ((i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) &&
1965  itemstobreaklist[itemstobreakcounter++] =
1966  this->pEquipment.pIndices[i] - 1;
1967  }
1968  }
1969 
1970  if (!itemstobreakcounter) return 0;
1971 
1972  itemtobreak = &this->pInventoryItemList
1973  [itemstobreaklist[rand() % itemstobreakcounter]];
1974  statcheckbonus =
1975  3 * (pItemsTable->pItems[itemtobreak->uItemID].uMaterial +
1976  itemtobreak->GetDamageMod());
1977  break;
1978 
1979  case SPECIAL_ATTACK_STEAL:
1980  for (int i = 0; i < 126; i++) {
1981  int ItemPosInList = this->pInventoryMatrix[i];
1982 
1983  if (ItemPosInList > 0) {
1984  itemtocheck = &this->pInventoryItemList[ItemPosInList - 1];
1985 
1986  if (itemtocheck->uItemID > 0 &&
1987  itemtocheck->uItemID <= 134) {
1988  itemstobreaklist[itemstobreakcounter++] = i;
1989  }
1990  }
1991  }
1992 
1993  if (!itemstobreakcounter) return 0;
1994 
1995  itemtostealinvindex =
1996  itemstobreaklist[rand() % itemstobreakcounter];
1997  statcheck = GetActualAccuracy();
1998  statcheckbonus = GetParameterBonus(statcheck);
1999  break;
2000 
2001  default:
2002  statcheckbonus = 0;
2003  break;
2004  }
2005 
2006  signed int savecheck = GetParameterBonus(luckstat) + statcheckbonus + 30;
2007  signed int whichplayer;
2008 
2009  if (rand() % savecheck >= 30) { // saving throw if attacke is avoided
2010  return 0;
2011  } else {
2012  for (whichplayer = 0; whichplayer < 4; whichplayer++) {
2013  if (this == pPlayers[whichplayer + 1]) break;
2014  }
2015 
2016  // pass this to new fucntion??
2017  // atttypecast - whichplayer - itemtobreak - itemtostealinvindex
2018 
2019  switch (attTypeCast) {
2020  case SPECIAL_ATTACK_CURSE:
2022  pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0);
2023  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2024  return 1;
2025  break;
2026 
2027  case SPECIAL_ATTACK_WEAK:
2029  pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0);
2030  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2031  return 1;
2032  break;
2033 
2034  case SPECIAL_ATTACK_SLEEP:
2036  pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0);
2037  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2038  return 1;
2039  break;
2040 
2041  case SPECIAL_ATTACK_DRUNK:
2043  pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0);
2044  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2045  return 1;
2046  break;
2047 
2048  case SPECIAL_ATTACK_INSANE:
2050  pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0);
2051  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2052  return 1;
2053  break;
2054 
2057  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2058  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2059  return 1;
2060  break;
2061 
2064  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2065  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2066  return 1;
2067  break;
2068 
2071  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2072  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2073  return 1;
2074  break;
2075 
2078  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2079  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2080  return 1;
2081  break;
2082 
2085  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2086  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2087  return 1;
2088  break;
2089 
2092  pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0);
2093  spell_fx_renderer->SetPlayerBuffAnim(0x99, whichplayer);
2094  return 1;
2095  break;
2096 
2099  pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0);
2100  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2101  return 1;
2102  break;
2103 
2106  pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0);
2107  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2108  return 1;
2109  break;
2110 
2111  case SPECIAL_ATTACK_DEAD:
2113  pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0);
2114  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2115  return 1;
2116  break;
2117 
2120  pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0);
2121  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2122  return 1;
2123  break;
2124 
2127  pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0);
2128  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2129  return 1;
2130  break;
2131 
2135  if (!(itemtobreak->uAttributes & ITEM_HARDENED)) {
2136  PlaySound(SPEECH_40, 0);
2137  itemtobreak->SetBroken();
2139  }
2140  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2141  return 1;
2142  break;
2143 
2144  case SPECIAL_ATTACK_STEAL:
2145  PlaySound(SPEECH_40, 0);
2146  void* actoritems;
2147  actoritems = pActor->ActorHasItems;
2148  if (pActor->ActorHasItems[0].uItemID) {
2149  actoritems = &pActor->ActorHasItems[1];
2150  if (pActor->ActorHasItems[1].uItemID) {
2151  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2152  return 1;
2153  }
2154  }
2155 
2156  memcpy(actoritems,
2157  &this->pInventoryItemList[this->pInventoryMatrix[itemtostealinvindex] - 1],
2158  0x24u);
2159  RemoveItemAtInventoryIndex(itemtostealinvindex);
2161  0, 0);
2162  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2163  return 1;
2164  break;
2165 
2166  case SPECIAL_ATTACK_AGING:
2167  PlaySound(SPEECH_42, 0);
2168  ++this->sAgeModifier;
2169  pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0);
2170  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2171  return 1;
2172  break;
2173 
2175  PlaySound(SPEECH_41, 0);
2176  this->sMana = 0;
2177  pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0);
2178  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2179  return 1;
2180  break;
2181 
2182  case SPECIAL_ATTACK_FEAR:
2184  pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0);
2185  spell_fx_renderer->SetPlayerBuffAnim(0x99u, whichplayer);
2186  return 1;
2187  break;
2188 
2189  default:
2190  return 0;
2191  }
2192  }
2193 }
2194 
2195 // 48DCF6: using guessed type char var_94[140];
2196 
2197 //----- (0048E1A3) --------------------------------------------------------
2198 unsigned int Player::GetSpellSchool(unsigned int uSpellID) {
2199  return pSpellStats->pInfos[uSpellID].uSchool;
2200 }
2201 
2202 //----- (0048E1B5) --------------------------------------------------------
2203 int Player::GetAttackRecoveryTime(bool bRangedAttack) {
2204  ItemGen* weapon = nullptr;
2205  uint weapon_recovery = base_recovery_times_per_weapon_type[0];
2206  if (bRangedAttack) {
2207  if (HasItemEquipped(EQUIP_BOW)) {
2208  weapon = GetBowItem();
2209  weapon_recovery =
2211  ->GetPlayerSkillType()];
2212  }
2213  } else if (IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) {
2214  weapon_recovery = base_recovery_times_per_weapon_type[1];
2215  } else if (HasItemEquipped(EQUIP_TWO_HANDED)) {
2216  weapon = GetMainHandItem();
2217  if (weapon->GetItemEquipType() == EQUIP_WAND) {
2218  // __debugbreak(); // looks like offset in player's inventory and
2219  // wand_lut much like case in 0042ECB5
2220  // __debugbreak(); // looks like wands were two-handed weapons once,
2221  // or supposed to be. should not get here now
2222  weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery;
2223  } else {
2224  weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
2225  }
2226  }
2229  // ADD: shield check because shield recovery is added later and can be
2230  // accidentally doubled
2232  ->GetPlayerSkillType()] >
2233  weapon_recovery) {
2234  weapon = GetOffHandItem();
2235  weapon_recovery =
2237  ->GetPlayerSkillType()];
2238  }
2239  }
2240 
2241  uint armour_recovery = 0;
2243  uchar armour_skill_type = GetArmorItem()->GetPlayerSkillType();
2244  uint base_armour_recovery =
2245  base_recovery_times_per_weapon_type[armour_skill_type];
2246  float multiplier;
2247 
2248  if (armour_skill_type == PLAYER_SKILL_LEATHER) {
2250  armour_skill_type, 1.0f, 0, 0, 0);
2251  } else if (armour_skill_type == PLAYER_SKILL_CHAIN) {
2253  armour_skill_type, 1.0f, 0.5f, 0, 0);
2254  } else if (armour_skill_type == PLAYER_SKILL_PLATE) {
2256  armour_skill_type, 1.0f, 0.5f, 0.5f, 0);
2257  } else {
2258  // PLAYER_SKILL_MISC
2259  // any others?
2261  armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f);
2262  }
2263 
2264  armour_recovery = (uint)(base_armour_recovery * multiplier);
2265  }
2266 
2267  uint shield_recovery = 0;
2270  uchar skill_type = GetOffHandItem()->GetPlayerSkillType();
2271 
2272  uint shield_base_recovery =
2274  float multiplier =
2275  GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0);
2276  shield_recovery = (uint)(shield_base_recovery * multiplier);
2277  }
2278 
2279  uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()),
2280  sword_axe_bow_recovery_reduction = 0;
2281  bool shooting_laser = false;
2282  if (weapon != nullptr) {
2283  if (GetActualSkillLevel(
2284  (PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) &&
2285  (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD ||
2286  weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE ||
2287  weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW)) {
2289  2) // Expert Sword, Axe & Bow reduce recovery
2290  sword_axe_bow_recovery_reduction =
2291  pActiveSkills[weapon->GetPlayerSkillType()] & 0x3F;
2292  }
2293  if (weapon->GetPlayerSkillType() == PLAYER_SKILL_BLASTER)
2294  shooting_laser = true;
2295  }
2296 
2297  uint armsmaster_recovery_reduction = 0;
2298  if (!bRangedAttack && !shooting_laser) {
2299  if (uint armsmaster_level =
2301  armsmaster_recovery_reduction = armsmaster_level & 0x3F;
2302  if (SkillToMastery(armsmaster_level) >= 4)
2303  armsmaster_recovery_reduction *= 2;
2304  }
2305  }
2306 
2307  uint hasteRecoveryReduction = 0;
2308  if (pPlayerBuffs[PLAYER_BUFF_HASTE].Active()) hasteRecoveryReduction = 25;
2309  if (pParty->pPartyBuffs[PARTY_BUFF_HASTE].Active()) hasteRecoveryReduction = 25;
2310 
2311  uint weapon_enchantment_recovery_reduction = 0;
2312  if (weapon) {
2313  if (weapon->special_enchantment == 59 ||
2314  weapon->special_enchantment == 41 ||
2315  weapon->special_enchantment == 500)
2316  weapon_enchantment_recovery_reduction = 20;
2317  }
2318 
2319  int recovery = weapon_recovery + armour_recovery + shield_recovery -
2320  armsmaster_recovery_reduction -
2321  weapon_enchantment_recovery_reduction -
2322  hasteRecoveryReduction - sword_axe_bow_recovery_reduction -
2323  player_speed_recovery_reduction;
2324 
2325  if (recovery < 0) recovery = 0;
2326  return recovery;
2327 }
2328 
2329 //----- new --------------------------------------------------------
2331  unsigned char armour_skill_type, float mult1, float mult2, float mult3,
2332  float mult4) {
2333  uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]);
2334 
2335  switch (skill_mastery) {
2336  case 1:
2337  return mult1;
2338  break;
2339  case 2:
2340  return mult2;
2341  break;
2342  case 3:
2343  return mult3;
2344  break;
2345  case 4:
2346  return mult4;
2347  break;
2348  }
2349  Error("Unexpected input value: %d", armour_skill_type);
2350  return 0;
2351 }
2352 
2353 //----- (0048E4F8) --------------------------------------------------------
2355  int endbonus = GetParameterBonus(GetActualEndurance());
2356  int healthbylevel =
2358  int itembonus = GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH) + healthbylevel;
2359  int maxhealth = uFullHealthBonus + pBaseHealthByClass[classType / 4] +
2361 
2362  if (maxhealth < 0) // min zero
2363  maxhealth = 0;
2364 
2365  return maxhealth;
2366 }
2367 
2368 //----- (0048E565) --------------------------------------------------------
2370  int mainmanastat;
2371  int statbonus;
2372  int addmanastat;
2373 
2374  switch (classType) {
2375  case PLAYER_CLASS_ROGUE:
2376  case PLAYER_CLASS_SPY:
2377  case PLAYER_CLASS_ASSASSIN:
2378  case PLAYER_CLASS_ARCHER:
2381  case PLAYER_CLASS_SNIPER:
2382  case PLAYER_CLASS_SORCERER:
2383  case PLAYER_CLASS_WIZARD:
2384  case PLAYER_CLASS_ARCHMAGE:
2385  case PLAYER_CLASS_LICH:
2386  // intelligence based mana
2387  mainmanastat = GetActualIntelligence();
2388  statbonus = GetParameterBonus(mainmanastat);
2389  break;
2390 
2391  case PLAYER_CLASS_INITIATE:
2392  case PLAYER_CLASS_MASTER:
2393  case PLAYER_CLASS_NINJA:
2394  case PLAYER_CLASS_PALADIN:
2395  case PLAYER_CLASS_CRUSADER:
2396  case PLAYER_CLASS_HERO:
2397  case PLAYER_CLASS_VILLIAN:
2398  case PLAYER_CLASS_CLERIC:
2399  case PLAYER_CLASS_PRIEST:
2402  // personality based mana
2403  mainmanastat = GetActualWillpower();
2404  statbonus = GetParameterBonus(mainmanastat);
2405  break;
2406 
2407  case PLAYER_CLASS_HUNTER:
2410  case PLAYER_CLASS_DRUID:
2413  case PLAYER_CLASS_WARLOCK:
2414  // mixed base mana
2415  mainmanastat = GetActualWillpower();
2416  statbonus = GetParameterBonus(mainmanastat);
2417  addmanastat = GetActualIntelligence();
2418  statbonus += GetParameterBonus(addmanastat);
2419  break;
2420 
2421  default: // no magic
2422  return 0;
2423  break;
2424  }
2425 
2426  int manabylevel =
2428  int itembonus = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA) + manabylevel;
2429  int maxmana = uFullManaBonus + pBaseManaByClass[classType / 4] +
2431 
2432  if (maxmana < 0) // min of 0
2433  maxmana = 0;
2434 
2435  return maxmana;
2436 }
2437 
2438 //----- (0048E656) --------------------------------------------------------
2440  int acc = GetActualAccuracy();
2441  int accbonus = GetParameterBonus(acc);
2442  int itembonus = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + accbonus;
2443  int skillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + itembonus;
2444 
2445  if (skillbonus < 0) // min zero
2446  skillbonus = 0;
2447 
2448  return skillbonus;
2449 }
2450 
2451 //----- (0048E68F) --------------------------------------------------------
2453  int acc = GetActualAccuracy();
2454  int accbonus = GetParameterBonus(acc);
2455  int itembonus = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + accbonus;
2456  int skillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + itembonus;
2457 
2458  int result = this->sACModifier +
2460 
2461  if (result < 0) // min zero
2462  result = 0;
2463 
2464  return result;
2465 }
2466 
2467 //----- (0048E6DC) --------------------------------------------------------
2468 unsigned int Player::GetBaseAge() {
2469  return pParty->GetPlayingTime().GetYears() - this->uBirthYear +
2471 }
2472 
2473 //----- (0048E72C) --------------------------------------------------------
2474 unsigned int Player::GetActualAge() {
2475  return this->sAgeModifier + GetBaseAge();
2476 }
2477 
2478 //----- (0048E73F) --------------------------------------------------------
2480  int v7; // esi@20
2481  int racialBonus = 0;
2482  __int16* resStat;
2483  int result;
2484 
2485  switch (a2) {
2487  resStat = &sResFireBase;
2488  if (IsRaceGoblin()) racialBonus = 5;
2489  break;
2491  resStat = &sResAirBase;
2492  if (IsRaceGoblin()) racialBonus = 5;
2493  break;
2495  resStat = &sResWaterBase;
2496  if (IsRaceDwarf()) racialBonus = 5;
2497  break;
2499  resStat = &sResEarthBase;
2500  if (IsRaceDwarf()) racialBonus = 5;
2501  break;
2503  resStat = &sResMindBase;
2504  if (IsRaceElf()) racialBonus = 10;
2505  break;
2508  resStat = &sResBodyBase;
2509  if (IsRaceHuman()) racialBonus = 5;
2510  break;
2511  default:
2512  Error("Unknown attribute");
2513  }
2514  v7 = GetItemsBonus(a2) + racialBonus;
2515  result = v7 + *resStat;
2516  if (classType == PLAYER_CLASS_LICH) {
2517  if (result > 200) result = 200;
2518  }
2519  return result;
2520 }
2521 
2522 //----- (0048E7D0) --------------------------------------------------------
2524  signed int v10 = 0; // [sp+14h] [bp-4h]@1
2525  __int16* resStat;
2526  int result;
2527  int baseRes;
2528 
2529  int leatherArmorSkillLevel = GetActualSkillLevel(PLAYER_SKILL_LEATHER);
2530 
2531  if (CheckHiredNPCSpeciality(Enchanter)) v10 = 20;
2532  if ((a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ||
2539  v10 += leatherArmorSkillLevel; // &0x3F;
2540 
2541  switch (a2) {
2543  resStat = &sResFireBonus;
2544  break;
2546  resStat = &sResAirBonus;
2547  break;
2549  resStat = &sResWaterBonus;
2550  break;
2552  resStat = &sResEarthBonus;
2553  break;
2555  resStat = &sResMindBonus;
2556  break;
2559  resStat = &sResBodyBonus;
2560  break;
2561  default:
2562  Error("Unexpected attribute");
2563  }
2564  baseRes = GetBaseResistance(a2);
2565  result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat);
2566  if (classType == PLAYER_CLASS_LICH) {
2567  if (result > 200) result = 200;
2568  }
2569  return result;
2570 }
2571 
2572 //----- (0048E8F5) --------------------------------------------------------
2573 bool Player::Recover(int dt) {
2574  int timepassed =
2576  dt);
2577 
2578  if (uTimeToRecovery > timepassed) { // need more time till recovery
2579  uTimeToRecovery -= timepassed;
2580  return true;
2581  } else {
2582  uTimeToRecovery = 0; // recovered
2583  viewparams->bRedrawGameUI = true;
2584 
2585  if (!uActiveCharacter) // set recoverd char as active
2587 
2588  return false;
2589  }
2590 }
2591 
2592 //----- (0048E96A) --------------------------------------------------------
2593 void Player::SetRecoveryTime(signed int rec) {
2594  Assert(rec >= 0);
2595 
2596  if (rec > uTimeToRecovery) uTimeToRecovery = rec;
2597 
2598  if (uActiveCharacter != 0 && pPlayers[uActiveCharacter] == this &&
2601 
2602  viewparams->bRedrawGameUI = true;
2603 }
2604 
2605 //----- (0048E9B7) --------------------------------------------------------
2607  if (!uExpressionTimePassed)
2608  strcpy(
2609  pName,
2611 }
2612 
2613 //----- (0048E9F4) --------------------------------------------------------
2615  for (uint i = 0; i < 18; ++i) {
2617  return pConditionImportancyTable[i]; // return worst condition
2618  }
2619  return 18; // condition good
2620 }
2621 
2622 //----- (0048EA1B) --------------------------------------------------------
2623 int Player::GetParameterBonus(int player_parameter) {
2624  int i; // eax@1
2625  i = 0;
2626  while (param_to_bonus_table[i]) {
2627  if (player_parameter >= param_to_bonus_table[i]) break;
2628  ++i;
2629  }
2630  return parameter_to_bonus_value[i];
2631 }
2632 
2633 //----- (0048EA46) --------------------------------------------------------
2635  for (int i = EQUIP_SINGLE_HANDED; i < EQUIP_BOOK; ++i) {
2636  if (HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
2637  if (enchantment == ITEM_ENCHANTMENT_OF_RECOVERY) {
2638  if (GetNthEquippedIndexItem(i)->special_enchantment ==
2640  (GetNthEquippedIndexItem(i)->uItemID ==
2642  return 50;
2643  }
2644  if (enchantment == ITEM_ENCHANTMENT_OF_FORCE) {
2645  if (GetNthEquippedIndexItem(i)->special_enchantment ==
2647  return 5;
2648  }
2649  }
2650  }
2651  return 0;
2652 }
2653 
2654 //----- (0048EAAE) --------------------------------------------------------
2656  bool getOnlyMainHandDmg /*= false*/) {
2657  int v5; // edi@1
2658  int v9; // eax@49
2659  int v14; // ecx@58
2660  int v15; // eax@58
2661  int v17; // eax@62
2662  int v22; // eax@76
2663  int v25; // ecx@80
2664  int v26; // edi@80
2665  int v32; // eax@98
2666  int v56; // eax@365
2667  signed int v58; // [sp-4h] [bp-20h]@10
2668  int v61; // [sp+10h] [bp-Ch]@1
2669  int v62; // [sp+14h] [bp-8h]@1
2670  ItemGen* currEquippedItem; // [sp+20h] [bp+4h]@101
2671  bool no_skills;
2672 
2673  v5 = 0;
2674  v62 = 0;
2675  v61 = 0;
2676 
2677  no_skills = false;
2678  switch (attr) {
2680  v58 = PLAYER_SKILL_ALCHEMY;
2681  break;
2683  v58 = PLAYER_SKILL_STEALING;
2684  break;
2687  break;
2689  v58 = PLAYER_SKILL_ITEM_ID;
2690  break;
2693  break;
2696  break;
2698  v58 = PLAYER_SKILL_DODGE;
2699  break;
2701  v58 = PLAYER_SKILL_UNARMED;
2702  break;
2704  v58 = PLAYER_SKILL_FIRE;
2705  break;
2707  v58 = PLAYER_SKILL_AIR;
2708  break;
2710  v58 = PLAYER_SKILL_WATER;
2711  break;
2713  v58 = PLAYER_SKILL_EARTH;
2714  break;
2716  v58 = PLAYER_SKILL_SPIRIT;
2717  break;
2719  v58 = PLAYER_SKILL_MIND;
2720  break;
2722  v58 = PLAYER_SKILL_BODY;
2723  break;
2725  v58 = PLAYER_SKILL_LIGHT;
2726  break;
2728  v58 = PLAYER_SKILL_DARK;
2729  break;
2732  break;
2734  v58 = PLAYER_SKILL_BOW;
2735  break;
2737  v58 = PLAYER_SKILL_SHIELD;
2738  break;
2740  v58 = PLAYER_SKILL_LEARNING;
2741  break;
2742  default:
2743  no_skills = true;
2744  }
2745  if (!no_skills) {
2746  if (!this->pActiveSkills[v58]) return 0;
2747  }
2748 
2749  switch (attr) { // TODO(_) would be nice to move these into separate functions
2753  return v5;
2754  break;
2755 
2757  if (!HasItemEquipped(EQUIP_BOW)) return 0;
2758  v5 = GetBowItem()->GetDamageMod();
2759  v56 = GetBowItem()->GetDamageDice();
2760  return v5 + v56;
2761  break;
2762 
2764  if (!HasItemEquipped(EQUIP_BOW)) return 0;
2766  v56 = GetBowItem()->GetDamageMod();
2767  return v5 + v56;
2768 
2770  if (!Player::HasEnchantedItemEquipped(25)) return 0;
2771  return 5;
2772  break;
2773 
2775  if (IsUnarmed()) {
2776  return 3;
2777  } else {
2778  if (this->HasItemEquipped(EQUIP_TWO_HANDED)) {
2780  if (v22 >= 0 && v22 <= 2) {
2781  ItemGen* mainHandItem = GetMainHandItem();
2782  v26 = mainHandItem->GetDamageRoll();
2783  if (GetOffHandItem() != nullptr ||
2784  mainHandItem->GetPlayerSkillType() != 4) {
2785  v25 = mainHandItem->GetDamageDice();
2786  } else {
2787  v25 = mainHandItem->GetDamageDice() + 1;
2788  }
2789  v5 = mainHandItem->GetDamageMod() + v25 * v26;
2790  }
2791  }
2792  if (getOnlyMainHandDmg ||
2796  return v5;
2797  } else {
2798  ItemGen* offHandItem = GetOffHandItem();
2799  v15 = offHandItem->GetDamageMod();
2800  v14 = offHandItem->GetDamageDice() *
2801  offHandItem->GetDamageRoll();
2802  return v5 + v15 + v14;
2803  }
2804  }
2805  break;
2806 
2809  if (IsUnarmed()) {
2810  return 0;
2811  }
2812  if (this->HasItemEquipped(EQUIP_TWO_HANDED)) {
2814  if (v17 >= 0 && v17 <= 2) {
2815  v5 = GetMainHandItem()->GetDamageMod();
2816  }
2817  }
2818  if (getOnlyMainHandDmg ||
2822  return v5;
2823  } else {
2824  v56 = GetOffHandItem()->GetDamageMod();
2825  return v5 + v56;
2826  }
2827  break;
2828 
2830  if (IsUnarmed()) {
2831  return 1;
2832  }
2833  if (this->HasItemEquipped(EQUIP_TWO_HANDED)) {
2835  if (v9 >= 0 && v9 <= 2) {
2836  ItemGen* mainHandItem = GetMainHandItem();
2837  v5 = mainHandItem->GetDamageDice() +
2838  mainHandItem->GetDamageMod();
2839  if (GetOffHandItem() == nullptr &&
2840  mainHandItem->GetPlayerSkillType() == 4) {
2841  ++v5;
2842  }
2843  }
2844  }
2845 
2846  if (getOnlyMainHandDmg ||
2850  return v5;
2851  } else {
2852  ItemGen* offHandItem = GetOffHandItem();
2853  v14 = offHandItem->GetDamageMod();
2854  v15 = offHandItem->GetDamageDice();
2855  return v5 + v15 + v14;
2856  }
2857  break;
2858 
2869 
2877 
2886 
2900  for (int i = 0; i < 16; i++) {
2901  if (HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
2902  currEquippedItem = GetNthEquippedIndexItem(i);
2903  if (attr == CHARACTER_ATTRIBUTE_AC_BONUS) {
2904  v32 = currEquippedItem->GetItemEquipType();
2905  if (v32 >= 3 && v32 <= 11) {
2906  v5 += currEquippedItem->GetDamageDice() +
2907  currEquippedItem->GetDamageMod();
2908  }
2909  }
2910  if (pItemsTable->IsMaterialNonCommon(currEquippedItem) &&
2911  !pItemsTable->IsMaterialSpecial(currEquippedItem)) {
2912  currEquippedItem->GetItemBonusArtifact(this, attr,
2913  &v62);
2914  } else if (currEquippedItem->uEnchantmentType != 0) {
2915  if (this->pInventoryItemList
2916  [this->pEquipment.pIndices[i] - 1]
2917  .uEnchantmentType -
2918  1 == attr) { // if
2919  // (currEquippedItem->IsRegularEnchanmentForAttribute(attr))
2920  if (attr > CHARACTER_ATTRIBUTE_RESIST_BODY &&
2921  v5 < currEquippedItem
2922  ->m_enchantmentStrength) // for skills
2923  // bonuses
2924  v5 = currEquippedItem->m_enchantmentStrength;
2925  else // for resists and attributes bonuses
2926  v5 += currEquippedItem->m_enchantmentStrength;
2927  }
2928  } else {
2929  currEquippedItem->GetItemBonusSpecialEnchantment(
2930  this, attr, &v5, &v61);
2931  }
2932  }
2933  }
2934  return v5 + v62 + v61;
2935  break;
2936  default:
2937  return 0;
2938  }
2939 }
2940 
2941 //----- (0048F73C) --------------------------------------------------------
2943  int v3 = 0; // eax@4
2944  int v4 = 0; // ecx@5
2945 
2946  switch (a2) {
2948  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].uPower;
2950  break;
2952  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].uPower;
2954  break;
2956  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].uPower;
2958  break;
2960  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].uPower;
2962  break;
2964  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].uPower;
2966  break;
2968  v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].uPower;
2970  break;
2974  .uPower; // only player effect spell in both VI and VII
2975  break;
2977  v3 = this->pPlayerBuffs[PLAYER_BUFF_HEROISM].uPower;
2978  v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
2979  break;
2983  break;
2987  break;
2991  break;
2995  break;
2999  break;
3001  v3 = pPlayerBuffs[PLAYER_BUFF_SPEED].uPower;
3003  break;
3005  v3 = pPlayerBuffs[PLAYER_BUFF_LUCK].uPower;
3007  break;
3009  v3 = this->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uPower;
3011  break;
3012  }
3013  return v3 + v4;
3014 }
3015 
3016 //----- (0048F882) --------------------------------------------------------
3018  PLAYER_SKILL_TYPE uSkillType) { // bitwise check & 0x3F when using this can
3019  // now be removed ?? must check behavior
3020  int bonus_value; // esi@1
3021  uint16_t skill_value; // ax@126
3022  int result; // al@127
3023 
3024  bonus_value = 0;
3025  switch (uSkillType) {
3026  case PLAYER_SKILL_MONSTER_ID: {
3027  if (CheckHiredNPCSpeciality(Hunter)) bonus_value = 6;
3028  if (CheckHiredNPCSpeciality(Sage)) bonus_value += 6;
3030  } break;
3031 
3032  case PLAYER_SKILL_ARMSMASTER: {
3033  if (CheckHiredNPCSpeciality(Armsmaster)) bonus_value = 2;
3034  if (CheckHiredNPCSpeciality(Weaponsmaster)) bonus_value += 3;
3036  } break;
3037 
3038  case PLAYER_SKILL_STEALING: {
3039  if (CheckHiredNPCSpeciality(Burglar)) bonus_value = 8;
3041  } break;
3042 
3043  case PLAYER_SKILL_ALCHEMY: {
3044  if (CheckHiredNPCSpeciality(Herbalist)) bonus_value = 4;
3045  if (CheckHiredNPCSpeciality(Apothecary)) bonus_value += 8;
3047  } break;
3048 
3049  case PLAYER_SKILL_LEARNING: {
3050  if (CheckHiredNPCSpeciality(Teacher)) bonus_value = 10;
3051  if (CheckHiredNPCSpeciality(Instructor)) bonus_value += 15;
3052  if (CheckHiredNPCSpeciality(Scholar)) bonus_value += 5;
3054  } break;
3055 
3056  case PLAYER_SKILL_UNARMED: {
3057  if (CheckHiredNPCSpeciality(Monk)) bonus_value = 2;
3059  } break;
3060 
3061  case PLAYER_SKILL_DODGE: {
3062  if (CheckHiredNPCSpeciality(Monk)) bonus_value = 2;
3064  } break;
3065 
3066  case PLAYER_SKILL_BOW:
3068  break;
3069  case PLAYER_SKILL_SHIELD:
3071  break;
3072 
3073  case PLAYER_SKILL_EARTH:
3074  if (CheckHiredNPCSpeciality(Apprentice)) bonus_value = 2;
3075  if (CheckHiredNPCSpeciality(Mystic)) bonus_value += 3;
3076  if (CheckHiredNPCSpeciality(Spellmaster)) bonus_value += 4;
3078  bonus_value += 3;
3080  break;
3081  case PLAYER_SKILL_FIRE:
3082  if (CheckHiredNPCSpeciality(Apprentice)) bonus_value = 2;
3083  if (CheckHiredNPCSpeciality(Mystic)) bonus_value += 3;
3084  if (CheckHiredNPCSpeciality(Spellmaster)) bonus_value += 4;
3086  bonus_value += 3;
3088  break;
3089  case PLAYER_SKILL_AIR:
3090  if (CheckHiredNPCSpeciality(Apprentice)) bonus_value = 2;
3091  if (CheckHiredNPCSpeciality(Mystic)) bonus_value += 3;
3092  if (CheckHiredNPCSpeciality(Spellmaster)) bonus_value += 4;
3094  bonus_value += 3;
3096  break;
3097  case PLAYER_SKILL_WATER:
3098  if (CheckHiredNPCSpeciality(Apprentice)) bonus_value = 2;
3099  if (CheckHiredNPCSpeciality(Mystic)) bonus_value += 3;
3100  if (CheckHiredNPCSpeciality(Spellmaster)) bonus_value += 4;
3102  bonus_value += 3;
3104  break;
3105  case PLAYER_SKILL_SPIRIT:
3106  if (CheckHiredNPCSpeciality(Acolyte2)) bonus_value = 2;
3107  if (CheckHiredNPCSpeciality(Initiate)) bonus_value += 3;
3108  if (CheckHiredNPCSpeciality(Prelate)) bonus_value += 4;
3110  break;
3111  case PLAYER_SKILL_MIND:
3112  if (CheckHiredNPCSpeciality(Acolyte2)) bonus_value = 2;
3113  if (CheckHiredNPCSpeciality(Initiate)) bonus_value += 3;
3114  if (CheckHiredNPCSpeciality(Prelate)) bonus_value += 4;
3116  break;
3117  case PLAYER_SKILL_BODY:
3118  if (CheckHiredNPCSpeciality(Acolyte2)) bonus_value = 2;
3119  if (CheckHiredNPCSpeciality(Initiate)) bonus_value += 3;
3120  if (CheckHiredNPCSpeciality(Prelate)) bonus_value += 4;
3122  break;
3123  case PLAYER_SKILL_LIGHT:
3125  break;
3126  case PLAYER_SKILL_DARK: {
3128  } break;
3129 
3130  case PLAYER_SKILL_MERCHANT: {
3131  if (CheckHiredNPCSpeciality(Trader)) bonus_value = 4;
3132  if (CheckHiredNPCSpeciality(Merchant)) bonus_value += 6;
3133  if (CheckHiredNPCSpeciality(Gypsy)) bonus_value += 3;
3134  if (CheckHiredNPCSpeciality(Duper)) bonus_value += 8;
3135  } break;
3136 
3137  case PLAYER_SKILL_PERCEPTION: {
3138  if (CheckHiredNPCSpeciality(Scout)) bonus_value = 6;
3139  if (CheckHiredNPCSpeciality(Psychic)) bonus_value += 5;
3140  } break;
3141 
3142  case PLAYER_SKILL_ITEM_ID:
3144  break;
3147  break;
3148  case PLAYER_SKILL_TRAP_DISARM: {
3149  if (CheckHiredNPCSpeciality(Tinker)) bonus_value = 4;
3150  if (CheckHiredNPCSpeciality(Locksmith)) bonus_value += 6;
3151  if (CheckHiredNPCSpeciality(Burglar)) bonus_value += 8;
3153  } break;
3154  }
3155 
3156  if (uSkillType == PLAYER_SKILL_CLUB) {
3157  // some items loaded in as clubs
3158  uSkillType = PLAYER_SKILL_MACE;
3159  }
3160 
3161  // cap skill and bonus at 60
3162  if (uSkillType == PLAYER_SKILL_MISC) {
3163  skill_value = 0;
3164  } else {
3165  skill_value = pActiveSkills[uSkillType] & 0x3F;
3166  }
3167 
3168  result = bonus_value + skill_value;
3169 
3170  if (result > 60) result = 60;
3171 
3172  // if ( bonus_value + (skill_value & 0x3F) < 60 )
3173  // / result =
3174  // else
3175  // result = skill_value & 0xFFFC | 0x3C; //al
3176  return result;
3177 }
3178 
3180  switch (pActiveSkills[uSkillType] & 0x1C0) { // could chnage to /64 + 1 ?
3181  case 0x100:
3182  return 4; // Grandmaster
3183  case 0x80:
3184  return 3; // Master
3185  case 0x40:
3186  return 2; // Expert
3187  case 0x00:
3188  return 1; // Normal
3189  }
3190 
3191  assert(false); // should never get here
3192  return 0;
3193 }
3194 
3195 //----- (0048FC00) --------------------------------------------------------
3198  inSkill) { // TODO(_): move the individual implementations to attribute
3199  // classes once possible ?? check
3200  int armsMasterBonus;
3201 
3202  armsMasterBonus = 0;
3203  int armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER);
3204  if (armmaster_skill > 0) {
3205  int multiplier = 0;
3206  if (inSkill == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) {
3207  multiplier =
3209  } else if (inSkill == CHARACTER_ATTRIBUTE_ATTACK) {
3210  multiplier =
3212  }
3213  armsMasterBonus = multiplier * (armmaster_skill); //& 0x3F);
3214  }
3215 
3216  switch (inSkill) {
3218  if (HasItemEquipped(EQUIP_BOW)) {
3219  int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_BOW);
3220  int multiplier =
3222  return multiplier * (bowSkillLevel & 0x3F);
3223  }
3224  return 0;
3225  break;
3227  int base_value = pBaseHealthPerLevelByClass[classType];
3228  int attrib_modif = GetBodybuilding();
3229  return base_value * attrib_modif;
3230  } break;
3231  case CHARACTER_ATTRIBUTE_MANA: {
3232  int base_value = pBaseManaPerLevelByClass[classType];
3233  int attrib_modif = GetMeditation();
3234  return base_value * attrib_modif;
3235  } break;
3237  bool wearingArmor = false;
3238  bool wearingLeather = false;
3239  unsigned int ACSum = 0;
3240 
3241  for (int j = 0; j < 16; ++j) {
3242  ItemGen* currItem = GetNthEquippedIndexItem(j);
3243  if (currItem != nullptr && (!currItem->IsBroken())) {
3244  PLAYER_SKILL_TYPE itemSkillType =
3246  int currArmorSkillLevel = 0;
3247  int multiplier = 0;
3248  switch (itemSkillType) {
3249  case PLAYER_SKILL_STAFF:
3250  currArmorSkillLevel =
3251  GetActualSkillLevel(itemSkillType);
3252  multiplier = GetMultiplierForSkillLevel(
3253  itemSkillType, 0, 1, 1, 1);
3254  break;
3255  case PLAYER_SKILL_SWORD:
3256  case PLAYER_SKILL_SPEAR:
3257  currArmorSkillLevel =
3258  GetActualSkillLevel(itemSkillType);
3259  multiplier = GetMultiplierForSkillLevel(
3260  itemSkillType, 0, 0, 0, 1);
3261  break;
3262  case PLAYER_SKILL_SHIELD:
3263  currArmorSkillLevel =
3264  GetActualSkillLevel(itemSkillType);
3265  wearingArmor = true;
3266  multiplier = GetMultiplierForSkillLevel(
3267  itemSkillType, 1, 1, 2, 2);
3268  break;
3269  case PLAYER_SKILL_LEATHER:
3270  currArmorSkillLevel =
3271  GetActualSkillLevel(itemSkillType);
3272  wearingLeather = true;
3273  multiplier = GetMultiplierForSkillLevel(
3274  itemSkillType, 1, 1, 2, 2);
3275  break;
3276  case PLAYER_SKILL_CHAIN:
3277  currArmorSkillLevel =
3278  GetActualSkillLevel(itemSkillType);
3279  wearingArmor = true;
3280  multiplier = GetMultiplierForSkillLevel(
3281  itemSkillType, 1, 1, 1, 1);
3282  break;
3283  case PLAYER_SKILL_PLATE:
3284  currArmorSkillLevel =
3285  GetActualSkillLevel(itemSkillType);
3286  wearingArmor = true;
3287  multiplier = GetMultiplierForSkillLevel(
3288  itemSkillType, 1, 1, 1, 1);
3289  break;
3290  }
3291  ACSum += multiplier * (currArmorSkillLevel & 0x3F);
3292  }
3293  }
3294 
3295  int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE);
3296  int dodgeMastery = GetActualSkillMastery(PLAYER_SKILL_DODGE);
3297  int multiplier =
3299  if (!wearingArmor && (!wearingLeather || dodgeMastery == 4)) {
3300  ACSum += multiplier * (dodgeSkillLevel & 0x3F);
3301  }
3302  return ACSum;
3303  } break;
3305  if (this->IsUnarmed()) {
3306  int unarmedSkill =
3308  if (!unarmedSkill) {
3309  return 0;
3310  }
3311  int multiplier = GetMultiplierForSkillLevel(
3312  PLAYER_SKILL_UNARMED, 0, 1, 2, 2);
3313  return armsMasterBonus + multiplier * (unarmedSkill & 0x3F);
3314  }
3315  for (int i = 0; i < 16; ++i) { // ?? what eh check behaviour
3316  if (this->HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
3317  ItemGen* currItem = GetNthEquippedIndexItem(i);
3318  if (currItem->GetItemEquipType() <= EQUIP_TWO_HANDED) {
3319  PLAYER_SKILL_TYPE currItemSkillType =
3321  int currentItemSkillLevel =
3322  this->GetActualSkillLevel(currItemSkillType);
3323  if (currItemSkillType == PLAYER_SKILL_BLASTER) {
3324  int multiplier = GetMultiplierForSkillLevel(
3325  currItemSkillType, 1, 2, 3, 5);
3326  return multiplier * (currentItemSkillLevel & 0x3F);
3327  } else if (currItemSkillType == PLAYER_SKILL_STAFF &&
3328  this->GetActualSkillLevel(
3329  PLAYER_SKILL_UNARMED) > 0) {
3330  int unarmedSkillLevel =
3332  int multiplier = GetMultiplierForSkillLevel(
3333  PLAYER_SKILL_UNARMED, 1, 1, 2, 2);
3334  return multiplier * (unarmedSkillLevel & 0x3F) +
3335  armsMasterBonus +
3336  (currentItemSkillLevel & 0x3F);
3337  } else {
3338  return armsMasterBonus +
3339  (currentItemSkillLevel & 0x3F);
3340  }
3341  }
3342  }
3343  }
3344  return 0;
3345  break;
3346 
3348  for (int i = 0; i < 16; i++) {
3349  if (this->HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
3350  ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
3351  if (currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED ||
3352  currItemPtr->GetItemEquipType() ==
3354  PLAYER_SKILL_TYPE currentItemSkillType =
3356  ->GetPlayerSkillType();
3357  int currentItemSkillLevel =
3358  this->GetActualSkillLevel(currentItemSkillType);
3359  if (currentItemSkillType == PLAYER_SKILL_BOW) {
3360  int multiplier = GetMultiplierForSkillLevel(
3361  PLAYER_SKILL_BOW, 1, 1, 1, 1);
3362  return multiplier * (currentItemSkillLevel & 0x3F);
3363  } else if (currentItemSkillType ==
3365  int multiplier = GetMultiplierForSkillLevel(
3366  PLAYER_SKILL_BLASTER, 1, 2, 3, 5);
3367  return multiplier * (currentItemSkillLevel & 0x3F);
3368  }
3369  }
3370  }
3371  }
3372  return 0;
3373  break;
3374 
3376  if (this->IsUnarmed()) {
3377  int unarmedSkillLevel =
3379  if (!unarmedSkillLevel) {
3380  return 0;
3381  }
3382  int multiplier = GetMultiplierForSkillLevel(
3383  PLAYER_SKILL_UNARMED, 0, 1, 2, 2);
3384  return multiplier * (unarmedSkillLevel & 0x3F);
3385  }
3386  for (int i = 0; i < 16; i++) {
3387  if (this->HasItemEquipped((ITEM_EQUIP_TYPE)i)) {
3388  ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
3389  if (currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED ||
3390  currItemPtr->GetItemEquipType() ==
3392  PLAYER_SKILL_TYPE currItemSkillType =
3394  currItemPtr->GetPlayerSkillType();
3395  int currItemSkillLevel =
3396  this->GetActualSkillLevel(currItemSkillType);
3397  int baseSkillBonus;
3398  int multiplier;
3399  switch (currItemSkillType) {
3400  case PLAYER_SKILL_STAFF:
3401  if (this->GetActualSkillMastery(
3402  PLAYER_SKILL_STAFF) >= 4 &&
3403  this->GetActualSkillLevel(
3404  PLAYER_SKILL_UNARMED) > 0) {
3405  int unarmedSkillLevel =
3406  this->GetActualSkillLevel(
3408  int multiplier = GetMultiplierForSkillLevel(
3409  PLAYER_SKILL_UNARMED, 0, 1, 2, 2);
3410  return multiplier *
3411  (unarmedSkillLevel & 0x3F);
3412  } else {
3413  return armsMasterBonus;
3414  }
3415  break;
3416 
3417  case PLAYER_SKILL_DAGGER:
3418  multiplier = GetMultiplierForSkillLevel(
3419  PLAYER_SKILL_DAGGER, 0, 0, 0, 1);
3420  baseSkillBonus =
3421  multiplier * (currItemSkillLevel & 0x3F);
3422  return armsMasterBonus + baseSkillBonus;
3423  break;
3424  case PLAYER_SKILL_SWORD:
3425  multiplier = GetMultiplierForSkillLevel(
3426  PLAYER_SKILL_SWORD, 0, 0, 0, 0);
3427  baseSkillBonus =
3428  multiplier * (currItemSkillLevel & 0x3F);
3429  return armsMasterBonus + baseSkillBonus;
3430  break;
3431  case PLAYER_SKILL_MACE:
3432  case PLAYER_SKILL_SPEAR:
3433  multiplier = GetMultiplierForSkillLevel(
3434  currItemSkillType, 0, 1, 1, 1);
3435  baseSkillBonus =
3436  multiplier * (currItemSkillLevel & 0x3F);
3437  return armsMasterBonus + baseSkillBonus;
3438  break;
3439  case PLAYER_SKILL_AXE:
3440  multiplier = GetMultiplierForSkillLevel(
3441  PLAYER_SKILL_AXE, 0, 0, 1, 1);
3442  baseSkillBonus =
3443  multiplier * (currItemSkillLevel & 0x3F);
3444  return armsMasterBonus + baseSkillBonus;
3445  break;
3446  }
3447  }
3448  }
3449  }
3450  return 0;
3451  break;
3452  default:
3453  return 0;
3454  }
3455 }
3456 
3458  PLAYER_SKILL_TYPE uSkillType, int mult1, int mult2, int mult3,
3459  int mult4) { // ?? needs changing - check behavious
3460  int masteryLvl = GetActualSkillMastery(uSkillType);
3461  switch (masteryLvl) {
3462  case 1:
3463  return mult1;
3464  case 2:
3465  return mult2;
3466  case 3:
3467  return mult3;
3468  case 4:
3469  return mult4;
3470  }
3471  Error("(%u)", masteryLvl);
3472  return 0;
3473 }
3474 //----- (00490109) --------------------------------------------------------
3475 // faces are: 0 1 2 3 human males
3476 // 4 5 6 7 human females
3477 // 8 9 elf males
3478 // 10 11 elf females
3479 // 12 13 dwarf males
3480 // 14 15 dwarf females
3481 // 16 17 goblin males
3482 // 18 19 goblin females
3483 // 20 lich male
3484 // 21 lich female
3485 // 22 underwater suits (unused)
3486 // 23 zombie male
3487 // 24 zombie female
3489  if (uCurrentFace <= 7) {
3490  return CHARACTER_RACE_HUMAN;
3491  } else if (uCurrentFace <= 11) {
3492  return CHARACTER_RACE_ELF;
3493  } else if (uCurrentFace <= 15) {
3494  return CHARACTER_RACE_DWARF;
3495  } else if (uCurrentFace <= 19) {
3496  return CHARACTER_RACE_GOBLIN;
3497  } else {
3498  return CHARACTER_RACE_HUMAN;
3499  }
3500 }
3501 
3503  switch (this->GetRace()) {
3504  case 0:
3505  return localization->GetString(99); // "Human"
3506  case 1:
3507  return localization->GetString(103); // "Dwarf"
3508  case 2:
3509  return localization->GetString(106); // "Goblin"
3510  case 3:
3511  return localization->GetString(101); // "Elf"
3512  }
3513 }
3514 
3515 //----- (00490141) --------------------------------------------------------
3517  switch (this->uVoiceID) {
3518  case 0u:
3519  case 1u:
3520  case 2u:
3521  case 3u:
3522  case 8u:
3523  case 9u:
3524  case 0xCu:
3525  case 0xDu:
3526  case 0x10u:
3527  case 0x11u:
3528  case 0x14u:
3529  case 0x17u:
3530  return SEX_MALE;
3531 
3532  case 4u:
3533  case 5u:
3534  case 6u:
3535  case 7u:
3536  case 0xAu:
3537  case 0xBu:
3538  case 0xEu:
3539  case 0xFu:
3540  case 0x12u:
3541  case 0x13u:
3542  case 0x15u:
3543  case 0x18u:
3544  return SEX_FEMALE;
3545  }
3546  Error("(%u)", this->uVoiceID);
3547  return SEX_MALE;
3548 }
3549 
3550 //----- (00490188) --------------------------------------------------------
3552  CHARACTER_RACE race = GetRace();
3553  uMight = StatTable[race][0].uBaseValue;
3554  uIntelligence = StatTable[race][1].uBaseValue;
3555  uWillpower = StatTable[race][2].uBaseValue;
3556  uEndurance = StatTable[race][3].uBaseValue;
3557  uAccuracy = StatTable[race][4].uBaseValue;
3558  uSpeed = StatTable[race][5].uBaseValue;
3559  uLuck = StatTable[race][6].uBaseValue;
3560 }
3561 
3562 //----- (004901FC) --------------------------------------------------------
3564  switch (this->uVoiceID) {
3565  case 0:
3566  case 1:
3567  case 2:
3568  case 3:
3569  case 8:
3570  case 9:
3571  case 0xC:
3572  case 0xD:
3573  case 0x10:
3574  case 0x11:
3575  case 0x14:
3576  case 0x17:
3577  this->uSex = SEX_MALE;
3578  break;
3579  case 4:
3580  case 5:
3581  case 6:
3582  case 7:
3583  case 0xA:
3584  case 0xB:
3585  case 0xE:
3586  case 0xF:
3587  case 0x12:
3588  case 0x13:
3589  case 0x15:
3590  case 0x18:
3591  this->uSex = SEX_FEMALE;
3592  break;
3593  default:
3594  Error("(%u)", this->uVoiceID);
3595  break;
3596  }
3597 }
3598 
3599 //----- (0049024A) --------------------------------------------------------
3601  sLevelModifier = 0;
3602  sAgeModifier = 0;
3603 
3604  classType = cls;
3605  uLuckBonus = 0;
3606  uSpeedBonus = 0;
3607  uAccuracyBonus = 0;
3608  uEnduranceBonus = 0;
3609  uWillpowerBonus = 0;
3610  uIntelligenceBonus = 0;
3611  uMightBonus = 0;
3612  uLevel = 1;
3613  uExperience = 251 + rand() % 100;
3614  uSkillPoints = 0;
3615  uBirthYear = 1147 - rand() % 6;
3616  pActiveSkills.fill(0);
3617  memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits));
3618  memset(&spellbook, 0, sizeof(spellbook));
3619 
3620  for (uint i = 0; i < 37; ++i) {
3621  if (pSkillAvailabilityPerClass[classType / 4][i] != 2) continue;
3622  pActiveSkills[i] = 1;
3623  }
3624 
3625  memset(&pEquipment, 0, sizeof(PlayerEquipment));
3626  pInventoryMatrix.fill(0);
3627  for (uint i = 0; i < 126; ++i) pInventoryItemList[i].Reset();
3628  for (uint i = 0; i < 12; ++i) pEquippedItems[i].Reset();
3629 
3630  sHealth = GetMaxHealth();
3631  sMana = GetMaxMana();
3632 }
3633 
3634 //----- (004903C9) --------------------------------------------------------
3636  int counter; // edx@5
3637  bool canBeInactive;
3638  unsigned char requiredValue;
3639  signed int offset;
3640 
3641  if (order <= 1) {
3642  canBeInactive = false;
3643  requiredValue = 2; // 2 - primary skill
3644  offset = 0;
3645  } else if (order <= 3) {
3646  canBeInactive = false;
3647  requiredValue = 1; // 1 - available
3648  offset = 2;
3649  } else if (order <= 12) {
3650  canBeInactive = true;
3651  requiredValue = 1; // 1 - available
3652  offset = 4;
3653  } else {
3654  return (PLAYER_SKILL_TYPE)37;
3655  }
3656  counter = 0;
3657  for (int i = 0; i < 37; i++) {
3658  if ((this->pActiveSkills[i] || canBeInactive) &&
3659  pSkillAvailabilityPerClass[classType / 4][i] == requiredValue) {
3660  if (counter == order - offset) return (PLAYER_SKILL_TYPE)i;
3661  ++counter;
3662  }
3663  }
3664 
3665  return (PLAYER_SKILL_TYPE)37;
3666 }
3667 
3668 //----- (0049048D) --------------------------------------------------------
3669 // unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute)
3670 void Player::DecreaseAttribute(int eAttribute) {
3671  int pBaseValue; // ecx@1
3672  int pDroppedStep; // ebx@1
3673  int pStep; // esi@1
3674  int uMinValue; // [sp+Ch] [bp-4h]@1
3675 
3676  int raceId = GetRace();
3677  pBaseValue = StatTable[raceId][eAttribute].uBaseValue;
3678  pDroppedStep = StatTable[raceId][eAttribute].uDroppedStep;
3679  uMinValue = pBaseValue - 2;
3680  pStep = StatTable[raceId][eAttribute].uBaseStep;
3681  unsigned short* AttrToChange = nullptr;
3682  switch (eAttribute) {
3684  AttrToChange = &this->uMight;
3685  break;
3687  AttrToChange = &this->uIntelligence;
3688  break;
3690  AttrToChange = &this->uWillpower;
3691  break;
3693  AttrToChange = &this->uEndurance;
3694  break;
3696  AttrToChange = &this->uAccuracy;
3697  break;
3699  AttrToChange = &this->uSpeed;
3700  break;
3702  AttrToChange = &this->uLuck;
3703  break;
3704  }
3705  if (*AttrToChange <= pBaseValue) pStep = pDroppedStep;
3706  if (*AttrToChange - pStep >= uMinValue) *AttrToChange -= pStep;
3707 }
3708 
3709 //----- (004905F5) --------------------------------------------------------
3710 // signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute)
3711 void Player::IncreaseAttribute(int eAttribute) {
3712  int raceId; // eax@1
3713  int maxValue; // ebx@1
3714  signed int baseStep; // edi@1
3715  signed int tmp; // eax@17
3716  signed int result; // eax@18
3717  int baseValue; // [sp+Ch] [bp-8h]@1
3718  signed int droppedStep; // [sp+10h] [bp-4h]@1
3719  unsigned short* statToChange;
3720 
3721  raceId = GetRace();
3722  maxValue = StatTable[raceId][eAttribute].uMaxValue;
3723  baseStep = StatTable[raceId][eAttribute].uBaseStep;
3724  baseValue = StatTable[raceId][eAttribute].uBaseValue;
3725  droppedStep = StatTable[raceId][eAttribute].uDroppedStep;
3727  switch (eAttribute) {
3728  case 0:
3729  statToChange = &this->uMight;
3730  break;
3731  case 1:
3732  statToChange = &this->uIntelligence;
3733  break;
3734  case 2:
3735  statToChange = &this->uWillpower;
3736  break;
3737  case 3:
3738  statToChange = &this->uEndurance;
3739  break;
3740  case 4:
3741  statToChange = &this->uAccuracy;
3742  break;
3743  case 5:
3744  statToChange = &this->uSpeed;
3745  break;
3746  case 6:
3747  statToChange = &this->uLuck;
3748  break;
3749  default:
3750  Error("(%u)", eAttribute);
3751  break;
3752  }
3753  if (*statToChange < baseValue) {
3754  tmp = baseStep;
3755  baseStep = droppedStep;
3756  droppedStep = tmp;
3757  }
3759  if (result >= droppedStep) {
3760  if (baseStep + *statToChange <= maxValue) *statToChange += baseStep;
3761  }
3762 }
3763 
3764 //----- (0049070F) --------------------------------------------------------
3766  this->sLevelModifier = 0;
3767  this->sACModifier = 0;
3768  this->uLuckBonus = 0;
3769  this->uAccuracyBonus = 0;
3770  this->uSpeedBonus = 0;
3771  this->uEnduranceBonus = 0;
3772  this->uWillpowerBonus = 0;
3773  this->uIntelligenceBonus = 0;
3774  this->uMightBonus = 0;
3775  this->field_100 = 0;
3776  this->field_FC = 0;
3777  this->field_F8 = 0;
3778  this->field_F4 = 0;
3779  this->field_F0 = 0;
3780  this->field_EC = 0;
3781  this->field_E8 = 0;
3782  this->field_E4 = 0;
3783  this->field_E0 = 0;
3784  memset(&this->sResFireBonus, 0, 0x16u);
3785  this->field_1A97 = 0;
3786  this->_ranged_dmg_bonus = 0;
3787  this->field_1A95 = 0;
3788  this->_ranged_atk_bonus = 0;
3789  this->field_1A93 = 0;
3790  this->_melee_dmg_bonus = 0;
3791  this->field_1A91 = 0;
3792  this->_some_attack_bonus = 0;
3793  this->_mana_related = 0;
3794  this->uFullManaBonus = 0;
3795  this->_health_related = 0;
3796  this->uFullHealthBonus = 0;
3797 }
3798 
3799 //----- (004907E7) --------------------------------------------------------
3800 unsigned int Player::GetStatColor(int uStat) {
3801  int attribute_value; // edx@1
3802 
3803  int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue;
3804  switch (uStat) {
3805  case 0:
3806  attribute_value = uMight;
3807  break;
3808  case 1:
3809  attribute_value = uIntelligence;
3810  break;
3811  case 2:
3812  attribute_value = uWillpower;
3813  break;
3814  case 3:
3815  attribute_value = uEndurance;
3816  break;
3817  case 4:
3818  attribute_value = uAccuracy;
3819  break;
3820  case 5:
3821  attribute_value = uSpeed;
3822  break;
3823  case 6:
3824  attribute_value = uLuck;
3825  break;
3826  default:
3827  Error("Unexpected attribute");
3828  }
3829 
3830  if (attribute_value == base_attribute_value)
3832  else if (attribute_value > base_attribute_value)
3834  else
3836 }
3837 
3838 //----- (004908A8) --------------------------------------------------------
3839 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition,
3840  GameTime time) {
3841  if (conditions_times[uCondition] && (time < conditions_times[uCondition])) {
3842  conditions_times[uCondition].Reset();
3843  return true;
3844  } else {
3845  return false;
3846  }
3847 }
3848 
3849 //----- (004680ED) --------------------------------------------------------
3850 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) {
3851  Player* playerAffected; // esi@1
3852  signed int v5; // eax@17
3853  int v8; // edx@39
3854  // const char *v13; // eax@45
3855  signed int v15; // edi@68
3856  int v16; // edx@73
3857  unsigned __int16 v17; // edi@73
3858  unsigned int v18; // eax@73
3859  // const char *v22; // eax@84
3860  int scroll_id; // esi@96
3861  int v25; // eax@109
3862  int v26; // eax@113
3863  int new_mana_val; // edi@114
3864  __int64 v30; // edi@137
3865  __int64 v32; // ST3C_4@137
3866  __int64 v34; // ST34_4@137
3867  unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
3868  signed int v67; // [sp-4h] [bp-30h]@77
3869  char v72; // [sp+20h] [bp-Ch]@68
3870  signed int v73; // [sp+24h] [bp-8h]@1
3871  const char* v74; // [sp+24h] [bp-8h]@23
3872  // Player *thisb; // [sp+28h] [bp-4h]@1
3873  unsigned int thisa; // [sp+28h] [bp-4h]@22
3874 
3875  // thisb = this;
3876  playerAffected = &pParty->pPlayers[player_num - 1];
3877  v73 = 1;
3878  if (pParty->bTurnBasedModeOn &&
3881  return;
3883  if (pParty->pPickedItem.uItemID == ITEM_161) {
3884  playerAffected->SetCondition(Condition_Poison_Weak, 1);
3885  } else if (pParty->pPickedItem.uItemID == ITEM_161) {
3886  new_mana_val = playerAffected->sMana;
3887  new_mana_val += 2;
3888  if (new_mana_val > playerAffected->GetMaxMana())
3889  new_mana_val = playerAffected->GetMaxMana();
3890  playerAffected->PlaySound(SPEECH_36, 0);
3891  } else if (pParty->pPickedItem.uItemID == ITEM_162) {
3892  playerAffected->Heal(2);
3893  playerAffected->PlaySound(SPEECH_36, 0);
3894  } else {
3895  GameUI_StatusBar_OnEvent(localization->FormatString(36, pParty->pPickedItem.GetDisplayName().c_str())); // %s can not be used that way
3896 
3897  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
3898  return;
3899  }
3900  pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0);
3901 
3902  if (pGUIWindow_CurrentMenu &&
3904  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
3905  }
3906  if (v73) {
3907  if (pParty->bTurnBasedModeOn) {
3908  pParty->pTurnBasedPlayerRecoveryTimes[player_num - 1] = 100;
3909  this->SetRecoveryTime(100);
3911  } else {
3912  this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
3913  }
3914  }
3915  mouse->RemoveHoldingItem();
3916  return;
3917  }
3918 
3920  switch (pParty->pPickedItem.uItemID) {
3921  case 221: // Catalyst
3922  playerAffected->SetCondition(Condition_Poison_Weak, 1);
3923  break;
3924 
3925  case 222: // Cure Wounds
3926  v25 = pParty->pPickedItem.uEnchantmentType + 10;
3927  playerAffected->Heal(v25);
3928  playerAffected->PlaySound(SPEECH_36, 0);
3929  break;
3930 
3931  case 223: // Magic Potion
3932  v26 = pParty->pPickedItem.uEnchantmentType + 10;
3933  new_mana_val = playerAffected->sMana;
3934  new_mana_val += v26;
3935  if (new_mana_val > playerAffected->GetMaxMana())
3936  new_mana_val = playerAffected->GetMaxMana();
3937  playerAffected->PlaySound(SPEECH_36, 0);
3938  playerAffected->sMana = new_mana_val;
3939  break;
3940 
3941  case 224: // Cure Weakness
3942  playerAffected->conditions_times[Condition_Weak].Reset();
3943  playerAffected->PlaySound(SPEECH_36, 0);
3944  break;
3945 
3946  case 225: // Cure Disease
3948  .Reset();
3950  .Reset();
3951  playerAffected->conditions_times[Condition_Disease_Weak]
3952  .Reset();
3953  playerAffected->PlaySound(SPEECH_36, 0);
3954  break;
3955 
3956  case 226: // Cure Poison
3957  playerAffected->conditions_times[Condition_Poison_Severe]
3958  .Reset();
3959  playerAffected->conditions_times[Condition_Poison_Medium]
3960  .Reset();
3961  playerAffected->conditions_times[Condition_Poison_Weak].Reset();
3962  playerAffected->PlaySound(SPEECH_36, 0);
3963  break;
3964 
3965  case 227: // Awaken
3966  playerAffected->conditions_times[Condition_Sleep].Reset();
3967  playerAffected->PlaySound(SPEECH_36, 0);
3968  break;
3969 
3970  case 228: // Haste
3971  if (!playerAffected->conditions_times[Condition_Weak]) {
3972  auto duration =
3973  GameTime(0, TIME_SECONDS_PER_QUANT *
3975  playerAffected->pPlayerBuffs[PLAYER_BUFF_HASTE].Apply(
3976  pParty->GetPlayingTime() + duration, 3, 5, 0, 0);
3977  playerAffected->PlaySound(SPEECH_36, 0);
3978  }
3979  break;
3980 
3981  case 229: // Heroism
3982  {
3983  auto duration =
3984  GameTime(0, TIME_SECONDS_PER_QUANT *
3986  playerAffected->pPlayerBuffs[PLAYER_BUFF_HEROISM].Apply(
3987  pParty->GetPlayingTime() + duration, 3, 5, 0, 0);
3988  playerAffected->PlaySound(SPEECH_36, 0);
3989  break;
3990  }
3991 
3992  case 230: // Bless
3993  {
3994  auto duration =
3995  GameTime(0, TIME_SECONDS_PER_QUANT *
3997  playerAffected->pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(
3998  pParty->GetPlayingTime() + duration, 3, 5, 0, 0);
3999  playerAffected->PlaySound(SPEECH_36, 0);
4000  break;
4001  }
4002 
4003  case 231: // Preservation
4004  {
4005  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4006  auto duration =
4007  GameTime(0, TIME_SECONDS_PER_QUANT *
4009  playerAffected->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(
4010  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4011  playerAffected->PlaySound(SPEECH_36, 0);
4012  break;
4013  }
4014 
4015  case 232: // Shield
4016  {
4017  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4018  auto duration =
4019  GameTime(0, TIME_SECONDS_PER_QUANT *
4021  playerAffected->pPlayerBuffs[PLAYER_BUFF_SHIELD].Apply(
4022  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4023  playerAffected->PlaySound(SPEECH_36, 0);
4024  break;
4025  }
4026 
4027  case 234: // Stoneskin
4028  {
4029  auto duration =
4030  GameTime(0, TIME_SECONDS_PER_QUANT *
4032  playerAffected->pPlayerBuffs[PLAYER_BUFF_STONESKIN].Apply(
4033  pParty->GetPlayingTime() + duration, 3, 5, 0, 0);
4034  playerAffected->PlaySound(SPEECH_36, 0);
4035  break;
4036  }
4037 
4038  case 235: // Water Breathing
4039  {
4040  auto duration =
4041  GameTime(0, TIME_SECONDS_PER_QUANT *
4043  playerAffected->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].Apply(
4044  pParty->GetPlayingTime() + duration, 3, 5, 0, 0);
4045  break;
4046  }
4047 
4048  case 237: // Remove Fear
4049  playerAffected->conditions_times[Condition_Fear].Reset();
4050  playerAffected->PlaySound(SPEECH_36, 0);
4051  break;
4052  case 238: // Remove Curse
4053  playerAffected->conditions_times[Condition_Cursed].Reset();
4054  playerAffected->PlaySound(SPEECH_36, 0);
4055  break;
4056  case 239: // Cure Insanity
4057  playerAffected->conditions_times[Condition_Insane].Reset();
4058  playerAffected->PlaySound(SPEECH_36, 0);
4059  break;
4060 
4061  case 240: // Might Boost
4062  {
4063  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4064  auto duration =
4065  GameTime(0, TIME_SECONDS_PER_QUANT *
4067  playerAffected->pPlayerBuffs[PLAYER_BUFF_STRENGTH].Apply(
4068  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4069  playerAffected->PlaySound(SPEECH_36, 0);
4070  break;
4071  }
4072 
4073  case 241: // Intellect Boost
4074  {
4075  auto duration =
4076  GameTime(0, TIME_SECONDS_PER_QUANT *
4078  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4079  playerAffected->pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].Apply(
4080  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4081  playerAffected->PlaySound(SPEECH_36, 0);
4082  break;
4083  }
4084 
4085  case 242: // Personality Boost
4086  {
4087  auto duration =
4088  GameTime(0, TIME_SECONDS_PER_QUANT *
4090  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4091  playerAffected->pPlayerBuffs[PLAYER_BUFF_WILLPOWER].Apply(
4092  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4093  playerAffected->PlaySound(SPEECH_36, 0);
4094  break;
4095  }
4096 
4097  case 243: // Endurance Boost
4098  {
4099  auto duration =
4100  GameTime(0, TIME_SECONDS_PER_QUANT *
4102  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4103  playerAffected->pPlayerBuffs[PLAYER_BUFF_ENDURANCE].Apply(
4104  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4105  playerAffected->PlaySound(SPEECH_36, 0);
4106  break;
4107  }
4108 
4109  case 244: // Speed Boost
4110  {
4111  auto duration =
4112  GameTime(0, TIME_SECONDS_PER_QUANT *
4114  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4115  playerAffected->pPlayerBuffs[PLAYER_BUFF_SPEED].Apply(
4116  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4117  playerAffected->PlaySound(SPEECH_36, 0);
4118  break;
4119  }
4120 
4121  case 245: // Accuracy Boost
4122  {
4123  auto duration =
4124  GameTime(0, TIME_SECONDS_PER_QUANT *
4126  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4127  playerAffected->pPlayerBuffs[PLAYER_BUFF_ACCURACY].Apply(
4128  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4129  playerAffected->PlaySound(SPEECH_36, 0);
4130  break;
4131  }
4132 
4133  case 251: // Cure Paralysis
4134  playerAffected->conditions_times[Condition_Paralyzed].Reset();
4135  playerAffected->PlaySound(SPEECH_36, 0);
4136  break;
4137 
4138  case 252: // Divine Restoration
4139  v30 = playerAffected->conditions_times[Condition_Dead];
4140  v32 = playerAffected->conditions_times[Condition_Pertified];
4141  v34 = playerAffected->conditions_times[Condition_Eradicated];
4142  conditions_times.fill(GameTime(0));
4143  playerAffected->conditions_times[Condition_Dead] = GameTime(v30);
4144  playerAffected->conditions_times[Condition_Pertified] = GameTime(v32);
4145  playerAffected->conditions_times[Condition_Eradicated] = GameTime(v34);
4146  playerAffected->PlaySound(SPEECH_36, 0);
4147  break;
4148 
4149  case 253: // Divine Cure
4150  v25 = 5 * pParty->pPickedItem.uEnchantmentType;
4151  playerAffected->Heal(v25);
4152  playerAffected->PlaySound(SPEECH_36, 0);
4153  break;
4154  case 254: // Divine Power
4155  v26 = 5 * pParty->pPickedItem.uEnchantmentType;
4156  new_mana_val = playerAffected->sMana;
4157  new_mana_val += v26;
4158  if (new_mana_val > playerAffected->GetMaxMana())
4159  new_mana_val = playerAffected->GetMaxMana();
4160  playerAffected->PlaySound(SPEECH_36, 0);
4161  break;
4162  case 255: // Luck Boost
4163  {
4164  auto duration =
4165  GameTime(0, TIME_SECONDS_PER_QUANT *
4167  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4168  playerAffected->pPlayerBuffs[PLAYER_BUFF_LUCK].Apply(
4169  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4170  playerAffected->PlaySound(SPEECH_36, 0);
4171  break;
4172  }
4173 
4174  case 256: // Fire Resistance
4175  {
4176  auto duration =
4177  GameTime(0, TIME_SECONDS_PER_QUANT *
4179  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4180  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].Apply(
4181  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4182  playerAffected->PlaySound(SPEECH_36, 0);
4183  break;
4184  }
4185 
4186  case 257: // Air Resistance
4187  {
4188  auto duration =
4189  GameTime(0, TIME_SECONDS_PER_QUANT *
4191  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4192  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].Apply(
4193  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4194  playerAffected->PlaySound(SPEECH_36, 0);
4195  break;
4196  }
4197 
4198  case 258: // Water Resistance
4199  {
4200  auto duration =
4201  GameTime(0, TIME_SECONDS_PER_QUANT *
4203  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4204  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].Apply(
4205  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4206  playerAffected->PlaySound(SPEECH_36, 0);
4207  break;
4208  }
4209 
4210  case 259: // Earth Resistance
4211  {
4212  auto duration =
4213  GameTime(0, TIME_SECONDS_PER_QUANT *
4215  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4216  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].Apply(
4217  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4218  playerAffected->PlaySound(SPEECH_36, 0);
4219  break;
4220  }
4221 
4222  case 260: // Mind Resistance
4223  {
4224  auto duration =
4225  GameTime(0, TIME_SECONDS_PER_QUANT *
4227  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4228  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].Apply(
4229  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4230  playerAffected->PlaySound(SPEECH_36, 0);
4231  break;
4232  }
4233 
4234  case 261: // Body Resistance
4235  {
4236  auto duration =
4237  GameTime(0, TIME_SECONDS_PER_QUANT *
4239  v50 = 3 * pParty->pPickedItem.uEnchantmentType;
4240  playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].Apply(
4241  pParty->GetPlayingTime() + duration, 0, v50, 0, 0);
4242  playerAffected->PlaySound(SPEECH_36, 0);
4243  break;
4244  }
4245 
4246  case 262: // Stone to Flesh
4247  playerAffected->conditions_times[Condition_Pertified].Reset();
4248  playerAffected->PlaySound(SPEECH_36, 0);
4249  break;
4250 
4251  case 264: // Pure Luck
4252  if (!playerAffected->pure_luck_used) {
4253  playerAffected->uLuck += 50;
4254  playerAffected->pure_luck_used = 1;
4255  }
4256  playerAffected->PlaySound(SPEECH_36, 0);
4257  break;
4258  case 265: // Pure Speed
4259  if (!playerAffected->pure_speed_used) {
4260  playerAffected->uSpeed += 50;
4261  playerAffected->pure_speed_used = 1;
4262  }
4263  playerAffected->PlaySound(SPEECH_36, 0);
4264  break;
4265  case 266: // Pure Intellect
4266  if (!playerAffected->pure_intellect_used) {
4267  playerAffected->uIntelligence += 50;
4268  playerAffected->pure_intellect_used = 1;
4269  }
4270  playerAffected->PlaySound(SPEECH_36, 0);
4271  break;
4272  case 267: // Pure Endurance
4273  if (!playerAffected->pure_endurance_used) {
4274  playerAffected->uEndurance += 50;
4275  playerAffected->pure_endurance_used = 1;
4276  }
4277  playerAffected->PlaySound(SPEECH_36, 0);
4278  break;
4279  case 268: // Pure Personality
4280  if (!playerAffected->pure_willpower_used) {
4281  playerAffected->uWillpower += 50;
4282  playerAffected->pure_willpower_used = 1;
4283  }
4284  playerAffected->PlaySound(SPEECH_36, 0);
4285  break;
4286  case 269: // Pure Accuracy
4287  if (!playerAffected->pure_accuracy_used) {
4288  playerAffected->uAccuracy += 50;
4289  playerAffected->pure_accuracy_used = 1;
4290  }
4291  playerAffected->PlaySound(SPEECH_36, 0);
4292  break;
4293  case 270: // Pure Might
4294  if (!playerAffected->pure_might_used) {
4295  playerAffected->uMight += 50;
4296  playerAffected->pure_might_used = 1;
4297  }
4298  playerAffected->PlaySound(SPEECH_36, 0);
4299  break;
4300  case 271: // Rejuvenation
4301  playerAffected->sAgeModifier = 0;
4302  playerAffected->PlaySound(SPEECH_36, 0);
4303  break;
4304 
4305  default:
4307  36, pParty->pPickedItem.GetDisplayName().c_str())); // %s can not be used that way
4308 
4309  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4310  return;
4311  }
4312  pAudioPlayer->PlaySound(SOUND_drink, 0, 0, -1, 0, 0);
4313  if (pGUIWindow_CurrentMenu &&
4315  // if ( !v73 ) v73 is always 1 at this point
4316  // {
4317  // pMouse->RemoveHoldingItem();
4318  // return;
4319  // }
4320  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
4321  }
4322  if (v73) {
4323  if (pParty->bTurnBasedModeOn) {
4324  pParty->pTurnBasedPlayerRecoveryTimes[player_num - 1] = 100;
4325  this->SetRecoveryTime(100);
4327  } else {
4328  this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
4329  }
4330  }
4331  mouse->RemoveHoldingItem();
4332  return;
4333  }
4334 
4337  if (!playerAffected->CanAct()) {
4338  auto str = localization->FormatString(
4340  playerAffected->GetMajorConditionIdx()));
4342 
4343  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4344  return;
4345  }
4346  if (engine->IsUnderwater()) {
4347  GameUI_StatusBar_OnEvent(localization->GetString(652)); // You can not do that while you are underwater!
4348  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4349  return;
4350  }
4351 
4352  scroll_id = pParty->pPickedItem.uItemID - 299;
4353  if (scroll_id == 30 || scroll_id == 4 || scroll_id == 91 ||
4354  scroll_id == 28) { // Enchant Item scroll, Vampiric Weapon scroll
4355  // ,Recharge Item ,Fire Aura
4360  _42777D_CastSpell_UseWand_ShootArrow((SPELL_TYPE)scroll_id, player_num - 1, 0x85u, 1, 0);
4361  } else {
4363  pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
4366  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
4367  }
4368  }
4369  return;
4370  }
4371 
4373  v15 = pParty->pPickedItem.uItemID - 400;
4374  v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID - 400];
4375  // (char *)&v3->pConditions[0] +
4376  // pParty->pPickedItem.uItemID + 2;
4377  if (v72) {
4378  auto str = localization->FormatString(
4379  380, pParty->pPickedItem.GetDisplayName().c_str()); // You already know the %s spell
4381 
4382  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4383  return;
4384  }
4385  if (!playerAffected->CanAct()) {
4386  auto str = localization->FormatString(
4387  382, // That player is %s
4389  playerAffected->GetMajorConditionIdx()));
4391 
4392  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4393  return;
4394  }
4395  v16 = v15 % 11 + 1;
4396  v17 = playerAffected->pActiveSkills[v15 / 11 + 12];
4397  v18 = SkillToMastery(v17) - 1;
4398  switch (v18) {
4399  case 0:
4400  v67 = 4;
4401  break;
4402  case 1:
4403  v67 = 7;
4404  break;
4405  case 2:
4406  v67 = 10;
4407  break;
4408  case 3:
4409  v67 = 11;
4410  break;
4411  default:
4412  v67 = player_num;
4413  }
4414 
4415  if (v16 > v67 || !v17) {
4416  auto str = localization->FormatString(
4418  .c_str()); // You don't have the skill to learn %s
4420 
4421  playerAffected->PlaySound((PlayerSpeech)20, 0);
4422  return;
4423  }
4424  playerAffected->spellbook
4425  .bHaveSpell[pParty->pPickedItem.uItemID - 400] = 1;
4426  playerAffected->PlaySound(SPEECH_21, 0);
4427  v73 = 0;
4428 
4429  if (pGUIWindow_CurrentMenu &&
4431  if (!v73) {
4433  return;
4434  }
4435  pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
4436  }
4437  // if ( v73 ) v73
4438  // is always 0 at this point
4439  // {
4440  // if ( pParty->bTurnBasedModeOn )
4441  // {
4442  // pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
4443  // thisb->SetRecoveryTime(100);
4444  // pTurnEngine->ApplyPlayerAction();
4445  // }
4446  // else
4447  // {
4448  // thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
4449  // }
4450  // }
4452  return;
4453  }
4454 
4456  if (playerAffected->CanAct()) {
4458  playerAffected->PlaySound(SPEECH_37, 0);
4459  return;
4460  }
4461 
4462  auto str = localization->FormatString(
4463  382, // That player is %s
4465  playerAffected->GetMajorConditionIdx()));
4467 
4468  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4469  return;
4470  } else {
4472  thisa = pParty->uCurrentMonthWeek + 1;
4473  if (pParty->uCurrentMonth >= 7)
4474  v74 = nullptr;
4475  else
4477 
4478  String status;
4479  switch (pParty->uCurrentMonth) {
4480  case 0:
4481  playerAffected->uMight += thisa;
4482  status = StringPrintf(
4483  "+%u %s %s", thisa, v74,
4484  localization->GetString(121)); // "Permanent"
4485  break;
4486  case 1:
4487  playerAffected->uIntelligence += thisa;
4488  status = StringPrintf(
4489  "+%u %s %s", thisa, v74,
4490  localization->GetString(121)); // "Permanent"
4491  break;
4492  case 2:
4493  playerAffected->uWillpower += thisa;
4494  status = StringPrintf(
4495  "+%u %s %s", thisa, v74,
4496  localization->GetString(121)); // "Permanent"
4497  break;
4498  case 3:
4499  playerAffected->uEndurance += thisa;
4500  status = StringPrintf(
4501  "+%u %s %s", thisa, v74,
4502  localization->GetString(121)); // "Permanent"
4503  break;
4504  case 4:
4505  playerAffected->uAccuracy += thisa;
4506  status = StringPrintf(
4507  "+%u %s %s", thisa, v74,
4508  localization->GetString(121)); // "Permanent"
4509  break;
4510  case 5:
4511  playerAffected->uSpeed += thisa;
4512  status = StringPrintf(
4513  "+%u %s %s", thisa, v74,
4514  localization->GetString(121)); // "Permanent"
4515  break;
4516  case 6:
4517  playerAffected->uLuck += thisa;
4518  status = StringPrintf(
4519  "+%u %s %s", thisa, v74,
4520  localization->GetString(121)); // "Permanent"
4521  break;
4522  case 7:
4523  pParty->PartyFindsGold(1000 * thisa, 0);
4524  status =
4525  StringPrintf("+%u %s", 1000 * thisa,
4526  localization->GetString(97)); // "Gold"
4527  break;
4528  case 8:
4529  Party::GiveFood(5 * thisa);
4530  status =
4531  StringPrintf("+%u %s", 5 * thisa,
4532  localization->GetString(653)); // "Food"
4533  break;
4534  case 9u:
4535  playerAffected->uSkillPoints += 2 * thisa;
4536  status = StringPrintf(
4537  "+%u %s", 2 * thisa,
4538  localization->GetString(207)); // Skill Points
4539  break;
4540  case 10:
4541  playerAffected->uExperience += 2500 * thisa;
4542  status = StringPrintf(
4543  "+%u %s", 2500 * thisa,
4544  localization->GetString(83)); // Experience
4545  break;
4546  case 11: {
4547  v8 = rand() % 6;
4548 
4549  auto spell_school_name =
4550  localization->GetSpellSchoolName(v8 == 5 ? v8 + 1 : v8);
4551 
4552  switch (v8) {
4553  case 0: // Fire
4554  playerAffected->sResFireBase += thisa;
4555  break;
4556  case 1: // Air
4557  playerAffected->sResAirBase += thisa;
4558  break;
4559  case 2: // Water
4560  playerAffected->sResWaterBase += thisa;
4561  break;
4562  case 3: // Earth
4563  playerAffected->sResEarthBase += thisa;
4564  break;
4565  case 4: // Mind
4566  playerAffected->sResMindBase += thisa;
4567  break;
4568  case 5: // Body
4569  playerAffected->sResBodyBase += thisa;
4570  break;
4571  default:
4572  ("Unexpected attribute");
4573  return;
4574  }
4575  status = StringPrintf(
4576  "+%u %s %s", thisa, spell_school_name,
4577  localization->GetString(121)); // Permanent
4578  break;
4579  }
4580  }
4581  GameUI_StatusBar_OnEvent(status);
4582 
4585  playerAffected->PlaySound(SPEECH_93, 0);
4586  pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0);
4587  if (pParty->uCurrentDayOfMonth == 6 ||
4588  pParty->uCurrentDayOfMonth == 20) {
4589  playerAffected->SetCondition(Condition_Eradicated, 0);
4590  pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0);
4591  } else if (pParty->uCurrentDayOfMonth == 12 ||
4592  pParty->uCurrentDayOfMonth == 26) {
4593  playerAffected->SetCondition(Condition_Dead, 0);
4594  pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0);
4595  } else if (pParty->uCurrentDayOfMonth == 4 ||
4596  pParty->uCurrentDayOfMonth == 25) {
4597  playerAffected->SetCondition(Condition_Pertified, 0);
4598  pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0);
4599  }
4600  return;
4601  } else if (pParty->pPickedItem.uItemID == ITEM_RED_APPLE) {
4602  Party::GiveFood(1);
4603  pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0);
4604  } else if (pParty->pPickedItem.uItemID == ITEM_LUTE) {
4605  pAudioPlayer->PlaySound(SOUND_luteguitar, 0, 0, -1, 0, 0);
4606  return;
4607  } else if (pParty->pPickedItem.uItemID == ITEM_FAERIE_PIPES) {
4608  pAudioPlayer->PlaySound(SOUND_panflute, 0, 0, -1, 0, 0);
4609  return;
4611  pAudioPlayer->PlaySound(SOUND_trumpet, 0, 0, -1, 0, 0);
4612  return;
4613  } else if (pParty->pPickedItem.uItemID == ITEM_HORSESHOE) {
4615  v5 = PID(OBJECT_Player, player_num + 49);
4616  pAudioPlayer->PlaySound(SOUND_quest, v5, 0, -1, 0, 0);
4617  playerAffected->AddVariable(VAR_NumSkillPoints, 2);
4620  return;
4621  } else {
4622  auto str = localization->FormatString(
4623  36, pParty->pPickedItem.GetDisplayName().c_str()); // %s can not be used that way
4625 
4626  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
4627  return;
4628  }
4629 
4631  return;
4632  }
4633 }
4634 
4635 bool CmpSkillValue(int valToCompare, int skillValue) {
4636  int v4;
4637  if (valToCompare <= 63)
4638  v4 = skillValue & 0x3F;
4639  else
4640  v4 = skillValue & skillValue;
4641  return v4 >= valToCompare;
4642 }
4643 
4644 //----- (00449BB4) --------------------------------------------------------
4645 bool Player::CompareVariable(enum VariableType VarNum, int pValue) {
4646  // in some cases this calls only calls v4 >= pValue, which i've
4647  // changed to return false, since these values are supposed to
4648  // be positive and v4 was -1 by default
4649  Assert(pValue >= 0, "Compare variable shouldn't have negative arguments");
4650 
4651  signed int v4; // edi@1
4652  unsigned __int8 test_bit_value; // eax@25
4653  unsigned __int8 byteWithRequestedBit; // cl@25
4654  DDM_DLV_Header* v19; // eax@122
4655  DDM_DLV_Header* v21; // eax@126
4656  int actStat; // ebx@161
4657  int baseStat; // eax@161
4658 
4659  if ((signed int)VarNum >= VAR_MapPersistentVariable_0 &&
4660  VarNum <= VAR_MapPersistentVariable_74)
4661  return (unsigned __int8)stru_5E4C90_MapPersistVars
4663  0; // originally (unsigned __int8)byte_5E4C15[VarNum];
4664  if ((signed int)VarNum >= VAR_MapPersistentVariable_75 &&
4665  VarNum <= VAR_MapPersistentVariable_99)
4666  return (unsigned __int8)stru_5E4C90_MapPersistVars
4668  0; // not really sure whether the number gets up to 99, but
4669  // can't ignore the possibility
4670 
4671  switch (VarNum) {
4672  case VAR_Sex:
4673  return (pValue == this->uSex);
4674  case VAR_Class:
4675  return (pValue == this->classType);
4676  case VAR_Race:
4677  return pValue == GetRace();
4678  case VAR_CurrentHP:
4679  return this->sHealth >= pValue;
4680  case VAR_MaxHP:
4681  return (this->sHealth >= GetMaxHealth());
4682  case VAR_CurrentSP:
4683  return this->sMana >= pValue;
4684  case VAR_MaxSP:
4685  return (this->sMana >= GetMaxMana());
4686  case VAR_ActualAC:
4687  return GetActualAC() >= pValue;
4688  case VAR_ACModifier:
4689  return this->sACModifier >= pValue;
4690  case VAR_BaseLevel:
4691  return this->uLevel >= pValue;
4692  case VAR_LevelModifier:
4693  return this->sLevelModifier >= pValue;
4694  case VAR_Age:
4695  return GetActualAge() >= (unsigned int)pValue;
4696  case VAR_Award:
4697  return _449B57_test_bit(this->_achieved_awards_bits, pValue);
4698  case VAR_Experience:
4699  return this->uExperience >=
4700  pValue; // TODO(_) change pValue to long long
4701  case VAR_QBits_QuestsDone:
4702  return _449B57_test_bit(pParty->_quest_bits, pValue);
4703  case VAR_PlayerItemInHands:
4704  // for (int i = 0; i < 138; i++)
4705  for (int i = 0; i < 126; i++) {
4706  if (pInventoryItemList[i].uItemID == pValue) {
4707  return true;
4708  }
4709  }
4710  return pParty->pPickedItem.uItemID == pValue;
4711 
4712  case VAR_Hour:
4713  return pParty->GetPlayingTime().GetHoursOfDay() == pValue;
4714 
4715  case VAR_DayOfYear:
4716  return pParty->GetPlayingTime().GetDays() % 336 + 1 == pValue;
4717 
4718  case VAR_DayOfWeek:
4719  return pParty->GetPlayingTime().GetDays() % 7 == pValue;
4720 
4721  case VAR_FixedGold:
4722  return pParty->GetGold() >= pValue;
4723  case VAR_FixedFood:
4724  return pParty->GetFood() >= pValue;
4725  case VAR_MightBonus:
4726  return this->uMightBonus >= pValue;
4727  case VAR_IntellectBonus:
4728  return this->uIntelligenceBonus >= pValue;
4729  case VAR_PersonalityBonus:
4730  return this->uWillpowerBonus >= pValue;
4731  case VAR_EnduranceBonus:
4732  return this->uEnduranceBonus >= pValue;
4733  case VAR_SpeedBonus:
4734  return this->uSpeedBonus >= pValue;
4735  case VAR_AccuracyBonus:
4736  return this->uAccuracyBonus >= pValue;
4737  case VAR_LuckBonus:
4738  return this->uLuckBonus >= pValue;
4739  case VAR_BaseMight:
4740  return this->uMight >= pValue;
4741  case VAR_BaseIntellect:
4742  return this->uIntelligence >= pValue;
4743  case VAR_BasePersonality:
4744  return this->uWillpower >= pValue;
4745  case VAR_BaseEndurance:
4746  return this->uEndurance >= pValue;
4747  case VAR_BaseSpeed:
4748  return this->uSpeed >= pValue;
4749  case VAR_BaseAccuracy:
4750  return this->uAccuracy >= pValue;
4751  case VAR_BaseLuck:
4752  return this->uLuck >= pValue;
4753  case VAR_ActualMight:
4754  return GetActualMight() >= pValue;
4755  case VAR_ActualIntellect:
4756  return GetActualIntelligence() >= pValue;
4757  case VAR_ActualPersonality:
4758  return GetActualWillpower() >= pValue;
4759  case VAR_ActualEndurance:
4760  return GetActualEndurance() >= pValue;
4761  case VAR_ActualSpeed:
4762  return GetActualSpeed() >= pValue;
4763  case VAR_ActualAccuracy:
4764  return GetActualAccuracy() >= pValue;
4765  case VAR_ActualLuck:
4766  return GetActualLuck() >= pValue;
4767  case VAR_FireResistance:
4768  return this->sResFireBase >= pValue;
4769  case VAR_AirResistance:
4770  return this->sResAirBase >= pValue;
4771  case VAR_WaterResistance:
4772  return this->sResWaterBase >= pValue;
4773  case VAR_EarthResistance:
4774  return this->sResEarthBase >= pValue;
4775  case VAR_SpiritResistance:
4776  return this->sResSpiritBase >= pValue;
4777  case VAR_MindResistance:
4778  return this->sResMindBase >= pValue;
4779  case VAR_BodyResistance:
4780  return this->sResBodyBase >= pValue;
4781  case VAR_LightResistance:
4782  return this->sResLightBase >= pValue;
4783  case VAR_DarkResistance:
4784  return this->sResDarkBase >= pValue;
4786  Error("Physical resistance isn't used in events");
4787  return false;
4788  case VAR_MagicResistance:
4789  return this->sResMagicBase >= pValue;
4791  return this->sResFireBonus >= pValue;
4793  return this->sResAirBonus >= pValue;
4795  return this->sResWaterBonus >= pValue;
4797  return this->sResEarthBonus >= pValue;
4799  return this->sResSpiritBonus >= pValue;
4801  return this->sResMindBonus >= pValue;
4803  return this->sResBodyBonus >= pValue;
4805  return this->sResLightBonus >= pValue;
4807  return this->sResDarkBonus >= pValue;
4809  return this->sResMagicBonus >= pValue;
4810  case VAR_StaffSkill:
4811  return CmpSkillValue(pValue, this->skillStaff);
4812  case VAR_SwordSkill:
4813  return CmpSkillValue(pValue, this->skillSword);
4814  case VAR_DaggerSkill:
4815  return CmpSkillValue(pValue, this->skillDagger);
4816  case VAR_AxeSkill:
4817  return CmpSkillValue(pValue, this->skillAxe);
4818  case VAR_SpearSkill:
4819  return CmpSkillValue(pValue, this->skillSpear);
4820  case VAR_BowSkill:
4821  return CmpSkillValue(pValue, this->skillBow);
4822  case VAR_MaceSkill:
4823  return CmpSkillValue(pValue, this->skillMace);
4824  case VAR_BlasterSkill:
4825  return CmpSkillValue(pValue, this->skillBlaster);
4826  case VAR_ShieldSkill:
4827  return CmpSkillValue(pValue, this->skillShield);
4828  case VAR_LeatherSkill:
4829  return CmpSkillValue(pValue, this->skillLeather);
4830  case VAR_SkillChain:
4831  return CmpSkillValue(pValue, this->skillChain);
4832  case VAR_PlateSkill:
4833  return CmpSkillValue(pValue, this->skillPlate);
4834  case VAR_FireSkill:
4835  return CmpSkillValue(pValue, this->skillFire);
4836  case VAR_AirSkill:
4837  return CmpSkillValue(pValue, this->skillAir);
4838  case VAR_WaterSkill:
4839  return CmpSkillValue(pValue, this->skillWater);
4840  case VAR_EarthSkill:
4841  return CmpSkillValue(pValue, this->skillEarth);
4842  case VAR_SpiritSkill:
4843  return CmpSkillValue(pValue, this->skillSpirit);
4844  case VAR_MindSkill:
4845  return CmpSkillValue(pValue, this->skillMind);
4846  case VAR_BodySkill:
4847  return CmpSkillValue(pValue, this->skillBody);
4848  case VAR_LightSkill:
4849  return CmpSkillValue(pValue, this->skillLight);
4850  case VAR_DarkSkill:
4851  return CmpSkillValue(pValue, this->skillDark);
4852  case VAR_IdentifyItemSkill:
4853  return CmpSkillValue(pValue, this->skillItemId);
4854  case VAR_MerchantSkill:
4855  return CmpSkillValue(pValue, this->skillMerchant);
4856  case VAR_RepairSkill:
4857  return CmpSkillValue(pValue, this->skillRepair);
4858  case VAR_BodybuildingSkill:
4859  return CmpSkillValue(pValue, this->skillBodybuilding);
4860  case VAR_MeditationSkill:
4861  return CmpSkillValue(pValue, this->skillMeditation);
4862  case VAR_PerceptionSkill:
4863  return CmpSkillValue(pValue, this->skillPerception);
4864  case VAR_DiplomacySkill:
4865  return CmpSkillValue(pValue, this->skillDiplomacy);
4866  case VAR_ThieverySkill:
4867  Error("Thievery isn't used in events");
4868  return false;
4869  case VAR_DisarmTrapSkill: // wasn't in the original
4870  return CmpSkillValue(pValue, this->skillDisarmTrap);
4871  case VAR_DodgeSkill: // wasn't in the original
4872  return CmpSkillValue(pValue, this->skillDodge);
4873  case VAR_UnarmedSkill: // wasn't in the original
4874  return CmpSkillValue(pValue, this->skillUnarmed);
4875  case VAR_IdentifyMonsterSkill: // wasn't in the original
4876  return CmpSkillValue(pValue, this->skillMonsterId);
4877  case VAR_ArmsmasterSkill: // wasn't in the original
4878  return CmpSkillValue(pValue, this->skillArmsmaster);
4879  case VAR_StealingSkill: // wasn't in the original
4880  return CmpSkillValue(pValue, this->skillStealing);
4881  case VAR_AlchemySkill: // wasn't in the original
4882  return CmpSkillValue(pValue, this->skillAlchemy);
4883  case VAR_LearningSkill:
4884  return CmpSkillValue(pValue, this->skillLearning);
4885  case VAR_Cursed:
4886  return conditions_times[Condition_Cursed].Valid();
4887  case VAR_Weak:
4888  return conditions_times[Condition_Weak].Valid();
4889  case VAR_Asleep:
4890  return conditions_times[Condition_Sleep].Valid();
4891  case VAR_Afraid:
4892  return conditions_times[Condition_Fear].Valid();
4893  case VAR_Drunk:
4894  return conditions_times[Condition_Drunk].Valid();
4895  case VAR_Insane:
4896  return conditions_times[Condition_Insane].Valid();
4897  case VAR_PoisonedGreen:
4898  return conditions_times[Condition_Poison_Weak].Valid();
4899  case VAR_DiseasedGreen:
4900  return conditions_times[Condition_Disease_Weak].Valid();
4901  case VAR_PoisonedYellow:
4902  return conditions_times[Condition_Poison_Medium].Valid();
4903  case VAR_DiseasedYellow:
4905  case VAR_PoisonedRed:
4906  return conditions_times[Condition_Poison_Severe].Valid();
4907  case VAR_DiseasedRed:
4909  case VAR_Paralyzed:
4910  return conditions_times[Condition_Paralyzed].Valid();
4911  case VAR_Unconsious:
4912  return conditions_times[Condition_Unconcious].Valid();
4913  case VAR_Dead:
4914  return conditions_times[Condition_Dead].Valid();
4915  case VAR_Stoned:
4916  return conditions_times[Condition_Pertified].Valid();
4917  case VAR_Eradicated:
4918  return conditions_times[Condition_Eradicated].Valid();
4919  case VAR_MajorCondition:
4920  v4 = GetMajorConditionIdx();
4921  if (v4 != 18) {
4922  return v4 >= pValue;
4923  }
4924  return true;
4925  case VAR_AutoNotes: // TODO(_): find out why the double subtraction. or
4926  // whether this is even used
4927  test_bit_value = 0x80u >> (pValue - 2) % 8;
4928  byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) / 8];
4929  return (test_bit_value & byteWithRequestedBit) != 0;
4931  actStat = GetActualMight();
4932  baseStat = GetBaseStrength();
4933  return (actStat >= baseStat);
4935  actStat = GetActualIntelligence();
4936  baseStat = GetBaseIntelligence();
4937  return (actStat >= baseStat);
4939  actStat = GetActualWillpower();
4940  baseStat = GetBaseWillpower();
4941  return (actStat >= baseStat);
4943  actStat = GetActualEndurance();
4944  baseStat = GetBaseEndurance();
4945  return (actStat >= baseStat);
4947  actStat = GetActualSpeed();
4948  baseStat = GetBaseSpeed();
4949  return (actStat >= baseStat);
4951  actStat = GetActualAccuracy();
4952  baseStat = GetBaseAccuracy();
4953  return (actStat >= baseStat);
4955  actStat = GetActualLuck();
4956  baseStat = GetBaseLuck();
4957  return (actStat >= baseStat);
4958  case VAR_PlayerBits:
4959  test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
4960  byteWithRequestedBit =
4961  this->playerEventBits[((signed __int16)pValue - 1) / 8];
4962  return (test_bit_value & byteWithRequestedBit) != 0;
4963  case VAR_NPCs2:
4964  return pNPCStats->pNewNPCData[pValue].Hired();
4965  case VAR_IsFlying:
4966  if (pParty->bFlying && pParty->pPartyBuffs[PARTY_BUFF_FLY].Active())
4967  return true;
4968  return false;
4970  return CheckHiredNPCSpeciality(pValue);
4971  case VAR_CircusPrises: // isn't used in MM6 since 0x1D6u is a book of
4972  // regeneration
4973  v4 = 0;
4974  for (int playerNum = 0; playerNum < 4; playerNum++) {
4975  for (int invPos = 0; invPos < 138; invPos++) {
4976  int itemId = pParty->pPlayers[playerNum]
4977  .pInventoryItemList[invPos]
4978  .uItemID;
4979  switch (itemId) {
4980  case 0x1D6u:
4981  ++v4;
4982  break;
4983  case 0x1D7u:
4984  v4 += 3;
4985  break;
4986  case 0x1DDu:
4987  v4 += 5;
4988  break;
4989  }
4990  }
4991  }
4992  return v4 >= pValue;
4993  case VAR_NumSkillPoints:
4994  return this->uSkillPoints >= (unsigned int)pValue;
4995  case VAR_MonthIs:
4996  return (pParty->uCurrentMonth == (unsigned int)pValue);
4997  case VAR_Counter1:
4998  case VAR_Counter2:
4999  case VAR_Counter3:
5000  case VAR_Counter4:
5001  case VAR_Counter5:
5002  case VAR_Counter6:
5003  case VAR_Counter7:
5004  case VAR_Counter8:
5005  case VAR_Counter9:
5006  case VAR_Counter10:
5008  .Valid()) {
5009  return (pParty->PartyTimes
5010  .CounterEventValues[VarNum - VAR_Counter1] +
5011  GameTime::FromHours(pValue)) <=
5013  }
5014  break;
5015 
5017  v19 = &pOutdoor->ddm;
5019  return (v19->uReputation >= pValue);
5020 
5021  case VAR_Unknown1:
5022  v21 = &pOutdoor->ddm;
5024  return (v21->field_C_alert == pValue); // yes, equality, not >=
5025 
5026  case VAR_GoldInBank:
5027  return pParty->uNumGoldInBank >= (unsigned int)pValue;
5028 
5029  case VAR_NumDeaths:
5030  return pParty->uNumDeaths >= (unsigned int)pValue;
5031 
5032  case VAR_NumBounties:
5033  return pParty->uNumBountiesCollected >= (unsigned int)pValue;
5034 
5035  case VAR_PrisonTerms:
5036  return pParty->uNumPrisonTerms >= pValue;
5037  case VAR_ArenaWinsPage:
5038  return (unsigned __int8)pParty->uNumArenaPageWins >= pValue;
5039  case VAR_ArenaWinsSquire:
5040  return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue;
5041  case VAR_ArenaWinsKnight:
5042  return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue;
5043  case VAR_ArenaWinsLord:
5044  return pParty->uNumArenaLordWins >= pValue;
5045  case VAR_Invisible:
5046  return pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Active();
5047  case VAR_ItemEquipped:
5048  for (int i = 0; i < 16; i++) {
5049  if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
5050  GetNthEquippedIndexItem(i)->uItemID == pValue) {
5051  return true;
5052  }
5053  }
5054  return false;
5055  }
5056 
5057  return false;
5058 }
5059 
5060 //----- (0044A5CB) --------------------------------------------------------
5061 void Player::SetVariable(enum VariableType var_type, signed int var_value) {
5062  unsigned int v6; // esi@13
5063  unsigned int v7; // esi@14
5064  signed int v11; // eax@30
5065  DDM_DLV_Header* v24; // ecx@148
5066  ItemGen item; // [sp+Ch] [bp-28h]@52
5067 
5068  if (var_type >= VAR_History_0 && var_type <= VAR_History_28) {
5069  if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0]) {
5072  if (pStorylineText->StoreLine[var_type - VAR_History_0].pText) {
5073  bFlashHistoryBook = 1;
5074  PlayAwardSound();
5075  }
5076  }
5077  return;
5078  }
5079 
5080  if (var_type >= VAR_MapPersistentVariable_0 &&
5081  var_type <= VAR_MapPersistentVariable_99) {
5082  if (var_type >= VAR_MapPersistentVariable_0 &&
5083  var_type <= VAR_MapPersistentVariable_74)
5085  .field_0[var_type - VAR_MapPersistentVariable_0] =
5086  (char)var_value;
5087  if (var_type >= VAR_MapPersistentVariable_75 &&
5088  var_type <= VAR_MapPersistentVariable_99)
5091  (unsigned char)
5092  var_value; // not really sure whether the number gets up to
5093  // 99, but can't ignore the possibility
5094  return;
5095  }
5096 
5097  if (var_type >= VAR_UnknownTimeEvent0 &&
5098  var_type <= VAR_UnknownTimeEvent19) {
5101  PlayAwardSound();
5102  return;
5103  }
5104 
5105  switch (var_type) {
5106  case VAR_Sex:
5107  this->uSex = (PLAYER_SEX)var_value;
5109  return;
5110  case VAR_Class:
5111  this->classType = (PLAYER_CLASS_TYPE)var_value;
5112  if ((PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH) {
5113  for (int i = 0; i < 138; i++) {
5114  if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY) {
5115  this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL;
5116  this->pOwnItems[i].uHolderPlayer = GetPlayerIndex() + 1;
5117  }
5118  }
5119  if (this->sResFireBase < 20) this->sResFireBase = 20;
5120  if (this->sResAirBase < 20) this->sResAirBase = 20;
5121  if (this->sResWaterBase < 20) this->sResWaterBase = 20;
5122  if (this->sResEarthBase < 20) this->sResEarthBase = 20;
5123  this->sResMindBase = 200;
5124  this->sResBodyBase = 200;
5125  v11 = this->GetSexByVoice();
5126  this->uPrevVoiceID = this->uVoiceID;
5127  this->uPrevFace = this->uCurrentFace;
5128  if (v11) {
5129  this->uCurrentFace = 21;
5130  this->uVoiceID = 21;
5131  } else {
5132  this->uCurrentFace = 20;
5133  this->uVoiceID = 20;
5134  }
5136  this->uCurrentFace);
5137  }
5139  return;
5140  case VAR_CurrentHP:
5141  this->sHealth = var_value;
5143  return;
5144  case VAR_MaxHP:
5145  this->sHealth = GetMaxHealth();
5146  return;
5147  case VAR_CurrentSP:
5148  this->sMana = var_value;
5150  return;
5151  case VAR_MaxSP:
5152  this->sMana = GetMaxMana();
5153  return;
5154  case VAR_ACModifier:
5155  this->sACModifier = (unsigned __int8)var_value;
5157  return;
5158  case VAR_BaseLevel:
5159  this->uLevel = (unsigned __int8)var_value;
5161  return;
5162  case VAR_LevelModifier:
5163  this->sLevelModifier = (unsigned __int8)var_value;
5165  return;
5166  case VAR_Age:
5167  this->sAgeModifier = var_value;
5168  return;
5169  case VAR_Award:
5170  if (!_449B57_test_bit(this->_achieved_awards_bits, var_value) &&
5171  pAwards[var_value].pText) {
5173  this->PlaySound(SPEECH_96, 0);
5174  }
5175  _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
5176  return;
5177  case VAR_Experience:
5178  this->uExperience = var_value;
5180  return;
5181  case VAR_QBits_QuestsDone:
5182  if (!_449B57_test_bit(pParty->_quest_bits, var_value) &&
5183  pQuestTable[var_value - 1]) {
5184  bFlashQuestBook = 1;
5186  PlayAwardSound();
5187  this->PlaySound(SPEECH_93, 0);
5188  }
5189  _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
5190  return;
5191  case VAR_PlayerItemInHands:
5192  item.Reset();
5193  item.uItemID = var_value;
5194  item.uAttributes = 1;
5195  pParty->SetHoldingItem(&item);
5196  if (var_value >= ITEM_ARTIFACT_PUCK &&
5197  var_value <= ITEM_RELIC_MEKORIGS_HAMMER)
5198  pParty->pIsArtifactFound[var_value - 500] = 1;
5199  return;
5200  case VAR_FixedGold:
5201  Party::SetGold(var_value);
5202  return;
5203  case VAR_RandomGold:
5204  v6 = rand() % var_value + 1;
5205  Party::SetGold(v6);
5207  localization->FormatString(500, v6)); // You have %lu gold
5209  return;
5210  case VAR_FixedFood:
5211  Party::SetFood(var_value);
5213  return;
5214  case VAR_RandomFood:
5215  v7 = rand() % var_value + 1;
5216  Party::SetFood(v7);
5218  localization->FormatString(501, v7)); // You have %lu food
5221  return;
5222  case VAR_BaseMight:
5223  this->uMight = (unsigned __int8)var_value;
5225  return;
5226  case VAR_BaseIntellect:
5227  this->uIntelligence = (unsigned __int8)var_value;
5229  return;
5230  case VAR_BasePersonality:
5231  this->uWillpower = (unsigned __int8)var_value;
5233  return;
5234  case VAR_BaseEndurance:
5235  this->uEndurance = (unsigned __int8)var_value;
5237  return;
5238  case VAR_BaseSpeed:
5239  this->uSpeed = (unsigned __int8)var_value;
5241  return;
5242  case VAR_BaseAccuracy:
5243  this->uAccuracy = (unsigned __int8)var_value;
5245  return;
5246  case VAR_BaseLuck:
5247  this->uLuck = (unsigned __int8)var_value;
5249  return;
5250  case VAR_MightBonus:
5251  case VAR_ActualMight:
5252  this->uMightBonus = (unsigned __int8)var_value;
5254  return;
5255  case VAR_IntellectBonus:
5256  case VAR_ActualIntellect:
5257  this->uIntelligenceBonus = (unsigned __int8)var_value;
5259  return;
5260  case VAR_PersonalityBonus:
5261  case VAR_ActualPersonality:
5262  this->uWillpowerBonus = (unsigned __int8)var_value;
5264  return;
5265  case VAR_EnduranceBonus:
5266  case VAR_ActualEndurance:
5267  this->uEnduranceBonus = (unsigned __int8)var_value;
5269  return;
5270  case VAR_SpeedBonus:
5271  case VAR_ActualSpeed:
5272  this->uSpeedBonus = (unsigned __int8)var_value;
5274  return;
5275  case VAR_AccuracyBonus:
5276  case VAR_ActualAccuracy:
5277  this->uAccuracyBonus = (unsigned __int8)var_value;
5279  return;
5280  case VAR_LuckBonus:
5281  case VAR_ActualLuck:
5282  this->uLuckBonus = (unsigned __int8)var_value;
5284  return;
5285  case VAR_FireResistance:
5286  this->sResFireBase = (unsigned __int8)var_value;
5288  return;
5289  case VAR_AirResistance:
5290  this->sResAirBase = (unsigned __int8)var_value;
5292  return;
5293  case VAR_WaterResistance:
5294  this->sResWaterBase = (unsigned __int8)var_value;
5296  return;
5297  case VAR_EarthResistance:
5298  this->sResEarthBase = (unsigned __int8)var_value;
5300  return;
5301  case VAR_SpiritResistance:
5302  this->sResSpiritBase = (unsigned __int8)var_value;
5304  return;
5305  case VAR_MindResistance:
5306  this->sResMindBase = (unsigned __int8)var_value;
5308  return;
5309  case VAR_BodyResistance:
5310  this->sResBodyBase = (unsigned __int8)var_value;
5312  return;
5313  case VAR_LightResistance:
5314  this->sResLightBase = (unsigned __int8)var_value;
5316  return;
5317  case VAR_DarkResistance:
5318  this->sResDarkBase = (unsigned __int8)var_value;
5320  return;
5321  case VAR_MagicResistance:
5322  this->sResMagicBase = (unsigned __int8)var_value;
5324  return;
5326  this->sResFireBonus = (unsigned __int8)var_value;
5328  return;
5330  this->sResAirBonus = (unsigned __int8)var_value;
5332  return;
5334  this->sResWaterBonus = (unsigned __int8)var_value;
5336  return;
5338  this->sResEarthBonus = (unsigned __int8)var_value;
5340  return;
5342  this->sResSpiritBonus = (unsigned __int8)var_value;
5344  return;
5346  this->sResMindBonus = (unsigned __int8)var_value;
5348  return;
5350  this->sResBodyBonus = (unsigned __int8)var_value;
5352  return;
5354  this->sResLightBonus = (unsigned __int8)var_value;
5356  return;
5358  this->sResDarkBonus = (unsigned __int8)var_value;
5360  return;
5362  Error("Physical res. bonus not used");
5363  return;
5365  this->sResMagicBonus = (unsigned __int8)var_value;
5367  return;
5368  case VAR_Cursed:
5369  this->SetCondition(Condition_Cursed, 1);
5371  return;
5372  case VAR_Weak:
5373  this->SetCondition(Condition_Weak, 1);
5375  return;
5376  case VAR_Asleep:
5377  this->SetCondition(Condition_Sleep, 1);
5379  return;
5380  case VAR_Afraid:
5381  this->SetCondition(Condition_Fear, 1);
5383  return;
5384  case VAR_Drunk:
5385  this->SetCondition(Condition_Drunk, 1);
5387  return;
5388  case VAR_Insane:
5389  this->SetCondition(Condition_Insane, 1);
5391  return;
5392  case VAR_PoisonedGreen:
5395  return;
5396  case VAR_DiseasedGreen:
5399  return;
5400  case VAR_PoisonedYellow:
5403  return;
5404  case VAR_DiseasedYellow:
5407  return;
5408  case VAR_PoisonedRed:
5411  return;
5412  case VAR_DiseasedRed:
5415  return;
5416  case VAR_Paralyzed:
5419  return;
5420  case VAR_Unconsious:
5423  return;
5424  case VAR_Dead:
5425  this->SetCondition(Condition_Dead, 1);
5427  return;
5428  case VAR_Stoned:
5431  return;
5432  case VAR_Eradicated:
5435  return;
5436  case VAR_MajorCondition:
5437  conditions_times.fill(GameTime(0));
5439  return;
5440  case VAR_AutoNotes:
5441  if (!_449B57_test_bit(pParty->_autonote_bits, var_value) &&
5442  pAutonoteTxt[var_value - 1].pText) {
5444  this->PlaySound(SPEECH_96, 0);
5445  bFlashAutonotesBook = 1;
5446  _506568_autonote_type = pAutonoteTxt[var_value - 1].eType; // dword_72371C[2 * a3];
5447  }
5448  _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
5449  PlayAwardSound();
5450  return;
5451  case VAR_PlayerBits:
5452  _449B7E_toggle_bit((unsigned char*)playerEventBits, var_value, 1u);
5453  return;
5454  case VAR_NPCs2:
5456  pNPCStats->pNewNPCData[var_value].uFlags |= 0x80u;
5458  viewparams->bRedrawGameUI = true;
5459  return;
5460  case VAR_NumSkillPoints:
5461  this->uSkillPoints = var_value;
5462  return;
5463 
5464  case VAR_Counter1:
5465  case VAR_Counter2:
5466  case VAR_Counter3:
5467  case VAR_Counter4:
5468  case VAR_Counter5:
5469  case VAR_Counter6:
5470  case VAR_Counter7:
5471  case VAR_Counter8:
5472  case VAR_Counter9:
5473  case VAR_Counter10:
5476  return;
5477 
5479  v24 = &pOutdoor->ddm;
5481  v24->uReputation = var_value;
5482  if (var_value > 10000) v24->uReputation = 10000;
5483  return;
5484  case VAR_GoldInBank:
5485  pParty->uNumGoldInBank = var_value;
5486  return;
5487  case VAR_NumDeaths:
5488  pParty->uNumDeaths = var_value;
5489  return;
5490  case VAR_NumBounties:
5491  pParty->uNumBountiesCollected = var_value;
5492  return;
5493  case VAR_PrisonTerms:
5494  pParty->uNumPrisonTerms = var_value;
5495  return;
5496  case VAR_ArenaWinsPage:
5497  pParty->uNumArenaPageWins = var_value;
5498  return;
5499  case VAR_ArenaWinsSquire:
5500  pParty->uNumArenaSquireWins = var_value;
5501  return;
5502  case VAR_ArenaWinsKnight:
5503  pParty->uNumArenaKnightWins = var_value;
5504  return;
5505  case VAR_ArenaWinsLord:
5506  pParty->uNumArenaLordWins = var_value;
5507  return;
5508  case VAR_StaffSkill:
5509  SetSkillByEvent(&Player::skillStaff, var_value);
5510  return;
5511  case VAR_SwordSkill:
5512  SetSkillByEvent(&Player::skillSword, var_value);
5513  return;
5514  case VAR_DaggerSkill:
5515  SetSkillByEvent(&Player::skillDagger, var_value);
5516  return;
5517  case VAR_AxeSkill:
5518  SetSkillByEvent(&Player::skillAxe, var_value);
5519  return;
5520  case VAR_SpearSkill:
5521  SetSkillByEvent(&Player::skillSpear, var_value);
5522  return;
5523  case VAR_BowSkill:
5524  SetSkillByEvent(&Player::skillBow, var_value);
5525  return;
5526  case VAR_MaceSkill:
5527  SetSkillByEvent(&Player::skillMace, var_value);
5528  return;
5529  case VAR_BlasterSkill:
5531  return;
5532  case VAR_ShieldSkill:
5533  SetSkillByEvent(&Player::skillShield, var_value);
5534  return;
5535  case VAR_LeatherSkill:
5537  return;
5538  case VAR_SkillChain:
5539  SetSkillByEvent(&Player::skillChain, var_value);
5540  return;
5541  case VAR_PlateSkill:
5542  SetSkillByEvent(&Player::skillPlate, var_value);
5543  return;
5544  case VAR_FireSkill:
5545  SetSkillByEvent(&Player::skillFire, var_value);
5546  return;
5547  case VAR_AirSkill:
5548  SetSkillByEvent(&Player::skillAir, var_value);
5549  return;
5550  case VAR_WaterSkill:
5551  SetSkillByEvent(&Player::skillWater, var_value);
5552  return;
5553  case VAR_EarthSkill:
5554  SetSkillByEvent(&Player::skillEarth, var_value);
5555  return;
5556  case VAR_SpiritSkill:
5557  SetSkillByEvent(&Player::skillSpirit, var_value);
5558  return;
5559  case VAR_MindSkill:
5560  SetSkillByEvent(&Player::skillMind, var_value);
5561  return;
5562  case VAR_BodySkill:
5563  SetSkillByEvent(&Player::skillBody, var_value);
5564  return;
5565  case VAR_LightSkill:
5566  SetSkillByEvent(&Player::skillLight, var_value);
5567  return;
5568  case VAR_DarkSkill:
5569  SetSkillByEvent(&Player::skillDark, var_value);
5570  return;
5571  case VAR_IdentifyItemSkill:
5572  SetSkillByEvent(&Player::skillItemId, var_value);
5573  return;
5574  case VAR_MerchantSkill:
5576  return;
5577  case VAR_RepairSkill:
5578  SetSkillByEvent(&Player::skillRepair, var_value);
5579  return;
5580  case VAR_BodybuildingSkill:
5582  return;
5583  case VAR_MeditationSkill:
5585  return;
5586  case VAR_PerceptionSkill:
5588  return;
5589  case VAR_DiplomacySkill:
5591  return;
5592  case VAR_ThieverySkill:
5593  Error("Thieving unsupported");
5594  return;
5595  case VAR_DisarmTrapSkill:
5597  return;
5598  case VAR_DodgeSkill:
5599  SetSkillByEvent(&Player::skillDodge, var_value);
5600  return;
5601  case VAR_UnarmedSkill:
5603  return;
5606  return;
5607  case VAR_ArmsmasterSkill:
5609  return;
5610  case VAR_StealingSkill:
5612  return;
5613  case VAR_AlchemySkill:
5615  return;
5616  case VAR_LearningSkill:
5618  return;
5619  }
5620 }
5621 
5622 //----- (new function) --------------------------------------------------------
5624  int playerIndex = GetPlayerIndex();
5625  int v25 = 8 * playerIndex + 400;
5626  HEXRAYS_LOBYTE(v25) = PID(OBJECT_Player, playerIndex - 112);
5627  pAudioPlayer->PlaySound(SOUND_quest, v25, 0, -1, 0, 0);
5628 }
5629 
5630 //----- (new function) --------------------------------------------------------
5632  int playerIndex = GetPlayerIndex();
5633  spell_fx_renderer->SetPlayerBuffAnim(0x96u, playerIndex);
5634  PlayAwardSound();
5635 }
5636 
5637 //----- (new function) --------------------------------------------------------
5639  this->PlaySound(speech, 0);
5641 }
5642 
5643 //----- (new function) --------------------------------------------------------
5644 void Player::SetSkillByEvent(unsigned __int16 Player::*skillToSet,
5645  unsigned __int16 skillValue) {
5646  unsigned __int16 currSkillValue = this->*skillToSet;
5647  if (skillValue > 63) { // the original had the condition reversed which was probably wrong
5648  this->*skillToSet = skillValue | currSkillValue & 63;
5649  } else {
5650  this->*skillToSet = skillValue | currSkillValue & 0xC0;
5651  }
5652  int playerIndex = GetPlayerIndex();
5653  spell_fx_renderer->SetPlayerBuffAnim(0x96u, playerIndex);
5654  PlayAwardSound();
5655 }
5656 
5657 //----- (0044AFFB) --------------------------------------------------------
5658 void Player::AddVariable(enum VariableType var_type, signed int val) {
5659  int v6; // eax@15
5660  unsigned int v7; // esi@18
5661  DDM_DLV_Header* v27; // eax@153
5662  ItemGen item; // [sp+Ch] [bp-2Ch]@45
5663 
5664  if (var_type >= VAR_Counter1 && var_type <= VAR_Counter10) {
5667  return;
5668  }
5669 
5670  if (var_type >= VAR_UnknownTimeEvent0 &&
5671  var_type <= VAR_UnknownTimeEvent19) {
5674  PlayAwardSound();
5675  return;
5676  }
5677 
5678  if (var_type >= VAR_MapPersistentVariable_0 &&
5679  var_type <= VAR_MapPersistentVariable_99) {
5680  if (var_type >= VAR_MapPersistentVariable_0 &&
5681  var_type <= VAR_MapPersistentVariable_74) {
5682  if (255 - val >
5684  .field_0[var_type - VAR_MapPersistentVariable_0])
5686  .field_0[var_type - VAR_MapPersistentVariable_0] += val;
5687  else
5689  .field_0[var_type - VAR_MapPersistentVariable_0] = 255;
5690  }
5691  if ((signed int)var_type >= VAR_MapPersistentVariable_75 &&
5692  var_type <= VAR_MapPersistentVariable_99) {
5693  if (255 - val >
5695  ._decor_events[var_type - VAR_MapPersistentVariable_75])
5698  val;
5699  else
5702  255;
5703  }
5704  return;
5705  }
5706 
5707  if (var_type >= VAR_History_0 && var_type <= VAR_History_28) {
5708  if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0]) {
5711  if (pStorylineText->StoreLine[var_type - VAR_History_0].pText == 0) {
5712  bFlashHistoryBook = 1;
5713  PlayAwardSound();
5714  }
5715  }
5716  return;
5717  }
5718 
5719  switch (var_type) {
5720  case VAR_RandomGold:
5721  if (val == 0) val = 1;
5722  v6 = rand();
5723  pParty->PartyFindsGold(v6 % val + 1, 1);
5725  return;
5726  case VAR_RandomFood:
5727  if (val == 0) val = 1;
5728  v7 = rand() % val + 1;
5729  Party::GiveFood(v7);
5731  localization->FormatString(502, v7)); // You find %lu food
5732 
5734  PlayAwardSound();
5735  return;
5736  case VAR_Sex:
5737  this->uSex = (PLAYER_SEX)val;
5739  return;
5740  case VAR_Class:
5741  this->classType = (PLAYER_CLASS_TYPE)val;
5743  return;
5744  case VAR_CurrentHP:
5745  this->sHealth = std::min(this->sHealth + val, this->GetMaxHealth());
5747  return;
5748  case VAR_MaxHP:
5749  this->_health_related = 0;
5750  this->uFullHealthBonus = 0;
5751  this->sHealth = this->GetMaxHealth();
5752  return;
5753  case VAR_CurrentSP:
5754  this->sMana = std::min(this->sMana + val, this->GetMaxMana());
5756  return;
5757  case VAR_MaxSP:
5758  this->_mana_related = 0;
5759  this->uFullManaBonus = 0;
5760  this->sMana = GetMaxMana();
5761  return;
5762  case VAR_ACModifier:
5763  this->sACModifier = std::min(this->sACModifier + val, 255);
5765  return;
5766  case VAR_BaseLevel:
5767  this->uLevel = std::min(this->uLevel + val, 255);
5769  return;
5770  case VAR_LevelModifier:
5771  this->sLevelModifier = std::min(this->sLevelModifier + val, 255);
5773  return;
5774  case VAR_Age:
5775  this->sAgeModifier += val;
5776  return;
5777  case VAR_Award:
5778  if (_449B57_test_bit(this->_achieved_awards_bits, val) &&
5779  pAwards[val].pText) {
5781  }
5783  return;
5784  case VAR_Experience:
5785  this->uExperience = std::min((unsigned __int64)(this->uExperience + val), 4000000000ull);
5787  return;
5788  case VAR_QBits_QuestsDone:
5790  pQuestTable[val]) {
5791  bFlashQuestBook = 1;
5793  }
5795  return;
5796  case VAR_PlayerItemInHands:
5797  item.Reset();
5798  item.uAttributes = 1;
5799  item.uItemID = val;
5801  pParty->pIsArtifactFound[val - 500] = 1;
5802  } else if (val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION) {
5803  item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
5804  item.uMaxCharges = item.uNumCharges;
5805  }
5806  pParty->SetHoldingItem(&item);
5807  return;
5808  case VAR_FixedGold:
5809  pParty->PartyFindsGold(val, 1);
5810  return;
5811  case VAR_BaseMight:
5812  this->uMight = std::min(this->uMight + val, 255);
5814  return;
5815  case VAR_BaseIntellect:
5816  this->uIntelligence = std::min(this->uIntelligence + val, 255);
5818  return;
5819  case VAR_BasePersonality:
5820  this->uWillpower = std::min(this->uWillpower + val, 255);
5822  return;
5823  case VAR_BaseEndurance:
5824  this->uEndurance = std::min(this->uEndurance + val, 255);
5826  return;
5827  case VAR_BaseSpeed:
5828  this->uSpeed = std::min(this->uSpeed + val, 255);
5830  return;
5831  case VAR_BaseAccuracy:
5832  this->uAccuracy = std::min(this->uAccuracy + val, 255);
5834  return;
5835  case VAR_BaseLuck:
5836  this->uLuck = std::min(this->uLuck + val, 255);
5838  return;
5839  case VAR_FixedFood:
5842  localization->FormatString(502, val)); // You find %lu food
5843 
5844  PlayAwardSound();
5845  return;
5846  case VAR_MightBonus:
5847  case VAR_ActualMight:
5848  this->uMightBonus = std::min(this->uMightBonus + val, 255);
5850  return;
5851  case VAR_IntellectBonus:
5852  case VAR_ActualIntellect:
5853  this->uIntelligenceBonus = std::min(this->uIntelligenceBonus + val, 255);
5855  return;
5856  case VAR_PersonalityBonus:
5857  case VAR_ActualPersonality:
5858  this->uWillpowerBonus = std::min(this->uWillpowerBonus + val, 255);
5860  return;
5861  case VAR_EnduranceBonus:
5862  case VAR_ActualEndurance:
5863  this->uEnduranceBonus = std::min(this->uEnduranceBonus + val, 255);
5865  return;
5866  case VAR_SpeedBonus:
5867  case VAR_ActualSpeed:
5868  this->uSpeedBonus = std::min(this->uSpeedBonus + val, 255);
5870  return;
5871  case VAR_AccuracyBonus:
5872  case VAR_ActualAccuracy:
5873  this->uAccuracyBonus = std::min(this->uAccuracyBonus + val, 255);
5875  return;
5876  case VAR_LuckBonus:
5877  case VAR_ActualLuck:
5878  this->uLuckBonus = std::min(this->uLuckBonus + val, 255);
5880  return;
5881  case VAR_FireResistance:
5882  this->sResFireBase = std::min(this->sResFireBase + val, 255);
5884  return;
5885  case VAR_AirResistance:
5886  this->sResAirBase = std::min(this->sResAirBase + val, 255);
5888  return;
5889  case VAR_WaterResistance:
5890  this->sResWaterBase = std::min(this->sResWaterBase + val, 255);
5892  return;
5893  case VAR_EarthResistance:
5894  this->sResEarthBase = std::min(this->sResEarthBase + val, 255);
5896  return;
5897  case VAR_SpiritResistance:
5898  this->sResSpiritBase = std::min(this->sResSpiritBase + val, 255);
5900  return;
5901  case VAR_MindResistance:
5902  this->sResMindBase = std::min(this->sResMindBase + val, 255);
5904  return;
5905  case VAR_BodyResistance:
5906  this->sResBodyBase = std::min(this->sResBodyBase + val, 255);
5908  return;
5909  case VAR_LightResistance:
5910  this->sResLightBase = std::min(this->sResLightBase + val, 255);
5912  return;
5913  case VAR_DarkResistance:
5914  this->sResDarkBase = std::min(this->sResDarkBase + val, 255);
5916  return;
5917  case VAR_MagicResistance:
5918  this->sResMagicBase = std::min(this->sResMagicBase + val, 255);
5920  return;
5922  this->sResFireBonus = std::min(this->sResFireBonus + val, 255);
5924  return;
5926  this->sResAirBonus = std::min(this->sResAirBonus + val, 255);
5928  return;
5930  this->sResWaterBonus = std::min(this->sResWaterBonus + val, 255);
5932  return;
5934  this->sResEarthBonus = std::min(this->sResEarthBonus + val, 255);
5936  return;
5938  this->sResSpiritBonus = std::min(this->sResSpiritBonus + val, 255);
5940  return;
5942  this->sResMindBonus = std::min(this->sResMindBonus + val, 255);
5944  return;
5946  this->sResBodyBonus = std::min(this->sResBodyBonus + val, 255);
5948  return;
5950  this->sResLightBonus = std::min(this->sResLightBonus + val, 255);
5952  return;
5954  this->sResDarkBonus = std::min(this->sResDarkBonus + val, 255);
5956  return;
5958  this->sResMagicBonus = std::min(this->sResMagicBonus + val, 255);
5960  return;
5961  case VAR_Cursed:
5962  this->SetCondition(Condition_Cursed, 1);
5964  return;
5965  case VAR_Weak:
5966  this->SetCondition(Condition_Weak, 1);
5968  return;
5969  case VAR_Asleep:
5970  this->SetCondition(Condition_Sleep, 1);
5972  return;
5973  case VAR_Afraid:
5974  this->SetCondition(Condition_Fear, 1);
5976  return;
5977  case VAR_Drunk:
5978  this->SetCondition(Condition_Drunk, 1);
5980  return;
5981  case VAR_Insane:
5982  this->SetCondition(Condition_Insane, 1);
5984  return;
5985  case VAR_PoisonedGreen:
5988  return;
5989  case VAR_DiseasedGreen:
5992  return;
5993  case VAR_PoisonedYellow:
5996  return;
5997  case VAR_DiseasedYellow:
6000  return;
6001  case VAR_PoisonedRed:
6004  return;
6005  case VAR_DiseasedRed:
6008  return;
6009  case VAR_Paralyzed:
6012  return;
6013  case VAR_Unconsious:
6016  return;
6017  case VAR_Dead:
6018  this->SetCondition(Condition_Dead, 1);
6020  return;
6021  case VAR_Stoned:
6024  return;
6025  case VAR_Eradicated:
6028  return;
6029  case VAR_MajorCondition:
6030  conditions_times.fill(GameTime(0));
6032  return;
6033  case VAR_AutoNotes:
6035  pAutonoteTxt[val].pText) {
6036  this->PlaySound(SPEECH_96, 0);
6037  bFlashAutonotesBook = 1;
6039  spell_fx_renderer->SetPlayerBuffAnim(0x97u, GetPlayerIndex());
6040  }
6042  PlayAwardSound();
6043  return;
6044  case VAR_PlayerBits:
6045  _449B7E_toggle_bit((unsigned char*)this->playerEventBits, val, 1u);
6046  return;
6047  case VAR_NPCs2:
6049  pNPCStats->pNewNPCData[val].uFlags |= 0x80;
6051  viewparams->bRedrawGameUI = true;
6052  return;
6053  case VAR_NumSkillPoints:
6054  this->uSkillPoints += val;
6055  return;
6057  v27 = &pOutdoor->ddm;
6059  v27->uReputation += val;
6060  if (v27->uReputation > 10000) v27->uReputation = 10000;
6061  return;
6062  case VAR_GoldInBank:
6064  return;
6065  case VAR_NumDeaths:
6066  pParty->uNumDeaths += val;
6067  return;
6068  case VAR_NumBounties:
6070  return;
6071  case VAR_PrisonTerms:
6073  return;
6074  case VAR_ArenaWinsPage:
6076  return;
6077  case VAR_ArenaWinsSquire:
6079  return;
6080  case VAR_ArenaWinsKnight:
6082  return;
6083  case VAR_ArenaWinsLord:
6085  return;
6086  case VAR_StaffSkill:
6088  return;
6089  case VAR_SwordSkill:
6091  return;
6092  case VAR_DaggerSkill:
6094  return;
6095  case VAR_AxeSkill:
6097  return;
6098  case VAR_SpearSkill:
6100  return;
6101  case VAR_BowSkill:
6103  return;
6104  case VAR_MaceSkill:
6106  return;
6107  case VAR_BlasterSkill:
6109  return;
6110  case VAR_ShieldSkill:
6112  return;
6113  case VAR_LeatherSkill:
6115  return;
6116  case VAR_SkillChain:
6118  return;
6119  case VAR_PlateSkill:
6121  return;
6122  case VAR_FireSkill:
6124  return;
6125  case VAR_AirSkill:
6127  return;
6128  case VAR_WaterSkill:
6130  return;
6131  case VAR_EarthSkill:
6133  return;
6134  case VAR_SpiritSkill:
6136  return;
6137  case VAR_MindSkill:
6139  return;
6140  case VAR_BodySkill:
6142  return;
6143  case VAR_LightSkill:
6145  return;
6146  case VAR_DarkSkill:
6148  return;
6149  case VAR_IdentifyItemSkill:
6151  return;
6152  case VAR_MerchantSkill:
6154  return;
6155  case VAR_RepairSkill:
6157  return;
6158  case VAR_BodybuildingSkill:
6160  return;
6161  case VAR_MeditationSkill:
6163  return;
6164  case VAR_PerceptionSkill:
6166  return;
6167  case VAR_DiplomacySkill:
6169  return;
6170  case VAR_ThieverySkill:
6171  Error("Thieving unsupported");
6172  return;
6173  case VAR_DisarmTrapSkill:
6175  return;
6176  case VAR_DodgeSkill:
6178  return;
6179  case VAR_UnarmedSkill:
6181  return;
6184  return;
6185  case VAR_ArmsmasterSkill:
6187  return;
6188  case VAR_StealingSkill:
6190  return;
6191  case VAR_AlchemySkill:
6193  return;
6194  case VAR_LearningSkill:
6196  return;
6197  default:
6198  return;
6199  }
6200 }
6201 
6202 //----- (new function) --------------------------------------------------------
6204  int playerIndex = GetPlayerIndex();
6205  spell_fx_renderer->SetPlayerBuffAnim(0x97u, playerIndex);
6206  PlayAwardSound();
6207 }
6208 
6209 //----- (new function) --------------------------------------------------------
6211  this->PlaySound(speech, 0);
6213 }
6214 
6215 //----- (new function) --------------------------------------------------------
6216 void Player::AddSkillByEvent(unsigned __int16 Player::*skillToSet,
6217  unsigned __int16 addSkillValue) {
6218  if (addSkillValue > 63) {
6219  this->*skillToSet =
6220  (unsigned __int8)addSkillValue | this->*skillToSet & 63;
6221  } else {
6222  this->*skillToSet = std::min(this->*skillToSet + addSkillValue, 60) |
6223  this->*skillToSet & 0xC0;
6224  }
6226  return;
6227 }
6228 
6229 //----- (0044B9C4) --------------------------------------------------------
6230 void Player::SubtractVariable(enum VariableType VarNum, signed int pValue) {
6231  DDM_DLV_Header* locationHeader; // eax@90
6232  int randGold;
6233  int randFood;
6234  int npcIndex;
6235 
6236  if (VarNum >= VAR_MapPersistentVariable_0 &&
6237  VarNum <= VAR_MapPersistentVariable_99) {
6238  if (VarNum >= VAR_MapPersistentVariable_0 &&
6239  VarNum <= VAR_MapPersistentVariable_74) {
6241  .field_0[VarNum - VAR_MapPersistentVariable_0] -= pValue;
6242  }
6243  if ((signed int)VarNum >= VAR_MapPersistentVariable_75 &&
6244  VarNum <= VAR_MapPersistentVariable_99) {
6246  ._decor_events[VarNum - VAR_MapPersistentVariable_75] -= pValue;
6247  }
6248  return;
6249  }
6250 
6251  switch (VarNum) {
6252  case VAR_CurrentHP:
6253  ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
6255  return;
6256  case VAR_CurrentSP:
6257  this->sMana = std::max(this->sMana - pValue, 0);
6259  return;
6260  case VAR_ACModifier:
6261  this->sACModifier -= (unsigned __int8)pValue;
6263  return;
6264  case VAR_BaseLevel:
6265  this->uLevel -= (unsigned __int8)pValue;
6267  return;
6268  case VAR_LevelModifier:
6269  this->sLevelModifier -= (unsigned __int8)pValue;
6271  return;
6272  case VAR_Age:
6273  this->sAgeModifier -= (signed __int16)pValue;
6274  return;
6275  case VAR_Award:
6277  (signed __int16)pValue, 0);
6278  return;
6279  case VAR_Experience:
6280  this->uExperience -= pValue;
6282  return;
6283  case VAR_QBits_QuestsDone:
6284  _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0);
6285  this->PlaySound(SPEECH_96, 0);
6286  return;
6287  case VAR_PlayerItemInHands:
6288  for (uint i = 0; i < 16; ++i) {
6289  int id_ = this->pEquipment.pIndices[i];
6290  if (id_ > 0) {
6291  if (this->pInventoryItemList[this->pEquipment.pIndices[i] -
6292  1]
6293  .uItemID == pValue) {
6294  this->pEquipment.pIndices[i] = 0;
6295  }
6296  }
6297  }
6298  for (int i = 0; i < 126; i++) {
6299  int id_ = this->pInventoryMatrix[i];
6300  if (id_ > 0) {
6301  if (this->pInventoryItemList[id_ - 1].uItemID == pValue) {
6303  return;
6304  }
6305  }
6306  }
6307  if (pParty->pPickedItem.uItemID == pValue) {
6309  return;
6310  }
6311  return;
6312  case VAR_FixedGold:
6313  if (pValue > pParty->GetGold()) {
6315  return;
6316  }
6317  Party::TakeGold(pValue);
6318  return;
6319  case VAR_RandomGold:
6320  randGold = rand() % (signed int)pValue + 1;
6321  if (randGold > pParty->GetGold())
6322  randGold = pParty->GetGold();
6323  Party::TakeGold(randGold);
6326  return;
6327  case VAR_FixedFood:
6328  Party::TakeFood(pValue);
6330  return;
6331  case VAR_RandomFood:
6332  randFood = rand() % (signed int)pValue + 1;
6333  if (randFood > pParty->GetFood())
6334  randFood = pParty->GetFood();
6335  Party::TakeFood(randFood);
6339  return;
6340  case VAR_MightBonus:
6341  case VAR_ActualMight:
6342  this->uMightBonus -= (unsigned __int16)pValue;
6344  return;
6345  case VAR_IntellectBonus:
6346  case VAR_ActualIntellect:
6347  this->uIntelligenceBonus -= (unsigned __int16)pValue;
6349  return;
6350  case VAR_PersonalityBonus:
6351  case VAR_ActualPersonality:
6352  this->uWillpowerBonus -= (unsigned __int16)pValue;
6354  return;
6355  case VAR_EnduranceBonus:
6356  case VAR_ActualEndurance:
6357  this->uEnduranceBonus -= (unsigned __int16)pValue;
6359  return;
6360  case VAR_SpeedBonus:
6361  case VAR_ActualSpeed:
6362  this->uSpeedBonus -= (unsigned __int16)pValue;
6364  return;
6365  case VAR_AccuracyBonus:
6366  case VAR_ActualAccuracy:
6367  this->uAccuracyBonus -= (unsigned __int16)pValue;
6369  return;
6370  case VAR_LuckBonus:
6371  case VAR_ActualLuck:
6372  this->uLuckBonus -= (unsigned __int16)pValue;
6374  return;
6375  case VAR_BaseMight:
6376  this->uMight -= (unsigned __int16)pValue;
6378  return;
6379  case VAR_BaseIntellect:
6380  this->uIntelligence -= (unsigned __int16)pValue;
6382  return;
6383  case VAR_BasePersonality:
6384  this->uWillpower -= (unsigned __int16)pValue;
6386  return;
6387  case VAR_BaseEndurance:
6388  this->uEndurance -= (unsigned __int16)pValue;
6390  return;
6391  case VAR_BaseSpeed:
6392  this->uSpeed -= (unsigned __int16)pValue;
6394  return;
6395  case VAR_BaseAccuracy:
6396  this->uAccuracy -= (unsigned __int16)pValue;
6398  return;
6399  case VAR_BaseLuck:
6400  this->uLuck -= (unsigned __int16)pValue;
6402  return;
6403  case VAR_FireResistance:
6404  this->sResFireBase -= (signed __int16)pValue;
6406  return;
6407  case VAR_AirResistance:
6408  this->sResAirBase -= (signed __int16)pValue;
6410  return;
6411  case VAR_WaterResistance:
6412  this->sResWaterBase -= (signed __int16)pValue;
6414  return;
6415  case VAR_EarthResistance:
6416  this->sResEarthBase -= (signed __int16)pValue;
6418  return;
6419  case VAR_SpiritResistance:
6420  this->sResSpiritBase -= (signed __int16)pValue;
6422  return;
6423  case VAR_MindResistance:
6424  this->sResMindBase -= (signed __int16)pValue;
6426  return;
6427  case VAR_BodyResistance:
6428  this->sResBodyBase -= (signed __int16)pValue;
6430  return;
6431  case VAR_LightResistance:
6432  this->sResLightBase -= (signed __int16)pValue;
6434  return;
6435  case VAR_DarkResistance:
6436  this->sResDarkBase -= (signed __int16)pValue;
6438  return;
6439  case VAR_MagicResistance:
6440  this->sResMagicBase -= (signed __int16)pValue;
6442  return;
6444  this->sResFireBonus -= (signed __int16)pValue;
6446  return;
6448  this->sResAirBonus -= (signed __int16)pValue;
6450  return;
6452  this->sResWaterBonus -= (signed __int16)pValue;
6454  return;
6456  this->sResEarthBonus -= (signed __int16)pValue;
6458  return;
6460  this->sResSpiritBonus -= (signed __int16)pValue;
6462  return;
6464  this->sResMindBonus -= (signed __int16)pValue;
6466  return;
6468  this->sResBodyBonus -= (signed __int16)pValue;
6470  return;
6472  this->sResLightBonus -= (signed __int16)pValue;
6474  return;
6476  this->sResDarkBonus -= (signed __int16)pValue;
6478  return;
6480  this->sResMagicBonus -= (signed __int16)pValue;
6482  return;
6483  case VAR_StaffSkill:
6484  this->skillStaff -= (unsigned __int8)pValue;
6486  return;
6487  case VAR_SwordSkill:
6488  this->skillSword -= (unsigned __int8)pValue;
6490  return;
6491  case VAR_DaggerSkill:
6492  this->skillDagger -= (unsigned __int8)pValue;
6494  return;
6495  case VAR_AxeSkill:
6496  this->skillAxe -= (unsigned __int8)pValue;
6498  return;
6499  case VAR_SpearSkill:
6500  this->skillSpear -= (unsigned __int8)pValue;
6502  return;
6503  case VAR_BowSkill:
6504  this->skillBow -= (unsigned __int8)pValue;
6506  return;
6507  case VAR_MaceSkill:
6508  this->skillMace -= (unsigned __int8)pValue;
6510  return;
6511  case VAR_BlasterSkill:
6512  this->skillBlaster -= (unsigned __int8)pValue;
6514  return;
6515  case VAR_ShieldSkill:
6516  this->skillShield -= (unsigned __int8)pValue;
6518  return;
6519  case VAR_LeatherSkill:
6520  this->skillLearning -= (unsigned __int8)pValue;
6522  return;
6523  case VAR_SkillChain:
6524  this->skillChain -= (unsigned __int8)pValue;
6526  return;
6527  case VAR_PlateSkill:
6528  this->skillPlate -= (unsigned __int8)pValue;
6530  return;
6531  case VAR_FireSkill:
6532  this->skillFire -= (unsigned __int8)pValue;
6534  return;
6535  case VAR_AirSkill:
6536  this->skillAir -= (unsigned __int8)pValue;
6538  return;
6539  case VAR_WaterSkill:
6540  this->skillWater -= (unsigned __int8)pValue;
6542  return;
6543  case VAR_EarthSkill:
6544  this->skillEarth -= (unsigned __int8)pValue;
6546  return;
6547  case VAR_SpiritSkill:
6548  this->skillSpirit -= (unsigned __int8)pValue;
6550  return;
6551  case VAR_MindSkill:
6552  this->skillMind -= (unsigned __int8)pValue;
6554  return;
6555  case VAR_BodySkill:
6556  this->skillBody -= (unsigned __int8)pValue;
6558  return;
6559  case VAR_LightSkill:
6560  this->skillLight -= (unsigned __int8)pValue;
6562  return;
6563  case VAR_DarkSkill:
6564  this->skillDark -= (unsigned __int8)pValue;
6566  return;
6567  case VAR_IdentifyItemSkill:
6568  this->skillItemId -= (unsigned __int8)pValue;
6570  return;
6571  case VAR_MerchantSkill:
6572  this->skillMerchant -= (unsigned __int8)pValue;
6574  return;
6575  case VAR_RepairSkill:
6576  this->skillRepair -= (unsigned __int8)pValue;
6578  return;
6579  case VAR_BodybuildingSkill:
6580  this->skillBodybuilding -= (unsigned __int8)pValue;
6582  return;
6583  case VAR_MeditationSkill:
6584  this->skillMeditation -= (unsigned __int8)pValue;
6586  return;
6587  case VAR_PerceptionSkill:
6588  this->skillPerception -= (unsigned __int8)pValue;
6590  return;
6591  case VAR_DiplomacySkill:
6592  this->skillDiplomacy -= (unsigned __int8)pValue;
6594  return;
6595  case VAR_ThieverySkill:
6596  Error("Thieving unsupported");
6597  return;
6598  case VAR_DisarmTrapSkill:
6599  this->skillDisarmTrap -= (unsigned __int8)pValue;
6601  return;
6602  case VAR_DodgeSkill:
6603  this->skillDodge -= (unsigned __int8)pValue;
6605  return;
6606  case VAR_UnarmedSkill:
6607  this->skillUnarmed -= (unsigned __int8)pValue;
6609  return;
6611  this->skillMonsterId -= (unsigned __int8)pValue;
6613  return;
6614  case VAR_ArmsmasterSkill:
6615  this->skillArmsmaster -= (unsigned __int8)pValue;
6617  return;
6618  case VAR_StealingSkill:
6619  this->skillStealing -= (unsigned __int8)pValue;
6621  return;
6622  case VAR_AlchemySkill:
6623  this->skillAlchemy -= (unsigned __int8)pValue;
6625  return;
6626  case VAR_LearningSkill:
6627  this->skillLearning -= (unsigned __int8)pValue;
6629  return;
6630  case VAR_Cursed:
6631  this->conditions_times[Condition_Cursed].Reset();
6633  return;
6634  case VAR_Weak:
6635  this->conditions_times[Condition_Weak].Reset();
6637  return;
6638  case VAR_Asleep:
6639  this->conditions_times[Condition_Sleep].Reset();
6641  return;
6642  case VAR_Afraid:
6643  this->conditions_times[Condition_Fear].Reset();
6645  return;
6646  case VAR_Drunk:
6647  this->conditions_times[Condition_Drunk].Reset();
6649  return;
6650  case VAR_Insane:
6651  this->conditions_times[Condition_Insane].Reset();
6653  return;
6654  case VAR_PoisonedGreen:
6655  this->conditions_times[Condition_Poison_Weak].Reset();
6657  return;
6658  case VAR_DiseasedGreen:
6661  return;
6662  case VAR_PoisonedYellow:
6665  return;
6666  case VAR_DiseasedYellow:
6669  return;
6670  case VAR_PoisonedRed:
6673  return;
6674  case VAR_DiseasedRed:
6677  return;
6678  case VAR_Paralyzed:
6679  this->conditions_times[Condition_Paralyzed].Reset();
6681  return;
6682  case VAR_Unconsious:
6683  this->conditions_times[Condition_Unconcious].Reset();
6685  return;
6686  case VAR_Dead:
6687  this->conditions_times[Condition_Dead].Reset();
6689  return;
6690  case VAR_Stoned:
6691  this->conditions_times[Condition_Pertified].Reset();
6693  return;
6694  case VAR_Eradicated:
6695  this->conditions_times[Condition_Eradicated].Reset();
6697  return;
6698  case VAR_AutoNotes:
6699  _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0);
6700  return;
6701  case VAR_NPCs2:
6702  npcIndex = 0;
6704  if (npcIndex == pValue) {
6705  npcIdToDismissAfterDialogue = pValue;
6706  } else {
6709  pNPCStats->pNewNPCData[(int)pValue].uFlags &= 0xFFFFFF7F;
6711  viewparams->bRedrawGameUI = true;
6712  }
6713  return;
6715  for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; i++) {
6716  if (pNPCStats->pNewNPCData[i].uProfession == pValue) {
6717  pNPCStats->pNewNPCData[(int)pValue].uFlags &= 0xFFFFFF7F;
6718  }
6719  }
6720  if (pParty->pHirelings[0].uProfession == pValue)
6721  memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
6722  if (pParty->pHirelings[1].uProfession == pValue)
6723  memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
6726  return;
6727  case VAR_NumSkillPoints:
6728  if ((unsigned int)pValue <= this->uSkillPoints) {
6729  this->uSkillPoints -= pValue;
6730  } else {
6731  this->uSkillPoints = 0;
6732  }
6733  return;
6735  locationHeader = &pOutdoor->ddm;
6737  locationHeader = &pIndoor->dlv;
6738  locationHeader->uReputation -= pValue;
6739  if (locationHeader->uReputation < -10000)
6740  locationHeader->uReputation = -10000;
6741  return;
6742  case VAR_GoldInBank:
6743  if ((unsigned int)pValue <= pParty->uNumGoldInBank) {
6744  pParty->uNumGoldInBank -= (unsigned int)pValue;
6745  } else {
6747  }
6748  return;
6749  case VAR_NumDeaths:
6750  pParty->uNumDeaths -= (unsigned int)pValue;
6751  return;
6752  case VAR_NumBounties:
6753  pParty->uNumBountiesCollected -= (unsigned int)pValue;
6754  return;
6755  case VAR_PrisonTerms:
6756  pParty->uNumPrisonTerms -= (int)pValue;
6757  return;
6758  case VAR_ArenaWinsPage:
6759  pParty->uNumArenaPageWins -= (char)pValue;
6760  return;
6761  case VAR_ArenaWinsSquire:
6762  pParty->uNumArenaSquireWins -= (char)pValue;
6763  return;
6764  case VAR_ArenaWinsKnight:
6765  pParty->uNumArenaKnightWins -= (char)pValue;
6766  return;
6767  case VAR_ArenaWinsLord:
6768  pParty->uNumArenaLordWins -= (char)pValue;
6769  return;
6770  }
6771 }
6772 
6773 //----- (new function) --------------------------------------------------------
6775  int playerIndex = GetPlayerIndex();
6776  spell_fx_renderer->SetPlayerBuffAnim(0x98u, playerIndex);
6777  PlayAwardSound();
6778 }
6779 
6780 //----- (new function) --------------------------------------------------------
6782  this->PlaySound(speech, 0);
6784 }
6785 
6786 //----- (00467E7F) --------------------------------------------------------
6788  int itemAnchor; // ebx@1
6789  int itemInvLocation; // edx@1
6790  int freeSlot; // eax@3
6791  ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1
6792 
6793  tempPickedItem.Reset();
6794  itemAnchor = pEquipTypeToBodyAnchor[uEquipType];
6795  itemInvLocation =
6796  pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor];
6797  if (itemInvLocation) { //переодеться в другую вещь
6798  memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem));
6800  ->pInventoryItemList[itemInvLocation - 1]
6801  .uBodyAnchor = 0;
6804  ->pInventoryItemList[itemInvLocation - 1]);
6805  tempPickedItem.uBodyAnchor = itemAnchor + 1;
6806  memcpy(&pPlayers[uActiveCharacter]
6807  ->pInventoryItemList[itemInvLocation - 1],
6808  &tempPickedItem, sizeof(ItemGen));
6809  pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] =
6810  itemInvLocation;
6811  } else { // одеть вещь
6812  freeSlot = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot();
6813  if (freeSlot >= 0) {
6814  pParty->pPickedItem.uBodyAnchor = itemAnchor + 1;
6815  memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[freeSlot],
6816  &pParty->pPickedItem, sizeof(ItemGen));
6817  pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] =
6818  freeSlot + 1;
6820  }
6821  }
6822 }
6823 
6824 //----- (0049387A) --------------------------------------------------------
6825 int CycleCharacter(bool backwards) {
6826  const int PARTYSIZE = 4;
6827  int valToAdd = backwards ? (PARTYSIZE - 2) : 0;
6828  int mult = backwards ? -1 : 1;
6829 
6830  for (int i = 0; i < (PARTYSIZE - 1); i++) {
6831  int currCharId =
6832  ((uActiveCharacter + mult * i + valToAdd) % PARTYSIZE) + 1;
6833  if (pPlayers[currCharId]->uTimeToRecovery == 0) {
6834  return currCharId;
6835  }
6836  }
6837  return uActiveCharacter;
6838 }
6839 
6840 //----- (0043EE77) --------------------------------------------------------
6842  // the original function took the
6843  // player number as a parameter. if it
6844  // was 0, the whole party was checked.
6845  // calls with the parameter 0 have been
6846  // changed to calls to this for every
6847  // player
6848  if (GetArmorItem() == nullptr || GetArmorItem()->uItemID != 604) {
6849  return false;
6850  }
6851  return true;
6852 }
6853 
6854 //----- (0043EE15) --------------------------------------------------------
6855 bool Player::HasItem(unsigned int uItemID, bool checkHeldItem) {
6856  if (!checkHeldItem || pParty->pPickedItem.uItemID != uItemID) {
6857  for (uint i = 0; i < 126; ++i) {
6858  if (this->pInventoryMatrix[i] > 0) {
6859  if ((unsigned int)this
6860  ->pInventoryItemList[this->pInventoryMatrix[i] - 1]
6861  .uItemID == uItemID)
6862  return true;
6863  }
6864  }
6865  for (uint i = 0; i < 16; ++i) {
6866  if (this->pEquipment.pIndices[i]) {
6867  if ((unsigned int)this
6868  ->pInventoryItemList[this->pEquipment.pIndices[i] - 1]
6869  .uItemID == uItemID)
6870  return true;
6871  }
6872  }
6873  return false;
6874  } else {
6875  return true;
6876  }
6877 }
6878 //----- (0043EDB9) --------------------------------------------------------
6879 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this) {
6880  CHARACTER_RACE race; // edi@2
6881  PLAYER_SEX sex; // eax@2
6882 
6883  for (int i = 1; i <= 4; i++) {
6884  race = pPlayers[i]->GetRace();
6885  sex = pPlayers[i]->GetSexByVoice();
6886  switch (_this) {
6887  case 0:
6888  if ((race == CHARACTER_RACE_HUMAN ||
6889  race == CHARACTER_RACE_ELF ||
6890  race == CHARACTER_RACE_GOBLIN) &&
6891  sex == SEX_MALE)
6892  return true;
6893  break;
6894  case 1:
6895  if ((race == CHARACTER_RACE_HUMAN ||
6896  race == CHARACTER_RACE_ELF ||
6897  race == CHARACTER_RACE_GOBLIN) &&
6898  sex == SEX_FEMALE)
6899  return true;
6900  break;
6901  case 2:
6902  if (race == CHARACTER_RACE_DWARF && sex == SEX_MALE)
6903  return true;
6904  break;
6905  case 3:
6906  if (race == CHARACTER_RACE_DWARF && sex == SEX_FEMALE)
6907  return true;
6908  break;
6909  }
6910  }
6911  return false;
6912 }
6913 
6914 //----- (0043ED6F) --------------------------------------------------------
6915 bool IsDwarfPresentInParty(bool a1) {
6916  for (uint i = 0; i < 4; ++i) {
6917  CHARACTER_RACE race = pParty->pPlayers[i].GetRace();
6918 
6919  if (race == CHARACTER_RACE_DWARF && a1)
6920  return true;
6921  else if (race != CHARACTER_RACE_DWARF && !a1)
6922  return true;
6923  }
6924  return false;
6925 }
6926 
6927 //----- (00439FCB) --------------------------------------------------------
6928 void DamagePlayerFromMonster(unsigned int uObjID, int dmgSource,
6929  Vec3_int_* pPos, signed int a4) {
6930  Player* playerPtr; // ebx@3
6931  Actor* actorPtr; // esi@3
6932  int spellId; // eax@38
6933  signed int recvdMagicDmg; // eax@139
6934  int v72[4]; // [sp+30h] [bp-24h]@164
6935  int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3
6936  unsigned int uActorID; // [sp+4Ch] [bp-8h]@1
6937 
6938  uActorID = PID_ID(uObjID);
6939  int pidtype = PID_TYPE(uObjID);
6940 
6941  if (pidtype != 2) {
6942  if (pidtype != 3) __debugbreak();
6943 
6944  if (a4 == -1) __debugbreak();
6945 
6946  playerPtr = &pParty->pPlayers[a4];
6947  actorPtr = &pActors[uActorID];
6948  healthBeforeRecvdDamage = playerPtr->sHealth;
6949  if (PID_TYPE(uObjID) != 3 || !actorPtr->ActorHitOrMiss(playerPtr))
6950  return;
6951 
6952  if (playerPtr->GetActualSkillMastery(PLAYER_SKILL_UNARMED) >= 4 &&
6953  rand() % 100 < playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED)) {
6954  auto str = localization->FormatString(637, playerPtr->pName); // evades damage
6956  playerPtr->PlaySound(SPEECH_6, 0);
6957  return;
6958  }
6959 
6960  ItemGen* equippedArmor = playerPtr->GetArmorItem();
6961  SoundID soundToPlay;
6962  if (!equippedArmor || equippedArmor->IsBroken() ||
6963  (equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_CHAIN &&
6964  equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_PLATE)) {
6965  int randVal = rand() % 4;
6966  switch (randVal) {
6967  case 0:
6968  soundToPlay = (SoundID)108;
6969  break;
6970  case 1:
6971  soundToPlay = (SoundID)109;
6972  break;
6973  case 2:
6974  soundToPlay = (SoundID)110;
6975  break;
6976  case 3:
6977  soundToPlay = (SoundID)44;
6978  break;
6979  default:
6980  Error("Unexpected sound value");
6981  }
6982  } else {
6983  int randVal = rand() % 4;
6984  switch (randVal) {
6985  case 0:
6986  soundToPlay = (SoundID)105;
6987  break;
6988  case 1:
6989  soundToPlay = (SoundID)106;
6990  break;
6991  case 2:
6992  soundToPlay = (SoundID)107;
6993  break;
6994  case 3:
6995  soundToPlay = (SoundID)45;
6996  break;
6997  default:
6998  Error("Unexpected sound value");
6999  }
7000  }
7001  pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player, a4 + 80), 0, -1, 0, 0);
7002  int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
7003  if (actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].Active()) {
7004  __int16 spellPower = actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
7005  if (spellPower > 0)
7006  dmgToReceive /= spellPower;
7007  }
7008 
7009  int damageType;
7010  switch (dmgSource) {
7011  case 0:
7012  damageType = actorPtr->pMonsterInfo.uAttack1Type;
7013  break;
7014  case 1:
7015  damageType = actorPtr->pMonsterInfo.uAttack2Type;
7016  break;
7017  case 2:
7018  spellId = actorPtr->pMonsterInfo.uSpell1ID;
7019  damageType = pSpellStats->pInfos[spellId].uSchool;
7020  break;
7021  case 3:
7022  spellId = actorPtr->pMonsterInfo.uSpell2ID;
7023  damageType = pSpellStats->pInfos[spellId].uSchool;
7024  break;
7025  case 4:
7026  damageType =
7028  break;
7029  default:
7030  case 5:
7031  damageType = 4; // yes, the original just assigned the value 4
7032  break;
7033  }
7034  // if (!engine->config->NoDamage()) {
7035  dmgToReceive =
7036  playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
7037  if (playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Active()) {
7038  int actorState = actorPtr->uAIState;
7039  if (actorState != Dying && actorState != Dead) {
7040  int reflectedDamage = actorPtr->CalcMagicalDamageToActor(
7041  (DAMAGE_TYPE)damageType, dmgToReceive);
7042  actorPtr->sCurrentHP -= reflectedDamage;
7043  if (reflectedDamage >= 0) {
7044  if (actorPtr->sCurrentHP >= 1) {
7046  uActorID, PID(OBJECT_Player, a4),
7047  0); // todo extract this branch to a function
7048  // once Actor::functions are changed to
7049  // nonstatic actor functions
7050  Actor::AggroSurroundingPeasants(uActorID, 1);
7051  } else {
7052  if (pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 &&
7053  !engine->config->NoBloodsplats()) {
7054  int splatRadius = _4D864C_force_sw_render_rules && !engine->config->NoHugeBloodsplats()
7055  ? 10 * actorPtr->uActorRadius
7056  : actorPtr->uActorRadius;
7058  actorPtr->vPosition.x,
7059  actorPtr->vPosition.y,
7060  actorPtr->vPosition.z, 1.0, 0.0, 0.0,
7061  (float)splatRadius, 0, 0);
7062  }
7063  Actor::Die(uActorID);
7065  Actor::AggroSurroundingPeasants(uActorID, 1);
7066  if (actorPtr->pMonsterInfo.uExp)
7069  ->pInfos[actorPtr->pMonsterInfo.uID]
7070  .uExp);
7071  int speechToPlay = SPEECH_51;
7072  if (rand() % 100 < 20)
7073  speechToPlay =
7074  actorPtr->pMonsterInfo.uHP >= 100 ? 2 : 1;
7075  playerPtr->PlaySound((PlayerSpeech)speechToPlay, 0);
7076  }
7077  }
7078  }
7079  }
7080  if (!engine->config->NoDamage() &&
7081  actorPtr->pMonsterInfo.uSpecialAttackType &&
7082  rand() % 100 < actorPtr->pMonsterInfo.uLevel *
7083  actorPtr->pMonsterInfo.uSpecialAttackLevel) {
7084  playerPtr->ReceiveSpecialAttackEffect(
7085  actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
7086  }
7087  //}
7088  if (!pParty->bTurnBasedModeOn) {
7089  int actEndurance = playerPtr->GetActualEndurance();
7090  int recoveryTime =
7091  (int)((20 - playerPtr->GetParameterBonus(actEndurance)) *
7092  flt_6BE3A4_debug_recmod1 * 2.133333333333333);
7093  playerPtr->SetRecoveryTime(recoveryTime);
7094  }
7095  int yellThreshold = playerPtr->GetMaxHealth() / 4;
7096  if (yellThreshold < playerPtr->sHealth &&
7097  yellThreshold >= healthBeforeRecvdDamage &&
7098  playerPtr->sHealth > 0) {
7099  playerPtr->PlaySound(SPEECH_48, 0);
7100  }
7102  return;
7103  } else {
7104  SpriteObject* v37 = &pSpriteObjects[uActorID];
7105  int uActorType = PID_TYPE(v37->spell_caster_pid);
7106  int uActorID = PID_ID(v37->spell_caster_pid);
7107  if (uActorType == 2) { // item
7108  Player* playerPtr; // eax@81
7109  if (a4 != -1) {
7110  playerPtr = &pParty->pPlayers[a4];
7111  } else {
7112  int activePlayerCounter = 0;
7113  for (int i = 1; i <= 4; i++) {
7114  if (pPlayers[i]->CanAct()) {
7115  v72[activePlayerCounter] = i;
7116  activePlayerCounter++;
7117  }
7118  }
7119  if (activePlayerCounter) {
7120  playerPtr =
7121  &pParty
7122  ->pPlayers[v72[rand() % activePlayerCounter] -
7123  1]; // &stru_AA1058[3].pSounds[6972 *
7124  // *(&v72 + rand() % v74) + 40552];
7125  }
7126  }
7127  int v68;
7128  int v69;
7129  if (uActorType != OBJECT_Player ||
7130  v37->spell_id != SPELL_BOW_ARROW) {
7131  int playerMaxHp = playerPtr->GetMaxHealth();
7133  v37->spell_skill, playerMaxHp);
7134  v69 = pSpellStats->pInfos[v37->spell_id].uSchool;
7135  } else {
7136  v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
7137  v69 = 0;
7138  }
7139  playerPtr->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
7140  if (uActorType == OBJECT_Player && !_A750D8_player_speech_timer) {
7143  uSpeakingCharacter = uActorID + 1;
7144  }
7145  return;
7146  } else if (uActorType == 3) { // actor
7147  Actor* actorPtr = &pActors[uActorID];
7148  if (a4 == -1) a4 = stru_50C198.which_player_to_attack(actorPtr);
7149  Player* playerPtr = &pParty->pPlayers[a4];
7150  int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
7151  unsigned __int16 spriteType = v37->uType;
7152 
7153  if (v37->uType == 545) { // arrows
7154  // GM unarmed 1% chance to evade attack per skill point
7155  logger->Info(L"Arrpow");
7156  if (playerPtr->GetActualSkillMastery(PLAYER_SKILL_UNARMED) >= 4 &&
7157  rand() % 100 < playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED)) {
7158  auto str = localization->FormatString(637, playerPtr->pName); // evades damage
7160  playerPtr->PlaySound(SPEECH_6, 0);
7161  return;
7162  }
7163  } else if (spriteType == 555 || spriteType == 510 || // dragonflies firebolt
7164  spriteType == 500 || spriteType == 515 ||
7165  spriteType == 505 || spriteType == 530 || // all missile types?
7166  spriteType == 525 || spriteType == 520 ||
7167  spriteType == 535 || spriteType == 540) {
7168  if (!actorPtr->ActorHitOrMiss(playerPtr)) return;
7169  if (playerPtr->pPlayerBuffs[PLAYER_BUFF_SHIELD].Active())
7170  dmgToReceive >>= 1;
7171  if (playerPtr->HasEnchantedItemEquipped(36)) dmgToReceive >>= 1;
7172  if (playerPtr->HasEnchantedItemEquipped(69)) dmgToReceive >>= 1;
7173  if (playerPtr->HasItemEquipped(EQUIP_ARMOUR) &&
7174  playerPtr->GetArmorItem()->uItemID ==
7176  dmgToReceive >>= 1;
7177  if (playerPtr->HasItemEquipped(EQUIP_TWO_HANDED)) {
7178  ItemGen* mainHandItem = playerPtr->GetMainHandItem();
7179  if (mainHandItem->uItemID == ITEM_RELIC_KELEBRIM ||
7180  mainHandItem->uItemID == ITEM_ARTIFACT_ELFBANE ||
7181  (mainHandItem->GetItemEquipType() == EQUIP_SHIELD &&
7182  playerPtr->GetActualSkillMastery(
7183  PLAYER_SKILL_SHIELD) == 4))
7184  dmgToReceive >>= 1;
7185  }
7186  if (playerPtr->HasItemEquipped(EQUIP_SINGLE_HANDED)) {
7187  ItemGen* offHandItem = playerPtr->GetOffHandItem();
7188  if (offHandItem->uItemID == ITEM_RELIC_KELEBRIM ||
7189  offHandItem->uItemID == ITEM_ARTIFACT_ELFBANE ||
7190  (offHandItem->GetItemEquipType() == EQUIP_SHIELD &&
7191  playerPtr->GetActualSkillMastery(
7192  PLAYER_SKILL_SHIELD) == 4))
7193  dmgToReceive >>= 1;
7194  }
7195  }
7196  if (actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].Active()) {
7197  int spellPower =
7199  if (spellPower > 0) dmgToReceive /= spellPower;
7200  }
7201  int damageType;
7202  switch (dmgSource) {
7203  case 0:
7204  damageType = actorPtr->pMonsterInfo.uAttack1Type;
7205  break;
7206  case 1:
7207  damageType = actorPtr->pMonsterInfo.uAttack2Type;
7208  break;
7209  case 2:
7210  spellId = actorPtr->pMonsterInfo.uSpell1ID;
7211  damageType = pSpellStats->pInfos[spellId].uSchool;
7212  break;
7213  case 3:
7214  spellId = actorPtr->pMonsterInfo.uSpell2ID;
7215  damageType = pSpellStats->pInfos[spellId].uSchool;
7216  break;
7217  case 4:
7218  damageType =
7220  break;
7221  case 5:
7222  damageType = 4;
7223  break;
7224  }
7225  // if (!engine->config->NoDamage()) {
7226  int reflectedDmg = playerPtr->ReceiveDamage(
7227  dmgToReceive, (DAMAGE_TYPE)damageType);
7229  .Active()) {
7230  unsigned __int16 actorState = actorPtr->uAIState;
7231  if (actorState != Dying && actorState != Dead) {
7232  recvdMagicDmg = actorPtr->CalcMagicalDamageToActor(
7233  (DAMAGE_TYPE)damageType, reflectedDmg);
7234  actorPtr->sCurrentHP -= recvdMagicDmg;
7235  if (recvdMagicDmg >= 0) {
7236  if (actorPtr->sCurrentHP >= 1) {
7237  Actor::AI_Stun(uActorID, PID(OBJECT_Player, a4),
7238  0);
7239  Actor::AggroSurroundingPeasants(uActorID, 1);
7240  } else {
7241  if (pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 &&
7242  !engine->config->NoBloodsplats()) {
7243  int splatRadius = _4D864C_force_sw_render_rules && !engine->config->NoHugeBloodsplats()
7244  ? 10 * actorPtr->uActorRadius
7245  : actorPtr->uActorRadius;
7247  actorPtr->vPosition.x,
7248  actorPtr->vPosition.y,
7249  actorPtr->vPosition.z, 1.0, 0.0, 0.0,
7250  (float)splatRadius, 0, 0);
7251  }
7252  Actor::Die(uActorID);
7254  Actor::AggroSurroundingPeasants(uActorID, 1);
7255  if (actorPtr->pMonsterInfo.uExp)
7258  ->pInfos[actorPtr->pMonsterInfo.uID]
7259  .uExp);
7260  int speechToPlay = SPEECH_51;
7261  if (rand() % 100 < 20)
7262  speechToPlay =
7263  actorPtr->pMonsterInfo.uHP >= 100 ? 2
7264  : 1;
7265  playerPtr->PlaySound((PlayerSpeech)speechToPlay,
7266  0);
7267  }
7268  }
7269  }
7270  }
7271  //}
7272  if (!dmgSource &&
7273  !engine->config->NoDamage() &&
7274  actorPtr->pMonsterInfo.uSpecialAttackType &&
7275  rand() % 100 < actorPtr->pMonsterInfo.uLevel *
7276  actorPtr->pMonsterInfo.uSpecialAttackLevel) {
7277  playerPtr->ReceiveSpecialAttackEffect(
7278  actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
7279  }
7280  if (!pParty->bTurnBasedModeOn) {
7281  int actEnd = playerPtr->GetActualEndurance();
7282  int recTime =
7283  (int)((20 - playerPtr->GetParameterBonus(actEnd)) *
7284  flt_6BE3A4_debug_recmod1 * 2.133333333333333);
7285  playerPtr->SetRecoveryTime(recTime);
7286  }
7287  return;
7288  } else {
7289  return;
7290  }
7291  }
7292 }
7293 
7295  unsigned int pickedItemId; // esi@12
7296  unsigned int invItemIndex; // eax@12
7297  unsigned int itemPos; // eax@18
7298  ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1
7299 
7300  CastSpellInfo* pSpellInfo;
7301 
7303  unsigned int pY;
7304  unsigned int pX;
7305  mouse->GetClickPos(&pX, &pY);
7306 
7307  int inventoryYCoord = (pY - 17) / 32;
7308  int inventoryXCoord = (pX - 14) / 32;
7309  int invMatrixIndex = inventoryXCoord + (INVETORYSLOTSWIDTH * inventoryYCoord);
7310 
7311  if (inventoryYCoord >= 0 && inventoryYCoord < INVETORYSLOTSHEIGHT &&
7312  inventoryXCoord >= 0 && inventoryXCoord < INVETORYSLOTSWIDTH) {
7314  unsigned int enchantedItemPos =
7315  this->GetItemListAtInventoryIndex(invMatrixIndex);
7316 
7317  if (enchantedItemPos) {
7318  /* *((char *)pGUIWindow_CastTargetedSpell->ptr_1C + 8) &=
7319  *0x7Fu;
7320  *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 2) =
7321  *uActiveCharacter - 1;
7322  *((int *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) =
7323  *enchantedItemPos - 1;
7324  *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) =
7325  *invMatrixIndex;*/
7326  pSpellInfo =
7328  pSpellInfo->uFlags &= 0x7F;
7329  pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
7330  pSpellInfo->spell_target_pid = enchantedItemPos; // - 1;
7331  pSpellInfo->field_6 = (-1 - enchantedItemPos); // check
7333  &this->pInventoryItemList[enchantedItemPos - 1];
7335 
7337 
7338  mouse->SetCursorImage("MICON1");
7342  }
7343 
7344  return;
7345  }
7346 
7347  if (ptr_50C9A4_ItemToEnchant) return;
7348 
7349  pickedItemId = pParty->pPickedItem.uItemID;
7350  invItemIndex = this->GetItemListAtInventoryIndex(invMatrixIndex);
7351 
7352  if (!pickedItemId) { // no hold item
7353  if (!invItemIndex) {
7354  return;
7355  } else {
7356  memcpy(&pParty->pPickedItem,
7357  &this->pInventoryItemList[invItemIndex - 1],
7358  sizeof(pParty->pPickedItem));
7359  this->RemoveItemAtInventoryIndex(invMatrixIndex);
7360  pickedItemId = pParty->pPickedItem.uItemID;
7362  pItemsTable->pItems[pickedItemId].pIconName);
7363  return;
7364  }
7365  } else { // hold item
7366  if (invItemIndex) {
7367  ItemGen* invItemPtr =
7368  &this->pInventoryItemList[invItemIndex - 1];
7369  memcpy(&tmpItem, invItemPtr, sizeof(tmpItem));
7370  this->RemoveItemAtInventoryIndex(invMatrixIndex);
7371  int emptyIndex =
7372  this->AddItem2(invMatrixIndex, &pParty->pPickedItem);
7373 
7374  if (!emptyIndex) {
7375  emptyIndex = this->AddItem2(-1, &pParty->pPickedItem);
7376  if (!emptyIndex) {
7377  this->PutItemArInventoryIndex(tmpItem.uItemID,
7378  invItemIndex - 1,
7379  invMatrixIndex);
7380  memcpy(invItemPtr, &tmpItem, sizeof(ItemGen));
7381  return;
7382  }
7383  }
7384 
7385  memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen));
7387  return;
7388  } else {
7389  itemPos = this->AddItem(invMatrixIndex, pickedItemId);
7390 
7391  if (itemPos) {
7392  memcpy(&this->pInventoryItemList[itemPos - 1],
7393  &pParty->pPickedItem, sizeof(ItemGen));
7395  return;
7396  }
7397 
7398  // itemPos = this->AddItem(-1, pickedItemId);
7399 
7400  // if ( itemPos ) {
7401  // memcpy(&this->pInventoryItemList[itemPos-1],
7402  // &pParty->pPickedItem, sizeof(ItemGen));
7403  // pMouse->RemoveHoldingItem();
7404  // return;
7405  // }
7406  }
7407  } // held item or no
7408  } // limits
7409  } // char wind
7410 } // func
7411 
7412 bool Player::IsWeak() const {
7413  return this->conditions_times[Condition_Weak].Valid();
7414 }
7415 
7416 bool Player::IsDead() const {
7417  return this->conditions_times[Condition_Dead].Valid();
7418 }
7419 
7420 bool Player::IsEradicated() const {
7421  return this->conditions_times[Condition_Eradicated].Valid();
7422 }
7423 
7424 bool Player::IsZombie() const {
7425  return this->conditions_times[Condition_Zombie].Valid();
7426 }
7427 
7428 bool Player::IsCursed() const {
7429  return this->conditions_times[Condition_Cursed].Valid();
7430 }
7431 
7432 bool Player::IsPertified() const {
7433  return this->conditions_times[Condition_Pertified].Valid();
7434 }
7435 
7436 bool Player::IsUnconcious() const {
7437  return this->conditions_times[Condition_Unconcious].Valid();
7438 }
7439 
7440 bool Player::IsAsleep() const {
7441  return this->conditions_times[Condition_Sleep].Valid();
7442 }
7443 
7444 bool Player::IsParalyzed() const {
7445  return this->conditions_times[Condition_Paralyzed].Valid();
7446 }
7447 
7448 bool Player::IsDrunk() const {
7449  return this->conditions_times[Condition_Drunk].Valid();
7450 }
7451 
7453  this->conditions_times[Condition_Cursed] = time;
7454 }
7455 
7457  this->conditions_times[Condition_Weak] = time;
7458 }
7459 
7461  this->conditions_times[Condition_Sleep] = time;
7462 }
7463 
7465  this->conditions_times[Condition_Fear] = time;
7466 }
7467 
7469  this->conditions_times[Condition_Drunk] = time;
7470 }
7471 
7473  this->conditions_times[Condition_Insane] = time;
7474 }
7475 
7478 }
7479 
7482 }
7483 
7486 }
7487 
7490 }
7491 
7494 }
7495 
7498 }
7499 
7501  this->conditions_times[Condition_Paralyzed] = time;
7502 }
7503 
7505  this->conditions_times[Condition_Unconcious] = time;
7506 }
7507 
7509  this->conditions_times[Condition_Dead] = time;
7510 }
7511 
7513  this->conditions_times[Condition_Pertified] = time;
7514 }
7515 
7517  this->conditions_times[Condition_Eradicated] = time;
7518 }
7519 
7521  this->conditions_times[Condition_Zombie] = time;
7522 }
7523 
7525  SetCondition(Condition_Weak, blockable);
7526 }
7527 
7529  SetCondition(Condition_Insane, blockable);
7530 }
7531 
7533  SetCondition(Condition_Dead, blockable);
7534 }
7535 
7537  SetCondition(Condition_Dead, blockable);
7538 }
7539 
7541 
7544 }
7545 
7547 
7549 
7551 
7553 
7555 
7557 
7559 
7561 
7563  return GetNthEquippedIndexItem(ringNum + 10);
7564 }
7565 
7567  if (this->pEquipment.pIndices[index] == 0) {
7568  return nullptr;
7569  }
7570 
7571  return &this->pInventoryItemList[this->pEquipment.pIndices[index] - 1];
7572 }
7573 
7574 ItemGen* Player::GetItem(unsigned int PlayerEquipment::*itemPos) {
7575  if (this->pEquipment.*itemPos == 0) {
7576  return nullptr;
7577  }
7578 
7579  return &this->pInventoryItemList[this->pEquipment.*itemPos - 1];
7580 }
7581 
7582 int Player::GetPlayerIndex() { // PS - RETURN PLAYER INDEX
7583  int uPlayerIdx = 0;
7584 
7585  if (this == pPlayers[1])
7586  uPlayerIdx = 0;
7587  else if (this == pPlayers[2])
7588  uPlayerIdx = 1;
7589  else if (this == pPlayers[3])
7590  uPlayerIdx = 2;
7591  else if (this == pPlayers[4])
7592  uPlayerIdx = 3;
7593  else
7594  Error("Unexpected player pointer");
7595 
7596  return uPlayerIdx;
7597 }
7598 
7599 //----- (004272F5) --------------------------------------------------------
7600 bool Player::PlayerHitOrMiss(Actor* pActor, int distancemod,
7601  int skillmod) { // PS - RETURN IF ATTACK WILL HIT
7602  int naturalArmor = pActor->pMonsterInfo.uAC; // actor usual armour
7603  int armorBuff = 0;
7604 
7606  .Active()) // gm axe effect??
7607  naturalArmor /= 2;
7608 
7610  armorBuff = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower;
7611 
7612  if (pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].Active() &&
7613  pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > armorBuff)
7614  armorBuff = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
7615 
7616  int effectiveActorArmor = armorBuff + naturalArmor;
7617 
7618  int attBonus; // player attack bonus
7619  if (distancemod)
7620  attBonus = this->GetRangedAttack(); // range
7621  else
7622  attBonus = this->GetActualAttack(false); // melee
7623 
7624  int attPositiveMod =
7625  skillmod + rand() % (effectiveActorArmor + 2 * attBonus +
7626  30); // positive effects to hit on attack
7627 
7628  int attNegativeMod; // negative effects to hit on attack
7629 
7630  if (distancemod == 2) { // medium range
7631  attNegativeMod =
7632  ((effectiveActorArmor + 15) / 2) + effectiveActorArmor + 15;
7633  } else if (distancemod == 3) { // far range
7634  attNegativeMod = 2 * effectiveActorArmor + 30;
7635  } else { // close range
7636  attNegativeMod = effectiveActorArmor + 15;
7637  }
7638 
7639  return (attPositiveMod > attNegativeMod); // do the pos outweight the negs
7640 }
7641 
7642 //----- (0042ECB5) --------------------------------------------------------
7644  // char *v5; // eax@8
7645  // unsigned int v9; // ecx@21
7646  // char *v11; // eax@26
7647  // unsigned int v12; // eax@47
7648  // SoundID v24; // [sp-4h] [bp-40h]@58
7649 
7650  // result = pParty->pPlayers[uActiveCharacter-1].CanAct();
7651  Player* player = &pParty->pPlayers[uActiveCharacter - 1];
7652  if (!player->CanAct()) return;
7653 
7655  // v3 = 0;
7656  if (pParty->Invisible())
7658 
7659  // v31 = player->pEquipment.uBow;
7660  int bow_idx = player->pEquipment.uBow;
7661  if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken())
7662  bow_idx = 0;
7663 
7664  // v32 = 0;
7665  int wand_item_id = 0;
7666  // v33 = 0;
7667 
7668  int laser_weapon_item_id = 0;
7669 
7670  int main_hand_idx = player->pEquipment.uMainHand;
7671  if (main_hand_idx) {
7672  ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1];
7673  // v5 = (char *)v1 + 36 * v4;
7674  if (!item->IsBroken()) {
7675  // v28b = &v1->pInventoryItems[v4].uItemID;
7676  // v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
7677  if (item->GetItemEquipType() == EQUIP_WAND) {
7678  if (item->uNumCharges <= 0)
7679  player->pEquipment.uMainHand =
7680  0; // wand discharged - unequip
7681  else
7682  wand_item_id = item->uItemID; // *((int *)v5 + 124);
7683  } else if (item->uItemID == ITEM_BLASTER ||
7684  item->uItemID == ITEM_LASER_RIFLE) {
7685  laser_weapon_item_id = item->uItemID; // *((int *)v5 + 124);
7686  }
7687  }
7688  }
7689 
7690  // v30 = 0;
7691  // v29 = 0;
7692  // v28 = 0;
7693  // v7 = pMouse->uPointingObjectID;
7694 
7695  int target_pid = mouse->uPointingObjectID;
7696  int target_type = PID_TYPE(target_pid), target_id = PID_ID(target_pid);
7697  if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) {
7698  target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
7699  target_type = PID_TYPE(target_pid);
7700  target_id = PID_ID(target_pid);
7701  }
7702 
7703  Actor* actor;
7704  if (target_id < 500) {
7705  actor = &pActors[target_id]; // prevent crash
7706  }
7707 
7708  int actor_distance = 0;
7709  if (target_type == OBJECT_Actor) {
7710  int distance_x = actor->vPosition.x - pParty->vPosition.x,
7711  distance_y = actor->vPosition.y - pParty->vPosition.y,
7712  distance_z = actor->vPosition.z - pParty->vPosition.z;
7713  actor_distance =
7714  integer_sqrt(distance_x * distance_x + distance_y * distance_y +
7715  distance_z * distance_z) -
7716  actor->uActorRadius;
7717  if (actor_distance < 0) actor_distance = 0;
7718  }
7719 
7720  bool shooting_bow = false, shotting_laser = false, shooting_wand = false,
7721  melee_attack = false;
7722  if (laser_weapon_item_id) {
7723  shotting_laser = true;
7725  uActiveCharacter - 1, 0, 0,
7726  uActiveCharacter + 8);
7727  } else if (wand_item_id) {
7728  shooting_wand = true;
7729 
7730  int main_hand_idx = player->pEquipment.uMainHand;
7732  wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1]
7733  .uItemID -
7734  ITEM_WAND_FIRE],
7735  uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
7736 
7737  if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
7738  player->pEquipment.uMainHand = 0;
7739  } else if (target_type == OBJECT_Actor && actor_distance <= 407.2) {
7740  melee_attack = true;
7741 
7742  Vec3_int_ a3;
7743  a3.x = actor->vPosition.x - pParty->vPosition.x;
7744  a3.y = actor->vPosition.y - pParty->vPosition.y;
7745  a3.z = actor->vPosition.z - pParty->vPosition.z;
7746  Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
7747 
7749  target_id, &a3);
7753  actor->vPosition.x, actor->vPosition.y,
7754  actor->vPosition.z + actor->uActorHeight / 2, 0, 512,
7756  } else if (bow_idx) {
7757  shooting_bow = true;
7759  uActiveCharacter - 1, 0, 0, 0);
7760  } else {
7761  melee_attack = true;
7762  // ; // actor out of range or no actor; no ranged weapon so melee
7763  // attacking air
7764  }
7765 
7766  if (!pParty->bTurnBasedModeOn &&
7767  melee_attack) { // wands, bows & lasers will add recovery while shooting
7768  // spell effect
7769  int recovery = player->GetAttackRecoveryTime(false);
7770  if (recovery < 30) recovery = 30;
7771  player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery *
7772  2.133333333333333);
7773  }
7774 
7775  int v34 = 0;
7776  if (shooting_wand) {
7777  return;
7778  } else if (shooting_bow) {
7779  v34 = 5;
7780  player->PlaySound(SPEECH_50, 0);
7781  } else if (shotting_laser) {
7782  v34 = 7;
7783  } else {
7784  int main_hand_idx = player->pEquipment.uMainHand;
7785  if (player->HasItemEquipped(EQUIP_TWO_HANDED))
7786  v34 = player->pInventoryItemList[main_hand_idx - 1]
7787  .GetPlayerSkillType();
7789  }
7790 
7791  switch (v34) {
7792  case 0:
7794  break;
7795  case 1:
7797  break;
7798  case 2:
7800  break;
7801  case 3:
7802  pAudioPlayer->PlaySound(SOUND_swing_with_axe01, 0, 0, -1, 0, 0);
7803  break;
7804  case 4:
7805  pAudioPlayer->PlaySound(SOUND_swing_with_axe03, 0, 0, -1, 0, 0);
7806  break;
7807  case 5:
7808  pAudioPlayer->PlaySound(SOUND_shoot_bow01, 0, 0, -1, 0, 0);
7809  break;
7810  case 6:
7812  break;
7813  case 7:
7814  pAudioPlayer->PlaySound(SOUND_shoot_blaster01, 0, 0, -1, 0, 0);
7815  break;
7816  }
7817 }
7818 
7819 //----- (0042FA66) --------------------------------------------------------
7820 void Player::_42FA66_do_explosive_impact(int xpos, int ypos, int zpos, int a4,
7821  __int16 a5, signed int actchar) {
7822  // EXPLOSIVE IMPACT OF ARTIFACT SPLITTER
7823 
7824  SpriteObject a1a;
7826  a1a.containing_item.Reset();
7828  a1a.spell_level = 8;
7829  a1a.spell_skill = 3;
7831  a1a.vPosition.x = xpos;
7832  a1a.vPosition.y = ypos;
7833  a1a.vPosition.z = zpos;
7834  a1a.uAttributes = 0;
7835  a1a.uSectorID = pIndoor->GetSector(xpos, ypos, zpos);
7836  a1a.uSpriteFrameID = 0;
7837  a1a.spell_target_pid = 0;
7839  a1a.uFacing = 0;
7840  a1a.uSoundID = 0;
7841 
7842  if (actchar >= 1 || actchar <= 4)
7843  a1a.spell_caster_pid = PID(OBJECT_Player, actchar - 1);
7844  else
7845  a1a.spell_caster_pid = 0;
7846 
7847  int id = a1a.Create(0, 0, 0, 0);
7848  if (id != -1)
7849  AttackerInfo.Add(PID(OBJECT_Item, id), a5, (short)a1a.vPosition.x,
7850  (short)a1a.vPosition.y, (short)a1a.vPosition.z, 0, 0);
7851 }
7852 
7853 //----- (00458244) --------------------------------------------------------
7854 unsigned int SkillToMastery(unsigned int skill_value) {
7855  // attempt to depreciate ?
7856  // use GetActualSkillMastery instead
7857 
7858  switch (skill_value & 0x1C0) {
7859  case 0x100:
7860  return 4; // Grandmaster
7861  case 0x80:
7862  return 3; // Master
7863  case 0x40:
7864  return 2; // Expert
7865  case 0x00:
7866  return 1; // Normal
7867  }
7868 
7869  assert(false); // should not get here
7870  return 0;
7871 }
7872 
7873 //----- (004948B1) --------------------------------------------------------
7875  int a3) { // ?? need to swith over to openal
7876  int speechCount = 0; // esi@4
7877  int expressionCount = 0; // esi@4
7878  int pickedVariant; // esi@10
7880  int pSoundID; // ecx@19
7881  int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7
7882  int expressionVariantArray[5];
7883  unsigned int expressionDuration = 0;
7884 
7885  unsigned int pickedSoundID = 0;
7886  if (engine->config->voice_level > 0) {
7887  for (int i = 0; i < 2; i++) {
7888  if (SoundSetAction[speech][i]) {
7889  speechVariantArray[speechCount] = SoundSetAction[speech][i];
7890  speechCount++;
7891  }
7892  }
7893  if (speechCount) {
7894  pickedVariant = speechVariantArray[rand() % speechCount];
7895  int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID];
7896  if (numberOfSubvariants > 0) {
7897  pickedSoundID = rand() % numberOfSubvariants +
7898  2 * (pickedVariant + 50 * uVoiceID) + 4998;
7900  (SoundID)pickedSoundID,
7901  PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0);
7902  }
7903  }
7904  }
7905 
7906  for (int i = 0; i < 5; i++) {
7907  if (SoundSetAction[speech][i + 3]) {
7908  expressionVariantArray[expressionCount] =
7909  SoundSetAction[speech][i + 3];
7910  expressionCount++;
7911  }
7912  }
7913  if (expressionCount) {
7915  expressionVariantArray[rand() % expressionCount];
7916  if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID) {
7917  pSoundID = pickedSoundID;
7918  if (pSoundID >= 0) {
7919  expressionDuration = (sLastTrackLengthMS << 7) / 1000;
7920  }
7921  }
7922  PlayEmotion(expression, expressionDuration);
7923  }
7924 }
7925 
7926 //----- (00494A25) --------------------------------------------------------
7927 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int duration) {
7928  // 38 - sparkles 1 player?
7929 
7930  unsigned int currexpr = expression;
7931 
7934  return; // no react
7936  new_expression != CHARACTER_EXPRESSION_FALLING) {
7937  return; // no react
7938  } else {
7940  new_expression != CHARACTER_EXPRESSION_FALLING) {
7941  if (currexpr >= 2 && currexpr <= 11 && currexpr != 8 &&
7942  !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR ||
7943  new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE ||
7944  new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR)) {
7945  return; // no react
7946  }
7947  }
7948  }
7949 
7950  this->uExpressionTimePassed = 0;
7951 
7952  if (!duration) {
7953  this->uExpressionTimeLength =
7954  8 * pPlayerFrameTable->pFrames[duration].uAnimLength;
7955  } else {
7956  this->uExpressionTimeLength = 0;
7957  }
7958 
7959  expression = new_expression;
7961 }
7962 
7963 //----- (0049327B) --------------------------------------------------------
7964 bool Player::ProfessionOrGuildFlagsCorrect(unsigned int uClass, int a3) {
7965  if (this->classType == uClass) {
7966  return true;
7967  } else {
7968  if (!a3) {
7969  return false;
7970  }
7971  switch (uClass) {
7973  return (_449B57_test_bit(
7974  (unsigned __int8*)this->_achieved_awards_bits, 65));
7976  return (_449B57_test_bit(
7977  (unsigned __int8*)this->_achieved_awards_bits, 67));
7978  case PLAYER_CLASS_ARCHMAGE:
7979  return (_449B57_test_bit(
7980  (unsigned __int8*)this->_achieved_awards_bits, 77));
7981  case PLAYER_CLASS_LICH:
7982  return (_449B57_test_bit(
7983  (unsigned __int8*)this->_achieved_awards_bits, 79));
7984  break;
7985  default:
7986  Error("Should not be able to get here (%u)", uClass);
7987  break;
7988  }
7989  return false;
7990  }
7991 }
7992 
7993 //----- (00490EEE) --------------------------------------------------------
7995  ItemGen* pItem, int building_type, int BuildID_2Events,
7996  int ShopMenuType) { // TODO(_): probably move this somewhere else, not really
7997  // Player:: stuff
7998  unsigned int idemId; // edx@1
7999  signed int equipType; // esi@1
8000  float multiplier; // ST04_4@26
8001  int price; // edi@26
8002  int merchantLevel; // [sp+10h] [bp-8h]@1
8003  int itemValue;
8004 
8005  merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
8006  idemId = pItem->uItemID;
8007  equipType = pItem->GetItemEquipType();
8008  itemValue = pItem->GetValue();
8009 
8010  switch (building_type) {
8012  if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5;
8013  if (equipType > EQUIP_BOW) return 4;
8014  break;
8016  if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5;
8017  if (equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) return 4;
8018  break;
8020  if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5;
8021  if (pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC)
8022  return 4;
8023  break;
8025  if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS &&
8026  idemId < ITEM_RECIPE_REJUVENATION) ||
8027  idemId > ITEM_RECIPE_BODY_RESISTANCE)
8028  return 5;
8029  if (!(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION ||
8030  equipType == EQUIP_MESSAGE_SCROLL))
8031  return 4;
8032  break;
8033  default:
8034  Error("(%u)", building_type);
8035  break;
8036  }
8037  if (pItem->IsStolen()) return 6;
8038 
8039  multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier;
8040  switch (ShopMenuType) {
8041  case 2:
8042  price = GetBuyingPrice(itemValue, multiplier);
8043  break;
8044  case 3:
8045  // if (pItem->IsBroken())
8046  // price = 1;
8047  // else
8048  price = this->GetPriceSell(*pItem,
8049  multiplier); // itemValue, multiplier);
8050  break;
8051  case 4:
8052  price = this->GetPriceIdentification(multiplier);
8053  break;
8054  case 5:
8055  price = this->GetPriceRepair(itemValue, multiplier);
8056  break;
8057  default:
8058  Error("(%u)", ShopMenuType);
8059  break;
8060  }
8061  if (merchantLevel) {
8062  if (price == itemValue) {
8063  return 3;
8064  } else {
8065  return 2;
8066  }
8067  } else {
8068  return 1;
8069  }
8070 }
8071 
8072 //----- (0048C6AF) --------------------------------------------------------
8074  memset(&pEquipment, 0, sizeof(PlayerEquipment));
8075  pInventoryMatrix.fill(0);
8076  for (uint i = 0; i < 126; ++i) pInventoryItemList[i].Reset();
8077  for (uint i = 0; i < 12; ++i) pEquippedItems[i].Reset();
8078 
8079  for (uint i = 0; i < 24; ++i) {
8080  pPlayerBuffs[i].uSkill = 0;
8081  pPlayerBuffs[i].uSkill = 0;
8082  pPlayerBuffs[i].uPower = 0;
8083  pPlayerBuffs[i].expire_time.Reset();
8084  pPlayerBuffs[i].uCaster = 0;
8085  pPlayerBuffs[i].uFlags = 0;
8086  }
8087 
8088  pName[0] = 0;
8089  uCurrentFace = 0;
8090  uVoiceID = 0;
8091  conditions_times.fill(GameTime(0));
8092 
8093  field_BB = 0;
8094 
8095  uMight = uMightBonus = 0;
8099  uSpeed = uSpeedBonus = 0;
8100  uAccuracy = uAccuracyBonus = 0;
8101  uLuck = uLuckBonus = 0;
8102  uLevel = sLevelModifier = 0;
8103  sAgeModifier = 0;
8104  sACModifier = 0;
8105 
8106  // memset(field_1F5, 0, 30);
8107  pure_luck_used = 0;
8108  pure_speed_used = 0;
8109  pure_intellect_used = 0;
8110  pure_endurance_used = 0;
8111  pure_willpower_used = 0;
8112  pure_accuracy_used = 0;
8113  pure_might_used = 0;
8114 
8116  sResAirBase = sResAirBonus = 0;
8125 
8126  uTimeToRecovery = 0;
8127 
8128  uSkillPoints = 0;
8129 
8130  sHealth = 0;
8131  uFullHealthBonus = 0;
8132  _health_related = 0;
8133 
8134  sMana = 0;
8135  uFullManaBonus = 0;
8136  _mana_related = 0;
8137 
8138  uQuickSpell = 0;
8139 
8140  _some_attack_bonus = 0;
8141  field_1A91 = 0;
8142  _melee_dmg_bonus = 0;
8143  field_1A93 = 0;
8144  _ranged_atk_bonus = 0;
8145  field_1A95 = 0;
8146  _ranged_dmg_bonus = 0;
8147  field_1A97 = 0;
8148 
8152 
8154  uNumArmageddonCasts = 0;
8155  uNumFireSpikeCasts = 0;
8156 
8157  memset(field_1988, 0, sizeof(field_1988));
8158  memset(playerEventBits, 0, sizeof(playerEventBits));
8159 
8160  field_E0 = 0;
8161  field_E4 = 0;
8162  field_E8 = 0;
8163  field_EC = 0;
8164  field_F0 = 0;
8165  field_F4 = 0;
8166  field_F8 = 0;
8167  field_FC = 0;
8168  field_100 = 0;
8169  field_104 = 0;
8170 
8173 
8175 }
8176 
8178  struct delete_beacon : public std::unary_function<const LloydBeacon&, bool> {
8179  bool operator()(const LloydBeacon &beacon) const {
8180  return (beacon.uBeaconTime < pParty->GetPlayingTime());
8181  }
8182  };
8183  vBeacons.erase(std::remove_if(vBeacons.begin(), vBeacons.end(), delete_beacon()), vBeacons.end());
8184 }
8185 
8186 bool Player::SetBeacon(size_t index, size_t power) {
8187  int file_index = pGames_LOD->GetSubNodeIndex(pCurrentMapName);
8188  if (file_index < 0) {
8189  return false;
8190  }
8191 
8192  LloydBeacon beacon;
8193 
8194  beacon.image = render->TakeScreenshot(92, 68);
8196  beacon.PartyPos_X = pParty->vPosition.x;
8197  beacon.PartyPos_Y = pParty->vPosition.y;
8198  beacon.PartyPos_Z = pParty->vPosition.z;
8199  beacon.PartyRot_X = pParty->sRotationY;
8200  beacon.PartyRot_Y = pParty->sRotationX;
8201  beacon.SaveFileID = file_index;
8202 
8203  if (index < vBeacons.size()) {
8204  vBeacons[index] = beacon;
8205  } else {
8206  vBeacons.push_back(beacon);
8207  }
8208 
8209  return true;
8210 }
VAR_Cursed
@ VAR_Cursed
Definition: Events.h:232
UIGame.h
Party::pPickedItem
ItemGen pPickedItem
Definition: Party.h:312
Player::uMightBonus
unsigned __int16 uMightBonus
Definition: Player.h:643
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
CHARACTER_ATTRIBUTE_LUCK
@ CHARACTER_ATTRIBUTE_LUCK
Definition: Engine.h:527
SpriteObject
Definition: SpriteObject.h:189
VAR_SkillChain
@ VAR_SkillChain
Definition: Events.h:205
MONSTER_SUPERTYPE_UNDEAD
@ MONSTER_SUPERTYPE_UNDEAD
Definition: Monsters.h:70
TE_MOVEMENT
@ TE_MOVEMENT
Definition: TurnEngine.h:22
Player::GetMeditation
int GetMeditation()
Definition: Player.cpp:925
Player::ReceiveSpecialAttackEffect
int ReceiveSpecialAttackEffect(int attType, struct Actor *pActor)
Definition: Player.cpp:1851
Player::GetLearningPercent
char GetLearningPercent()
Definition: Player.cpp:1023
SOUND_spellfail0201
@ SOUND_spellfail0201
Definition: AudioPlayer.h:79
Player::GetSkillBonus
int GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
Definition: Player.cpp:3196
CHARACTER_EXPRESSION_PERTIFIED
@ CHARACTER_EXPRESSION_PERTIFIED
Definition: Player.h:354
ItemsTable::IsMaterialNonCommon
bool IsMaterialNonCommon(ItemGen *pItem)
Definition: Items.cpp:487
CHARACTER_ATTRIBUTE_SKILL_EARTH
@ CHARACTER_ATTRIBUTE_SKILL_EARTH
Definition: Engine.h:562
Player::SetRecoveryTime
void SetRecoveryTime(signed int sRecoveryTime)
Definition: Player.cpp:2593
Player
Definition: Player.h:401
VAR_MindSkill
@ VAR_MindSkill
Definition: Events.h:212
Actor::vPosition
struct Vec3_short_ vPosition
Definition: Actor.h:298
VAR_SpearSkill
@ VAR_SpearSkill
Definition: Events.h:199
Player::UseItem_DrinkPotion_etc
void UseItem_DrinkPotion_etc(signed int a2, int a3)
Definition: Player.cpp:3850
Player::AddSkillByEvent
void AddSkillByEvent(unsigned __int16 Player::*skillToSet, unsigned __int16 addSkillValue)
Definition: Player.cpp:6216
VAR_PerceptionSkill
@ VAR_PerceptionSkill
Definition: Events.h:221
Player::StealFromActor
int StealFromActor(unsigned int uActorID, int _steal_perm, int reputation)
Definition: Player.cpp:1667
PLAYER_SKILL_BLASTER
@ PLAYER_SKILL_BLASTER
Definition: Player.h:178
PlayerEquipment::pIndices
std::array< unsigned int, 16 > pIndices
Definition: Player.h:336
Player::IsWeak
bool IsWeak() const
Definition: Player.cpp:7412
DMGT_PHISYCAL
@ DMGT_PHISYCAL
Definition: Items.h:15
Party::vPosition
Vec3_int_ vPosition
Definition: Party.h:250
Engine_::IocContainer
Definition: IocContainer.h:15
SPECIAL_ATTACK_DISEASE_WEAK
@ SPECIAL_ATTACK_DISEASE_WEAK
Definition: Monsters.h:90
Player::field_F4
int field_F4
Definition: Player.h:665
PlayerEquipment::uShield
unsigned int uShield
Definition: Player.h:319
PLAYER_CLASS_CRUSADER
@ PLAYER_CLASS_CRUSADER
Definition: Player.h:229
VAR_MaxHP
@ VAR_MaxHP
Definition: Events.h:132
Actor::ActorHasItems
struct ItemGen ActorHasItems[4]
Definition: Actor.h:316
Player::PlayerHitOrMiss
bool PlayerHitOrMiss(Actor *pActor, int distancemod, int skillmod)
Definition: Player.cpp:7600
PARTY_BUFF_DAY_OF_GODS
@ PARTY_BUFF_DAY_OF_GODS
Definition: Party.h:73
Party::uNumBountiesCollected
unsigned int uNumBountiesCollected
Definition: Party.h:286
VAR_EarthResistanceBonus
@ VAR_EarthResistanceBonus
Definition: Events.h:187
PLAYER_SKILL_MONSTER_ID
@ PLAYER_SKILL_MONSTER_ID
Definition: Player.h:203
VAR_RandomFood
@ VAR_RandomFood
Definition: Events.h:151
PLAYER_SKILL_DAGGER
@ PLAYER_SKILL_DAGGER
Definition: Player.h:173
Player::pure_endurance_used
int pure_endurance_used
Definition: Player.h:721
ItemGen::GetDamageMod
unsigned __int8 GetDamageMod()
Definition: Items.cpp:1533
CHARACTER_ATTRIBUTE_RESIST_FIRE
@ CHARACTER_ATTRIBUTE_RESIST_FIRE
Definition: Engine.h:532
Player::pure_willpower_used
int pure_willpower_used
Definition: Player.h:722
SPECIAL_ATTACK_DRUNK
@ SPECIAL_ATTACK_DRUNK
Definition: Monsters.h:85
Actor::AI_Stun
static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0)
Definition: Actor.cpp:1815
Player::GetRangedDamageString
String GetRangedDamageString()
Definition: Player.cpp:1441
Player::IsUnconcious
bool IsUnconcious() const
Definition: Player.cpp:7436
PLAYER_CLASS_PRIEST_OF_MOON
@ PLAYER_CLASS_PRIEST_OF_MOON
Definition: Player.h:243
PLAYER_CLASS_HUNTER
@ PLAYER_CLASS_HUNTER
Definition: Player.h:237
Player::pure_intellect_used
int pure_intellect_used
Definition: Player.h:720
VAR_LeatherSkill
@ VAR_LeatherSkill
Definition: Events.h:204
VAR_PersonalityBonus
@ VAR_PersonalityBonus
Definition: Events.h:154
Player::sResEarthBonus
__int16 sResEarthBonus
Definition: Player.h:748
PLAYER_BUFF_PAIN_REFLECTION
@ PLAYER_BUFF_PAIN_REFLECTION
Definition: Player.h:24
PLAYER_CLASS_INITIATE
@ PLAYER_CLASS_INITIATE
Definition: Player.h:225
Condition_Poison_Medium
@ Condition_Poison_Medium
Definition: Conditions.h:16
Player::sAgeModifier
__int16 sAgeModifier
Definition: Player.h:659
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
NPCData::uProfession
unsigned int uProfession
Definition: NPC.h:89
base_recovery_times_per_weapon_type
unsigned short base_recovery_times_per_weapon_type[12]
Definition: Player.cpp:207
Localization::GetCharacterConditionName
const char * GetCharacterConditionName(unsigned int index) const
Definition: Localization.h:75
Player::IsZombie
bool IsZombie() const
Definition: Player.cpp:7424
Player::skillSword
unsigned __int16 skillSword
Definition: Player.h:673
Player::_expression21_animtime
int _expression21_animtime
Definition: Player.h:792
Player::pure_accuracy_used
int pure_accuracy_used
Definition: Player.h:723
Actor::uActorHeight
uint16_t uActorHeight
Definition: Actor.h:296
Player::skillMeditation
unsigned __int16 skillMeditation
Definition: Player.h:697
Party::TakeFood
static void TakeFood(int amount)
Definition: Party.cpp:245
Player::GetItemsBonus
int GetItemsBonus(enum CHARACTER_ATTRIBUTE_TYPE attr, bool a3=false)
Definition: Player.cpp:2655
uSpeakingCharacter
int uSpeakingCharacter
Definition: mm7_data.cpp:764
Dying
@ Dying
Definition: Actor.h:79
VAR_BaseIntellect
@ VAR_BaseIntellect
Definition: Events.h:160
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
SpriteObject::uFacing
unsigned __int16 uFacing
Definition: SpriteObject.h:220
Player::sResMagicBonus
__int16 sResMagicBonus
Definition: Player.h:750
VAR_Asleep
@ VAR_Asleep
Definition: Events.h:234
Party::uCurrentMonth
unsigned int uCurrentMonth
Definition: Party.h:272
Player::GetAttackRecoveryTime
int GetAttackRecoveryTime(bool bRangedAttack)
Definition: Player.cpp:2203
VAR_MeditationSkill
@ VAR_MeditationSkill
Definition: Events.h:220
VAR_FireResistanceBonus
@ VAR_FireResistanceBonus
Definition: Events.h:184
Player::IncreaseAttribute
void IncreaseAttribute(int eAttribute)
Definition: Player.cpp:3711
Player::SubtractVariable
void SubtractVariable(enum VariableType VarNum, signed int pValue)
Definition: Player.cpp:6230
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
Player::GetBaseResistance
int GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Definition: Player.cpp:2479
VAR_Insane
@ VAR_Insane
Definition: Events.h:237
Player::IsRaceGoblin
bool IsRaceGoblin()
Definition: Player.h:608
Player::_some_attack_bonus
char _some_attack_bonus
Definition: Player.h:776
GameTime::GetDays
int GetDays() const
Definition: Time.h:32
VAR_DarkResistance
@ VAR_DarkResistance
Definition: Events.h:181
Player::field_1988
int field_1988[49]
Definition: Player.h:770
PartyHasDragon
bool PartyHasDragon()
Definition: NPC.cpp:750
PLAYER_SKILL_STAFF
@ PLAYER_SKILL_STAFF
Definition: Player.h:171
Player::IsRaceHuman
bool IsRaceHuman()
Definition: Player.h:605
condition
EGLenum condition
Definition: SDL_egl.h:1629
Player::SetPoisonSevere
void SetPoisonSevere(GameTime time)
Definition: Player.cpp:7492
VAR_NumBounties
@ VAR_NumBounties
Definition: Events.h:287
Teacher
@ Teacher
Definition: NPC.h:18
Tinker
@ Tinker
Definition: NPC.h:30
Player::GetMagicalBonus
int GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
Definition: Player.cpp:2942
LloydBeacon::PartyRot_X
int16_t PartyRot_X
Definition: Player.h:275
Party::pIsArtifactFound
std::array< char, 29 > pIsArtifactFound
Definition: Party.h:298
PLAYER_CLASS_VILLIAN
@ PLAYER_CLASS_VILLIAN
Definition: Player.h:231
PLAYER_BUFF_RESIST_MIND
@ PLAYER_BUFF_RESIST_MIND
Definition: Player.h:23
VAR_Counter4
@ VAR_Counter4
Definition: Events.h:272
PLAYER_CLASS_RANGER_LORD
@ PLAYER_CLASS_RANGER_LORD
Definition: Player.h:238
Smith
@ Smith
Definition: NPC.h:6
Mouse
Definition: Mouse.h:279
VAR_SpiritResistance
@ VAR_SpiritResistance
Definition: Events.h:177
Player::CalculateRangedDamageTo
int CalculateRangedDamageTo(int uMonsterInfoID)
Definition: Player.cpp:1365
Player::PlayEmotion
void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int duration)
Definition: Player.cpp:7927
VAR_IsSpeedMoreThanBase
@ VAR_IsSpeedMoreThanBase
Definition: Events.h:259
Player::GetActualSkillMastery
int GetActualSkillMastery(PLAYER_SKILL_TYPE uSkillType)
Definition: Player.cpp:3179
SPECIAL_ATTACK_POISON_SEVERE
@ SPECIAL_ATTACK_POISON_SEVERE
Definition: Monsters.h:89
CastSpellInfo::uFlags
uint16_t uFlags
Definition: CastSpellInfo.h:28
CastSpellInfo
Definition: CastSpellInfo.h:17
Player::field_F8
int field_F8
Definition: Player.h:666
CHARACTER_ATTRIBUTE_MANA
@ CHARACTER_ATTRIBUTE_MANA
Definition: Engine.h:529
pConditionImportancyTable
std::array< unsigned int, 18 > pConditionImportancyTable
Definition: Player.cpp:197
Player::skillArmsmaster
unsigned __int16 skillArmsmaster
Definition: Player.h:705
VAR_Afraid
@ VAR_Afraid
Definition: Events.h:235
Player::skillDiplomacy
unsigned __int16 skillDiplomacy
Definition: Player.h:699
CHARACTER_ATTRIBUTE_RESIST_SPIRIT
@ CHARACTER_ATTRIBUTE_RESIST_SPIRIT
Definition: Engine.h:557
VAR_DodgeSkill
@ VAR_DodgeSkill
Definition: Events.h:225
Player::skillItemId
unsigned __int16 skillItemId
Definition: Player.h:693
pSpriteObjects
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
Definition: SpriteObject.cpp:34
VAR_Experience
@ VAR_Experience
Definition: Events.h:141
PLAYER_CLASS_CLERIC
@ PLAYER_CLASS_CLERIC
Definition: Player.h:240
Player::skillBlaster
unsigned __int16 skillBlaster
Definition: Player.h:679
CHARACTER_ATTRIBUTE_SKILL_AIR
@ CHARACTER_ATTRIBUTE_SKILL_AIR
Definition: Engine.h:560
PLAYER_CLASS_ASSASSIN
@ PLAYER_CLASS_ASSASSIN
Definition: Player.h:223
TeleportToNWCDungeon
void TeleportToNWCDungeon()
Definition: Engine.cpp:2524
Monk
@ Monk
Definition: NPC.h:65
VAR_Hour
@ VAR_Hour
Definition: Events.h:145
SpriteObject::field_60_distance_related_prolly_lod
char field_60_distance_related_prolly_lod
Definition: SpriteObject.h:234
Player::GetActualAttack
int GetActualAttack(bool onlyMainHandDmg)
Definition: Player.cpp:1156
NPCData::uFlags
unsigned int uFlags
Definition: NPC.h:84
Player::Player
Player()
Definition: Player.cpp:8073
pBaseHealthPerLevelByClass
unsigned char pBaseHealthPerLevelByClass[36]
Definition: Player.cpp:163
ITEM_TEMPLE_IN_A_BOTTLE
@ ITEM_TEMPLE_IN_A_BOTTLE
Definition: Items.h:219
Player::CanIdentify
bool CanIdentify(ItemGen *pItem)
Definition: Player.cpp:934
OBJECT_Item
@ OBJECT_Item
Definition: Actor.h:66
VAR_Counter8
@ VAR_Counter8
Definition: Events.h:276
pMonsterStats
struct MonsterStats * pMonsterStats
Definition: Monsters.cpp:8
Player::uWillpowerBonus
unsigned __int16 uWillpowerBonus
Definition: Player.h:647
PlayerEquipment::uCloak
unsigned int uCloak
Definition: Player.h:325
Player::skillDodge
unsigned __int16 skillDodge
Definition: Player.h:702
Party::SetFood
static void SetFood(int amount)
Definition: Party.cpp:239
ItemsTable::SetSpecialBonus
void SetSpecialBonus(ItemGen *pItem)
Definition: Items.cpp:472
Player::GetItemAtInventoryIndex
struct ItemGen * GetItemAtInventoryIndex(int inout_item_cell)
Definition: Player.cpp:493
Party::GetNextActiveCharacter
int GetNextActiveCharacter()
Definition: Party.cpp:166
NPCData::Hired
bool Hired()
Definition: NPC.h:80
VAR_IsFlying
@ VAR_IsFlying
Definition: Events.h:264
PLAYER_BUFF_SHIELD
@ PLAYER_BUFF_SHIELD
Definition: Player.h:27
ItemGen::GetItemEquipType
ITEM_EQUIP_TYPE GetItemEquipType()
Definition: Items.cpp:1504
Party::sRotationX
int sRotationX
Definition: Party.h:252
VAR_MagicResistance
@ VAR_MagicResistance
Definition: Events.h:183
Player::uAccuracy
unsigned __int16 uAccuracy
Definition: Player.h:652
SOUND_trumpet
@ SOUND_trumpet
Definition: AudioPlayer.h:71
NPCStats::pNPCNames
char * pNPCNames[540][2]
Definition: NPC.h:166
pGUIWindow_CurrentMenu
GUIWindow * pGUIWindow_CurrentMenu
Definition: GUIWindow.cpp:54
Player::uFullManaBonus
char uFullManaBonus
Definition: Player.h:786
PLAYER_BUFF_ACCURACY
@ PLAYER_BUFF_ACCURACY
Definition: Player.h:29
Player::SetDrunk
void SetDrunk(GameTime time)
Definition: Player.cpp:7468
PLAYER_BUFF_STRENGTH
@ PLAYER_BUFF_STRENGTH
Definition: Player.h:33
Player::GetNthRingItem
ItemGen * GetNthRingItem(int ringNum)
Definition: Player.cpp:7562
Player::skillLearning
unsigned __int16 skillLearning
Definition: Player.h:708
Player::GetEquippedItemEquipType
ITEM_EQUIP_TYPE GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot)
Definition: Player.cpp:1565
PlayerFrameTable::pFrames
struct PlayerFrame * pFrames
Definition: PlayerFrameTable.h:29
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
CHARACTER_ATTRIBUTE_SKILL_BOW
@ CHARACTER_ATTRIBUTE_SKILL_BOW
Definition: Engine.h:569
Player::ReceiveDamage
int ReceiveDamage(signed int amount, DAMAGE_TYPE dmg_type)
Definition: Player.cpp:1816
Player::Heal
void Heal(int amount)
Definition: Player.cpp:1796
SpellStats::pInfos
SpellInfo pInfos[100]
Definition: Spells.h:192
VAR_Age
@ VAR_Age
Definition: Events.h:139
VAR_AirSkill
@ VAR_AirSkill
Definition: Events.h:208
CHARACTER_ATTRIBUTE_ATTACK
@ CHARACTER_ATTRIBUTE_ATTACK
Definition: Engine.h:549
VAR_ActualAccuracy
@ VAR_ActualAccuracy
Definition: Events.h:171
DecalBuilder::AddBloodsplat
void AddBloodsplat(float x, float y, float z, float r, float g, float b, float radius, int a8, int a9)
Definition: DecalBuilder.cpp:50
Player::skillStealing
unsigned __int16 skillStealing
Definition: Player.h:706
DMGT_FIRE
@ DMGT_FIRE
Definition: Items.h:11
PlayerSpeechID
enum PlayerSpeech PlayerSpeechID
Definition: Player.cpp:48
PLAYER_SKILL_AXE
@ PLAYER_SKILL_AXE
Definition: Player.h:174
EQUIP_BOOK
@ EQUIP_BOOK
Definition: Items.h:243
SpellInfo::uSchool
SPELL_SCHOOL uSchool
Definition: Spells.h:183
SPEECH_25
@ SPEECH_25
Definition: Player.h:71
EQUIP_SHIELD
@ EQUIP_SHIELD
Definition: Items.h:231
Player::GetTempleHealCostModifier
int GetTempleHealCostModifier(float price_multi)
Definition: Player.cpp:340
Player::uNumDivineInterventionCastsThisDay
char uNumDivineInterventionCastsThisDay
Definition: Player.h:795
CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER
@ CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER
Definition: Engine.h:544
CHARACTER_ATTRIBUTE_SKILL_BODY
@ CHARACTER_ATTRIBUTE_SKILL_BODY
Definition: Engine.h:565
SPECIAL_ATTACK_STEAL
@ SPECIAL_ATTACK_STEAL
Definition: Monsters.h:101
Psychic
@ Psychic
Definition: NPC.h:53
LloydBeacon::PartyPos_X
int32_t PartyPos_X
Definition: Player.h:272
BuildingType_ArmorShop
@ BuildingType_ArmorShop
Definition: Events2D.h:6
GUIMessageQueue::Flush
void Flush()
Definition: GUIWindow.cpp:159
Player::GetBodybuilding
int GetBodybuilding()
Definition: Player.cpp:916
Player::GetCloakItem
ItemGen * GetCloakItem()
Definition: Player.cpp:7554
Player::IsUnarmed
bool IsUnarmed()
Definition: Player.cpp:1576
Player::uEnduranceBonus
unsigned __int16 uEnduranceBonus
Definition: Player.h:649
ITEM_LICH_JAR_EMPTY
@ ITEM_LICH_JAR_EMPTY
Definition: Items.h:208
Player::ItemsPotionDmgBreak
void ItemsPotionDmgBreak(int enchant_count)
Definition: Player.cpp:517
SkillToMastery
unsigned int SkillToMastery(unsigned int skill_value)
Definition: Player.cpp:7854
Player::IsPertified
bool IsPertified() const
Definition: Player.cpp:7432
Player::Recover
bool Recover(int dt)
Definition: Player.cpp:2573
Player::INVETORYSLOTSHEIGHT
static const unsigned int INVETORYSLOTSHEIGHT
Definition: Player.h:403
mouse
static Mouse * mouse
Definition: Player.cpp:42
Party::hirelingScrollPosition
unsigned __int8 hirelingScrollPosition
Definition: Party.h:268
Actor
Definition: Actor.h:151
SOUND_shoot_blaster01
@ SOUND_shoot_blaster01
Definition: AudioPlayer.h:35
VAR_MerchantSkill
@ VAR_MerchantSkill
Definition: Events.h:217
SpriteObject::uSectorID
__int16 uSectorID
Definition: SpriteObject.h:223
VAR_SwordSkill
@ VAR_SwordSkill
Definition: Events.h:196
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
CHARACTER_EXPRESSION_DMGRECVD_MAJOR
@ CHARACTER_EXPRESSION_DMGRECVD_MAJOR
Definition: Player.h:378
Player::skillRepair
unsigned __int16 skillRepair
Definition: Player.h:695
SpriteObject.h
VAR_IntellectBonus
@ VAR_IntellectBonus
Definition: Events.h:153
PlayerCreation_AttributeProps::uBaseStep
unsigned char uBaseStep
Definition: Player.cpp:55
Player::skillSpear
unsigned __int16 skillSpear
Definition: Player.h:676
MonsterInfo::uSpell1ID
uint8_t uSpell1ID
Definition: Monsters.h:147
Player::CanAct
bool CanAct()
Definition: Player.cpp:549
engine
std::shared_ptr< Engine > engine
Definition: Engine.cpp:130
Player::_42FA66_do_explosive_impact
static void _42FA66_do_explosive_impact(int xpos, int ypos, int zpos, int a4, __int16 a5, signed int actchar)
Definition: Player.cpp:7820
Player::SetAfraid
void SetAfraid(GameTime time)
Definition: Player.cpp:7464
SOUND_swing_with_axe03
@ SOUND_swing_with_axe03
Definition: AudioPlayer.h:39
CHARACTER_RACE_DWARF
@ CHARACTER_RACE_DWARF
Definition: Player.h:164
EQUIP_REAGENT
@ EQUIP_REAGENT
Definition: Items.h:240
LloydBeacon::PartyPos_Y
int32_t PartyPos_Y
Definition: Player.h:273
CHARACTER_ATTRIBUTE_LEVEL
@ CHARACTER_ATTRIBUTE_LEVEL
Definition: Engine.h:548
CURRENT_SCREEN::SCREEN_CASTING
@ SCREEN_CASTING
MONSTER_SUPERTYPE_KREEGAN
@ MONSTER_SUPERTYPE_KREEGAN
Definition: Monsters.h:71
SOUND_shoot_bow01
@ SOUND_shoot_bow01
Definition: AudioPlayer.h:36
Player::GetBaseAge
unsigned int GetBaseAge()
Definition: Player.cpp:2468
ITEM_HARDENED
@ ITEM_HARDENED
Definition: Items.h:35
PLAYER_SKILL_EARTH
@ PLAYER_SKILL_EARTH
Definition: Player.h:186
Player::skillAxe
unsigned __int16 skillAxe
Definition: Player.h:675
SOUND_error
@ SOUND_error
Definition: AudioPlayer.h:19
MonsterInfo::uAC
unsigned int uAC
Definition: Monsters.h:176
StorylineRecord::pText
char * pText
Definition: StorylineTextTable.h:7
Actor::uCarriedItemID
uint16_t uCarriedItemID
Definition: Actor.h:309
PlayerEquipment::uBow
unsigned int uBow
Definition: Player.h:321
PlayerEquipment::uAmulet
unsigned int uAmulet
Definition: Player.h:328
stru262_TurnBased::ApplyPlayerAction
void ApplyPlayerAction()
Definition: TurnEngine.cpp:101
VAR_Counter3
@ VAR_Counter3
Definition: Events.h:271
PlayerEquipment::uGlove
unsigned int uGlove
Definition: Player.h:326
PLAYER_CLASS_MASTER
@ PLAYER_CLASS_MASTER
Definition: Player.h:226
SPEECH_96
@ SPEECH_96
Definition: Player.h:142
DMGT_SPIRIT
@ DMGT_SPIRIT
Definition: Items.h:17
SOUND_drink
@ SOUND_drink
Definition: AudioPlayer.h:80
Player::skillBow
unsigned __int16 skillBow
Definition: Player.h:677
GetSizeInInventorySlots
unsigned int GetSizeInInventorySlots(unsigned int uNumPixels)
Definition: UICharacter.cpp:919
Player::GetRaceName
String GetRaceName() const
Definition: Player.cpp:3502
SPECIAL_ATTACK_DISEASE_MEDIUM
@ SPECIAL_ATTACK_DISEASE_MEDIUM
Definition: Monsters.h:91
Player::GetBaseLevel
int GetBaseLevel()
Definition: Player.cpp:1068
ITEM_RED_APPLE
@ ITEM_RED_APPLE
Definition: Items.h:211
Alchemist
@ Alchemist
Definition: NPC.h:8
PLAYER_SKILL_CLUB
@ PLAYER_SKILL_CLUB
Definition: Player.h:208
Player::sResLightBase
__int16 sResLightBase
Definition: Player.h:743
ITEM_FAERIE_PIPES
@ ITEM_FAERIE_PIPES
Definition: Items.h:214
SPECIAL_ATTACK_PETRIFIED
@ SPECIAL_ATTACK_PETRIFIED
Definition: Monsters.h:96
PLAYER_SKILL_MIND
@ PLAYER_SKILL_MIND
Definition: Player.h:188
game_starting_year
int game_starting_year
Definition: mm7_data.cpp:193
NPCStats::uNumNPCNames
unsigned int uNumNPCNames[2]
Definition: NPC.h:182
Party::_quest_bits
unsigned __int8 _quest_bits[64]
Definition: Party.h:291
localization
Localization * localization
Definition: Localization.cpp:11
Player::GetBaseRepairPrice
int GetBaseRepairPrice(int uRealValue, float price_multiplier)
Definition: Player.cpp:465
SPECIAL_ATTACK_MANA_DRAIN
@ SPECIAL_ATTACK_MANA_DRAIN
Definition: Monsters.h:103
PARTY_BUFF_STONE_SKIN
@ PARTY_BUFF_STONE_SKIN
Definition: Party.h:86
MonsterInfo::field_3C_some_special_attack
int16_t field_3C_some_special_attack
Definition: Monsters.h:173
NZIArray
Definition: NZIArray.h:7
Player::GetRangedDamageMax
int GetRangedDamageMax()
Definition: Player.cpp:1351
Player::GetAmuletItem
ItemGen * GetAmuletItem()
Definition: Player.cpp:7560
PLAYER_CLASS_HERO
@ PLAYER_CLASS_HERO
Definition: Player.h:230
Player::SetInsane
void SetInsane(GameTime time)
Definition: Player.cpp:7472
PLAYER_SKILL_LEARNING
@ PLAYER_SKILL_LEARNING
Definition: Player.h:207
VAR_MaceSkill
@ VAR_MaceSkill
Definition: Events.h:201
Player::CalculateMeleeDamageTo
int CalculateMeleeDamageTo(bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID)
Definition: Player.cpp:1202
VAR_DaggerSkill
@ VAR_DaggerSkill
Definition: Events.h:197
PLAYER_BUFF_WATER_WALK
@ PLAYER_BUFF_WATER_WALK
Definition: Player.h:37
ITEM_RELIC_JUSTICE
@ ITEM_RELIC_JUSTICE
Definition: Items.h:180
CHARACTER_EXPRESSION_DEAD
@ CHARACTER_EXPRESSION_DEAD
Definition: Player.h:395
VAR_CurrentHP
@ VAR_CurrentHP
Definition: Events.h:131
CHARACTER_EXPRESSION_SLEEP
@ CHARACTER_EXPRESSION_SLEEP
Definition: Player.h:346
VAR_BodybuildingSkill
@ VAR_BodybuildingSkill
Definition: Events.h:219
Player::field_104
int field_104
Definition: Player.h:669
Instructor
@ Instructor
Definition: NPC.h:19
ull
unsigned long long ull
Definition: MM7.h:23
VAR_HiredNPCHasSpeciality
@ VAR_HiredNPCHasSpeciality
Definition: Events.h:265
CHARACTER_ATTRIBUTE_AC_BONUS
@ CHARACTER_ATTRIBUTE_AC_BONUS
Definition: Engine.h:530
VAR_QBits_QuestsDone
@ VAR_QBits_QuestsDone
Definition: Events.h:143
PLAYER_CLASS_ARCHMAGE
@ PLAYER_CLASS_ARCHMAGE
Definition: Player.h:250
VAR_AirResistance
@ VAR_AirResistance
Definition: Events.h:174
ObjectList::ObjectIDByItemID
unsigned int ObjectIDByItemID(unsigned int uItemID)
Definition: ObjectList.cpp:7
Player::skillDagger
unsigned __int16 skillDagger
Definition: Player.h:674
ShouldLoadTexturesForRaceAndGender
bool ShouldLoadTexturesForRaceAndGender(unsigned int _this)
Definition: Player.cpp:6879
Actor::CalcMagicalDamageToActor
int CalcMagicalDamageToActor(DAMAGE_TYPE dmgType, int incomingDmg)
Definition: Actor.cpp:4314
Player::GetPriceRepair
int GetPriceRepair(int uRealValue, float price_multiplier)
Definition: Player.cpp:421
PLAYER_SKILL_BOW
@ PLAYER_SKILL_BOW
Definition: Player.h:176
Player::lastOpenedSpellbookPage
char lastOpenedSpellbookPage
Definition: Player.h:773
SPEECH_42
@ SPEECH_42
Definition: Player.h:88
Player::field_1A91
char field_1A91
Definition: Player.h:777
PlayerCreation_AttributeProps::uMaxValue
unsigned char uMaxValue
Definition: Player.cpp:53
Burglar
@ Burglar
Definition: NPC.h:57
Player::skillLight
unsigned __int16 skillLight
Definition: Player.h:691
ptr_50C9A4_ItemToEnchant
ItemGen * ptr_50C9A4_ItemToEnchant
Definition: Items.cpp:35
Player::sResAirBonus
__int16 sResAirBonus
Definition: Player.h:746
Player::Zero
void Zero()
Definition: Player.cpp:3765
Player::skillMerchant
unsigned __int16 skillMerchant
Definition: Player.h:694
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
SOUND_panflute
@ SOUND_panflute
Definition: AudioPlayer.h:70
PartyTimeStruct::HistoryEventTimes
std::array< GameTime, 29 > HistoryEventTimes
Definition: Party.h:146
EQUIP_MESSAGE_SCROLL
@ EQUIP_MESSAGE_SCROLL
Definition: Items.h:245
VAR_Invisible
@ VAR_Invisible
Definition: Events.h:293
Player::field_100
int field_100
Definition: Player.h:668
bFlashAutonotesBook
char bFlashAutonotesBook
Definition: mm7_data.cpp:548
SOUND_chimes
@ SOUND_chimes
Definition: AudioPlayer.h:85
EQUIP_GOLD
@ EQUIP_GOLD
Definition: Items.h:246
Player::sResLightBonus
__int16 sResLightBonus
Definition: Player.h:754
PLAYER_CLASS_PALADIN
@ PLAYER_CLASS_PALADIN
Definition: Player.h:228
Party::uNumArenaLordWins
char uNumArenaLordWins
Definition: Party.h:297
CHARACTER_ATTRIBUTE_SKILL_LEARNING
@ CHARACTER_ATTRIBUTE_SKILL_LEARNING
Definition: Engine.h:571
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
Party::uNumPrisonTerms
int uNumPrisonTerms
Definition: Party.h:285
CHARACTER_ATTRIBUTE_SKILL_SPIRIT
@ CHARACTER_ATTRIBUTE_SKILL_SPIRIT
Definition: Engine.h:563
Player::PlayAwardSound
void PlayAwardSound()
Definition: Player.cpp:5623
Player::uSex
PLAYER_SEX uSex
Definition: Player.h:638
VAR_ReputationInCurrentLocation
@ VAR_ReputationInCurrentLocation
Definition: Events.h:281
ITEM_EQUIP_TYPE
ITEM_EQUIP_TYPE
Definition: Items.h:226
VAR_BaseLevel
@ VAR_BaseLevel
Definition: Events.h:137
ITEM_FORGE_GAUNTLETS
@ ITEM_FORGE_GAUNTLETS
Definition: Items.h:187
CHARACTER_EXPRESSION_DMGRECVD_MINOR
@ CHARACTER_EXPRESSION_DMGRECVD_MINOR
Definition: Player.h:376
Player::GetSpecialItemBonus
int GetSpecialItemBonus(ITEM_ENCHANTMENT enchantment)
Definition: Player.cpp:2634
PARTY_BUFF_RESIST_AIR
@ PARTY_BUFF_RESIST_AIR
Definition: Party.h:71
Player::skillBodybuilding
unsigned __int16 skillBodybuilding
Definition: Player.h:696
Player::_ranged_dmg_bonus
char _ranged_dmg_bonus
Definition: Player.h:782
CHARACTER_ATTRIBUTE_SKILL_WATER
@ CHARACTER_ATTRIBUTE_SKILL_WATER
Definition: Engine.h:561
Party::uNumArenaSquireWins
char uNumArenaSquireWins
Definition: Party.h:295
ITEM_RECIPE_REJUVENATION
@ ITEM_RECIPE_REJUVENATION
Definition: Items.h:221
SPECIAL_ATTACK_INSANE
@ SPECIAL_ATTACK_INSANE
Definition: Monsters.h:86
VAR_UnknownTimeEvent19
@ VAR_UnknownTimeEvent19
Definition: Events.h:280
SpriteObject::uType
SPRITE_OBJECT_TYPE uType
Definition: SpriteObject.h:215
Player::SetUnconcious
void SetUnconcious(GameTime time)
Definition: Player.cpp:7504
SOUND_luteguitar
@ SOUND_luteguitar
Definition: AudioPlayer.h:69
Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
void sub_421B2C_PlaceInInventory_or_DropPickedItem()
Definition: Party.cpp:1048
Player::sResEarthBase
__int16 sResEarthBase
Definition: Player.h:737
SpellFxRenderer.h
Party::uCurrentMonthWeek
unsigned int uCurrentMonthWeek
Definition: Party.h:273
Actor::ActorHitOrMiss
bool ActorHitOrMiss(Player *pPlayer)
Definition: Actor.cpp:4293
IsDwarfPresentInParty
bool IsDwarfPresentInParty(bool a1)
Definition: Player.cpp:6915
VAR_AlchemySkill
@ VAR_AlchemySkill
Definition: Events.h:230
Player::GetActualAC
int GetActualAC()
Definition: Player.cpp:2452
SEX_FEMALE
@ SEX_FEMALE
Definition: Player.h:399
Apothecary
@ Apothecary
Definition: NPC.h:29
SEX_MALE
@ SEX_MALE
Definition: Player.h:399
Player::field_E0
int field_E0
Definition: Player.h:660
VAR_NumSkillPoints
@ VAR_NumSkillPoints
Definition: Events.h:267
Actor::Die
static void Die(unsigned int uActorID)
Definition: Actor.cpp:1906
VAR_BowSkill
@ VAR_BowSkill
Definition: Events.h:200
GameTime::GetYears
int GetYears() const
Definition: Time.h:35
SPEECH_51
@ SPEECH_51
Definition: Player.h:97
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
Armorer
@ Armorer
Definition: NPC.h:7
PARTY_BUFF_RESIST_MIND
@ PARTY_BUFF_RESIST_MIND
Definition: Party.h:83
ITEM_ARTIFACT_MINDS_EYE
@ ITEM_ARTIFACT_MINDS_EYE
Definition: Items.h:185
SPELL_TYPE
SPELL_TYPE
Definition: Spells.h:10
Player::uSkillPoints
unsigned int uSkillPoints
Definition: Player.h:765
ui_character_bonus_text_color
unsigned int ui_character_bonus_text_color
Definition: UICharacter.cpp:46
SPEECH_48
@ SPEECH_48
Definition: Player.h:94
Player::pActiveSkills
std::array< unsigned __int16, 37 > pActiveSkills
Definition: Player.h:711
SPEECH_26
@ SPEECH_26
Definition: Player.h:72
index
GLuint index
Definition: SDL_opengl_glext.h:663
Player::WearItem
void WearItem(unsigned int uItemID)
Definition: Player.cpp:788
Condition_Paralyzed
@ Condition_Paralyzed
Definition: Conditions.h:20
PLAYER_CLASS_ROGUE
@ PLAYER_CLASS_ROGUE
Definition: Player.h:221
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
Player::uLuck
unsigned __int16 uLuck
Definition: Player.h:654
ConditionProcessor::IsPlayerAffected
static bool IsPlayerAffected(Player *, int, int)
Definition: Conditions.cpp:50
sLastTrackLengthMS
int sLastTrackLengthMS
Definition: AudioPlayer.cpp:19
PLAYER_BUFF_RESIST_FIRE
@ PLAYER_BUFF_RESIST_FIRE
Definition: Player.h:19
VAR_DarkSkill
@ VAR_DarkSkill
Definition: Events.h:215
Player::field_E4
int field_E4
Definition: Player.h:661
Player::FindFreeInventoryListSlot
int FindFreeInventoryListSlot()
Definition: Player.cpp:750
SpriteObject::uSpriteFrameID
unsigned __int16 uSpriteFrameID
Definition: SpriteObject.h:224
Player::SalesProcess
void SalesProcess(unsigned int inventory_idnx, int item_index, int _2devent_idx)
Definition: Player.cpp:293
PLAYER_SKILL_ITEM_ID
@ PLAYER_SKILL_ITEM_ID
Definition: Player.h:192
VAR_Drunk
@ VAR_Drunk
Definition: Events.h:236
Player::GetPerception
int GetPerception()
Definition: Player.cpp:994
Player::GetBaseAC
int GetBaseAC()
Definition: Player.cpp:2439
VAR_Unknown1
@ VAR_Unknown1
Definition: Events.h:284
PLAYER_SKILL_FIRE
@ PLAYER_SKILL_FIRE
Definition: Player.h:183
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
Player::skillLeather
unsigned __int16 skillLeather
Definition: Player.h:681
VAR_BaseAccuracy
@ VAR_BaseAccuracy
Definition: Events.h:164
SOUND_swing_with_sword02
@ SOUND_swing_with_sword02
Definition: AudioPlayer.h:43
ITEM_HORSESHOE
@ ITEM_HORSESHOE
Definition: Items.h:217
Condition_Insane
@ Condition_Insane
Definition: Conditions.h:13
MONSTER_SUPERTYPE_ELF
@ MONSTER_SUPERTYPE_ELF
Definition: Monsters.h:73
SPECIAL_ATTACK_WEAK
@ SPECIAL_ATTACK_WEAK
Definition: Monsters.h:83
Engine.h
CHARACTER_ATTRIBUTE_RESIST_WATER
@ CHARACTER_ATTRIBUTE_RESIST_WATER
Definition: Engine.h:534
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
ItemGen::uEnchantmentType
int uEnchantmentType
Definition: Items.h:327
CHARACTER_ATTRIBUTE_SKILL_SHIELD
@ CHARACTER_ATTRIBUTE_SKILL_SHIELD
Definition: Engine.h:570
PLAYER_CLASS_ARCHER
@ PLAYER_CLASS_ARCHER
Definition: Player.h:232
Player::skillDisarmTrap
unsigned __int16 skillDisarmTrap
Definition: Player.h:701
Player::GetActualEndurance
int GetActualEndurance()
Definition: Player.cpp:1099
Player::GetActualIntelligence
int GetActualIntelligence()
Definition: Player.cpp:1086
CHARACTER_ATTRIBUTE_SKILL_FIRE
@ CHARACTER_ATTRIBUTE_SKILL_FIRE
Definition: Engine.h:559
PLAYER_SKILL_UNARMED
@ PLAYER_SKILL_UNARMED
Definition: Player.h:202
PLAYER_CLASS_WIZARD
@ PLAYER_CLASS_WIZARD
Definition: Player.h:249
PlayerEquipment::uBelt
unsigned int uBelt
Definition: Player.h:324
Party::PartyTimes
PartyTimeStruct PartyTimes
Definition: Party.h:249
pTurnEngine
struct stru262_TurnBased * pTurnEngine
Definition: TurnEngine.cpp:21
Player::uFullHealthBonus
char uFullHealthBonus
Definition: Player.h:784
Dead
@ Dead
Definition: Actor.h:80
ACTOR_BUFF_SHRINK
@ ACTOR_BUFF_SHRINK
Definition: Actor.h:41
Player::IsEradicated
bool IsEradicated() const
Definition: Player.cpp:7420
ITEM_ARTIFACT_GHOULSBANE
@ ITEM_ARTIFACT_GHOULSBANE
Definition: Items.h:160
dword_5B65C4_cancelEventProcessing
int dword_5B65C4_cancelEventProcessing
Definition: mm7_data.cpp:629
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
Player::skillWater
unsigned __int16 skillWater
Definition: Player.h:686
Player::GetMainHandItem
ItemGen * GetMainHandItem()
Definition: Player.cpp:7542
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
VAR_Eradicated
@ VAR_Eradicated
Definition: Events.h:248
SpriteObject::uObjectDescID
unsigned __int16 uObjectDescID
Definition: SpriteObject.h:217
pEquipTypeToBodyAnchor
unsigned char pEquipTypeToBodyAnchor[21]
Definition: Player.cpp:136
Party::pPartyBuffs
std::array< SpellBuff, 20 > pPartyBuffs
Definition: Party.h:309
Actor::uAIState
AIState uAIState
Definition: Actor.h:307
EQUIP_SPELL_SCROLL
@ EQUIP_SPELL_SCROLL
Definition: Items.h:242
GameTime::FromHours
static GameTime FromHours(int hours)
Definition: Time.h:89
Player::sResAirBase
__int16 sResAirBase
Definition: Player.h:735
WINDOW_null
@ WINDOW_null
Definition: GUIWindow.h:291
Player::sResSpiritBonus
__int16 sResSpiritBonus
Definition: Player.h:751
_42777D_CastSpell_UseWand_ShootArrow
void _42777D_CastSpell_UseWand_ShootArrow(SPELL_TYPE spell, unsigned int uPlayerID, unsigned int a4, __int16 flags, int a6)
Definition: CastSpellInfo.cpp:4369
OBJECT_Actor
@ OBJECT_Actor
Definition: Actor.h:67
Player::OnInventoryLeftClick
void OnInventoryLeftClick()
Definition: Player.cpp:7294
PLAYER_CLASS_ARCH_DRUID
@ PLAYER_CLASS_ARCH_DRUID
Definition: Player.h:246
ITEM_ARTIFACT_GIBBET
@ ITEM_ARTIFACT_GIBBET
Definition: Items.h:161
Player::GetBaseSpeed
int GetBaseSpeed()
Definition: Player.cpp:1058
Player::sResMagicBase
__int16 sResMagicBase
Definition: Player.h:739
PLAYER_SKILL_LIGHT
@ PLAYER_SKILL_LIGHT
Definition: Player.h:190
Player::pure_speed_used
int pure_speed_used
Definition: Player.h:719
VAR_StaffSkill
@ VAR_StaffSkill
Definition: Events.h:195
GameUI_DrawFoodAndGold
void GameUI_DrawFoodAndGold()
Definition: UIGame.cpp:1179
Player::EquipBody
void EquipBody(ITEM_EQUIP_TYPE uEquipType)
Definition: Player.cpp:6787
VAR_StealingSkill
@ VAR_StealingSkill
Definition: Events.h:229
VAR_Dead
@ VAR_Dead
Definition: Events.h:246
ITEM_LUTE
@ ITEM_LUTE
Definition: Items.h:213
VAR_WaterResistance
@ VAR_WaterResistance
Definition: Events.h:175
VAR_BaseEndurance
@ VAR_BaseEndurance
Definition: Events.h:162
VAR_Unconsious
@ VAR_Unconsious
Definition: Events.h:245
Actor::ApplyFineForKillingPeasant
static void ApplyFineForKillingPeasant(unsigned int uActorID)
Definition: Actor.cpp:1223
Actor.h
Scholar
@ Scholar
Definition: NPC.h:9
VAR_DayOfYear
@ VAR_DayOfYear
Definition: Events.h:146
Player::SetPertified
void SetPertified(GameTime time)
Definition: Player.cpp:7512
SPEECH_40
@ SPEECH_40
Definition: Player.h:86
pItemsTable
struct ItemsTable * pItemsTable
Definition: Items.cpp:37
Party::PartyFindsGold
void PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
Definition: Party.cpp:976
current_character_screen_window
enum WindowType current_character_screen_window
Definition: GUIWindow.cpp:78
Player::WearsItemAnyWhere
bool WearsItemAnyWhere(int item_id)
Definition: Player.cpp:1609
VAR_FireResistance
@ VAR_FireResistance
Definition: Events.h:173
SOUND_gong
@ SOUND_gong
Definition: AudioPlayer.h:82
CHARACTER_ATTRIBUTE_HEALTH
@ CHARACTER_ATTRIBUTE_HEALTH
Definition: Engine.h:528
PLAYER_SKILL_BODYBUILDING
@ PLAYER_SKILL_BODYBUILDING
Definition: Player.h:195
stru319::which_player_to_attack
int which_player_to_attack(struct Actor *pActor)
Definition: Actor.cpp:3754
Player::skillAlchemy
unsigned __int16 skillAlchemy
Definition: Player.h:707
Player::uExpressionTimeLength
unsigned __int16 uExpressionTimeLength
Definition: Player.h:790
Localization.h
PLAYER_SKILL_PERCEPTION
@ PLAYER_SKILL_PERCEPTION
Definition: Player.h:197
VAR_BodyResistance
@ VAR_BodyResistance
Definition: Events.h:179
Player::SetCondInsaneWithBlockCheck
void SetCondInsaneWithBlockCheck(int blockable)
Definition: Player.cpp:7528
BuildingType_WeaponShop
@ BuildingType_WeaponShop
Definition: Events2D.h:5
CHARACTER_EXPRESSION_FALLING
@ CHARACTER_EXPRESSION_FALLING
Definition: Player.h:391
ItemGen::uAttributes
unsigned int uAttributes
Definition: Items.h:349
Player::pInventoryMatrix
std::array< int, 126 > pInventoryMatrix
Definition: Player.h:733
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
pConditionAttributeModifier
unsigned char pConditionAttributeModifier[7][19]
Definition: Player.cpp:170
VAR_MindResistanceBonus
@ VAR_MindResistanceBonus
Definition: Events.h:189
Player::SetCondDeadWithBlockCheck
void SetCondDeadWithBlockCheck(int blockable)
Definition: Player.cpp:7532
ItemGen::special_enchantment
ITEM_ENCHANTMENT special_enchantment
Definition: Items.h:330
Player::skillMonsterId
unsigned __int16 skillMonsterId
Definition: Player.h:704
MONSTER_SUPERTYPE_TITAN
@ MONSTER_SUPERTYPE_TITAN
Definition: Monsters.h:76
ItemGen::uMaxCharges
char uMaxCharges
Definition: Items.h:351
NPCStats::uNumNewNPCs
unsigned int uNumNewNPCs
Definition: NPC.h:179
ui_character_stat_buffed_color
unsigned int ui_character_stat_buffed_color
Definition: UICharacter.cpp:51
VAR_PrisonTerms
@ VAR_PrisonTerms
Definition: Events.h:288
VAR_History_0
@ VAR_History_0
Definition: Events.h:282
Player::playerEventBits
char playerEventBits[64]
Definition: Player.h:775
PLAYER_SKILL_MISC
@ PLAYER_SKILL_MISC
Definition: Player.h:209
Player::CompareVariable
bool CompareVariable(enum VariableType VarNum, signed int pValue)
Definition: Player.cpp:4645
Player::uAccuracyBonus
unsigned __int16 uAccuracyBonus
Definition: Player.h:653
VAR_UnarmedSkill
@ VAR_UnarmedSkill
Definition: Events.h:226
VAR_FixedFood
@ VAR_FixedFood
Definition: Events.h:150
Player::HasUnderwaterSuitEquipped
bool HasUnderwaterSuitEquipped()
Definition: Player.cpp:6841
VAR_IsLuckMoreThanBase
@ VAR_IsLuckMoreThanBase
Definition: Events.h:261
Condition_Fear
@ Condition_Fear
Definition: Conditions.h:11
Acolyte2
@ Acolyte2
Definition: NPC.h:59
PlayerSpells::bHaveSpell
std::array< char, 99 > bHaveSpell
Definition: Player.h:308
Player::skillStaff
unsigned __int16 skillStaff
Definition: Player.h:672
SPEECH_31
@ SPEECH_31
Definition: Player.h:77
VAR_ActualAC
@ VAR_ActualAC
Definition: Events.h:135
SOUND_swing_with_sword01
@ SOUND_swing_with_sword01
Definition: AudioPlayer.h:42
window_SpeakInHouse
GUIWindow * window_SpeakInHouse
Definition: GUIWindow.cpp:51
Merchant
@ Merchant
Definition: NPC.h:26
Player::SetCondUnconsciousWithBlockCheck
void SetCondUnconsciousWithBlockCheck(int blockable)
Definition: Player.cpp:7536
SPELL_LASER_PROJECTILE
@ SPELL_LASER_PROJECTILE
Definition: Spells.h:123
VAR_ActualLuck
@ VAR_ActualLuck
Definition: Events.h:172
Player::pOwnItems
std::array< ItemGen, 138 > pOwnItems
Definition: Player.h:730
Player::IsFemale
bool IsFemale()
Definition: Player.h:611
CHARACTER_RACE_HUMAN
@ CHARACTER_RACE_HUMAN
Definition: Player.h:161
PlayerEquipment::uBoot
unsigned int uBoot
Definition: Player.h:327
DAMAGE_TYPE
DAMAGE_TYPE
Definition: Items.h:10
Player::StealFromShop
int StealFromShop(ItemGen *itemToSteal, int extraStealDifficulty, int reputation, int extraStealFine, int *fineIfFailed)
Definition: Player.cpp:1620
SpriteObject::vPosition
struct Vec3_int_ vPosition
Definition: SpriteObject.h:218
DDM_DLV_Header::field_C_alert
int field_C_alert
Definition: Indoor.h:97
VAR_MindResistance
@ VAR_MindResistance
Definition: Events.h:178
Player::DiscardConditionIfLastsLongerThan
bool DiscardConditionIfLastsLongerThan(unsigned int uCondition, GameTime time)
Definition: Player.cpp:3839
pParty
Party * pParty
Definition: Party.cpp:30
Player::skillPlate
unsigned __int16 skillPlate
Definition: Player.h:683
Player::CreateItemInInventory
int CreateItemInInventory(unsigned int uSlot, unsigned int uItemID)
Definition: Player.cpp:761
VAR_PoisonedGreen
@ VAR_PoisonedGreen
Definition: Events.h:238
CreateMsgScrollWindow
void CreateMsgScrollWindow(signed int mscroll_id)
Definition: GUIWindow.cpp:1014
VAR_LuckBonus
@ VAR_LuckBonus
Definition: Events.h:158
Player::SetPoisonMedium
void SetPoisonMedium(GameTime time)
Definition: Player.cpp:7484
Player::field_1A97
char field_1A97
Definition: Player.h:783
pMessageQueue_50C9E8
struct GUIMessageQueue * pMessageQueue_50C9E8
Definition: GUIWindow.cpp:87
npcIdToDismissAfterDialogue
int npcIdToDismissAfterDialogue
Definition: mm7_data.cpp:632
ITEM_162
@ ITEM_162
Definition: Items.h:96
ui_character_default_text_color
unsigned int ui_character_default_text_color
Definition: UICharacter.cpp:43
VAR_Stoned
@ VAR_Stoned
Definition: Events.h:247
Player::GetActualResistance
int GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Definition: Player.cpp:2523
PlayerCreation_AttributeProps
Definition: Player.cpp:51
Herbalist
@ Herbalist
Definition: NPC.h:28
PLAYER_SKILL_SPIRIT
@ PLAYER_SKILL_SPIRIT
Definition: Player.h:187
Player::RemoveItemAtInventoryIndex
void RemoveItemAtInventoryIndex(unsigned int uSlot)
Definition: Player.cpp:892
VAR_Counter2
@ VAR_Counter2
Definition: Events.h:270
Player::SetCondWeakWithBlockCheck
void SetCondWeakWithBlockCheck(int blockable)
Definition: Player.cpp:7524
SOUND_swing_with_blunt_weapon01
@ SOUND_swing_with_blunt_weapon01
Definition: AudioPlayer.h:40
Player::GetNthEquippedIndexItem
ItemGen * GetNthEquippedIndexItem(int index)
Definition: Player.cpp:7566
Player::IsRaceDwarf
bool IsRaceDwarf()
Definition: Player.h:606
bFlashHistoryBook
char bFlashHistoryBook
Definition: mm7_data.cpp:547
_50C9D0_AfterEnchClickEventId
int _50C9D0_AfterEnchClickEventId
Definition: mm7_data.cpp:580
Player::CanTrainToNextLevel
bool CanTrainToNextLevel()
Definition: Player.cpp:1474
CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID
@ CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID
Definition: Engine.h:543
NPCStats::pNewNPCData
NPCData pNewNPCData[501]
Definition: NPC.h:165
Party::bFlying
unsigned int bFlying
Definition: Party.h:266
Mystic
@ Mystic
Definition: NPC.h:23
VAR_PoisonedYellow
@ VAR_PoisonedYellow
Definition: Events.h:240
VAR_PlateSkill
@ VAR_PlateSkill
Definition: Events.h:206
PLAYER_CLASS_PRIEST
@ PLAYER_CLASS_PRIEST
Definition: Player.h:241
EQUIP_ARMOUR
@ EQUIP_ARMOUR
Definition: Items.h:230
Player::PlayAwardSound_Anim
void PlayAwardSound_Anim()
Definition: Player.cpp:5631
CHARACTER_EXPRESSION_ID
CHARACTER_EXPRESSION_ID
Definition: Player.h:341
Player::uWillpower
unsigned __int16 uWillpower
Definition: Player.h:646
VAR_IsMightMoreThanBase
@ VAR_IsMightMoreThanBase
Definition: Events.h:255
CHARACTER_ATTRIBUTE_SKILL_ITEM_ID
@ CHARACTER_ATTRIBUTE_SKILL_ITEM_ID
Definition: Engine.h:542
counter
GLuint counter
Definition: SDL_opengl_glext.h:4995
ItemGen::GetDisplayName
String GetDisplayName()
Definition: Items.cpp:610
ITEM_ENCHANTMENT_OF_RECOVERY
@ ITEM_ENCHANTMENT_OF_RECOVERY
Definition: Items.h:54
Player::sResSpiritBase
__int16 sResSpiritBase
Definition: Player.h:740
ITEM_ARTIFACT_LADYS_ESCORT
@ ITEM_ARTIFACT_LADYS_ESCORT
Definition: Items.h:189
Player::SetCondition
void SetCondition(unsigned int uConditionIdx, int blockable)
Definition: Player.cpp:612
PARTY_BUFF_RESIST_WATER
@ PARTY_BUFF_RESIST_WATER
Definition: Party.h:88
ITEM_ARTIFACT_HERMES_SANDALS
@ ITEM_ARTIFACT_HERMES_SANDALS
Definition: Items.h:182
SoundSetAction
std::array< std::array< unsigned char, 8 >, 110 > SoundSetAction
Definition: mm7_data.cpp:367
Player::field_F0
int field_F0
Definition: Player.h:664
VAR_Class
@ VAR_Class
Definition: Events.h:130
Player::GetItemListAtInventoryIndex
unsigned int GetItemListAtInventoryIndex(int inout_item_cell)
Definition: Player.cpp:504
PLAYER_BUFF_SPEED
@ PLAYER_BUFF_SPEED
Definition: Player.h:35
Gypsy
@ Gypsy
Definition: NPC.h:54
VAR_AirResistanceBonus
@ VAR_AirResistanceBonus
Definition: Events.h:185
VAR_MapPersistentVariable_0
@ VAR_MapPersistentVariable_0
Definition: Events.h:250
Player::uExpressionTimePassed
unsigned __int16 uExpressionTimePassed
Definition: Player.h:789
EQUIP_SINGLE_HANDED
@ EQUIP_SINGLE_HANDED
Definition: Items.h:227
ITEM_WETSUIT
@ ITEM_WETSUIT
Definition: Items.h:207
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
WINDOW_CharacterWindow_Inventory
@ WINDOW_CharacterWindow_Inventory
Definition: GUIWindow.h:330
Player::uSpeed
unsigned __int16 uSpeed
Definition: Player.h:650
PLAYER_SKILL_DODGE
@ PLAYER_SKILL_DODGE
Definition: Player.h:201
Player::sResDarkBonus
__int16 sResDarkBonus
Definition: Player.h:755
SPECIAL_ATTACK_TYPE
SPECIAL_ATTACK_TYPE
Definition: Monsters.h:80
Player::GetBaseIdentifyPrice
int GetBaseIdentifyPrice(float price_multiplier)
Definition: Player.cpp:455
Player::IsCursed
bool IsCursed() const
Definition: Player.cpp:7428
Player::IsDrunk
bool IsDrunk() const
Definition: Player.cpp:7448
Log::Info
void Info(const wchar_t *pFormat,...)
Definition: Log.cpp:11
Actor::SetRandomGoldIfTheresNoItem
void SetRandomGoldIfTheresNoItem()
Definition: Actor.cpp:174
VAR_Race
@ VAR_Race
Definition: Events.h:142
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
wand_spell_ids
std::array< SPELL_TYPE, 25 > wand_spell_ids
Definition: Spells.cpp:280
Player::skillChain
unsigned __int16 skillChain
Definition: Player.h:682
ITEM_RELIC_TWILIGHT
@ ITEM_RELIC_TWILIGHT
Definition: Items.h:178
Player::expression
CHARACTER_EXPRESSION_ID expression
Definition: Player.h:788
Trader
@ Trader
Definition: NPC.h:25
Player::GetBaseAccuracy
int GetBaseAccuracy()
Definition: Player.cpp:1053
Player::GetPlayerIndex
int GetPlayerIndex()
Definition: Player.cpp:7582
PLAYER_SKILL_TYPE
PLAYER_SKILL_TYPE
Definition: Player.h:170
PLAYER_CLASS_PRIEST_OF_SUN
@ PLAYER_CLASS_PRIEST_OF_SUN
Definition: Player.h:242
SOUND_metal_vs_metal03h
@ SOUND_metal_vs_metal03h
Definition: AudioPlayer.h:20
Player::AddVariable
void AddVariable(enum VariableType var, signed int val)
Definition: Player.cpp:5658
uchar
unsigned char uchar
Definition: MM7.h:44
SPEECH_33
@ SPEECH_33
Definition: Player.h:79
Condition_Dead
@ Condition_Dead
Definition: Conditions.h:22
VAR_BlasterSkill
@ VAR_BlasterSkill
Definition: Events.h:202
SPECIAL_ATTACK_ERADICATED
@ SPECIAL_ATTACK_ERADICATED
Definition: Monsters.h:97
Condition_Disease_Weak
@ Condition_Disease_Weak
Definition: Conditions.h:15
MonsterInfo::uID
uint16_t uID
Definition: Monsters.h:169
ACTOR_BUFF_SOMETHING_THAT_HALVES_AC
@ ACTOR_BUFF_SOMETHING_THAT_HALVES_AC
Definition: Actor.h:46
Player::pure_might_used
int pure_might_used
Definition: Player.h:724
PLAYER_SKILL_MEDITATION
@ PLAYER_SKILL_MEDITATION
Definition: Player.h:196
CastSpellInfo::uPlayerID_2
uint16_t uPlayerID_2
Definition: CastSpellInfo.h:26
ITEM_ARTIFACT_HEROS_BELT
@ ITEM_ARTIFACT_HEROS_BELT
Definition: Items.h:188
ItemGen::GetIconName
char * GetIconName()
Definition: Items.cpp:1521
Player::WearsItem
bool WearsItem(int item_id, ITEM_EQUIP_TYPE equip_type)
Definition: Player.cpp:1603
CHARACTER_ATTRIBUTE_SKILL_MIND
@ CHARACTER_ATTRIBUTE_SKILL_MIND
Definition: Engine.h:564
Player::GetArmorRecoveryMultiplierFromSkillLevel
float GetArmorRecoveryMultiplierFromSkillLevel(unsigned char armour_skill_type, float param2, float param3, float param4, float param5)
Definition: Player.cpp:2330
PARTY_BUFF_HASTE
@ PARTY_BUFF_HASTE
Definition: Party.h:79
SPECIAL_ATTACK_SLEEP
@ SPECIAL_ATTACK_SLEEP
Definition: Monsters.h:84
ItemGen::uItemID
int uItemID
Definition: Items.h:326
Player::GetMeleeDamageString
String GetMeleeDamageString()
Definition: Player.cpp:1413
SOUND_quest
@ SOUND_quest
Definition: AudioPlayer.h:106
CHARACTER_ATTRIBUTE_TYPE
CHARACTER_ATTRIBUTE_TYPE
Definition: Engine.h:520
Engine_::IocContainer::ResolveDecalBuilder
static DecalBuilder * ResolveDecalBuilder()
Definition: IocContainer.cpp:60
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
VAR_ArenaWinsSquire
@ VAR_ArenaWinsSquire
Definition: Events.h:290
pSpellDatas
std::array< SpellData, 100 > pSpellDatas
Definition: Spells.cpp:170
ITEM_GENIE_LAMP
@ ITEM_GENIE_LAMP
Definition: Items.h:209
Player::CalculateMeleeDmgToEnemyWithWeapon
int CalculateMeleeDmgToEnemyWithWeapon(ItemGen *weapon, unsigned int uTargetActorID, bool addOneDice)
Definition: Player.cpp:1256
MonsterInfo::uExp
unsigned int uExp
Definition: Monsters.h:177
CmpSkillValue
bool CmpSkillValue(int valToCompare, int skillValue)
Definition: Player.cpp:4635
StorylineText::StoreLine
StorylineRecord StoreLine[29]
Definition: StorylineTextTable.h:20
stru123::_decor_events
std::array< unsigned char, 125 > _decor_events
Definition: stru123.h:8
DMGT_COLD
@ DMGT_COLD
Definition: Items.h:13
Localization::GetSpellSchoolName
const char * GetSpellSchoolName(unsigned int index) const
Definition: Localization.h:27
Player::uBirthYear
unsigned int uBirthYear
Definition: Player.h:768
Player::_achieved_awards_bits
unsigned char _achieved_awards_bits[64]
Definition: Player.h:715
Player::GetBaseLuck
int GetBaseLuck()
Definition: Player.cpp:1063
EQUIP_BOW
@ EQUIP_BOW
Definition: Items.h:229
SPEECH_44
@ SPEECH_44
Definition: Player.h:90
PLAYER_BUFF_BLESS
@ PLAYER_BUFF_BLESS
Definition: Player.h:15
Player::SetDead
void SetDead(GameTime time)
Definition: Player.cpp:7508
CHARACTER_ATTRIBUTE_RESIST_AIR
@ CHARACTER_ATTRIBUTE_RESIST_AIR
Definition: Engine.h:533
PLAYER_SKILL_AIR
@ PLAYER_SKILL_AIR
Definition: Player.h:184
ItemGen::GetPlayerSkillType
unsigned char GetPlayerSkillType()
Definition: Items.cpp:1512
PLAYER_CLASS_LICH
@ PLAYER_CLASS_LICH
Definition: Player.h:251
VAR_ArenaWinsLord
@ VAR_ArenaWinsLord
Definition: Events.h:292
CHARACTER_ATTRIBUTE_SKILL_STEALING
@ CHARACTER_ATTRIBUTE_SKILL_STEALING
Definition: Engine.h:540
Player::GetRace
enum CHARACTER_RACE GetRace() const
Definition: Player.cpp:3488
SpriteObject::spell_id
int spell_id
Definition: SpriteObject.h:228
Engine_::IocContainer::ResolveMouse
static Mouse * ResolveMouse()
Definition: IocContainer.cpp:88
CHARACTER_ATTRIBUTE_WILLPOWER
@ CHARACTER_ATTRIBUTE_WILLPOWER
Definition: Engine.h:523
SPEECH_37
@ SPEECH_37
Definition: Player.h:83
IndoorLocation::dlv
struct DDM_DLV_Header dlv
Definition: Indoor.h:648
Party::TakeGold
static void TakeGold(int amount)
Definition: Party.cpp:292
ITEM_LASER_RIFLE
@ ITEM_LASER_RIFLE
Definition: Items.h:83
ItemGen::uBodyAnchor
unsigned __int8 uBodyAnchor
Definition: Items.h:350
VAR_LearningSkill
@ VAR_LearningSkill
Definition: Events.h:231
VAR_LevelModifier
@ VAR_LevelModifier
Definition: Events.h:138
ItemGen::GetDamageDice
unsigned __int8 GetDamageDice()
Definition: Items.cpp:1525
MonsterInfo::bQuestMonster
uint16_t bQuestMonster
Definition: Monsters.h:170
ITEM_BLASTER
@ ITEM_BLASTER
Definition: Items.h:82
ItemGen::GetDamageRoll
unsigned __int8 GetDamageRoll()
Definition: Items.cpp:1529
Player::uLuckBonus
unsigned __int16 uLuckBonus
Definition: Player.h:655
SOUND_eleccircle
@ SOUND_eleccircle
Definition: AudioPlayer.h:91
CHARACTER_ATTRIBUTE_SKILL_ALCHEMY
@ CHARACTER_ATTRIBUTE_SKILL_ALCHEMY
Definition: Engine.h:539
VAR_BodySkill
@ VAR_BodySkill
Definition: Events.h:213
pActors
std::array< Actor, 500 > pActors
Definition: Actor.cpp:38
Mouse::uPointingObjectID
unsigned int uPointingObjectID
Definition: Mouse.h:315
CHARACTER_EXPRESSION_INVALID
@ CHARACTER_EXPRESSION_INVALID
Definition: Player.h:342
PLAYER_SKILL_LEATHER
@ PLAYER_SKILL_LEATHER
Definition: Player.h:180
Weaponsmaster
@ Weaponsmaster
Definition: NPC.h:21
VAR_MightBonus
@ VAR_MightBonus
Definition: Events.h:152
Player::GetRangedDamageMin
int GetRangedDamageMin()
Definition: Player.cpp:1336
Player::GetMeleeDamageMaximal
int GetMeleeDamageMaximal()
Definition: Player.cpp:1186
SPEECH_27
@ SPEECH_27
Definition: Player.h:73
Condition_Zombie
@ Condition_Zombie
Definition: Conditions.h:25
Actor::uActorRadius
uint16_t uActorRadius
Definition: Actor.h:295
BuildingType_MagicShop
@ BuildingType_MagicShop
Definition: Events2D.h:7
LloydBeacon::PartyRot_Y
int16_t PartyRot_Y
Definition: Player.h:276
pQuestTable
std::array< const char *, 513 > pQuestTable
Definition: mm7_data.cpp:741
spell_fx_renderer
static SpellFxRenderer * spell_fx_renderer
Definition: Player.cpp:44
PLAYER_SKILL_MACE
@ PLAYER_SKILL_MACE
Definition: Player.h:177
Player::uEndurance
unsigned __int16 uEndurance
Definition: Player.h:648
Player::PlayAwardSound_Anim98
void PlayAwardSound_Anim98()
Definition: Player.cpp:6774
VAR_Paralyzed
@ VAR_Paralyzed
Definition: Events.h:244
Player::uVoiceID
unsigned int uVoiceID
Definition: Player.h:757
pPlayerFrameTable
struct PlayerFrameTable * pPlayerFrameTable
Definition: mm7_data.cpp:171
Player::GetMaxMana
int GetMaxMana()
Definition: Player.cpp:2369
MONSTER_SUPERTYPE_DRAGON
@ MONSTER_SUPERTYPE_DRAGON
Definition: Monsters.h:72
Player::NothingOrJustBlastersEquipped
bool NothingOrJustBlastersEquipped()
Definition: Player.cpp:303
VAR_GoldInBank
@ VAR_GoldInBank
Definition: Events.h:285
PLAYER_SKILL_TRAP_DISARM
@ PLAYER_SKILL_TRAP_DISARM
Definition: Player.h:200
PLAYER_CLASS_DRUID
@ PLAYER_CLASS_DRUID
Definition: Player.h:244
VAR_EarthSkill
@ VAR_EarthSkill
Definition: Events.h:210
Party::IsPartyGood
bool IsPartyGood()
Definition: Party.cpp:1141
SOUND_star2
@ SOUND_star2
Definition: AudioPlayer.h:88
VAR_BaseLuck
@ VAR_BaseLuck
Definition: Events.h:165
PARTY_BUFF_HEROISM
@ PARTY_BUFF_HEROISM
Definition: Party.h:80
Player::pName
char pName[16]
Definition: Player.h:637
GameUI_ReloadPlayerPortraits
void GameUI_ReloadPlayerPortraits(int player_id, int face_id)
Definition: UIGame.cpp:199
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
Player::GetBowItem
ItemGen * GetBowItem()
Definition: Player.cpp:7546
CHARACTER_ATTRIBUTE_RESIST_MIND
@ CHARACTER_ATTRIBUTE_RESIST_MIND
Definition: Engine.h:536
Player::uTimeToRecovery
unsigned __int16 uTimeToRecovery
Definition: Player.h:762
SPEECH_91
@ SPEECH_91
Definition: Player.h:137
PLAYER_SKILL_WATER
@ PLAYER_SKILL_WATER
Definition: Player.h:185
GameTime::GetHoursOfDay
int GetHoursOfDay() const
Definition: Time.h:39
SOUND_eradicate
@ SOUND_eradicate
Definition: AudioPlayer.h:90
CHARACTER_EXPRESSION_DMGRECVD_MODERATE
@ CHARACTER_EXPRESSION_DMGRECVD_MODERATE
Definition: Player.h:377
MonsterStats::pInfos
MonsterInfo pInfos[265]
Definition: Monsters.h:194
SPECIAL_ATTACK_BREAK_ARMOR
@ SPECIAL_ATTACK_BREAK_ARMOR
Definition: Monsters.h:99
DDM_DLV_Header::uReputation
int uReputation
Definition: Indoor.h:96
Player::GetSpellSchool
unsigned int GetSpellSchool(unsigned int uSpellID)
Definition: Player.cpp:2198
VAR_Counter6
@ VAR_Counter6
Definition: Events.h:274
Mouse::GetClickPos
void GetClickPos(unsigned int *pX, unsigned int *pY)
Definition: Mouse.cpp:20
VAR_IsEnduranceMoreThanBase
@ VAR_IsEnduranceMoreThanBase
Definition: Events.h:258
Player::sMana
int sMana
Definition: Player.h:767
EQUIP_POTION
@ EQUIP_POTION
Definition: Items.h:241
PLAYER_CLASS_TYPE
PLAYER_CLASS_TYPE
Definition: Player.h:215
LOD::File::GetSubNodeIndex
int GetSubNodeIndex(const String &name) const
Definition: LOD.cpp:1005
Player::_mana_related
char _mana_related
Definition: Player.h:787
SPECIAL_ATTACK_DEAD
@ SPECIAL_ATTACK_DEAD
Definition: Monsters.h:95
ui_character_stat_default_color
unsigned int ui_character_stat_default_color
Definition: UICharacter.cpp:50
stru_50C198
stru319 stru_50C198
Definition: Actor.cpp:41
ItemGen::GetItemBonusSpecialEnchantment
void GetItemBonusSpecialEnchantment(Player *owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int *additiveBonus, int *halfSkillBonus)
Definition: Items.cpp:1448
GetNewNPCData
struct NPCData * GetNewNPCData(signed int npcid, int *npc_indx)
Definition: NPC.cpp:99
MonsterInfo::uSpecialAttackType
SPECIAL_ATTACK_TYPE uSpecialAttackType
Definition: Monsters.h:133
Player::sResMindBonus
__int16 sResMindBonus
Definition: Player.h:752
MonsterInfo::uSpecialAttackLevel
uint8_t uSpecialAttackLevel
Definition: Monsters.h:134
PLAYER_CLASS_SORCERER
@ PLAYER_CLASS_SORCERER
Definition: Player.h:248
VAR_PoisonedRed
@ VAR_PoisonedRed
Definition: Events.h:242
SOUND_swing_with_axe01
@ SOUND_swing_with_axe01
Definition: AudioPlayer.h:38
Player::SetDiseaseSevere
void SetDiseaseSevere(GameTime time)
Definition: Player.cpp:7496
VAR_IsAccuracyMoreThanBase
@ VAR_IsAccuracyMoreThanBase
Definition: Events.h:260
VAR_SpeedBonus
@ VAR_SpeedBonus
Definition: Events.h:156
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
DDM_DLV_Header
Definition: Indoor.h:82
Player::_expression21_frameset
int _expression21_frameset
Definition: Player.h:793
NPCData
Definition: NPC.h:79
Player::HasItem
bool HasItem(unsigned int uItemID, bool checkHeldItem)
Definition: Player.cpp:6855
pStorylineText
struct StorylineText * pStorylineText
Definition: StorylineTextTable.cpp:8
CHARACTER_ATTRIBUTE_MELEE_DMG_MIN
@ CHARACTER_ATTRIBUTE_MELEE_DMG_MIN
Definition: Engine.h:551
Player::GetMaxHealth
int GetMaxHealth()
Definition: Player.cpp:2354
UIMSG_SpellScrollUse
@ UIMSG_SpellScrollUse
Definition: GUIWindow.h:126
ItemsTable::IsMaterialSpecial
bool IsMaterialSpecial(ItemGen *pItem)
Definition: Items.cpp:482
order
GLfixed GLfixed GLint GLint order
Definition: SDL_opengl_glext.h:4561
Player::_health_related
char _health_related
Definition: Player.h:785
Player::GetHelmItem
ItemGen * GetHelmItem()
Definition: Player.cpp:7550
SPECIAL_ATTACK_BREAK_WEAPON
@ SPECIAL_ATTACK_BREAK_WEAPON
Definition: Monsters.h:100
PLAYER_BUFF_RESIST_AIR
@ PLAYER_BUFF_RESIST_AIR
Definition: Player.h:14
Player::skillShield
unsigned __int16 skillShield
Definition: Player.h:680
Player::sResWaterBonus
__int16 sResWaterBonus
Definition: Player.h:747
Player::GetMultiplierForSkillLevel
unsigned int GetMultiplierForSkillLevel(PLAYER_SKILL_TYPE uSkillType, int mult1, int mult2, int mult3, int mult4)
Definition: Player.cpp:3457
CHARACTER_RACE
CHARACTER_RACE
Definition: Player.h:160
SPECIAL_ATTACK_BREAK_ANY
@ SPECIAL_ATTACK_BREAK_ANY
Definition: Monsters.h:98
byte_4ECF08
std::array< std::array< unsigned char, 25 >, 48 > byte_4ECF08
Definition: mm7_data.cpp:317
VAR_Sex
@ VAR_Sex
Definition: Events.h:129
VAR_Counter1
@ VAR_Counter1
Definition: Events.h:269
PLAYER_BUFF_INTELLIGENCE
@ PLAYER_BUFF_INTELLIGENCE
Definition: Player.h:31
_50C9A0_IsEnchantingInProgress
bool _50C9A0_IsEnchantingInProgress
Definition: mm7_data.cpp:578
bFlashQuestBook
char bFlashQuestBook
Definition: mm7_data.cpp:549
Player::INVETORYSLOTSWIDTH
static const unsigned int INVETORYSLOTSWIDTH
Definition: Player.h:402
Player::GetParameterBonus
int GetParameterBonus(int player_parameter)
Definition: Player.cpp:2623
VAR_FixedGold
@ VAR_FixedGold
Definition: Events.h:148
PLAYER_SKILL_SPEAR
@ PLAYER_SKILL_SPEAR
Definition: Player.h:175
Player::PlayAwardSound_Anim97_Face
void PlayAwardSound_Anim97_Face(PlayerSpeech speech)
Definition: Player.cpp:6210
SPEECH_92
@ SPEECH_92
Definition: Player.h:138
Player::AddItem2
int AddItem2(int uSlot, ItemGen *Src)
Definition: Player.cpp:828
VAR_NumDeaths
@ VAR_NumDeaths
Definition: Events.h:286
PlayerCreation_AttributeProps::uBaseValue
unsigned char uBaseValue
Definition: Player.cpp:52
Armsmaster
@ Armsmaster
Definition: NPC.h:20
pGames_LOD
LOD::File * pGames_LOD
Definition: LOD.cpp:25
TE_WAIT
@ TE_WAIT
Definition: TurnEngine.h:20
VAR_ActualIntellect
@ VAR_ActualIntellect
Definition: Events.h:167
ITEM_ENCHANTMENT
ITEM_ENCHANTMENT
Definition: Items.h:38
Party::GetFood
int GetFood() const
Definition: Party.cpp:272
CHARACTER_ATTRIBUTE_RANGED_DMG_MIN
@ CHARACTER_ATTRIBUTE_RANGED_DMG_MIN
Definition: Engine.h:555
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
VAR_DisarmTrapSkill
@ VAR_DisarmTrapSkill
Definition: Events.h:224
Player::sResFireBase
__int16 sResFireBase
Definition: Player.h:734
VAR_SpiritSkill
@ VAR_SpiritSkill
Definition: Events.h:211
PLAYER_CLASS_SNIPER
@ PLAYER_CLASS_SNIPER
Definition: Player.h:235
VAR_NPCs2
@ VAR_NPCs2
Definition: Events.h:263
Player::_melee_dmg_bonus
char _melee_dmg_bonus
Definition: Player.h:778
ITEM_RELIC_KELEBRIM
@ ITEM_RELIC_KELEBRIM
Definition: Items.h:173
Player::PlayAwardSound_Anim_Face
void PlayAwardSound_Anim_Face(PlayerSpeech speech)
Definition: Player.cpp:5638
Condition_Poison_Severe
@ Condition_Poison_Severe
Definition: Conditions.h:18
Player::field_E8
int field_E8
Definition: Player.h:662
PlayerEquipment
Definition: Player.h:316
SPEECH_6
@ SPEECH_6
Definition: Player.h:52
VAR_AxeSkill
@ VAR_AxeSkill
Definition: Events.h:198
Scout
@ Scout
Definition: NPC.h:27
Player::field_FC
int field_FC
Definition: Player.h:667
CycleCharacter
int CycleCharacter(bool backwards)
Definition: Player.cpp:6825
Player::SetInitialStats
void SetInitialStats()
Definition: Player.cpp:3551
Player::uIntelligenceBonus
unsigned __int16 uIntelligenceBonus
Definition: Player.h:645
stru319::FindClosestActor
int FindClosestActor(int a2, int a3, int a4)
Definition: Actor.cpp:3876
SPECIAL_ATTACK_AGING
@ SPECIAL_ATTACK_AGING
Definition: Monsters.h:102
Player::pInventoryItemList
ItemGen pInventoryItemList[126]
Definition: Player.h:727
PlayerEquipment::uMainHand
unsigned int uMainHand
Definition: Player.h:320
Party::uNumArenaPageWins
char uNumArenaPageWins
Definition: Party.h:294
SPEECH_28
@ SPEECH_28
Definition: Player.h:74
Player::CanSteal
bool CanSteal()
Definition: Player.cpp:559
ITEM_RELIC_OLD_NICK
@ ITEM_RELIC_OLD_NICK
Definition: Items.h:170
Player::uCurrentFace
unsigned __int8 uCurrentFace
Definition: Player.h:640
DMGT_ELECTR
@ DMGT_ELECTR
Definition: Items.h:12
Player::SetCursed
void SetCursed(GameTime time)
Definition: Player.cpp:7452
SPELL_QUEST_COMPLETED
@ SPELL_QUEST_COMPLETED
Definition: Spells.h:126
Player::IsAsleep
bool IsAsleep() const
Definition: Player.cpp:7440
ItemGen::SetBroken
void SetBroken()
Definition: Items.h:305
VAR_CurrentSP
@ VAR_CurrentSP
Definition: Events.h:133
DMGT_BODY
@ DMGT_BODY
Definition: Items.h:19
PLAYER_SKILL_SHIELD
@ PLAYER_SKILL_SHIELD
Definition: Player.h:179
Sage
@ Sage
Definition: NPC.h:66
PLAYER_BUFF_STONESKIN
@ PLAYER_BUFF_STONESKIN
Definition: Player.h:28
Player::SetParalyzed
void SetParalyzed(GameTime time)
Definition: Player.cpp:7500
Hunter
@ Hunter
Definition: NPC.h:67
pSpellStats
struct SpellStats * pSpellStats
Definition: Spells.cpp:32
Player::GetSexByVoice
PLAYER_SEX GetSexByVoice()
Definition: Player.cpp:3516
PLAYER_SKILL_ALCHEMY
@ PLAYER_SKILL_ALCHEMY
Definition: Player.h:206
Party::pTurnBasedPlayerRecoveryTimes
std::array< int, 4 > pTurnBasedPlayerRecoveryTimes
Definition: Party.h:322
ITEM_WAND_INCENERATION
@ ITEM_WAND_INCENERATION
Definition: Items.h:93
VAR_ActualMight
@ VAR_ActualMight
Definition: Events.h:166
VAR_IsIntellectMoreThanBase
@ VAR_IsIntellectMoreThanBase
Definition: Events.h:256
Player::GetItem
ItemGen * GetItem(unsigned int PlayerEquipment::*itemPos)
Definition: Player.cpp:7574
SPEECH_93
@ SPEECH_93
Definition: Player.h:139
Party::GetPartyReputation
int GetPartyReputation()
Definition: Party.cpp:922
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
Condition_Cursed
@ Condition_Cursed
Definition: Conditions.h:8
Player::GetActualWillpower
int GetActualWillpower()
Definition: Player.cpp:1093
Player::field_EC
int field_EC
Definition: Player.h:663
Player::PutItemArInventoryIndex
void PutItemArInventoryIndex(int uItemID, int itemListPos, int uSlot)
Definition: Player.cpp:868
Player::sResDarkBase
__int16 sResDarkBase
Definition: Player.h:744
Player::uSpeedBonus
unsigned __int16 uSpeedBonus
Definition: Player.h:651
Player::GetBeltItem
ItemGen * GetBeltItem()
Definition: Player.cpp:7552
Localization::GetAttirubteName
const char * GetAttirubteName(unsigned int index) const
Definition: Localization.h:43
VAR_LightResistanceBonus
@ VAR_LightResistanceBonus
Definition: Events.h:191
VAR_Award
@ VAR_Award
Definition: Events.h:140
PLAYER_CLASS_MASTER_ARCHER
@ PLAYER_CLASS_MASTER_ARCHER
Definition: Player.h:234
Player::CanRepair
bool CanRepair(ItemGen *pItem)
Definition: Player.cpp:952
ItemGen::IsBroken
bool IsBroken()
Definition: Items.h:304
Party::GivePartyExp
void GivePartyExp(unsigned int pEXPNum)
Definition: Party.cpp:938
Player::_ranged_atk_bonus
char _ranged_atk_bonus
Definition: Player.h:780
SpriteObject::Create
int Create(int yaw, int pitch, int a4, int a5)
Definition: SpriteObject.cpp:56
SpriteObject::containing_item
struct ItemGen containing_item
Definition: SpriteObject.h:227
PLAYER_CLASS_BOUNTY_HUNTER
@ PLAYER_CLASS_BOUNTY_HUNTER
Definition: Player.h:239
CHARACTER_ATTRIBUTE_ENDURANCE
@ CHARACTER_ATTRIBUTE_ENDURANCE
Definition: Engine.h:524
Player::GetMerchant
int GetMerchant()
Definition: Player.cpp:975
Player::GetBaseStrength
int GetBaseStrength()
Definition: Player.cpp:1032
SPELL_FIRE_FIREBALL
@ SPELL_FIRE_FIREBALL
Definition: Spells.h:18
stru298::Add
void Add(int16_t uID, int16_t a3, int16_t x, int16_t y, int16_t z, char a7, char a8)
Definition: stru298.cpp:4
SPEECH_21
@ SPEECH_21
Definition: Player.h:67
Player::uMight
unsigned __int16 uMight
Definition: Player.h:642
Player::field_BB
char field_BB
Definition: Player.h:641
memset32
void memset32(void *ptr, uint32_t value, int count)
Definition: MM7.h:14
Player::skillBody
unsigned __int16 skillBody
Definition: Player.h:690
VAR_ActualEndurance
@ VAR_ActualEndurance
Definition: Events.h:169
VAR_Counter5
@ VAR_Counter5
Definition: Events.h:273
EQUIP_TWO_HANDED
@ EQUIP_TWO_HANDED
Definition: Items.h:228
PLAYER_CLASS_NINJA
@ PLAYER_CLASS_NINJA
Definition: Player.h:227
PLAYER_BUFF_ENDURANCE
@ PLAYER_BUFF_ENDURANCE
Definition: Player.h:30
Party::pHirelings
std::array< NPCData, 2 > pHirelings
Definition: Party.h:311
VAR_DarkResistanceBonus
@ VAR_DarkResistanceBonus
Definition: Events.h:192
Player::skillMind
unsigned __int16 skillMind
Definition: Player.h:689
Party::uNumGoldInBank
unsigned int uNumGoldInBank
Definition: Party.h:282
AudioPlayer.h
OBJECT_Player
@ OBJECT_Player
Definition: Actor.h:68
Party::bTurnBasedModeOn
bool bTurnBasedModeOn
Definition: Party.h:305
PLAYER_CLASS_WARLOCK
@ PLAYER_CLASS_WARLOCK
Definition: Player.h:247
Party::CountHirelings
void CountHirelings()
Definition: Party.cpp:57
ACTOR_BUFF_HOUR_OF_POWER
@ ACTOR_BUFF_HOUR_OF_POWER
Definition: Actor.h:52
Player::conditions_times
std::array< GameTime, 20 > conditions_times
Definition: Player.h:635
ItemGen::uNumCharges
int uNumCharges
Definition: Items.h:348
PLAYER_BUFF_WILLPOWER
@ PLAYER_BUFF_WILLPOWER
Definition: Player.h:34
CURRENT_SCREEN::SCREEN_GAME
@ SCREEN_GAME
VAR_IsPersonalityMoreThanBase
@ VAR_IsPersonalityMoreThanBase
Definition: Events.h:257
MonsterStats::BelongsToSupertype
static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
Definition: Monsters.cpp:1200
SpriteObject::uSoundID
unsigned __int16 uSoundID
Definition: SpriteObject.h:221
PLAYER_SKILL_STEALING
@ PLAYER_SKILL_STEALING
Definition: Player.h:205
StealingEnchantmentBonusForSkill
std::array< int, 5 > StealingEnchantmentBonusForSkill
Definition: Player.cpp:102
VAR_MapPersistentVariable_74
@ VAR_MapPersistentVariable_74
Definition: Events.h:251
PARTY_BUFF_INVISIBILITY
@ PARTY_BUFF_INVISIBILITY
Definition: Party.h:82
_4D864C_force_sw_render_rules
char _4D864C_force_sw_render_rules
Definition: mm7_data.cpp:208
Player::SetSexByVoice
void SetSexByVoice()
Definition: Player.cpp:3563
Initiate
@ Initiate
Definition: NPC.h:61
Party::uCurrentDayOfMonth
unsigned int uCurrentDayOfMonth
Definition: Party.h:274
PLAYER_SKILL_CHAIN
@ PLAYER_SKILL_CHAIN
Definition: Player.h:181
CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS
@ CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS
Definition: Engine.h:554
VAR_LightResistance
@ VAR_LightResistance
Definition: Events.h:180
Player::field_1A93
char field_1A93
Definition: Player.h:779
PLAYER_SEX
PLAYER_SEX
Definition: Player.h:399
Player::skillDark
unsigned __int16 skillDark
Definition: Player.h:692
VAR_BasePersonality
@ VAR_BasePersonality
Definition: Events.h:161
Player::GetOffHandItem
ItemGen * GetOffHandItem()
Definition: Player.cpp:7540
Player::GetActualMight
int GetActualMight()
Definition: Player.cpp:1080
VAR_PlayerBits
@ VAR_PlayerBits
Definition: Events.h:262
param_to_bonus_table
short param_to_bonus_table[29]
Definition: Player.cpp:200
Player::GetBaseBuyingPrice
int GetBaseBuyingPrice(int uRealValue, float price_multiplier)
Definition: Player.cpp:445
SPEECH_50
@ SPEECH_50
Definition: Player.h:96
Player::CanEquip_RaceAndAlignmentCheck
bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID)
Definition: Player.cpp:564
SpellFxRenderer
Definition: SpellFxRenderer.h:97
ACTOR_BUFF_SHIELD
@ ACTOR_BUFF_SHIELD
Definition: Actor.h:53
Player::classType
PLAYER_CLASS_TYPE classType
Definition: Player.h:639
StealingRandomBonuses
std::array< int, 5 > StealingRandomBonuses
Definition: Player.cpp:100
VAR_ThieverySkill
@ VAR_ThieverySkill
Definition: Events.h:223
VAR_MapPersistentVariable_99
@ VAR_MapPersistentVariable_99
Definition: Events.h:253
pAgingAttributeModifier
unsigned char pAgingAttributeModifier[7][4]
Definition: Player.cpp:186
SPEECH_35
@ SPEECH_35
Definition: Player.h:81
SPECIAL_ATTACK_DISEASE_SEVERE
@ SPECIAL_ATTACK_DISEASE_SEVERE
Definition: Monsters.h:92
Player::GetBaseIntelligence
int GetBaseIntelligence()
Definition: Player.cpp:1037
VAR_FireSkill
@ VAR_FireSkill
Definition: Events.h:207
VariableType
VariableType
Definition: Events.h:128
Prelate
@ Prelate
Definition: NPC.h:63
CastSpellInfo::spell_target_pid
int spell_target_pid
Definition: CastSpellInfo.h:30
decal_builder
static DecalBuilder * decal_builder
Definition: Player.cpp:43
PLAYER_BUFF_HEROISM
@ PLAYER_BUFF_HEROISM
Definition: Player.h:22
SPEECH_24
@ SPEECH_24
Definition: Player.h:70
Player::AddItem
bool AddItem(struct ItemGen *pItem)
pBaseManaPerLevelByClass
unsigned char pBaseManaPerLevelByClass[36]
Definition: Player.cpp:166
PARTY_BUFF_RESIST_EARTH
@ PARTY_BUFF_RESIST_EARTH
Definition: Party.h:75
Actor::ActorEnemy
bool ActorEnemy() const
Definition: Actor.h:185
Player::GetBaseWillpower
int GetBaseWillpower()
Definition: Player.cpp:1043
SpriteObject::spell_level
int spell_level
Definition: SpriteObject.h:229
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
ITEM_RELIC_MEKORIGS_HAMMER
@ ITEM_RELIC_MEKORIGS_HAMMER
Definition: Items.h:181
Actor::sCurrentHP
int16_t sCurrentHP
Definition: Actor.h:290
VAR_MonthIs
@ VAR_MonthIs
Definition: Events.h:268
Condition_Weak
@ Condition_Weak
Definition: Conditions.h:9
Actor::AggroSurroundingPeasants
static void AggroSurroundingPeasants(unsigned int uActorID, int a2)
Definition: Actor.cpp:717
CHARACTER_ATTRIBUTE_ACCURACY
@ CHARACTER_ATTRIBUTE_ACCURACY
Definition: Engine.h:525
SPECIAL_ATTACK_PARALYZED
@ SPECIAL_ATTACK_PARALYZED
Definition: Monsters.h:93
ITEM_NULL
@ ITEM_NULL
Definition: Items.h:74
ITEM_ELVEN_CHAINMAIL
@ ITEM_ELVEN_CHAINMAIL
Definition: Items.h:186
MonsterInfo::uHP
unsigned int uHP
Definition: Monsters.h:175
Player::skillEarth
unsigned __int16 skillEarth
Definition: Player.h:687
VAR_AccuracyBonus
@ VAR_AccuracyBonus
Definition: Events.h:157
ItemGen::IsStolen
bool IsStolen()
Definition: Items.h:308
Player.h
uRequiredMana
unsigned int uRequiredMana
Definition: mm7_data.cpp:516
VAR_ArenaWinsPage
@ VAR_ArenaWinsPage
Definition: Events.h:289
DamagePlayerFromMonster
void DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, signed int a4)
Definition: Player.cpp:6928
Fool
@ Fool
Definition: NPC.h:32
Player::HasEnchantedItemEquipped
bool HasEnchantedItemEquipped(int uEnchantment)
Definition: Player.cpp:1592
PLAYER_BUFF_RESIST_EARTH
@ PLAYER_BUFF_RESIST_EARTH
Definition: Player.h:17
CHARACTER_RACE_GOBLIN
@ CHARACTER_RACE_GOBLIN
Definition: Player.h:163
CHARACTER_EXPRESSION_ERADICATED
@ CHARACTER_EXPRESSION_ERADICATED
Definition: Player.h:396
SpellBuff::Active
bool Active() const
Definition: Spells.h:162
UIStatusBar.h
SOUND_eat
@ SOUND_eat
Definition: AudioPlayer.h:81
PLAYER_SKILL_SWORD
@ PLAYER_SKILL_SWORD
Definition: Player.h:172
VAR_RandomGold
@ VAR_RandomGold
Definition: Events.h:149
SpriteObject::spell_target_pid
int spell_target_pid
Definition: SpriteObject.h:233
Player::GetMajorConditionIdx
unsigned int GetMajorConditionIdx()
Definition: Player.cpp:2614
VAR_ActualSpeed
@ VAR_ActualSpeed
Definition: Events.h:170
Player::vBeacons
std::vector< LloydBeacon > vBeacons
Definition: Player.h:794
BuildingType_AlchemistShop
@ BuildingType_AlchemistShop
Definition: Events2D.h:8
LloydBeacon::image
Image * image
Definition: Player.h:279
VAR_ArmsmasterSkill
@ VAR_ArmsmasterSkill
Definition: Events.h:228
flt_6BE3A4_debug_recmod1
float flt_6BE3A4_debug_recmod1
Definition: mm7_data.cpp:716
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
integer_sqrt
int integer_sqrt(int val)
Definition: OurMath.cpp:164
CastSpellInfo::field_6
__int16 field_6
Definition: CastSpellInfo.h:27
uint
unsigned int uint
Definition: MM7.h:4
VAR_WaterResistanceBonus
@ VAR_WaterResistanceBonus
Definition: Events.h:186
VAR_MagicResistanceBonus
@ VAR_MagicResistanceBonus
Definition: Events.h:194
ITEM_161
@ ITEM_161
Definition: Items.h:95
MonsterInfo::uSpell2ID
uint8_t uSpell2ID
Definition: Monsters.h:149
Condition_Poison_Weak
@ Condition_Poison_Weak
Definition: Conditions.h:14
ITEM_BROKEN
@ ITEM_BROKEN
Definition: Items.h:27
Player::SelectPhrasesTransaction
int SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int a5)
Definition: Player.cpp:7994
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
ItemGen::GetItemBonusArtifact
void GetItemBonusArtifact(Player *owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int *bonusSum)
Definition: Items.cpp:1474
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
Localization::FormatString
String FormatString(unsigned int index,...) const
Definition: Localization.cpp:17
Player::uPrevVoiceID
int uPrevVoiceID
Definition: Player.h:758
Player::skillUnarmed
unsigned __int16 skillUnarmed
Definition: Player.h:703
VAR_ItemEquipped
@ VAR_ItemEquipped
Definition: Events.h:294
Party::IsPartyEvil
bool IsPartyEvil()
Definition: Party.cpp:1139
_449B7E_toggle_bit
void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
Definition: Party.cpp:1190
PLAYER_CLASS_WARRIOR_MAGE
@ PLAYER_CLASS_WARRIOR_MAGE
Definition: Player.h:233
Player::IsMale
bool IsMale()
Definition: Player.h:610
Player::SetBeacon
bool SetBeacon(size_t index, size_t power)
Definition: Player.cpp:8186
__debugbreak
void __cdecl __debugbreak(void)
EQUIP_WAND
@ EQUIP_WAND
Definition: Items.h:239
ITEM_POTION_BOTTLE
@ ITEM_POTION_BOTTLE
Definition: Items.h:120
Actor::_43B3E0_CalcDamage
int _43B3E0_CalcDamage(signed int dmgSource)
Definition: Actor.cpp:1314
Player::uIntelligence
unsigned __int16 uIntelligence
Definition: Player.h:644
Player::SetZombie
void SetZombie(GameTime time)
Definition: Player.cpp:7520
VAR_ACModifier
@ VAR_ACModifier
Definition: Events.h:136
AttackerInfo
stru298 AttackerInfo
Definition: mm7_data.cpp:24
SpellBuff::uPower
unsigned __int16 uPower
Definition: Spells.h:166
PlayerEquipment::uHelm
unsigned int uHelm
Definition: Player.h:323
ui_character_stat_debuffed_color
unsigned int ui_character_stat_debuffed_color
Definition: UICharacter.cpp:52
Player::GetMeleeDamageMinimal
int GetMeleeDamageMinimal()
Definition: Player.cpp:1170
pNPCStats
struct NPCStats * pNPCStats
Definition: NPC.cpp:29
PlayerEquipment::uArmor
unsigned int uArmor
Definition: Player.h:322
_2devent::fPriceMultiplier
float fPriceMultiplier
Definition: Events2D.h:53
GUIWindow::par1C
unsigned int par1C
Definition: GUIWindow.h:477
VAR_UnknownTimeEvent0
@ VAR_UnknownTimeEvent0
Definition: Events.h:279
VAR_BodyResistanceBonus
@ VAR_BodyResistanceBonus
Definition: Events.h:190
VAR_PhysicalResistanceBonus
@ VAR_PhysicalResistanceBonus
Definition: Events.h:193
PLAYER_BUFF_RESIST_BODY
@ PLAYER_BUFF_RESIST_BODY
Definition: Player.h:16
PLAYER_SKILL_REPAIR
@ PLAYER_SKILL_REPAIR
Definition: Player.h:194
pSkillAvailabilityPerClass
unsigned char pSkillAvailabilityPerClass[9][37]
Definition: Player.cpp:111
Player::CleanupBeacons
void CleanupBeacons()
Definition: Player.cpp:8177
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
Player::sResWaterBase
__int16 sResWaterBase
Definition: Player.h:736
SOUND_star4
@ SOUND_star4
Definition: AudioPlayer.h:89
Player::IsDead
bool IsDead() const
Definition: Player.cpp:7416
SPRITE_OBJECT_EXPLODE
@ SPRITE_OBJECT_EXPLODE
Definition: SpriteObject.h:32
PARTY_BUFF_FLY
@ PARTY_BUFF_FLY
Definition: Party.h:78
SPECIAL_ATTACK_POISON_MEDIUM
@ SPECIAL_ATTACK_POISON_MEDIUM
Definition: Monsters.h:88
Party::SetHoldingItem
void SetHoldingItem(ItemGen *pItem)
Definition: Party.cpp:150
Player::sHealth
int sHealth
Definition: Player.h:766
Player::CalculateIncommingDamage
int CalculateIncommingDamage(DAMAGE_TYPE dmg_type, int amount)
Definition: Player.cpp:1489
LloydBeacon::SaveFileID
uint16_t SaveFileID
Definition: Player.h:278
Player::GetExperienceDisplayColor
unsigned int GetExperienceDisplayColor()
Definition: Player.cpp:1481
Player::PlaySound
void PlaySound(PlayerSpeech speech, int a3)
Definition: Player.cpp:7874
Player::RandomizeName
void RandomizeName()
Definition: Player.cpp:2606
VAR_Counter7
@ VAR_Counter7
Definition: Events.h:275
SpriteObject::spell_skill
int spell_skill
Definition: SpriteObject.h:230
Mouse::SetCursorBitmapFromItemID
void SetCursorBitmapFromItemID(unsigned int uItemID)
Definition: Mouse.cpp:32
Condition_Good
@ Condition_Good
Definition: Conditions.h:26
GUIWindow::eWindowType
WindowType eWindowType
Definition: GUIWindow.h:474
VAR_SpiritResistanceBonus
@ VAR_SpiritResistanceBonus
Definition: Events.h:188
VAR_IdentifyItemSkill
@ VAR_IdentifyItemSkill
Definition: Events.h:216
Player::GetActualLevel
int GetActualLevel()
Definition: Player.cpp:1073
Condition_Unconcious
@ Condition_Unconcious
Definition: Conditions.h:21
Actor::ActorHasItem
bool ActorHasItem() const
Definition: Actor.h:191
SPELL_BOW_ARROW
@ SPELL_BOW_ARROW
Definition: Spells.h:121
Player::Reset
void Reset(PLAYER_CLASS_TYPE classType)
Definition: Player.cpp:3600
GUIWindow::ptr_1C
void * ptr_1C
Definition: GUIWindow.h:476
Player::IsParalyzed
bool IsParalyzed() const
Definition: Player.cpp:7444
ITEM_WAND_FIRE
@ ITEM_WAND_FIRE
Definition: Items.h:91
VAR_DayOfWeek
@ VAR_DayOfWeek
Definition: Events.h:147
Player::PlayAwardSound_Anim98_Face
void PlayAwardSound_Anim98_Face(PlayerSpeech speech)
Definition: Player.cpp:6781
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
Player::skillAir
unsigned __int16 skillAir
Definition: Player.h:685
PARTY_BUFF_RESIST_BODY
@ PARTY_BUFF_RESIST_BODY
Definition: Party.h:72
Player::GetPriceIdentification
int GetPriceIdentification(float price_multiplier)
Definition: Player.cpp:407
Locksmith
@ Locksmith
Definition: NPC.h:31
VAR_ShieldSkill
@ VAR_ShieldSkill
Definition: Events.h:203
Duper
@ Duper
Definition: NPC.h:56
PlayerCreation_GetUnspentAttributePointCount
int PlayerCreation_GetUnspentAttributePointCount()
Definition: Player.cpp:223
SoundID
SoundID
Definition: AudioPlayer.h:10
Player::GetActualSpeed
int GetActualSpeed()
Definition: Player.cpp:1111
PARTY_BUFF_RESIST_FIRE
@ PARTY_BUFF_RESIST_FIRE
Definition: Party.h:77
VAR_LightSkill
@ VAR_LightSkill
Definition: Events.h:214
VAR_BaseMight
@ VAR_BaseMight
Definition: Events.h:159
Party::_autonote_bits
unsigned char _autonote_bits[26]
Definition: Party.h:300
SPEECH_107
@ SPEECH_107
Definition: Player.h:153
PLAYER_CLASS_SPY
@ PLAYER_CLASS_SPY
Definition: Player.h:222
Player::GetArmorItem
ItemGen * GetArmorItem()
Definition: Player.cpp:7548
Player::GetDisarmTrap
int GetDisarmTrap()
Definition: Player.cpp:1007
Player::GetActualAttribute
int GetActualAttribute(CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::*attrValue, unsigned short Player::*attrBonus)
Definition: Player.cpp:1132
CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS
@ CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS
Definition: Engine.h:550
Player::GetActualAccuracy
int GetActualAccuracy()
Definition: Player.cpp:1105
Mouse::SetCursorImage
void SetCursorImage(const String &name)
Definition: Mouse.cpp:38
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
Player::GetBaseSellingPrice
int GetBaseSellingPrice(int uRealValue, float price_multiplier)
Definition: Player.cpp:435
VAR_DiplomacySkill
@ VAR_DiplomacySkill
Definition: Events.h:222
Player::GetActualLuck
int GetActualLuck()
Definition: Player.cpp:1117
CHARACTER_ATTRIBUTE_SKILL_LIGHT
@ CHARACTER_ATTRIBUTE_SKILL_LIGHT
Definition: Engine.h:566
PLAYER_BUFF_RESIST_WATER
@ PLAYER_BUFF_RESIST_WATER
Definition: Player.h:36
ChimneySweep
@ ChimneySweep
Definition: NPC.h:33
VAR_RepairSkill
@ VAR_RepairSkill
Definition: Events.h:218
Player::IsRaceElf
bool IsRaceElf()
Definition: Player.h:607
Party::uNumDeaths
unsigned int uNumDeaths
Definition: Party.h:283
PLAYER_SKILL_DARK
@ PLAYER_SKILL_DARK
Definition: Player.h:191
_50C9D8_AfterEnchClickEventTimeout
int _50C9D8_AfterEnchClickEventTimeout
Definition: mm7_data.cpp:582
ACTOR_BUFF_STONESKIN
@ ACTOR_BUFF_STONESKIN
Definition: Actor.h:54
SPECIAL_ATTACK_CURSE
@ SPECIAL_ATTACK_CURSE
Definition: Monsters.h:82
Player::PlayAwardSound_Anim97
void PlayAwardSound_Anim97()
Definition: Player.cpp:6203
PLAYER_SKILL_BODY
@ PLAYER_SKILL_BODY
Definition: Player.h:189
IndoorLocation::GetSector
int GetSector(int sX, int sY, int sZ)
Definition: Indoor.cpp:1279
Apprentice
@ Apprentice
Definition: NPC.h:22
PLAYER_SKILL_MERCHANT
@ PLAYER_SKILL_MERCHANT
Definition: Player.h:193
PartyTimeStruct::CounterEventValues
std::array< GameTime, 10 > CounterEventValues
Definition: Party.h:145
CheckHiredNPCSpeciality
bool CheckHiredNPCSpeciality(unsigned int uProfession)
Definition: NPC.cpp:754
CHARACTER_ATTRIBUTE_SPEED
@ CHARACTER_ATTRIBUTE_SPEED
Definition: Engine.h:526
ITEM_ARTIFACT_ELFBANE
@ ITEM_ARTIFACT_ELFBANE
Definition: Items.h:184
Player::sResMindBase
__int16 sResMindBase
Definition: Player.h:741
ITEM_ARTIFACT_SPLITTER
@ ITEM_ARTIFACT_SPLITTER
Definition: Items.h:159
ITEM_ENCHANTMENT_OF_FORCE
@ ITEM_ENCHANTMENT_OF_FORCE
Definition: Items.h:56
LloydBeacon
Definition: Player.h:254
CHARACTER_RACE_ELF
@ CHARACTER_RACE_ELF
Definition: Player.h:162
VAR_History_28
@ VAR_History_28
Definition: Events.h:283
Player::uExperience
unsigned __int64 uExperience
Definition: Player.h:636
PlayerFrame::uAnimLength
__int16 uAnimLength
Definition: PlayerFrameTable.h:11
Player::SetWeak
void SetWeak(GameTime time)
Definition: Player.cpp:7456
Player::GetEquippedItemSkillType
PLAYER_SKILL_TYPE GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot)
Definition: Player.cpp:1570
Enchanter
@ Enchanter
Definition: NPC.h:42
CHARACTER_ATTRIBUTE_RANGED_DMG_MAX
@ CHARACTER_ATTRIBUTE_RANGED_DMG_MAX
Definition: Engine.h:556
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
_506568_autonote_type
int _506568_autonote_type
Definition: mm7_data.cpp:532
Condition_Disease_Severe
@ Condition_Disease_Severe
Definition: Conditions.h:19
Player::sLevelModifier
__int16 sLevelModifier
Definition: Player.h:658
SPEECH_30
@ SPEECH_30
Definition: Player.h:76
Player::CanCastSpell
bool CanCastSpell(unsigned int uRequiredMana)
Definition: Player.cpp:280
Player::GetActualSkillLevel
int GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType)
Definition: Player.cpp:3017
SPEECH_36
@ SPEECH_36
Definition: Player.h:82
Condition_Eradicated
@ Condition_Eradicated
Definition: Conditions.h:24
MonsterInfo::uAttack1Type
uint8_t uAttack1Type
Definition: Monsters.h:135
ITEM_RECIPE_BODY_RESISTANCE
@ ITEM_RECIPE_BODY_RESISTANCE
Definition: Items.h:222
_50C9D4_AfterEnchClickEventSecondParam
int _50C9D4_AfterEnchClickEventSecondParam
Definition: mm7_data.cpp:581
PLAYER_BUFF_LUCK
@ PLAYER_BUFF_LUCK
Definition: Player.h:32
DMGT_EARTH
@ DMGT_EARTH
Definition: Items.h:14
Player::HasItemEquipped
bool HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex)
Definition: Player.cpp:1583
GUIWindow.h
Player::SetAsleep
void SetAsleep(GameTime time)
Definition: Player.cpp:7460
SOUND_swing_with_blunt_weapon03
@ SOUND_swing_with_blunt_weapon03
Definition: AudioPlayer.h:41
ItemGen
Definition: Items.h:263
ItemGen::GetValue
unsigned int GetValue()
Definition: Items.cpp:588
ITEM_LICH_JAR_FULL
@ ITEM_LICH_JAR_FULL
Definition: Items.h:206
Player::SetDiseaseWeak
void SetDiseaseWeak(GameTime time)
Definition: Player.cpp:7480
ITEM_RELIC_ETHRICS_STAFF
@ ITEM_RELIC_ETHRICS_STAFF
Definition: Items.h:168
ObjectList.h
pMessageQueue_50CBD0
struct GUIMessageQueue * pMessageQueue_50CBD0
Definition: GUIWindow.cpp:86
offset
GLintptr offset
Definition: SDL_opengl_glext.h:541
logger
Log * logger
Definition: IocContainer.cpp:47
CastSpellInfoHelpers::Cancel_Spell_Cast_In_Progress
void Cancel_Spell_Cast_In_Progress()
Definition: CastSpellInfo.cpp:4350
Player::HasSkill
int HasSkill(unsigned int uSkillType)
Definition: Player.cpp:778
PlayerSpeech
PlayerSpeech
Definition: Player.h:46
stru_5E4C90_MapPersistVars
stru123 stru_5E4C90_MapPersistVars
Definition: mm7_data.cpp:23
SpellFxRenderer::SetPlayerBuffAnim
void SetPlayerBuffAnim(uint16_t uSpellID, uint16_t uPlayerID)
Definition: SpellFxRenderer.cpp:1103
pAutonoteTxt
std::array< Autonote, 196 > pAutonoteTxt
Definition: mm7_data.cpp:25
Player::GetBuyingPrice
int GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
Definition: Player.cpp:396
PlayerCreation_AttributeProps::uDroppedStep
unsigned char uDroppedStep
Definition: Player.cpp:54
PLAYER_SKILL_ARMSMASTER
@ PLAYER_SKILL_ARMSMASTER
Definition: Player.h:204
Condition_Pertified
@ Condition_Pertified
Definition: Conditions.h:23
pAwards
std::array< Award, 105 > pAwards
Definition: mm7_data.cpp:26
Engine_::IocContainer::ResolveSpellFxRenderer
static SpellFxRenderer * ResolveSpellFxRenderer()
Definition: IocContainer.cpp:74
Player::uPrevFace
int uPrevFace
Definition: Player.h:759
PartyTimeStruct::_s_times
std::array< GameTime, 20 > _s_times
Definition: Party.h:147
Player::CreateItemInInventory2
int CreateItemInInventory2(unsigned int index, ItemGen *Src)
Definition: Player.cpp:851
Condition_Drunk
@ Condition_Drunk
Definition: Conditions.h:12
Player::SetDiseaseMedium
void SetDiseaseMedium(GameTime time)
Definition: Player.cpp:7488
ItemGen::m_enchantmentStrength
int m_enchantmentStrength
Definition: Items.h:328
SPECIAL_ATTACK_UNCONSCIOUS
@ SPECIAL_ATTACK_UNCONSCIOUS
Definition: Monsters.h:94
StealingMasteryBonuses
std::array< int, 5 > StealingMasteryBonuses
Definition: Player.cpp:96
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
VAR_CircusPrises
@ VAR_CircusPrises
Definition: Events.h:266
VAR_ActualPersonality
@ VAR_ActualPersonality
Definition: Events.h:168
VAR_DiseasedRed
@ VAR_DiseasedRed
Definition: Events.h:243
Player::uNumFireSpikeCasts
char uNumFireSpikeCasts
Definition: Player.h:797
CHARACTER_EXPRESSION_21
@ CHARACTER_EXPRESSION_21
Definition: Player.h:363
ITEM_RELIC_TALEDONS_HELM
@ ITEM_RELIC_TALEDONS_HELM
Definition: Items.h:174
_A750D8_player_speech_timer
int64_t _A750D8_player_speech_timer
Definition: mm7_data.cpp:763
SpriteObject::uAttributes
unsigned __int16 uAttributes
Definition: SpriteObject.h:222
some_active_character
int some_active_character
Definition: mm7_data.cpp:569
VAR_EarthResistance
@ VAR_EarthResistance
Definition: Events.h:176
VAR_DiseasedYellow
@ VAR_DiseasedYellow
Definition: Events.h:241
CHARACTER_ATTRIBUTE_RANGED_ATTACK
@ CHARACTER_ATTRIBUTE_RANGED_ATTACK
Definition: Engine.h:553
Player::uNumArmageddonCasts
char uNumArmageddonCasts
Definition: Player.h:796
Player::SetVariable
void SetVariable(enum VariableType var, signed int a3)
Definition: Player.cpp:5061
LloydBeacon::uBeaconTime
GameTime uBeaconTime
Definition: Player.h:271
VAR_IdentifyMonsterSkill
@ VAR_IdentifyMonsterSkill
Definition: Events.h:227
VAR_PlayerItemInHands
@ VAR_PlayerItemInHands
Definition: Events.h:144
Player::IsPlayerHealableByTemple
bool IsPlayerHealableByTemple()
Definition: Player.cpp:475
CHARACTER_ATTRIBUTE_SKILL_DODGE
@ CHARACTER_ATTRIBUTE_SKILL_DODGE
Definition: Engine.h:545
VAR_Weak
@ VAR_Weak
Definition: Events.h:233
Actor::DamageMonsterFromParty
static void DamageMonsterFromParty(int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity)
Definition: Actor.cpp:3379
PLAYER_BUFF_HASTE
@ PLAYER_BUFF_HASTE
Definition: Player.h:21
Actor::pMonsterInfo
struct MonsterInfo pMonsterInfo
Definition: Actor.h:292
Player::uQuickSpell
unsigned __int8 uQuickSpell
Definition: Player.h:774
Player::skillSpirit
unsigned __int16 skillSpirit
Definition: Player.h:688
pGUIWindow_CastTargetedSpell
GUIWindow * pGUIWindow_CastTargetedSpell
Definition: GUIWindow.cpp:56
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
pBaseHealthByClass
unsigned char pBaseHealthByClass[12]
Definition: Player.cpp:160
Player::skillMace
unsigned __int16 skillMace
Definition: Player.h:678
pBaseManaByClass
unsigned char pBaseManaByClass[12]
Definition: Player.cpp:162
Player::uLevel
unsigned __int16 uLevel
Definition: Player.h:657
Player::ProfessionOrGuildFlagsCorrect
bool ProfessionOrGuildFlagsCorrect(unsigned int uClass, int a3)
Definition: Player.cpp:7964
Player::field_1A95
char field_1A95
Definition: Player.h:781
MonsterInfo::uAttack2Type
uint8_t uAttack2Type
Definition: Monsters.h:141
Party::AddGold
static void AddGold(int amount)
Definition: Party.cpp:287
pAgeingTable
unsigned int pAgeingTable[4]
Definition: Player.cpp:195
VAR_ArenaWinsKnight
@ VAR_ArenaWinsKnight
Definition: Events.h:291
Player::pEquipment
PlayerEquipment pEquipment
Definition: Player.h:769
Player::SetEradicated
void SetEradicated(GameTime time)
Definition: Player.cpp:7516
Party::sRotationY
int sRotationY
Definition: Party.h:251
PLAYER_BUFF_PRESERVATION
@ PLAYER_BUFF_PRESERVATION
Definition: Player.h:25
stru262_TurnBased::turn_stage
int turn_stage
Definition: TurnEngine.h:75
SPEECH_99
@ SPEECH_99
Definition: Player.h:145
VAR_AutoNotes
@ VAR_AutoNotes
Definition: Events.h:254
EQUIP_BOOTS
@ EQUIP_BOOTS
Definition: Items.h:236
CHARACTER_ATTRIBUTE_SKILL_UNARMED
@ CHARACTER_ATTRIBUTE_SKILL_UNARMED
Definition: Engine.h:546
VAR_Counter9
@ VAR_Counter9
Definition: Events.h:277
String
std::string String
Definition: Strings.h:10
SPEECH_41
@ SPEECH_41
Definition: Player.h:87
CHARACTER_ATTRIBUTE_STRENGTH
@ CHARACTER_ATTRIBUTE_STRENGTH
Definition: Engine.h:521
Player::SetPoisonWeak
void SetPoisonWeak(GameTime time)
Definition: Player.cpp:7476
VAR_PhysicalResistance
@ VAR_PhysicalResistance
Definition: Events.h:182
VAR_EnduranceBonus
@ VAR_EnduranceBonus
Definition: Events.h:155
ITEM_ARTIFACT_GOVERNORS_ARMOR
@ ITEM_ARTIFACT_GOVERNORS_ARMOR
Definition: Items.h:157
Player::GetBaseEndurance
int GetBaseEndurance()
Definition: Player.cpp:1048
CHARACTER_ATTRIBUTE_RESIST_BODY
@ CHARACTER_ATTRIBUTE_RESIST_BODY
Definition: Engine.h:537
GameTime
Definition: Time.h:14
Player::GetActualAge
unsigned int GetActualAge()
Definition: Player.cpp:2474
CHARACTER_ATTRIBUTE_SKILL_MEDITATION
@ CHARACTER_ATTRIBUTE_SKILL_MEDITATION
Definition: Engine.h:568
Player::GetPriceSell
int GetPriceSell(ItemGen itemx, float price_multiplier)
Definition: Player.cpp:380
Player::pPlayerBuffs
std::array< SpellBuff, 24 > pPlayerBuffs
Definition: Player.h:756
Player::CanFitItem
bool CanFitItem(unsigned int uSlot, unsigned int uItemID)
Definition: Player.cpp:727
Party::GetGold
int GetGold() const
Definition: Party.cpp:264
Player::skillPerception
unsigned __int16 skillPerception
Definition: Player.h:698
Player::sResBodyBonus
__int16 sResBodyBonus
Definition: Player.h:753
VAR_WaterSkill
@ VAR_WaterSkill
Definition: Events.h:209
CHARACTER_ATTRIBUTE_INTELLIGENCE
@ CHARACTER_ATTRIBUTE_INTELLIGENCE
Definition: Engine.h:522
Player::GetBootItem
ItemGen * GetBootItem()
Definition: Player.cpp:7558
Player::GetGloveItem
ItemGen * GetGloveItem()
Definition: Player.cpp:7556
Player::sACModifier
__int16 sACModifier
Definition: Player.h:656
VAR_MapPersistentVariable_75
@ VAR_MapPersistentVariable_75
Definition: Events.h:252
Mouse::RemoveHoldingItem
void RemoveHoldingItem()
Definition: Mouse.cpp:25
SPEECH_29
@ SPEECH_29
Definition: Player.h:75
MonsterInfo::uLevel
uint8_t uLevel
Definition: Monsters.h:122
Party::uNumArenaKnightWins
char uNumArenaKnightWins
Definition: Party.h:296
Player::GetConditionDaysPassed
int GetConditionDaysPassed(unsigned int uCondition)
Definition: Player.cpp:325
pObjectList
struct ObjectList * pObjectList
Definition: ObjectList.cpp:5
SOUND_star1
@ SOUND_star1
Definition: AudioPlayer.h:87
Player::DecreaseAttribute
void DecreaseAttribute(int eAttribute)
Definition: Player.cpp:3670
Spellmaster
@ Spellmaster
Definition: NPC.h:24
Party::Invisible
bool Invisible()
Definition: Party.h:217
Player::pEquippedItems
ItemGen pEquippedItems[12]
Definition: Player.h:728
GameTime::FromSeconds
static GameTime FromSeconds(int seconds)
Definition: Time.h:83
PLAYER_CLASS_GREAT_DRUID
@ PLAYER_CLASS_GREAT_DRUID
Definition: Player.h:245
ItemsTable::pItems
NZIArray< ItemDesc, 800 > pItems
Definition: Items.h:460
Party::SetGold
static void SetGold(int amount)
Definition: Party.cpp:281
Player::GetStatColor
unsigned int GetStatColor(int uStat)
Definition: Player.cpp:3800
Mouse.h
VAR_MaxSP
@ VAR_MaxSP
Definition: Events.h:134
DMGT_MIND
@ DMGT_MIND
Definition: Items.h:18
parameter_to_bonus_value
signed int parameter_to_bonus_value[29]
Definition: Player.cpp:203
img
GLint GLvoid * img
Definition: SDL_opengl.h:1980
Condition_Disease_Medium
@ Condition_Disease_Medium
Definition: Conditions.h:17
Player::_42ECB5_PlayerAttacksActor
static void _42ECB5_PlayerAttacksActor()
Definition: Player.cpp:7643
VAR_BaseSpeed
@ VAR_BaseSpeed
Definition: Events.h:163
CHARACTER_ATTRIBUTE_MELEE_DMG_MAX
@ CHARACTER_ATTRIBUTE_MELEE_DMG_MAX
Definition: Engine.h:552
sDialogue_SpeakingActorNPC_ID
int sDialogue_SpeakingActorNPC_ID
Definition: mm7_data.cpp:605
SPEECH_34
@ SPEECH_34
Definition: Player.h:80
Player::GetSkillIdxByOrder
PLAYER_SKILL_TYPE GetSkillIdxByOrder(signed int order)
Definition: Player.cpp:3635
SPECIAL_ATTACK_POISON_WEAK
@ SPECIAL_ATTACK_POISON_WEAK
Definition: Monsters.h:87
SpriteObject::spell_caster_pid
int spell_caster_pid
Definition: SpriteObject.h:232
DecalBuilder
Definition: DecalBuilder.h:123
CHARACTER_ATTRIBUTE_SKILL_DARK
@ CHARACTER_ATTRIBUTE_SKILL_DARK
Definition: Engine.h:567
SPEECH_32
@ SPEECH_32
Definition: Player.h:78
SPEECH_NoRoom
@ SPEECH_NoRoom
Definition: Player.h:61
ITEM_GRYPHONHEARTS_TRUMPET
@ ITEM_GRYPHONHEARTS_TRUMPET
Definition: Items.h:215
VAR_MajorCondition
@ VAR_MajorCondition
Definition: Events.h:249
Player::skillFire
unsigned __int16 skillFire
Definition: Player.h:684
Player::sResFireBonus
__int16 sResFireBonus
Definition: Player.h:745
VAR_Counter10
@ VAR_Counter10
Definition: Events.h:278
Player::pure_luck_used
int pure_luck_used
Definition: Player.h:718
StatTable
PlayerCreation_AttributeProps StatTable[4][7]
Definition: Player.cpp:59
Party::GiveFood
static void GiveFood(int amount)
Definition: Party.cpp:255
_43AFE3_calc_spell_damage
int _43AFE3_calc_spell_damage(int spellId, int spellLevel, signed int skillMastery, int currentHp)
Definition: Spells.cpp:745
stru123::field_0
std::array< unsigned char, 75 > field_0
Definition: stru123.h:7
Player::sResBodyBase
__int16 sResBodyBase
Definition: Player.h:742
Condition_Sleep
@ Condition_Sleep
Definition: Conditions.h:10
PLAYER_SKILL_PLATE
@ PLAYER_SKILL_PLATE
Definition: Player.h:182
SPECIAL_ATTACK_FEAR
@ SPECIAL_ATTACK_FEAR
Definition: Monsters.h:104
Player::spellbook
PlayerSpells spellbook
Definition: Player.h:716
CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM
@ CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM
Definition: Engine.h:541
Player::GetRangedAttack
int GetRangedAttack()
Definition: Player.cpp:1311
LloydBeacon::PartyPos_Z
int32_t PartyPos_Z
Definition: Player.h:274
CHARACTER_ATTRIBUTE_RESIST_EARTH
@ CHARACTER_ATTRIBUTE_RESIST_EARTH
Definition: Engine.h:535
Player::SetSkillByEvent
void SetSkillByEvent(unsigned __int16 Player::*skillToSet, unsigned __int16 skillValue)
Definition: Player.cpp:5644
Actor::pActorBuffs
struct SpellBuff pActorBuffs[22]
Definition: Actor.h:315
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52
ITEM_ARTIFACT_PUCK
@ ITEM_ARTIFACT_PUCK
Definition: Items.h:153
VAR_DiseasedGreen
@ VAR_DiseasedGreen
Definition: Events.h:239