Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SpellAuraStats.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Battlefield.h"
7#include "BattlefieldMgr.h"
8#include "Battleground.h"
9#include "CellImpl.h"
10#include "Common.h"
11#include "Formulas.h"
12#include "GridNotifiers.h"
13#include "GridNotifiersImpl.h"
14#include "Log.h"
15#include "ObjectAccessor.h"
16#include "ObjectMgr.h"
17#include "Opcodes.h"
18#include "OutdoorPvPMgr.h"
19#include "Pet.h"
20#include "Player.h"
21#include "ReputationMgr.h"
22#include "ScriptMgr.h"
23#include "Spell.h"
24#include "SpellAuraEffects.h"
25#include "SpellAuraMetadata.h"
26#include "SpellMgr.h"
27#include "Unit.h"
28#include "Util.h"
29#include "Vehicle.h"
30#include "WeatherMgr.h"
31#include "WorldPacket.h"
32
33class Aura;
34
35namespace
36{
37 void ApplyAuraStateImmunityRule(Unit* target, uint32 spellId, Skyfire::Spells::AuraStateImmunityRule const& rule, bool apply,
38 std::list<AuraType>& auraImmunityList, uint32& mechanicImmunityMask)
39 {
41
42 for (uint8 i = 0; i < rule.MechanicCount; ++i)
43 target->ApplySpellImmune(spellId, IMMUNITY_MECHANIC, rule.Mechanics[i], apply);
44
45 for (uint8 i = 0; i < rule.EffectCount; ++i)
46 target->ApplySpellImmune(spellId, IMMUNITY_EFFECT, rule.Effects[i], apply);
47
48 for (uint8 i = 0; i < rule.AuraTypeCount; ++i)
49 auraImmunityList.push_back(AuraType(rule.AuraTypes[i]));
50 }
51
52 void AppendDefaultAuraStateImmunityTypes(int32 miscValue, std::list<AuraType>& auraImmunityList)
53 {
55 uint8 auraTypeCount = Skyfire::Spells::GetDefaultAuraStateImmunityAuraTypes(miscValue, auraTypes,
57
58 for (uint8 i = 0; i < auraTypeCount; ++i)
59 auraImmunityList.push_back(AuraType(auraTypes[i]));
60 }
61}
62
63void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 mode, bool apply) const
64{
65 if (!(mode & AURA_EFFECT_HANDLE_REAL))
66 return;
67
68 Unit* target = aurApp->GetTarget();
69 std::list <AuraType> aura_immunity_list;
70 uint32 mechanic_immunity_list = 0;
71 int32 miscVal = GetMiscValue();
72
73 if (Skyfire::Spells::AuraStateImmunityRule const* immunityRule =
75 ApplyAuraStateImmunityRule(target, GetId(), *immunityRule, apply, aura_immunity_list, mechanic_immunity_list);
76
77 if (aura_immunity_list.empty())
78 AppendDefaultAuraStateImmunityTypes(miscVal, aura_immunity_list);
79
80 // apply immunities
81 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
82 target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
83
84 if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
85 {
86 target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
87 for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
88 target->RemoveAurasByType(*iter);
89 }
90}
91
92void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
93{
94 if (!(mode & AURA_EFFECT_HANDLE_REAL))
95 return;
96
97 Unit* target = aurApp->GetTarget();
98 uint32 mechanic;
99
100 if (Skyfire::Spells::MechanicImmunitySpellRule const* immunityRule =
102 {
103 mechanic = Skyfire::Spells::GetAuraImmunityMechanicMask(immunityRule->MechanicMask);
104 for (uint8 i = 0; i < immunityRule->MechanicCount; ++i)
105 target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, immunityRule->Mechanics[i], apply);
106 }
107 else
108 {
109 if (GetMiscValue() < 1)
110 return;
111
112 mechanic = 1 << GetMiscValue();
114 }
115
116 if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
118}
119
120void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
121{
122 if (!(mode & AURA_EFFECT_HANDLE_REAL))
123 return;
124
125 Unit* target = aurApp->GetTarget();
126
128
129 // when removing flag aura, handle flag drop
130 Player* player = target->ToPlayer();
131 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
132 {
133 if (player->InBattleground())
134 {
135 if (Battleground* bg = player->GetBattleground())
136 bg->EventPlayerDroppedFlag(player);
137 }
138 else
139 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
140 }
141}
142
143void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
144{
145 if (!(mode & AURA_EFFECT_HANDLE_REAL))
146 return;
147
148 Unit* target = aurApp->GetTarget();
149
151
152 if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
154}
155
156void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
157{
158 if (!(mode & AURA_EFFECT_HANDLE_REAL))
159 return;
160
161 Unit* target = aurApp->GetTarget();
162
163 target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, GetMiscValue(), (apply));
164
165 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
166 {
167 if (apply)
169 else
170 {
171 bool banishFound = false;
172 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
173 for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
174 if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
175 {
176 banishFound = true;
177 break;
178 }
179 if (!banishFound)
181 }
182 }
183
184 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
186
187 // remove all flag auras (they are positive, but they must be removed when you are immune)
191
193 if ((apply)
195 && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
196 {
197 uint32 school_mask = GetMiscValue();
198 Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
199 for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
200 {
201 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
202 if ((spell->GetSchoolMask() & school_mask)//Check for school mask
203 && GetSpellInfo()->CanDispelAura(spell)
204 && !iter->second->IsPositive() //Don't remove positive spells
205 && spell->Id != GetId()) //Don't remove self
206 {
207 target->RemoveAura(iter);
208 }
209 else
210 ++iter;
211 }
212 }
213}
214
215void AuraEffect::HandleAuraModDmgImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
216{
217 if (!(mode & AURA_EFFECT_HANDLE_REAL))
218 return;
219
220 Unit* target = aurApp->GetTarget();
221
223}
224
225void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
226{
227 if (!(mode & AURA_EFFECT_HANDLE_REAL))
228 return;
229
230 Unit* target = aurApp->GetTarget();
231
233}
234
235/*********************************************************/
236/*** MODIFY STATS ***/
237/*********************************************************/
238
239/********************************/
240/*** RESISTANCE ***/
241/********************************/
242
243void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const* aurApp, uint8 mode, bool apply) const
244{
246 return;
247
248 Unit* target = aurApp->GetTarget();
249
250 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
251 {
252 if (GetMiscValue() & int32(1 << x))
253 {
255 if (amount < GetAmount())
256 {
257 float value = float(GetAmount() - amount);
259 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
260 target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
261 }
262 }
263 }
264}
265
266void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
267{
269 return;
270
271 Unit* target = aurApp->GetTarget();
272
273 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
274 {
275 if (GetMiscValue() & int32(1 << x))
276 {
278 if (target->GetTypeId() == TypeID::TYPEID_PLAYER || target->ToCreature()->IsPet())
279 target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
280 }
281 }
282}
283
284void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
285{
287 return;
288
289 Unit* target = aurApp->GetTarget();
290
291 // only players have base stats
292 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
293 {
294 //pets only have base armor
295 if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
296 target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetAmount()), apply);
297 }
298 else
299 {
300 for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++)
301 {
302 if (GetMiscValue() & int32(1 << x))
304 }
305 }
306}
307
308void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
309{
311 return;
312
313 Unit* target = aurApp->GetTarget();
314
315 for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
316 {
317 if (GetMiscValue() & int32(1 << i))
318 {
320 if (target->GetTypeId() == TypeID::TYPEID_PLAYER || target->ToCreature()->IsPet())
321 {
322 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
323 target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
324 }
325 }
326 }
327}
328
329void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
330{
332 return;
333
334 Unit* target = aurApp->GetTarget();
335
336 // only players have base stats
337 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
338 {
339 //only pets have base stats
340 if (target->ToCreature()->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
341 target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetAmount()), apply);
342 }
343 else
344 {
345 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
346 if (GetMiscValue() & (1 << i))
348 }
349}
350
351void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
352{
354 return;
355
356 Unit* target = aurApp->GetTarget();
357
358 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
359
360 // show armor penetration
363
364 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
367}
368
369/********************************/
370/*** STAT ***/
371/********************************/
372
373void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
374{
376 return;
377
378 Unit* target = aurApp->GetTarget();
379
380 if (GetMiscValue() < -2 || GetMiscValue() > 4)
381 {
382 SF_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
383 return;
384 }
385
386 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
387 {
388 // -1 or -2 is all stats (misc < -2 checked in function beginning)
389 if (GetMiscValue() < 0 || GetMiscValue() == i)
390 {
391 //target->ApplyStatMod(Stats(i), m_amount, apply);
393 if (target->GetTypeId() == TypeID::TYPEID_PLAYER || target->ToCreature()->IsPet())
394 target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
395 }
396 }
397}
398
399void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
400{
402 return;
403
404 Unit* target = aurApp->GetTarget();
405
406 if (GetMiscValue() < -1 || GetMiscValue() > 4)
407 {
408 SF_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
409 return;
410 }
411
412 // only players have base stats
413 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
414 return;
415
416 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
417 {
418 if (GetMiscValue() == i || GetMiscValue() == -1)
420 }
421}
422
423void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
424{
426 return;
427
428 Unit* target = aurApp->GetTarget();
429
430 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
431 return;
432
433 // Magic damage modifiers implemented in Unit::SpellDamageBonus
434 // This information for client side use only
435 // Recalculate bonus
437}
438
439void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
440{
442 return;
443
444 Unit* target = aurApp->GetTarget();
445
446 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
447 return;
448
449 // Recalculate bonus
451}
452
453void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
454{
456 return;
457
458 Unit* target = aurApp->GetTarget();
459
460 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
461 return;
462 // implemented in Unit::SpellHealingBonus
463 // this information is for client side only
465}
466
467void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
468{
470 return;
471
472 Unit* target = aurApp->GetTarget();
473
474 // save current health state
475 float healthPct = target->GetHealthPct();
476 bool alive = target->IsAlive();
477
478 for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
479 {
480 if (GetMiscValueB() & 1 << i || !GetMiscValueB()) // 0 is also used for all stats
481 {
482 target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
483 if (target->GetTypeId() == TypeID::TYPEID_PLAYER || target->ToCreature()->IsPet())
484 target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
485 }
486 }
487
488 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
489 // this check is total bullshit i think
490 if (GetMiscValueB() & 1 << STAT_STAMINA && (m_spellInfo->Attributes & SPELL_ATTR0_ABILITY))
491 target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
492}
493
494void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
495{
497 return;
498
499 Unit* target = aurApp->GetTarget();
500
501 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
502 return;
503
506}
507
508/********************************/
509/*** HEAL & ENERGIZE ***/
510/********************************/
511
512void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
513{
515 return;
516
517 Unit* target = aurApp->GetTarget();
518
519 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
520 return;
521
522 // Update manaregen value
523 if (GetMiscValue() == POWER_MANA)
524 target->ToPlayer()->UpdateManaRegen();
525 else if (GetMiscValue() == POWER_RUNES)
527 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
528}
529
530void AuraEffect::HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
531{
532 HandleModPowerRegen(aurApp, mode, apply);
533}
534
535void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
536{
538 return;
539
540 Unit* target = aurApp->GetTarget();
541
542 if (apply)
543 {
544 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
545 target->ModifyHealth(GetAmount());
546 }
547 else
548 {
549 if (int32(target->GetHealth()) > GetAmount())
550 target->ModifyHealth(-GetAmount());
551 else
552 target->SetHealth(1);
553 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
554 }
555}
556
557void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
558{
560 return;
561
562 Unit* target = aurApp->GetTarget();
563
564 uint32 oldhealth = target->GetHealth();
565 double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth();
566
567 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(GetAmount()), apply);
568
569 // refresh percentage
570 if (oldhealth > 0)
571 {
572 uint32 newhealth = uint32(ceil((double)target->GetMaxHealth() * healthPercentage));
573 if (newhealth == 0)
574 newhealth = 1;
575
576 target->SetHealth(newhealth);
577 }
578}
579
580void AuraEffect::HandleAuraModIncreaseMaxPowerFlat(AuraApplication const* aurApp, uint8 mode, bool apply) const
581{
583 return;
584
585 Unit* target = aurApp->GetTarget();
586
587 Powers powerType = Powers(GetMiscValue());
588 // do not check power type, we can always modify the maximum
589 // as the client will not see any difference
590 // also, placing conditions that may change during the aura duration
591 // inside effect handlers is not a good idea
592 //if (int32(powerType) != GetMiscValue())
593 // return;
594
595 UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + UnitMods(powerType));
596
597 target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
598}
599
601{
603 return;
604
605 Unit* target = aurApp->GetTarget();
606
607 Powers powerType = Powers(GetMiscValue());
608 // do not check power type, we can always modify the maximum
609 // as the client will not see any difference
610 // also, placing conditions that may change during the aura duration
611 // inside effect handlers is not a good idea
612 //if (int32(powerType) != GetMiscValue())
613 // return;
614
615 UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + UnitMods(powerType));
616 float amount = float(GetAmount());
617
618 if (apply)
619 {
620 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
621 target->ModifyPowerPct(powerType, amount, apply);
622 }
623 else
624 {
625 target->ModifyPowerPct(powerType, amount, apply);
626 target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
627 }
628}
629
631{
633 return;
634
635 Unit* target = aurApp->GetTarget();
636
637 // Unit will keep hp% after MaxHealth being modified if unit is alive.
638 float percent = target->GetHealthPct();
639 target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply);
640 if (target->IsAlive())
641 target->SetHealth(target->CountPctFromMaxHealth(int32(percent)));
642}
643
645{
647 return;
648
649 Unit* target = aurApp->GetTarget();
650
651 target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(GetAmount()), apply);
652}
653
654/********************************/
655/*** FIGHT ***/
656/********************************/
657
658void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
659{
661 return;
662
663 Unit* target = aurApp->GetTarget();
664
665 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
666 return;
667
668 target->ToPlayer()->UpdateParryPercentage();
669}
670
671void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
672{
674 return;
675
676 Unit* target = aurApp->GetTarget();
677
678 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
679 return;
680
681 target->ToPlayer()->UpdateDodgePercentage();
682}
683
684void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
685{
687 return;
688
689 Unit* target = aurApp->GetTarget();
690
691 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
692 return;
693
694 target->ToPlayer()->UpdateBlockPercentage();
695}
696
697void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
698{
700 return;
701
702 Unit* target = aurApp->GetTarget();
703
704 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
705 return;
706
707 target->ToPlayer()->UpdateManaRegen();
708}
709
710void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
711{
713 return;
714
715 Unit* target = aurApp->GetTarget();
716
717 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
718 return;
719
721 for (int i = 0; i < maxAttackType; ++i)
722 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
723 target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
724
725 // mods must be applied base at equipped weapon class and subclass comparison
726 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
727 // GetMiscValue() comparison with item generated damage types
728
729 if (GetSpellInfo()->EquippedItemClass == -1)
730 {
731 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float(GetAmount()), apply);
734 }
735 else
736 {
737 // done in Player::_ApplyWeaponDependentAuraMods
738 }
739}
740
741void AuraEffect::HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
742{
744 return;
745
746 Unit* target = aurApp->GetTarget();
747
748 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
749 {
750 target->ToPlayer()->UpdateMeleeHitChances();
751 target->ToPlayer()->UpdateRangedHitChances();
752 }
753 else
754 {
755 target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
756 target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
757 }
758}
759
760void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
761{
763 return;
764
765 Unit* target = aurApp->GetTarget();
766
767 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
768 target->ToPlayer()->UpdateSpellHitChances();
769 else
770 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
771}
772
773void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
774{
776 return;
777
778 Unit* target = aurApp->GetTarget();
779
780 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
782 else
783 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
784}
785
786void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
787{
789 return;
790
791 Unit* target = aurApp->GetTarget();
792
793 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
794 {
795 target->m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
796 return;
797 }
798
799 target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float(GetAmount()), apply);
802
803 // included in Player::UpdateSpellCritChance calculation
805}
806
807/********************************/
808/*** ATTACK SPEED ***/
809/********************************/
810
811void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
812{
814 return;
815
816 Unit* target = aurApp->GetTarget();
817
818 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
819}
820
821void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
822{
824 return;
825
827 Unit* target = aurApp->GetTarget();
828
832}
833
834void AuraEffect::HandleModCombatSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
835{
837 return;
838
839 Unit* target = aurApp->GetTarget();
840
841 target->ApplyCastTimePercentMod(float(m_amount), apply);
845}
846
847void AuraEffect::HandleModAttackSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
848{
850 return;
851
852 Unit* target = aurApp->GetTarget();
853
856}
857
858void AuraEffect::HandleModMeleeSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
859{
861 return;
862
864 Unit* target = aurApp->GetTarget();
865
868}
869
870void AuraEffect::HandleAuraModRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
871{
873 return;
874
876 Unit* target = aurApp->GetTarget();
877
879}
880
881/********************************/
882/*** COMBAT RATING ***/
883/********************************/
884
885void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const
886{
888 return;
889
890 Unit* target = aurApp->GetTarget();
891
892 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
893 return;
894
895 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
896 if (GetMiscValue() & (1 << rating))
897 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
898}
899
900void AuraEffect::HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
901{
903 return;
904
905 Unit* target = aurApp->GetTarget();
906
907 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
908 return;
909
910 // Just recalculate ratings
911 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
912 if (GetMiscValue() & (1 << rating))
913 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
914}
915
916/********************************/
917/*** ATTACK POWER ***/
918/********************************/
919
920void AuraEffect::HandleAuraModAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
921{
923 return;
924
925 Unit* target = aurApp->GetTarget();
926
928}
929
930void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
931{
933 return;
934
935 Unit* target = aurApp->GetTarget();
936
937 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
938 return;
939
941}
942
943void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
944{
946 return;
947
948 Unit* target = aurApp->GetTarget();
949
950 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
952}
953
955{
957 return;
958
959 Unit* target = aurApp->GetTarget();
960
961 if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
962 return;
963
964 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
966}
967
968/********************************/
969/*** DAMAGE BONUS ***/
970/********************************/
971
972void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
973{
975 return;
976
977 Unit* target = aurApp->GetTarget();
978
979 // apply item specific bonuses for already equipped weapon
980 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
981 {
983 for (int i = 0; i < maxAttackType; ++i)
984 if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
985 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
986 }
987
988 // GetMiscValue() is bitmask of spell schools
989 // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
990 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
991 // 127 - full bitmask any damages
992 //
993 // mods must be applied base at equipped weapon class and subclass comparison
994 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
995 // GetMiscValue() comparison with item generated damage types
996
998 {
999 // apply generic physical damage bonuses including wand case
1000 if (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TypeID::TYPEID_PLAYER)
1001 {
1005
1006 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1007 {
1008 if (GetAmount() > 0)
1010 else
1012 }
1013 }
1014 else
1015 {
1016 // done in Player::_ApplyWeaponDependentAuraMods
1017 }
1018 }
1019
1020 // Skip non magic case for speedup
1022 return;
1023
1024 if (GetSpellInfo()->EquippedItemClass != -1 || GetSpellInfo()->EquippedItemInventoryTypeMask != 0)
1025 {
1026 // wand magic case (skip generic to all item spell bonuses)
1027 // done in Player::_ApplyWeaponDependentAuraMods
1028
1029 // Skip item specific requirements for not wand magic damage
1030 return;
1031 }
1032
1033 // Magic damage modifiers implemented in Unit::SpellDamageBonus
1034 // This information for client side use only
1035 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1036 {
1037 if (GetAmount() > 0)
1038 {
1039 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
1040 {
1041 if ((GetMiscValue() & (1 << i)) != 0)
1043 }
1044 }
1045 else
1046 {
1047 for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
1048 {
1049 if ((GetMiscValue() & (1 << i)) != 0)
1051 }
1052 }
1053 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
1054 pet->UpdateAttackPowerAndDamage();
1055 }
1056}
1057
1058void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
1059{
1061 return;
1062
1063 Unit* target = aurApp->GetTarget();
1064 if (!target)
1065 return;
1066
1067 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1068 {
1069 uint8 maxAttackType = uint8(WeaponAttackType::MAX_ATTACK);
1070 for (int i = 0; i < maxAttackType; ++i)
1071 if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
1072 target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
1073 }
1074
1075 if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TypeID::TYPEID_PLAYER))
1076 {
1080
1081 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1083 }
1084 else
1085 {
1086 // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
1087 }
1088}
1089
1090void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
1091{
1093 return;
1094
1095 Unit* target = aurApp->GetTarget();
1096
1098}
1099
1100void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mode, bool apply) const
1101{
1103 return;
1104
1105 Unit* target = aurApp->GetTarget();
1106
1107 BaseModType modType = FLAT_MOD;
1109 modType = PCT_MOD;
1110
1111 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
1112 target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
1113}
1114
1115/********************************/
1116/*** POWER COST ***/
1117/********************************/
1118
1119void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
1120{
1122 return;
1123
1124 Unit* target = aurApp->GetTarget();
1125
1126 float amount = CalculatePct(1.0f, GetAmount());
1127 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
1128 if (GetMiscValue() & (1 << i))
1130}
1131
1132void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const
1133{
1135 return;
1136
1137 Unit* target = aurApp->GetTarget();
1138
1139 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
1140 if (GetMiscValue() & (1 << i))
1142}
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::int8_t int8
Definition Define.h:75
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ TYPEID_PLAYER
Definition Object.h:55
#define sOutdoorPvPMgr
RuneType
Definition Player.h:485
#define MAX_STATS
@ SPELL_ATTR0_ABILITY
Powers
@ POWER_RUNES
@ POWER_MANA
SpellSchools
@ SPELL_SCHOOL_NORMAL
@ SPELL_SCHOOL_HOLY
#define CLASSMASK_WAND_USERS
@ SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
@ SPELL_ATTR2_DAMAGE_REDUCED_SHIELD
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ IMMUNITY_DAMAGE
@ IMMUNITY_MECHANIC
@ IMMUNITY_SCHOOL
Stats
@ STAT_STRENGTH
@ STAT_STAMINA
@ MECHANIC_BANISH
#define MAX_SPELL_SCHOOL
DispelType
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_SCHOOL_MASK_MAGIC
@ SPELL_SCHOOL_MASK_SPELL
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
@ AURA_EFFECT_HANDLE_STAT
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
@ AURA_EFFECT_HANDLE_REAL
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
Definition Unit.h:61
BaseModType
Definition Unit.h:495
@ FLAT_MOD
Definition Unit.h:496
@ PCT_MOD
Definition Unit.h:497
WeaponAttackType
Definition Unit.h:572
UnitMods
Definition Unit.h:439
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:473
@ UNIT_MOD_ARMOR
Definition Unit.h:463
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:470
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:479
@ UNIT_MOD_HEALTH
Definition Unit.h:445
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:474
@ UNIT_MOD_POWER_START
Definition Unit.h:481
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:472
@ UNIT_MOD_STAT_START
Definition Unit.h:477
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:471
#define MAX_COMBAT_RATING
Definition Unit.h:610
@ OFFHAND_CRIT_PERCENTAGE
Definition Unit.h:489
@ SHIELD_BLOCK_VALUE
Definition Unit.h:490
@ CRIT_PERCENTAGE
Definition Unit.h:487
@ RANGED_CRIT_PERCENTAGE
Definition Unit.h:488
@ AURA_REMOVE_BY_DEFAULT
Definition Unit.h:407
@ BASE_VALUE
Definition Unit.h:384
@ TOTAL_VALUE
Definition Unit.h:386
@ TOTAL_PCT
Definition Unit.h:387
@ BASE_PCT
Definition Unit.h:385
CombatRating
Definition Unit.h:580
@ UNIT_STATE_ISOLATED
Definition Unit.h:525
@ UNIT_FIELD_POWER_COST_MODIFIER
@ UNIT_FIELD_POWER_COST_MULTIPLIER
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PERCENT
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
T CalculatePct(T base, U pct)
Definition Util.h:103
Unit * GetTarget() const
Definition SpellAuras.h:54
bool IsPositive() const
Definition SpellAuras.h:61
void HandleAuraModBlockPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModHealingDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRatingFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDispelImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellInfo const * GetSpellInfo() const
AuraType GetAuraType() const
void HandleModDamagePercentDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModEffectImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerCostPCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCombatSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModResistanceExclusive(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDodgePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDmgImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDamageDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSchoolImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModWeaponCritPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRating(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraIncreaseBaseHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
uint32 GetId() const
void HandleAuraModRangedHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModBaseResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerCost(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModStateImmunityMask(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModStateImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValueB() const
void HandleAuraModExpertise(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModOffhandDamagePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeRangedSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCastingSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMaxHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTargetResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValue() const
void HandleModTotalPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellCritChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
Aura * GetBase() const
uint32 GetEffIndex() const
void HandleAuraModParryPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMaxPowerFlat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellDamagePercentFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShieldBlockValue(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellInfo const *const m_spellInfo
void HandleAuraModAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModBaseResistancePCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellHealingPercentFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellHitChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRegenInterrupt(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModResistancePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMechanicImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerRegenPCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModAttackSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModCritPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModHitChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseEnergyPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetAmount() const
Definition Item.h:202
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:1238
Player * ToPlayer()
Definition Object.h:204
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:1231
TypeID GetTypeId() const
Definition Object.h:131
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:1222
Creature * ToCreature()
Definition Object.h:207
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:1245
void UpdateParryPercentage()
void UpdateAllSpellCritChances()
void UpdateRuneRegen(RuneType rune)
void UpdateDodgePercentage()
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5966
void UpdateBlockPercentage()
bool InBattleground() const
Definition Player.h:2692
void UpdateManaRegen()
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:8779
void UpdateSpellHitChances()
void UpdateExpertise(WeaponAttackType attType)
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const *aura, bool apply)
Definition Player.cpp:8756
Battleground * GetBattleground() const
Definition Player.cpp:19212
void UpdateSpellDamageAndHealingBonus()
void UpdateMeleeHitChances()
void UpdateRangedHitChances()
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
Definition Player.cpp:5767
uint32 Id
Definition SpellInfo.h:160
SpellSchoolMask GetSchoolMask() const
Definition Unit.h:1367
int32 ModifyHealth(int32 val)
Definition Unit.cpp:4023
void ClearUnitState(uint32 f)
Definition Unit.h:1489
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:2243
float GetHealthPct() const
Definition Unit.h:1629
virtual void UpdateDamagePhysical(WeaponAttackType attType)=0
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=NULL) const
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply)
Definition Unit.cpp:1584
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:1376
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition Unit.cpp:1597
bool IsPet() const
Definition Unit.h:1511
uint32 GetMaxHealth() const
Definition Unit.h:1604
bool IsAlive() const
Definition Unit.h:2032
float m_modRangedHitChance
Definition Unit.h:2388
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
Definition Unit.cpp:1602
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:6074
void SetHealth(uint32 val)
Definition Unit.cpp:5162
void AddUnitState(uint32 f)
Definition Unit.h:1481
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition Unit.cpp:4955
int32 m_baseSpellCritChance
Definition Unit.h:2390
uint32 GetHealth() const
Definition Unit.h:1600
float m_modMeleeHitChance
Definition Unit.h:2387
int32 ModifyPowerPct(Powers power, float pct, bool apply=true)
Definition Unit.cpp:4114
void RemoveAurasByType(AuraType auraType, uint64 casterGUID=0, Aura *except=NULL, bool negative=true, bool positive=true)
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:6106
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:3580
uint32 getClassMask() const
Definition Unit.h:1547
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1633
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:2204
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:1383
void ApplySpellDispelImmunity(const SpellInfo *spellProto, DispelType type, bool apply)
Definition Unit.cpp:3611
float m_modSpellHitChance
Definition Unit.h:2389
Guardian * GetGuardianPet() const
Definition Unit.cpp:2390
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition Unit.cpp:1579
uint8 GetDefaultAuraStateImmunityAuraTypes(int32 miscValue, uint32 *auraTypes, uint8 maxAuraTypes)
uint8 const MAX_AURA_IMMUNITY_AURA_TYPES
uint32 GetAuraImmunityMechanicMask(AuraImmunityMechanicMask mechanicMask)
MechanicImmunitySpellRule const * GetMechanicImmunitySpellRule(uint32 auraSpellId)
AuraStateImmunityRule const * GetAuraStateImmunityRule(int32 miscValue, uint32 auraSpellId, int32 amount)