OregonCore  revision be9e804-git
Your Favourite TBC server
StatSystem.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "Unit.h"
19 #include "Player.h"
20 #include "Pet.h"
21 #include "Creature.h"
22 #include "SharedDefines.h"
23 #include "SpellAuras.h"
24 
25 /*#######################################
26 ######## ########
27 ######## UNIT STAT SYSTEM ########
28 ######## ########
29 #######################################*/
30 
32 {
33  for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
35 }
36 
38 {
39  float minDamage = 0.0f;
40  float maxDamage = 0.0f;
41 
42  CalculateMinMaxDamage(attType, false, true, minDamage, maxDamage);
43 
44  switch (attType)
45  {
46  case BASE_ATTACK:
47  default:
50  break;
51  case OFF_ATTACK:
54  break;
55  case RANGED_ATTACK:
58  break;
59  }
60 }
61 
62 /*#######################################
63 ######## ########
64 ######## PLAYERS STAT SYSTEM ########
65 ######## ########
66 #######################################*/
67 
69 {
70  if (stat > STAT_SPIRIT)
71  return false;
72 
73  // value = ((base_value * base_pct) + total_value) * total_pct
74  float value = GetTotalStatValue(stat);
75 
76  SetStat(stat, int32(value));
77 
78  if (stat == STAT_STAMINA || stat == STAT_INTELLECT)
79  {
80  Pet* pet = GetPet();
81  if (pet)
82  pet->UpdateStats(stat);
83  }
84 
85  switch (stat)
86  {
87  case STAT_STRENGTH:
88  UpdateShieldBlockValue();
89  break;
90  case STAT_AGILITY:
91  UpdateArmor();
92  UpdateAllCritPercentages();
93  UpdateDodgePercentage();
94  break;
95  case STAT_STAMINA:
97  break;
98  case STAT_INTELLECT:
100  UpdateAllSpellCritChances();
101  UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
102  break;
103  case STAT_SPIRIT:
104  break;
105  default:
106  break;
107  }
108 
109  if (stat == STAT_STRENGTH)
110  {
114  }
115  else if (stat == STAT_AGILITY)
116  {
119  }
120  else
121  {
124  }
125 
126  UpdateSpellDamageAndHealingBonus();
127  UpdateManaRegen();
128 
129  // Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
130  uint32 mask = 0;
131  AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
132  for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
133  if (Stats((*i)->GetMiscBValue()) == stat)
134  mask |= (*i)->GetMiscValue();
135  if (mask)
136  {
137  for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
138  if (mask & (1 << rating))
139  ApplyRatingMod(CombatRating(rating), 0, true);
140  }
141  return true;
142 }
143 
145 {
146  // Magic damage modifiers implemented in Unit::SpellDamageBonus
147  // This information for client side use only
148  // Get healing bonus for all schools
150  // Get damage bonus for all schools
151  for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
153 }
154 
156 {
157  for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
158  {
159  float value = GetTotalStatValue(Stats(i));
160  SetStat(Stats(i), int32(value));
161  }
162 
165  UpdateArmor();
166  UpdateMaxHealth();
167 
168  for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
170 
171  UpdateAllCritPercentages();
172  UpdateAllSpellCritChances();
173  UpdateDefenseBonusesMod();
174  UpdateShieldBlockValue();
175  UpdateSpellDamageAndHealingBonus();
176  UpdateManaRegen();
177  UpdateExpertise(BASE_ATTACK);
178  UpdateExpertise(OFF_ATTACK);
180 
181  return true;
182 }
183 
185 {
186  if (school > SPELL_SCHOOL_NORMAL)
187  {
189  SetResistance(SpellSchools(school), int32(value));
190 
191  Pet* pet = GetPet();
192  if (pet)
193  pet->UpdateResistances(school);
194  }
195  else
196  UpdateArmor();
197 }
198 
200 {
201  UnitMods unitMod = UNIT_MOD_ARMOR;
202 
203  float value = GetModifierValue(unitMod, BASE_VALUE); // base armor (from items)
204  value *= GetModifierValue(unitMod, BASE_PCT); // armor percent from items
205  value += GetStat(STAT_AGILITY) * 2.0f; // armor bonus from stats
206  value += GetModifierValue(unitMod, TOTAL_VALUE);
207 
208  //add dynamic flat mods
210  for (AuraList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
211  {
212  Modifier* mod = (*i)->GetModifier();
214  value += CalculatePct(GetStat(Stats((*i)->GetMiscBValue())), (*i)->GetModifierValue());
215  }
216 
217  value *= GetModifierValue(unitMod, TOTAL_PCT);
218 
219  // @todo Move this outta here!
220  // Druid Enrage armor reduction
221  if (HasAura(5229, 0))
222  value -= (m_form == FORM_DIREBEAR) ? 0.16 * value : 0.27 * value;
223 
224  SetArmor(int32(value));
225 
226  Pet* pet = GetPet();
227  if (pet)
228  pet->UpdateArmor();
229 }
230 
232 {
233  float stamina = GetStat(STAT_STAMINA);
234  float baseStam = std::min(20.0f, stamina);
235  float moreStam = stamina - baseStam;
236 
237  return baseStam + (moreStam * 10.0f);
238 }
239 
241 {
242  float intellect = GetStat(STAT_INTELLECT);
243  float baseInt = std::min(20.0f, intellect);
244  float moreInt = intellect - baseInt;
245 
246  return baseInt + (moreInt * 15.0f);
247 }
248 
250 {
251  UnitMods unitMod = UNIT_MOD_HEALTH;
252 
253  float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
254  value *= GetModifierValue(unitMod, BASE_PCT);
255  value += GetModifierValue(unitMod, TOTAL_VALUE) + GetHealthBonusFromStamina();
256  value *= GetModifierValue(unitMod, TOTAL_PCT);
257 
258  SetMaxHealth((uint32)value);
259 }
260 
262 {
263  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
264 
265  // ignore classes without mana
266  float bonusPower = (power == POWER_MANA && GetCreatePowers(power) > 0) ? GetManaBonusFromIntellect() : 0;
267 
268  float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
269  value *= GetModifierValue(unitMod, BASE_PCT);
270  value += GetModifierValue(unitMod, TOTAL_VALUE) + bonusPower;
271  value *= GetModifierValue(unitMod, TOTAL_PCT);
272 
273  SetMaxPower(power, uint32(value));
274 }
275 
277 {
278  float val2 = 0.0f;
279  float level = float(getLevel());
280 
282 
286 
287  if (ranged)
288  {
292 
293  switch (getClass())
294  {
295  case CLASS_HUNTER:
296  val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f;
297  break;
298  case CLASS_ROGUE:
299  val2 = level + GetStat(STAT_AGILITY) - 10.0f;
300  break;
301  case CLASS_WARRIOR:
302  val2 = level + GetStat(STAT_AGILITY) - 10.0f;
303  break;
304  case CLASS_DRUID:
305  switch (m_form)
306  {
307  case FORM_CAT:
308  case FORM_BEAR:
309  case FORM_DIREBEAR:
310  val2 = 0.0f; break;
311  default:
312  val2 = GetStat(STAT_AGILITY) - 10.0f; break;
313  }
314  break;
315  default: val2 = GetStat(STAT_AGILITY) - 10.0f; break;
316  }
317  }
318  else
319  {
320  switch (getClass())
321  {
322  case CLASS_WARRIOR:
323  val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
324  break;
325  case CLASS_PALADIN:
326  val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
327  break;
328  case CLASS_ROGUE:
329  val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
330  break;
331  case CLASS_HUNTER:
332  val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
333  break;
334  case CLASS_SHAMAN:
335  val2 = level * 2.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
336  break;
337  case CLASS_DRUID:
338  {
339  //Check if Predatory Strikes is skilled
340  float mLevelMult = 0.0;
341  switch (m_form)
342  {
343  case FORM_CAT:
344  case FORM_BEAR:
345  case FORM_DIREBEAR:
346  case FORM_MOONKIN:
347  {
349  for (Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
350  {
351  // Predatory Strikes
352  if ((*itr)->GetSpellProto()->SpellIconID == 1563)
353  {
354  mLevelMult = (*itr)->GetModifier()->m_amount / 100.0f;
355  break;
356  }
357  }
358  break;
359  }
360  default:
361  break;
362  }
363 
364  switch (m_form)
365  {
366  case FORM_CAT:
367  val2 = getLevel() * (mLevelMult + 2.0f) + GetStat(STAT_STRENGTH) * 2.0f + GetStat(STAT_AGILITY) - 20.0f;
368  break;
369  case FORM_BEAR:
370  case FORM_DIREBEAR:
371  val2 = getLevel() * (mLevelMult + 3.0f) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
372  break;
373  case FORM_MOONKIN:
374  val2 = getLevel() * (mLevelMult + 1.5f) + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
375  break;
376  default:
377  val2 = GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
378  break;
379  }
380  break;
381  }
382  case CLASS_MAGE:
383  val2 = GetStat(STAT_STRENGTH) - 10.0f;
384  break;
385  case CLASS_PRIEST:
386  val2 = GetStat(STAT_STRENGTH) - 10.0f;
387  break;
388  case CLASS_WARLOCK:
389  val2 = GetStat(STAT_STRENGTH) - 10.0f;
390  break;
391  }
392  }
393 
394  SetModifierValue(unitMod, BASE_VALUE, val2);
395 
396  float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
397  float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
398 
399  //add dynamic flat mods
400  if (ranged)
401  {
402  if ((getClassMask() & CLASSMASK_WAND_USERS) == 0)
403  {
405  for (AuraList::const_iterator i = mRAPbyIntellect.begin(); i != mRAPbyIntellect.end(); ++i)
406  attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetModifierValue());
407  }
408  }
409 
410  float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
411 
412  SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field
413  SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
414  SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
415 
416  Pet* pet = GetPet(); //update pet's AP
417  //automatically update weapon damage after attack power modification
418  if (ranged)
419  {
421  if (pet && pet->IsHunterPet()) // At ranged attack change for hunter pet
423  }
424  else
425  {
427  if (CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
429  if (getClass() == CLASS_SHAMAN) // mental quickness
430  UpdateSpellDamageAndHealingBonus();
431  }
432 }
433 
435 {
437 }
438 
439 void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage)
440 {
441  UnitMods unitMod;
442 
443  switch (attType)
444  {
445  case BASE_ATTACK:
446  default:
447  unitMod = UNIT_MOD_DAMAGE_MAINHAND;
448  break;
449  case OFF_ATTACK:
450  unitMod = UNIT_MOD_DAMAGE_OFFHAND;
451  break;
452  case RANGED_ATTACK:
453  unitMod = UNIT_MOD_DAMAGE_RANGED;
454  break;
455  }
456 
457  float attackSpeedMod = GetAPMultiplier(attType, normalized);
458 
459  float baseValue = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * attackSpeedMod;
460  float basePct = GetModifierValue(unitMod, BASE_PCT);
461  float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
462  float totalPct = GetModifierValue(unitMod, TOTAL_PCT);
463 
464  float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
465  float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
466 
467  if (IsInFeralForm()) // check if player is druid and in cat or bear forms
468  {
469  uint8 lvl = getLevel();
470  if (lvl > 60)
471  lvl = 60;
472 
473  weaponMinDamage = lvl * 0.85f * attackSpeedMod;
474  weaponMaxDamage = lvl * 1.25f * attackSpeedMod;
475  }
476  else if (!CanUseAttackType(attType)) // check if player not in form but still can't use (disarm case)
477  {
478  // cannot use ranged/off attack, set values to 0
479  if (attType != BASE_ATTACK)
480  {
481  minDamage = 0;
482  maxDamage = 0;
483  return;
484  }
485  weaponMinDamage = BASE_MINDAMAGE;
486  weaponMaxDamage = BASE_MAXDAMAGE;
487  }
488  else if (attType == RANGED_ATTACK) // add ammo DPS to ranged damage
489  {
490  weaponMinDamage += GetAmmoDPS() * attackSpeedMod;
491  weaponMaxDamage += GetAmmoDPS() * attackSpeedMod;
492  }
493 
494  /*if (attType == BASE_ATTACK)
495  {
496  int32 speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKSPEED);
497  base_pct *= 100.0f / (100.0f + float(speed_mod / 2));
498  }*/
499 
500  minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct;
501  maxDamage = ((weaponMaxDamage + baseValue) * basePct + totalValue) * totalPct;
502 }
503 
505 {
506  UpdateBlockPercentage();
507  UpdateParryPercentage();
508  UpdateDodgePercentage();
509 }
510 
512 {
513  // No block
514  float value = 0.0f;
515  if (CanBlock())
516  {
517  // Base value
518  value = 5.0f;
519  // Modify value from defense skill
520  value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
521  // Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
523  // Increase from rating
524  value += GetRatingBonusValue(CR_BLOCK);
525  value = value < 0.0f ? 0.0f : value;
526  }
528 }
529 
531 {
532  BaseModGroup modGroup;
533  uint16 index;
534  CombatRating cr;
535 
536  switch (attType)
537  {
538  case OFF_ATTACK:
539  modGroup = OFFHAND_CRIT_PERCENTAGE;
541  cr = CR_CRIT_MELEE;
542  break;
543  case RANGED_ATTACK:
544  modGroup = RANGED_CRIT_PERCENTAGE;
546  cr = CR_CRIT_RANGED;
547  break;
548  case BASE_ATTACK:
549  default:
550  modGroup = CRIT_PERCENTAGE;
551  index = PLAYER_CRIT_PERCENTAGE;
552  cr = CR_CRIT_MELEE;
553  break;
554  }
555 
556  float value = GetTotalPercentageModValue(modGroup) + GetRatingBonusValue(cr);
557  // Modify crit from weapon skill and maximized defense skill of same level victim difference
558  value += (int32(GetWeaponSkillValue(attType)) - int32(GetMaxSkillValueForLevel())) * 0.04f;
559  value = value < 0.0f ? 0.0f : value;
560  SetStatFloatValue(index, value);
561 }
562 
564 {
565  float value = GetMeleeCritFromAgility();
566 
567  SetBaseModValue(CRIT_PERCENTAGE, PCT_MOD, value);
568  SetBaseModValue(OFFHAND_CRIT_PERCENTAGE, PCT_MOD, value);
569  SetBaseModValue(RANGED_CRIT_PERCENTAGE, PCT_MOD, value);
570 
571  UpdateCritPercentage(BASE_ATTACK);
572  UpdateCritPercentage(OFF_ATTACK);
573  UpdateCritPercentage(RANGED_ATTACK);
574 }
575 
577 {
578  // No parry
579  float value = 0.0f;
580  if (CanParry())
581  {
582  // Base parry
583  value = 5.0f;
584  // Modify value from defense skill
585  value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
586  // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
588  // Parry from rating
589  value += GetRatingBonusValue(CR_PARRY);
590  value = value < 0.0f ? 0.0f : value;
591  }
593 }
594 
596 {
597  // Dodge from agility
598  float value = GetDodgeFromAgility();
599  // Modify value from defense skill
600  value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
601  // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
603  // Dodge from rating
604  value += GetRatingBonusValue(CR_DODGE);
605  value = value < 0.0f ? 0.0f : value;
607 }
608 
610 {
611  // For normal school set zero crit chance
612  if (school == SPELL_SCHOOL_NORMAL)
613  {
615  return;
616  }
617  // For others recalculate it from:
618  float crit = 0.0f;
619  // Crit from Intellect
620  crit += GetSpellCritFromIntellect();
621  // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
623  // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
625  // Increase crit from spell crit ratings
626  crit += GetRatingBonusValue(CR_CRIT_SPELL);
627 
628  // Store crit value
630 }
631 
633 {
635  m_modMeleeHitChance += GetRatingBonusValue(CR_HIT_MELEE);
636 }
637 
639 {
641  m_modRangedHitChance += GetRatingBonusValue(CR_HIT_RANGED);
642 }
643 
645 {
647  m_modSpellHitChance += GetRatingBonusValue(CR_HIT_SPELL);
648 }
649 
651 {
652  for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
653  UpdateSpellCritChance(i);
654 }
655 
657 {
658  if (attack == RANGED_ATTACK)
659  return;
660 
661  int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
662 
663  Item* weapon = GetWeaponForAttack(attack, true);
664 
666  for (AuraList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
667  {
668  // item neutral spell
669  if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
670  expertise += (*itr)->GetModifierValue();
671  // item dependent spell
672  else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
673  expertise += (*itr)->GetModifierValue();
674  }
675 
676  if (expertise < 0)
677  expertise = 0;
678 
679  switch (attack)
680  {
681  case BASE_ATTACK:
682  SetUInt32Value(PLAYER_EXPERTISE, expertise);
683  break;
684  case OFF_ATTACK:
686  break;
687  default:
688  break;
689  }
690 }
691 
693 {
694  float Intellect = GetStat(STAT_INTELLECT);
695  // Mana regen from spirit and intellect
696  float power_regen = std::sqrt(Intellect) * OCTRegenMPPerSpirit();
697  // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
699 
700  // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
702 
703  // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
705  for (AuraList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
706  {
707  Modifier* mod = (*i)->GetModifier();
708  power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * (*i)->GetModifierValue() / 500.0f;
709  }
710 
711  // Bonus from some dummy auras
712  AuraList const& mDummyAuras = GetAurasByType(SPELL_AURA_PERIODIC_DUMMY);
713  for (AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
714  if ((*i)->GetId() == 34074) // Aspect of the Viper
715  {
716  power_regen_mp5 += (*i)->GetModifier()->m_amount * Intellect / 500.0f;
717  // Add regen bonus from level in this dummy
718  power_regen_mp5 += float(getLevel() * 35 / 100);
719  }
720 
721  // Set regen rate in cast state apply only on spirit based regen
723  if (modManaRegenInterrupt > 100)
724  modManaRegenInterrupt = 100;
725  SetStatFloatValue(PLAYER_FIELD_MOD_MANA_REGEN_INTERRUPT, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
726 
727  SetStatFloatValue(PLAYER_FIELD_MOD_MANA_REGEN, power_regen_mp5 + power_regen);
728 }
729 
731 {
732  SetCanModifyStats(false);
733 
735  _ApplyAllItemMods();
736 
737  SetCanModifyStats(true);
738 
739  UpdateAllStats();
740 }
741 
743 {
744  SetCanModifyStats(false);
745 
746  _RemoveAllItemMods();
748 
749  SetCanModifyStats(true);
750 
751  UpdateAllStats();
752 }
753 
754 /*#######################################
755 ######## ########
756 ######## MOBS STAT SYSTEM ########
757 ######## ########
758 #######################################*/
759 
761 {
762  return true;
763 }
764 
766 {
767  UpdateMaxHealth();
770 
771  for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
773 
775 
776  return true;
777 }
778 
780 {
781  if (school > SPELL_SCHOOL_NORMAL)
782  {
784  SetResistance(SpellSchools(school), int32(value));
785  }
786  else
787  UpdateArmor();
788 }
789 
791 {
793  SetArmor(int32(value));
794 }
795 
797 {
799  SetMaxHealth(uint32(value));
800 }
801 
803 {
804  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
805 
806  float value = GetTotalAuraModValue(unitMod);
807  SetMaxPower(power, uint32(value));
808 }
809 
811 {
813 
817 
818  if (ranged)
819  {
823  }
824 
825  float baseAttackPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
826  float attackPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
827  float attackPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
828 
829  SetInt32Value(index, uint32(baseAttackPower)); // UNIT_FIELD_(RANGED)_ATTACK_POWER
830  SetInt32Value(indexMod, uint32(attackPowerMod)); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS
831  SetFloatValue(indexMulti, attackPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER
832 
833  // automatically update weapon damage after attack power modification
834  if (ranged)
836  else
837  {
840  }
841 }
842 
843 void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage)
844 {
845  float variance = 1.0f;
846  UnitMods unitMod;
847  switch (attType)
848  {
849  case BASE_ATTACK:
850  default:
851  variance = GetCreatureTemplate()->BaseVariance;
852  unitMod = UNIT_MOD_DAMAGE_MAINHAND;
853  break;
854  case OFF_ATTACK:
855  variance = GetCreatureTemplate()->BaseVariance;
856  unitMod = UNIT_MOD_DAMAGE_OFFHAND;
857  break;
858  case RANGED_ATTACK:
859  variance = GetCreatureTemplate()->RangeVariance;
860  unitMod = UNIT_MOD_DAMAGE_RANGED;
861  break;
862  }
863 
864  if (attType == OFF_ATTACK && !haveOffhandWeapon())
865  {
866  minDamage = 0.0f;
867  maxDamage = 0.0f;
868  return;
869  }
870 
871  float weaponMinDamage = GetWeaponDamageRange(attType, MINDAMAGE);
872  float weaponMaxDamage = GetWeaponDamageRange(attType, MAXDAMAGE);
873 
874  if (!CanUseAttackType(attType)) // disarm case
875  {
876  weaponMinDamage = 0.0f;
877  weaponMaxDamage = 0.0f;
878  }
879 
880  float attackPower = GetTotalAttackPowerValue(attType);
881  float attackSpeedMulti = GetAPMultiplier(attType, normalized);
882  float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower / 14.0f) * variance;
883  float basePct = GetModifierValue(unitMod, BASE_PCT) * attackSpeedMulti;
884  float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
885  float totalPct = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;
886  float dmgMultiplier = GetCreatureTemplate()->ModDamage; // = ModDamage * _GetDamageMod(rank);
887 
888  minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
889  maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
890 }
891 
892 /*#######################################
893 ######## ########
894 ######## PETS STAT SYSTEM ########
895 ######## ########
896 #######################################*/
897 
898 #define ENTRY_IMP 416
899 #define ENTRY_VOIDWALKER 1860
900 #define ENTRY_SUCCUBUS 1863
901 #define ENTRY_FELHUNTER 417
902 #define ENTRY_FELGUARD 17252
903 #define ENTRY_WATER_ELEMENTAL 510
904 #define ENTRY_TREANT 1964
905 #define ENTRY_FIRE_ELEMENTAL 15438
906 #define ENTRY_SHADOWFIEND 19668
907 
909 {
910  if (stat > MAX_STATS)
911  return false;
912 
913  // value = ((base_value * base_pct) + total_value) * total_pct
914  float value = GetTotalStatValue(stat);
915  float ownersBonus = 0.0f;
916 
917  Unit* owner = GetOwner();
918  if (stat == STAT_STAMINA)
919  {
920  if (owner && (IsHunterPet() || owner->getClass() == CLASS_WARLOCK))
921  {
922  ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 30);
923  value += ownersBonus;
924  }
925  }
926  //warlock's and mage's pets gain 30% of owner's intellect
927  else if (stat == STAT_INTELLECT && IsPet())
928  {
929  if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
930  {
931  ownersBonus = CalculatePct(owner->GetStat(stat), 30);
932  value += ownersBonus;
933  }
934  }
935 
936  SetStat(stat, int32(value));
937 
938  switch (stat)
939  {
941  case STAT_AGILITY: UpdateArmor(); break;
942  case STAT_STAMINA: UpdateMaxHealth(); break;
944  case STAT_SPIRIT:
945  default:
946  break;
947  }
948 
949  return true;
950 }
951 
953 {
954  for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
955  UpdateStats(Stats(i));
956 
957  for (int i = POWER_MANA; i < MAX_POWERS; ++i)
959 
961 
962  return true;
963 }
964 
966 {
967  if (school > SPELL_SCHOOL_NORMAL)
968  {
970 
971  // hunter and warlock pets gain 40% of owner's resistance
972  if (IsPet())
973  value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));
974 
975  SetResistance(SpellSchools(school), int32(value));
976  }
977  else
978  UpdateArmor();
979 }
980 
982 {
983  float value = 0.0f;
984  float bonus_armor = 0.0f;
985  UnitMods unitMod = UNIT_MOD_ARMOR;
986 
987  // hunter and warlock pets gain 35% of owner's armor value
988  if (IsPet())
989  bonus_armor = float(CalculatePct(m_owner->GetArmor(), 35));
990 
991  value = GetModifierValue(unitMod, BASE_VALUE);
992  value *= GetModifierValue(unitMod, BASE_PCT);
993  value += GetStat(STAT_AGILITY) * 2.0f;
994  value += GetModifierValue(unitMod, TOTAL_VALUE) + bonus_armor;
995  value *= GetModifierValue(unitMod, TOTAL_PCT);
996 
997  SetArmor(int32(value));
998 }
999 
1001 {
1002  UnitMods unitMod = UNIT_MOD_HEALTH;
1003  float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);
1004 
1005  float multiplicator;
1006  switch (GetEntry())
1007  {
1008  case ENTRY_IMP: multiplicator = 8.4f; break;
1009  case ENTRY_VOIDWALKER: multiplicator = 11.0f; break;
1010  case ENTRY_SUCCUBUS: multiplicator = 9.1f; break;
1011  case ENTRY_FELHUNTER: multiplicator = 9.5f; break;
1012  case ENTRY_FELGUARD: multiplicator = 11.0f; break;
1013  default: multiplicator = 10.0f; break;
1014  }
1015 
1016  float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
1017  value *= GetModifierValue(unitMod, BASE_PCT);
1018  value += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * multiplicator;
1019  value *= GetModifierValue(unitMod, TOTAL_PCT);
1020 
1021  SetMaxHealth((uint32)value);
1022 }
1023 
1025 {
1026  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
1027 
1028  float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
1029  float multiplicator = 15.0f;
1030 
1031  switch (GetEntry())
1032  {
1033  case ENTRY_IMP: multiplicator = 4.95f; break;
1034  case ENTRY_VOIDWALKER:
1035  case ENTRY_SUCCUBUS:
1036  case ENTRY_FELHUNTER:
1037  case ENTRY_FELGUARD: multiplicator = 11.5f; break;
1038  default: multiplicator = 15.0f; break;
1039  }
1040 
1041  float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
1042  value *= GetModifierValue(unitMod, BASE_PCT);
1043  value += GetModifierValue(unitMod, TOTAL_VALUE) + addValue * multiplicator;
1044  value *= GetModifierValue(unitMod, TOTAL_PCT);
1045 
1046  SetMaxPower(power, uint32(value));
1047 }
1048 
1050 {
1051  if (ranged)
1052  return;
1053 
1054  float val = 0.0f;
1055  float bonusAP = 0.0f;
1056  UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
1057 
1058  if (GetEntry() == ENTRY_IMP) // imp's attack power
1059  val = GetStat(STAT_STRENGTH) - 10.0f;
1060  else
1061  val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
1062 
1063  Unit* owner = GetOwner();
1064  if (owner && owner->GetTypeId() == TYPEID_PLAYER)
1065  {
1066  if (IsHunterPet()) //hunter pets benefit from owner's attack power
1067  {
1068  bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f;
1069  SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.125f));
1070  }
1071  //demons benefit from warlocks shadow or fire damage
1072  else if (IsPet() && owner->getClass() == CLASS_WARLOCK)
1073  {
1076  int32 maximum = (fire > shadow) ? fire : shadow;
1077  if (maximum < 0)
1078  maximum = 0;
1079  SetBonusDamage(int32(maximum * 0.15f));
1080  bonusAP = maximum * 0.57f;
1081  }
1082  //water elementals benefit from mage's frost damage
1083  else if (GetEntry() == ENTRY_WATER_ELEMENTAL)
1084  {
1086  if (frost < 0)
1087  frost = 0;
1088  SetBonusDamage(int32(frost * 0.4f));
1089  }
1090  }
1091 
1093 
1094  //in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
1095  float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
1096  float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
1097  float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
1098 
1099  //UNIT_FIELD_(RANGED)_ATTACK_POWER field
1100  SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
1101  //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
1103  //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
1105 
1106  //automatically update weapon damage after attack power modification
1108 }
1109 
1111 {
1112  if (attType > BASE_ATTACK)
1113  return;
1114 
1115  float bonusDamage = 0.0f;
1116  if (m_owner->GetTypeId() == TYPEID_PLAYER)
1117  {
1118  //force of nature
1119  if (GetEntry() == ENTRY_TREANT)
1120  {
1121  int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
1122  if (spellDmg > 0)
1123  bonusDamage = spellDmg * 0.09f;
1124  }
1125  //greater fire elemental
1126  else if (GetEntry() == ENTRY_FIRE_ELEMENTAL)
1127  {
1128  int32 spellDmg = int32(m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - m_owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
1129  if (spellDmg > 0)
1130  bonusDamage = spellDmg * 0.4f;
1131  }
1132  // shadowfiend 65.7% per 10 hits so 6.57 per hit
1133  else if (GetEntry() == ENTRY_SHADOWFIEND)
1134  {
1135  int32 spellDmg = int32(m_owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW));
1136  if (spellDmg > 0)
1137  bonusDamage = spellDmg * 0.0657f;
1138  }
1139  }
1140 
1142 
1143  float att_speed = float(GetAttackTime(BASE_ATTACK)) / 1000.0f;
1144 
1145  float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 14.0f * att_speed + bonusDamage;
1146  float base_pct = GetModifierValue(unitMod, BASE_PCT);
1147  float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
1148  float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
1149 
1150  float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
1151  float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
1152 
1153  /*int32 speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKSPEED);
1154  base_pct *= 100.0f / (100.0f + float(speed_mod / 2));*/
1155 
1156  float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
1157  float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;
1158 
1159  // Pet's base damage changes depending on happiness
1160  if (IsHunterPet() && attType == BASE_ATTACK)
1161  {
1162  switch (ToPet()->GetHappinessState())
1163  {
1164  case HAPPY:
1165  // 125% of normal damage
1166  mindamage = mindamage * 1.25f;
1167  maxdamage = maxdamage * 1.25f;
1168  break;
1169  case CONTENT:
1170  // 100% of normal damage, nothing to modify
1171  break;
1172  case UNHAPPY:
1173  // 75% of normal damage
1174  mindamage = mindamage * 0.75f;
1175  maxdamage = maxdamage * 0.75f;
1176  break;
1177  }
1178  }
1179 
1182 }
1183 
CreatureInfo const * GetCreatureTemplate(uint32 id)
Definition: ObjectMgr.cpp:7745
virtual void UpdateResistances(uint32 school)=0
#define ENTRY_IMP
Definition: StatSystem.cpp:898
BaseModGroup
Definition: Unit.h:419
#define ENTRY_VOIDWALKER
Definition: StatSystem.cpp:899
void SetStatFloatValue(uint16 index, float value)
Definition: Object.cpp:928
Definition: Unit.h:513
void UpdateMaxPower(Powers power) override
#define BASE_MINDAMAGE
Definition: Unit.h:157
virtual void UpdateMaxPower(Powers power)=0
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:210
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:3812
Definition: Unit.h:511
void SetStat(Stats stat, int32 val)
Definition: Unit.h:1067
void UpdateSpellDamageAndHealingBonus()
Definition: StatSystem.cpp:144
float m_modMeleeHitChance
Definition: Unit.h:1625
Definition: Pet.h:67
float ModDamage
Definition: Creature.h:190
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
Definition: Unit.cpp:883
SpellSchoolMask
UnitMods
Definition: Unit.h:384
#define ENTRY_FELHUNTER
Definition: StatSystem.cpp:901
void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value)
Definition: Unit.h:1640
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:3700
float GetManaBonusFromIntellect()
Definition: StatSystem.cpp:240
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage) override
Definition: StatSystem.cpp:843
SpellSchools
WeaponAttackType
Definition: Unit.h:498
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:261
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:758
void UpdateManaRegen()
Definition: StatSystem.cpp:692
Pet * ToPet()
Definition: Unit.h:1054
void UpdateResistances(uint32 school) override
Definition: StatSystem.cpp:779
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:3826
bool IsFitToSpellRequirements(SpellEntry const *spellInfo) const
Definition: Item.cpp:791
void _ApplyAllStatBonuses()
Definition: StatSystem.cpp:730
virtual void UpdateArmor()=0
#define ENTRY_FIRE_ELEMENTAL
Definition: StatSystem.cpp:905
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:1654
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:777
ACE_INT32 int32
Definition: Define.h:67
std::list< Aura * > AuraList
Definition: Unit.h:917
bool IsInFeralForm() const
Definition: Unit.h:1613
#define ENTRY_SUCCUBUS
Definition: StatSystem.cpp:900
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:810
bool UpdateStats(Stats stat) override
Definition: StatSystem.cpp:908
void UpdateMeleeHitChances()
Definition: StatSystem.cpp:632
void SetStatInt32Value(uint16 index, int32 value)
Definition: Object.cpp:936
bool UpdateAllStats() override
Definition: StatSystem.cpp:765
#define MAX_POWERS
void UpdateMaxHealth() override
Definition: StatSystem.cpp:796
void _RemoveAllStatBonuses()
Definition: StatSystem.cpp:742
#define MAX_SPELL_SCHOOL
int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask)
Definition: Unit.cpp:8434
float BaseVariance
Definition: Creature.h:159
bool UpdateAllStats() override
Definition: StatSystem.cpp:952
void UpdateSpellCritChance(uint32 school)
Definition: StatSystem.cpp:609
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:1072
uint8 getLevel() const
Definition: Unit.h:1057
uint32 GetAttackTime(WeaponAttackType att) const
Definition: Unit.h:1104
void UpdateAttackPowerAndDamage(bool ranged=false) override
uint32 GetCreatePowers(Powers power) const
Definition: Unit.cpp:11146
#define MAX_STATS
void _RemoveAllAuraMods()
Definition: Unit.cpp:4660
bool IsHunterPet() const
Definition: Unit.h:1049
float m_modSpellHitChance
Definition: Unit.h:1627
Definition: Pet.h:65
int32 m_miscvalue
Definition: SpellAuras.h:36
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage)=0
uint8 GetTypeId() const
Definition: Object.h:192
ACE_UINT8 uint8
Definition: Define.h:73
Powers
void UpdateBlockPercentage()
Definition: StatSystem.cpp:511
int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask)
Definition: Unit.cpp:8897
virtual bool UpdateStats(Stats stat)=0
bool UpdateStats(Stats stat) override
Definition: StatSystem.cpp:760
Definition: Unit.h:194
#define ENTRY_TREANT
Definition: StatSystem.cpp:904
Stats
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=NULL) const
Definition: Unit.cpp:3325
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:12319
void UpdateArmor() override
Definition: StatSystem.cpp:981
virtual uint32 GetShieldBlockValue() const =0
Definition: Item.h:196
void SetArmor(int32 val)
Definition: Unit.h:1069
#define MAX_COMBAT_RATING
Definition: Unit.h:535
void UpdateDamagePhysical(WeaponAttackType attType) override
float GetHealthBonusFromStamina()
Definition: StatSystem.cpp:231
void UpdateDefenseBonusesMod()
Definition: StatSystem.cpp:504
etc mysql my cnf *Then change max_allowed_packet to a bigger value
void UpdateArmor() override
Definition: StatSystem.cpp:199
void UpdateResistances(uint32 school) override
Definition: StatSystem.cpp:184
bool UpdateAllStats() override
Definition: StatSystem.cpp:155
#define BASE_MAXDAMAGE
Definition: Unit.h:158
float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const
Definition: Unit.cpp:10804
void UpdateArmor() override
Definition: StatSystem.cpp:790
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage) override
Definition: StatSystem.cpp:439
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:276
void SetMaxHealth(uint32 val)
Definition: Unit.cpp:10973
bool haveOffhandWeapon() const
Definition: Unit.cpp:628
void UpdateAllSpellCritChances()
Definition: StatSystem.cpp:650
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2795
uint32 GetDefenseSkillValue(Unit const *target=NULL) const
Definition: Unit.cpp:3177
T CalculatePct(T base, U pct)
Definition: Util.h:97
float GetTotalStatValue(Stats stat) const
Definition: Unit.cpp:10818
void UpdateAllCritPercentages()
Definition: StatSystem.cpp:563
uint32 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition: Unit.h:1170
bool IsPet() const
Definition: Unit.h:1048
void _ApplyAllAuraMods()
Definition: Unit.cpp:4666
float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const
Definition: Unit.cpp:10923
uint32 getClassMask() const
Definition: Unit.h:1063
bool UpdateStats(Stats stat) override
Definition: StatSystem.cpp:68
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:3752
HappinessState GetHappinessState()
Definition: Pet.cpp:723
void UpdateCritPercentage(WeaponAttackType attType)
Definition: StatSystem.cpp:530
void UpdateMaxHealth() override
Definition: StatSystem.cpp:249
void UpdateParryPercentage()
Definition: StatSystem.cpp:576
#define ENTRY_FELGUARD
Definition: StatSystem.cpp:902
#define ENTRY_WATER_ELEMENTAL
Definition: StatSystem.cpp:903
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:37
void UpdateExpertise(WeaponAttackType attType)
Definition: StatSystem.cpp:656
Unit * GetOwner() const
Definition: Unit.cpp:7660
float GetCreateStat(Stats stat) const
Definition: Unit.h:1571
#define CLASSMASK_WAND_USERS
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:857
uint32 GetCreateHealth() const
Definition: Unit.h:1550
uint8 getClass() const
Definition: Unit.h:1062
Definition: Unit.h:431
Definition: Unit.h:512
void UpdateSpellHitChances()
Definition: StatSystem.cpp:644
void UpdateMaxPower(Powers power) override
Definition: StatSystem.cpp:802
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:11065
uint32 GetEntry() const
Definition: Object.h:186
float m_modRangedHitChance
Definition: Unit.h:1626
Definition: Unit.h:354
AuraList const & GetAurasByType(AuraType type) const
Definition: Unit.h:1747
void UpdateShieldBlockValue()
Definition: StatSystem.cpp:434
ACE_UINT16 uint16
Definition: Define.h:72
float GetTotalAuraModValue(UnitMods unitMod) const
Definition: Unit.cpp:10834
float GetTotalAttackPowerValue(WeaponAttackType attType) const
Definition: Unit.cpp:10905
bool CanDualWield() const
Definition: Unit.h:973
float RangeVariance
Definition: Creature.h:160
ACE_UINT32 uint32
Definition: Define.h:71
void UpdateRangedHitChances()
Definition: StatSystem.cpp:638
virtual void UpdateMaxHealth()=0
Definition: Unit.h:908
CombatRating
Definition: Unit.h:507
Definition: Pet.h:66
void UpdateMaxHealth() override
virtual bool UpdateAllStats()=0
virtual void UpdateAllResistances()
Definition: StatSystem.cpp:31
void UpdateDodgePercentage()
Definition: StatSystem.cpp:595
float GetStat(Stats stat) const
Definition: Unit.h:1066
void UpdateResistances(uint32 school) override
Definition: StatSystem.cpp:965
#define ENTRY_SHADOWFIEND
Definition: StatSystem.cpp:906
Definition: Pet.h:146
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
ShapeshiftForm m_form
Definition: Unit.h:1612
bool HasAura(uint32 spellId, uint8 effIndex=0) const
Definition: Unit.h:1262