TrinityCore
spell_pet.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore 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 <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Scripts for spells with SPELLFAMILY_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_dk_".
22 */
23
24#include "ScriptMgr.h"
25#include "ObjectMgr.h"
26#include "Pet.h"
27#include "Player.h"
28#include "SpellAuraEffects.h"
29#include "SpellMgr.h"
30#include "SpellScript.h"
31
33{
44};
45
47{
59 ENTRY_IMP = 416,
61};
62
64{
71};
72
74{
79};
80
82{
87};
88
90{
91 public:
92 spell_gen_pet_calculate() : SpellScriptLoader("spell_gen_pet_calculate") { }
93
95 {
96 bool Load() override
97 {
98 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
99 return false;
100 return true;
101 }
102
103 void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
104 {
105 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
106 {
107 // For others recalculate it from:
108 float CritSpell = 5.0f;
109 // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
110 CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
111 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
112 CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
113 // Increase crit spell from spell crit ratings
114 CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
115
116 amount += int32(CritSpell);
117 }
118 }
119
120 void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
121 {
122 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
123 {
124 // For others recalculate it from:
125 float CritMelee = 5.0f;
126 // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
127 CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
128 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
129 CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
130 // Increase crit melee from melee crit ratings
131 CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
132
133 amount += int32(CritMelee);
134 }
135 }
136
137 void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
138 {
139 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
140 {
141 // For others recalculate it from:
142 float HitMelee = 0.0f;
143 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
144 HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
145 // Increase hit melee from meele hit ratings
146 HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
147
148 amount += int32(HitMelee);
149 }
150 }
151
152 void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
153 {
154 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
155 {
156 // For others recalculate it from:
157 float HitSpell = 0.0f;
158 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
159 HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
160 // Increase hit spell from spell hit ratings
161 HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
162
163 amount += int32(HitSpell);
164 }
165 }
166
167 void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
168 {
169 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
170 {
171 // For others recalculate it from:
172 float Expertise = 0.0f;
173 // Increase hit from SPELL_AURA_MOD_EXPERTISE
174 Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
175 // Increase Expertise from Expertise ratings
176 Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
177
178 amount += int32(Expertise);
179 }
180 }
181
182 void Register() override
183 {
184 switch (m_scriptSpellId)
185 {
189 break;
193 break;
199 break;
201// case SPELL_SHAMAN_PET_HIT:
204 break;
205 default:
206 break;
207 }
208 }
209 };
210
211 AuraScript* GetAuraScript() const override
212 {
214 }
215};
216
218{
219public:
220 spell_warl_pet_scaling_01() : SpellScriptLoader("spell_warl_pet_scaling_01") { }
221
223 {
224 public:
226 {
227 _tempBonus = 0;
228 }
229
230 private:
231 bool Load() override
232 {
233 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
234 return false;
235 return true;
236 }
237
238 void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
239 {
240 if (Unit* pet = GetUnitOwner())
241 if (pet->IsPet())
242 if (Unit* owner = pet->ToPet()->GetOwner())
243 {
244 float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
245
246 amount += ownerBonus;
247 }
248 }
249
250 void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
251 {
252 if (Unit* pet = GetUnitOwner())
253 if (_tempBonus)
254 {
255 PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->GetLevel());
256 uint32 healthMod = 0;
257 uint32 baseHealth = pInfo->health;
258 switch (pet->GetEntry())
259 {
260 case ENTRY_IMP:
261 healthMod = uint32(_tempBonus * 8.4f);
262 break;
263 case ENTRY_FELGUARD:
264 case ENTRY_VOIDWALKER:
265 healthMod = _tempBonus * 11;
266 break;
267 case ENTRY_SUCCUBUS:
268 healthMod = uint32(_tempBonus * 9.1f);
269 break;
270 case ENTRY_FELHUNTER:
271 healthMod = uint32(_tempBonus * 9.5f);
272 break;
273 default:
274 healthMod = 0;
275 break;
276 }
277 if (healthMod)
278 pet->ToPet()->SetCreateHealth(baseHealth + healthMod);
279 }
280 }
281
282 void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
283 {
284 if (Unit* pet = GetUnitOwner())
285 if (pet->IsPet())
286 {
287 PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->GetLevel());
288 pet->ToPet()->SetCreateHealth(pInfo->health);
289 }
290 }
291
292 void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
293 {
294 if (Unit* pet = GetUnitOwner())
295 if (pet->IsPet())
296
297 if (Player* owner = pet->ToPet()->GetOwner())
298 {
299 int32 fire = owner->m_activePlayerData->ModDamageDonePos[SPELL_SCHOOL_FIRE] - owner->m_activePlayerData->ModDamageDoneNeg[SPELL_SCHOOL_FIRE];
300 int32 shadow = owner->m_activePlayerData->ModDamageDonePos[SPELL_SCHOOL_SHADOW] - owner->m_activePlayerData->ModDamageDoneNeg[SPELL_SCHOOL_SHADOW];
301 int32 maximum = (fire > shadow) ? fire : shadow;
302 if (maximum < 0)
303 maximum = 0;
304 float bonusAP = maximum * 0.57f;
305
306 amount += bonusAP;
307
308 // Glyph of felguard
309 if (pet->GetEntry() == ENTRY_FELGUARD)
310 {
311 if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
312 {
313 float base_attPower = pet->GetFlatModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetPctModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
314 amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
315 }
316 }
317 }
318 }
319
320 void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
321 {
322 if (Unit* pet = GetUnitOwner())
323 if (pet->IsPet())
324 if (Player* owner = pet->ToPet()->GetOwner())
325 {
326 //the damage bonus used for pets is either fire or shadow damage, whatever is higher
327 int32 fire = owner->m_activePlayerData->ModDamageDonePos[SPELL_SCHOOL_FIRE] - owner->m_activePlayerData->ModDamageDoneNeg[SPELL_SCHOOL_FIRE];
328 int32 shadow = owner->m_activePlayerData->ModDamageDonePos[SPELL_SCHOOL_SHADOW] - owner->m_activePlayerData->ModDamageDoneNeg[SPELL_SCHOOL_SHADOW];
329 int32 maximum = (fire > shadow) ? fire : shadow;
330 float bonusDamage = 0.0f;
331
332 if (maximum > 0)
333 bonusDamage = maximum * 0.15f;
334
335 amount += bonusDamage;
336 }
337 }
338
339 void Register() override
340 {
346 }
347
348 private:
350 };
351
352 AuraScript* GetAuraScript() const override
353 {
355 }
356};
357
359{
360public:
361 spell_warl_pet_scaling_02() : SpellScriptLoader("spell_warl_pet_scaling_02") { }
362
364 {
365 public:
367 {
368 _tempBonus = 0;
369 }
370
371 private:
372 bool Load() override
373 {
374 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
375 return false;
376 return true;
377 }
378
379 void CalculateIntellectAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
380 {
381 if (Unit* pet = GetUnitOwner())
382 if (pet->IsPet())
383 if (Unit* owner = pet->ToPet()->GetOwner())
384 {
385 int32 const ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
386
387 amount += ownerBonus;
388 _tempBonus = ownerBonus;
389 }
390 }
391
392 void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
393 {
394 if (Unit* pet = GetUnitOwner())
395 if (_tempBonus)
396 {
397 PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->GetLevel());
398 uint32 manaMod = 0;
399 uint32 baseMana = pInfo->mana;
400 switch (pet->GetEntry())
401 {
402 case ENTRY_IMP:
403 manaMod = uint32(_tempBonus * 4.9f);
404 break;
405 case ENTRY_VOIDWALKER:
406 case ENTRY_SUCCUBUS:
407 case ENTRY_FELHUNTER:
408 case ENTRY_FELGUARD:
409 manaMod = uint32(_tempBonus * 11.5f);
410 break;
411 default:
412 manaMod = 0;
413 break;
414 }
415 if (manaMod)
416 pet->ToPet()->SetCreateMana(baseMana + manaMod);
417 }
418 }
419
420 void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
421 {
422 if (Unit* pet = GetUnitOwner())
423 if (pet->IsPet())
424 {
425 PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->GetLevel());
426 pet->ToPet()->SetCreateMana(pInfo->mana);
427 }
428 }
429
430 void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
431 {
432 if (Unit* pet = GetUnitOwner())
433 if (pet->IsPet())
434 if (Unit* owner = pet->ToPet()->GetOwner())
435 {
436 int32 const ownerBonus = CalculatePct(owner->GetArmor(), 35);
437 amount += ownerBonus;
438 }
439 }
440
441 void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
442 {
443 if (Unit* pet = GetUnitOwner())
444 if (pet->IsPet())
445 if (Unit* owner = pet->ToPet()->GetOwner())
446 {
447 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_FIRE), 40);
448 amount += ownerBonus;
449 }
450 }
451
452 void Register() override
453 {
459 }
460
461 private:
463 };
464
465 AuraScript* GetAuraScript() const override
466 {
468 }
469};
470
472{
473public:
474 spell_warl_pet_scaling_03() : SpellScriptLoader("spell_warl_pet_scaling_03") { }
475
477 {
478 bool Load() override
479 {
480 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
481 return false;
482 return true;
483 }
484
485 void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
486 {
487 if (Unit* pet = GetUnitOwner())
488 if (pet->IsPet())
489 if (Unit* owner = pet->ToPet()->GetOwner())
490 {
491 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_FROST), 40);
492 amount += ownerBonus;
493 }
494 }
495
496 void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
497 {
498 if (Unit* pet = GetUnitOwner())
499 if (pet->IsPet())
500 if (Unit* owner = pet->ToPet()->GetOwner())
501 {
502 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_ARCANE), 40);
503 amount += ownerBonus;
504 }
505 }
506
507 void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
508 {
509 if (Unit* pet = GetUnitOwner())
510 if (pet->IsPet())
511 if (Unit* owner = pet->ToPet()->GetOwner())
512 {
513 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_NATURE), 40);
514 amount += ownerBonus;
515 }
516 }
517
518 void Register() override
519 {
523 }
524 };
525
526 AuraScript* GetAuraScript() const override
527 {
529 }
530};
531
533{
534public:
535 spell_warl_pet_scaling_04() : SpellScriptLoader("spell_warl_pet_scaling_04") { }
536
538 {
539 bool Load() override
540 {
541 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
542 return false;
543 return true;
544 }
545
546 void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
547 {
548 if (Unit* pet = GetUnitOwner())
549 if (pet->IsPet())
550 if (Unit* owner = pet->ToPet()->GetOwner())
551 {
552 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_SHADOW), 40);
553 amount += ownerBonus;
554 }
555 }
556
557 void Register() override
558 {
560 }
561 };
562
563 AuraScript* GetAuraScript() const override
564 {
566 }
567};
568
570{
571public:
572 spell_warl_pet_scaling_05() : SpellScriptLoader("spell_warl_pet_scaling_05") { }
573
575 {
576 bool Load() override
577 {
578 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
579 return false;
580 return true;
581 }
582
583 void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
584 {
585 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
586 {
587 // For others recalculate it from:
588 float HitMelee = 0.0f;
589 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
590 HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
591 // Increase hit spell from spell hit ratings
592 HitMelee += owner->GetRatingBonusValue(CR_HIT_SPELL);
593
594 amount += int32(HitMelee);
595 }
596 }
597
598 void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
599 {
600 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
601 {
602 // For others recalculate it from:
603 float HitSpell = 0.0f;
604 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
605 HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
606 // Increase hit spell from spell hit ratings
607 HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
608
609 amount += int32(HitSpell);
610 }
611 }
612
613 void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
614 {
615 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
616 {
617 // For others recalculate it from:
618 float Expertise = 0.0f;
619 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
620 Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
621 // Increase hit spell from spell hit ratings
622 Expertise += owner->GetRatingBonusValue(CR_HIT_SPELL);
623
624 amount += int32(Expertise);
625 }
626 }
627
628 void Register() override
629 {
633 }
634 };
635
636 AuraScript* GetAuraScript() const override
637 {
639 }
640};
641
643{
644public:
645 spell_warl_pet_passive() : SpellScriptLoader("spell_warl_pet_passive") { }
646
648 {
649 bool Load() override
650 {
651 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
652 return false;
653 return true;
654 }
655
656 void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
657 {
658 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
659 {
660 // For others recalculate it from:
661 float CritSpell = 5.0f;
662 // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
663 CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
664 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
665 CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
666 // Increase crit spell from spell crit ratings
667 CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
668
669 if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
670 if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
671 if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
672 amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount());
673 }
674 }
675
676 void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
677 {
678 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
679 {
680 // For others recalculate it from:
681 float CritMelee = 5.0f;
682 // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
683 CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
684 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
685 CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
686 // Increase crit melee from melee crit ratings
687 CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
688
689 if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
690 if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
691 if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
692 amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount());
693 }
694 }
695
696 void Register() override
697 {
700 }
701 };
702
703 AuraScript* GetAuraScript() const override
704 {
706 }
707};
708// this doesnt actually fit in here
710{
711public:
712 spell_warl_pet_passive_damage_done() : SpellScriptLoader("spell_warl_pet_passive_damage_done") { }
713
715 {
716 bool Load() override
717 {
718 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
719 return false;
720 return true;
721 }
722
723 void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
724 {
725 if (!GetCaster() || !GetCaster()->GetOwner())
726 return;
727 if (GetCaster()->GetOwner()->ToPlayer())
728 {
729 switch (GetCaster()->GetEntry())
730 {
731 case ENTRY_VOIDWALKER:
732 amount += -16;
733 break;
734 case ENTRY_FELHUNTER:
735 amount += -20;
736 break;
737 case ENTRY_SUCCUBUS:
738 case ENTRY_FELGUARD:
739 amount += 5;
740 break;
741 }
742 }
743 }
744
745 void Register() override
746 {
749 }
750 };
751
752 AuraScript* GetAuraScript() const override
753 {
755 }
756};
757
759{
760public:
761 spell_warl_pet_passive_voidwalker() : SpellScriptLoader("spell_warl_pet_passive_voidwalker") { }
762
764 {
765 bool Load() override
766 {
767 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
768 return false;
769 return true;
770 }
771
772 void CalculateAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
773 {
774 if (Unit* pet = GetUnitOwner())
775 if (pet->IsPet())
776 if (Unit* owner = pet->ToPet()->GetOwner())
777 if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0))
778 amount += /* aurEff */ect->GetAmount();
779 }
780
781 void Register() override
782 {
784 }
785 };
786
787 AuraScript* GetAuraScript() const override
788 {
790 }
791};
792
794{
795public:
796 spell_sha_pet_scaling_04() : SpellScriptLoader("spell_sha_pet_scaling_04") { }
797
799 {
800 bool Load() override
801 {
802 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
803 return false;
804 return true;
805 }
806
807 void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
808 {
809 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
810 {
811 // For others recalculate it from:
812 float HitMelee = 0.0f;
813 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
814 HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
815 // Increase hit melee from meele hit ratings
816 HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
817
818 amount += int32(HitMelee);
819 }
820 }
821
822 void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
823 {
824 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
825 {
826 // For others recalculate it from:
827 float HitSpell = 0.0f;
828 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
829 HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
830 // Increase hit spell from spell hit ratings
831 HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
832
833 amount += int32(HitSpell);
834 }
835 }
836
837 void Register() override
838 {
841 }
842 };
843
844 AuraScript* GetAuraScript() const override
845 {
847 }
848};
849
851{
852public:
853 spell_hun_pet_scaling_01() : SpellScriptLoader("spell_hun_pet_scaling_01") { }
854
856 {
857 public:
859 {
860 _tempHealth = 0;
861 }
862
863 private:
864 void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
865 {
866 if (Unit* pet = GetUnitOwner())
867 if (pet->IsPet())
868 if (Unit* owner = pet->ToPet()->GetOwner())
869 {
870 float mod = 0.45f;
871
872 PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
873 if (itr == pet->ToPet()->m_spells.end())
874 itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
875
876 if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
877 {
878 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, GetCastDifficulty()); // Then get the SpellProto and add the dummy effect value
879 AddPct(mod, spellInfo->GetEffect(EFFECT_0).CalcValue());
880 }
881
882 int32 const ownerBonus = owner->GetStat(STAT_STAMINA) * mod;
883 amount += ownerBonus;
884 }
885 }
886
887 void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
888 {
889 if (Unit* pet = GetUnitOwner())
890 if (_tempHealth)
891 pet->SetHealth(_tempHealth);
892 }
893
894 void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
895 {
896 if (Unit* pet = GetUnitOwner())
897 _tempHealth = pet->GetHealth();
898 }
899
900 void CalculateAttackPowerAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
901 {
902 if (Unit* pet = GetUnitOwner())
903 {
904 if (!pet->IsPet())
905 return;
906
907 Unit* owner = pet->ToPet()->GetOwner();
908 if (!owner)
909 return;
910
911 float mod = 1.0f; //Hunter contribution modifier
912 float bonusAP = 0.0f;
913
914 PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
915 if (itr == pet->ToPet()->m_spells.end())
916 itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
917
918 if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
919 {
920 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, GetCastDifficulty()); // Then get the SpellProto and add the dummy effect value
921 mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1).CalcValue());
922 }
923
924 bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
925
926 amount += bonusAP;
927 }
928 }
929
930 void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
931 {
932 if (Unit* pet = GetUnitOwner())
933 {
934 if (!pet->IsPet())
935 return;
936
937 Unit* owner = pet->ToPet()->GetOwner();
938 if (!owner)
939 return;
940
941 float mod = 1.0f; //Hunter contribution modifier
942 float bonusDamage = 0.0f;
943
944 PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
945 if (itr == pet->ToPet()->m_spells.end())
946 itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
947
948 if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
949 {
950 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, GetCastDifficulty()); // Then get the SpellProto and add the dummy effect value
951 mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1).CalcValue());
952 }
953
954 bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
955
956 amount += bonusDamage;
957 }
958 }
959
960 void Register() override
961 {
967 }
968
969 private:
971 };
972
973 AuraScript* GetAuraScript() const override
974 {
976 }
977};
978
980{
981public:
982 spell_hun_pet_scaling_02() : SpellScriptLoader("spell_hun_pet_scaling_02") { }
983
985 {
986 bool Load() override
987 {
988 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
989 return false;
990 return true;
991 }
992
993 void CalculateFrostResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
994 {
995 if (Unit* pet = GetUnitOwner())
996 {
997 if (!pet->IsPet())
998 return;
999
1000 Unit* owner = pet->ToPet()->GetOwner();
1001 if (!owner)
1002 return;
1003
1004 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_FROST), 40);
1005 amount += ownerBonus;
1006 }
1007 }
1008
1009 void CalculateFireResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1010 {
1011 if (Unit* pet = GetUnitOwner())
1012 {
1013 if (!pet->IsPet())
1014 return;
1015
1016 Unit* owner = pet->ToPet()->GetOwner();
1017 if (!owner)
1018 return;
1019
1020 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_FIRE), 40);
1021 amount += ownerBonus;
1022 }
1023 }
1024
1025 void CalculateNatureResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1026 {
1027 if (Unit* pet = GetUnitOwner())
1028 {
1029 if (!pet->IsPet())
1030 return;
1031
1032 Unit* owner = pet->ToPet()->GetOwner();
1033 if (!owner)
1034 return;
1035
1036 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_NATURE), 40);
1037 amount += ownerBonus;
1038 }
1039 }
1040
1041 void Register() override
1042 {
1046 }
1047 };
1048
1049 AuraScript* GetAuraScript() const override
1050 {
1052 }
1053};
1054
1056{
1057public:
1058 spell_hun_pet_scaling_03() : SpellScriptLoader("spell_hun_pet_scaling_03") { }
1059
1061 {
1062 bool Load() override
1063 {
1064 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1065 return false;
1066 return true;
1067 }
1068
1069 void CalculateShadowResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1070 {
1071 if (Unit* pet = GetUnitOwner())
1072 {
1073 if (!pet->IsPet())
1074 return;
1075
1076 Unit* owner = pet->ToPet()->GetOwner();
1077 if (!owner)
1078 return;
1079
1080 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_SHADOW), 40);
1081 amount += ownerBonus;
1082 }
1083 }
1084
1085 void CalculateArcaneResistanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1086 {
1087 if (Unit* pet = GetUnitOwner())
1088 {
1089 if (!pet->IsPet())
1090 return;
1091
1092 Unit* owner = pet->ToPet()->GetOwner();
1093 if (!owner)
1094 return;
1095
1096 int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_MASK_ARCANE), 40);
1097 amount += ownerBonus;
1098 }
1099 }
1100
1101 void CalculateArmorAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1102 {
1103 if (Unit* pet = GetUnitOwner())
1104 {
1105 if (!pet->IsPet())
1106 return;
1107
1108 Unit* owner = pet->ToPet()->GetOwner();
1109 if (!owner)
1110 return;
1111
1112 int32 const ownerBonus = CalculatePct(owner->GetArmor(), 35);
1113 amount += ownerBonus;
1114 }
1115 }
1116
1117 void Register() override
1118 {
1122 }
1123 };
1124
1125 AuraScript* GetAuraScript() const override
1126 {
1128 }
1129};
1130
1132{
1133public:
1134 spell_hun_pet_scaling_04() : SpellScriptLoader("spell_hun_pet_scaling_04") { }
1135
1137 {
1138 bool Load() override
1139 {
1140 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1141 return false;
1142 return true;
1143 }
1144
1145 void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1146 {
1147 if (!GetCaster() || !GetCaster()->GetOwner())
1148 return;
1149 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1150 {
1151 // For others recalculate it from:
1152 float HitMelee = 0.0f;
1153 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
1154 HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
1155 // Increase hit melee from meele hit ratings
1156 HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
1157
1158 amount += int32(HitMelee);
1159 }
1160 }
1161
1162 void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1163 {
1164 if (!GetCaster() || !GetCaster()->GetOwner())
1165 return;
1166 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1167 {
1168 // For others recalculate it from:
1169 float HitSpell = 0.0f;
1170 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
1171 HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
1172 // Increase hit spell from spell hit ratings
1173 HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
1174
1175 amount += int32(HitSpell);
1176 }
1177 }
1178
1179 void CalculateAmountExpertise(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1180 {
1181 if (!GetCaster() || !GetCaster()->GetOwner())
1182 return;
1183 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1184 {
1185 // For others recalculate it from:
1186 float Expertise = 0.0f;
1187 // Increase hit from SPELL_AURA_MOD_EXPERTISE
1188 Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
1189 // Increase Expertise from Expertise ratings
1190 Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
1191
1192 amount += int32(Expertise);
1193 }
1194 }
1195
1196 void Register() override
1197 {
1201 }
1202 };
1203
1204 AuraScript* GetAuraScript() const override
1205 {
1207 }
1208};
1209
1211{
1212public:
1213 spell_hun_pet_passive_crit() : SpellScriptLoader("spell_hun_pet_passive_crit") { }
1214
1216 {
1217 bool Load() override
1218 {
1219 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1220 return false;
1221 return true;
1222 }
1223
1224 void CalculateAmountCritSpell(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1225 {
1226 if (!GetCaster() || !GetCaster()->GetOwner())
1227 return;
1228 if (GetCaster()->GetOwner()->ToPlayer())
1229 {
1230 // For others recalculate it from:
1231 float CritSpell = 5.0f;
1232 // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
1233 // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
1234 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
1235 // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
1236 // Increase crit spell from spell crit ratings
1237 // CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
1238
1239 amount += (CritSpell*0.8f);
1240 }
1241 }
1242
1243 void CalculateAmountCritMelee(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1244 {
1245 if (!GetCaster() || !GetCaster()->GetOwner())
1246 return;
1247 if (GetCaster()->GetOwner()->ToPlayer())
1248 {
1249 // For others recalculate it from:
1250 float CritMelee = 5.0f;
1251 // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
1252 // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
1253 // Increase crit from SPELL_AURA_MOD_CRIT_PCT
1254 // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
1255 // Increase crit melee from melee crit ratings
1256 // CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
1257
1258 amount += (CritMelee*0.8f);
1259 }
1260 }
1261
1262 void Register() override
1263 {
1266 }
1267 };
1268
1269 AuraScript* GetAuraScript() const override
1270 {
1272 }
1273};
1274
1276{
1277public:
1278 spell_hun_pet_passive_damage_done() : SpellScriptLoader("spell_hun_pet_passive_damage_done") { }
1279
1281 {
1282 bool Load() override
1283 {
1284 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1285 return false;
1286 return true;
1287 }
1288
1289 void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1290 {
1291 if (!GetCaster() || !GetCaster()->GetOwner())
1292 return;
1293 if (GetCaster()->GetOwner()->ToPlayer())
1294 {
1295 // Cobra Reflexes
1296 if (AuraEffect* cobraReflexes = GetCaster()->GetAuraEffectOfRankedSpell(61682, EFFECT_0))
1297 amount -= cobraReflexes->GetAmount();
1298 }
1299 }
1300
1301 void Register() override
1302 {
1304 }
1305 };
1306
1307 AuraScript* GetAuraScript() const override
1308 {
1310 }
1311};
1312
1314{
1315public:
1316 spell_hun_animal_handler() : SpellScriptLoader("spell_hun_animal_handler") { }
1317
1319 {
1320 bool Load() override
1321 {
1322 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1323 return false;
1324 return true;
1325 }
1326
1327 void CalculateAmountDamageDone(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1328 {
1329 if (!GetCaster() || !GetCaster()->GetOwner())
1330 return;
1331 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1332 {
1333 if (AuraEffect* /* aurEff */ect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1))
1334 amount = /* aurEff */ect->GetAmount();
1335 else
1336 amount = 0;
1337 }
1338 }
1339
1340 void Register() override
1341 {
1343 }
1344 };
1345
1346 AuraScript* GetAuraScript() const override
1347 {
1349 }
1350};
1351
1353{
1354public:
1355 spell_dk_avoidance_passive() : SpellScriptLoader("spell_dk_avoidance_passive") { }
1356
1358 {
1359 bool Load() override
1360 {
1361 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1362 return false;
1363 return true;
1364 }
1365
1366 void CalculateAvoidanceAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1367 {
1368 if (Unit* pet = GetUnitOwner())
1369 {
1370 if (Unit* owner = pet->GetOwner())
1371 {
1372 // Army of the dead ghoul
1373 if (pet->GetEntry() == ENTRY_ARMY_OF_THE_DEAD_GHOUL)
1374 amount = -90;
1375 // Night of the dead
1376 else if (Aura* aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD))
1377 amount = aur->GetSpellInfo()->GetEffect(EFFECT_2).CalcValue();
1378 }
1379 }
1380 }
1381
1382 void Register() override
1383 {
1385 }
1386 };
1387
1388 AuraScript* GetAuraScript() const override
1389 {
1391 }
1392};
1393
1395{
1396public:
1397 spell_dk_pet_scaling_01() : SpellScriptLoader("spell_dk_pet_scaling_01") { }
1398
1400 {
1401 bool Load() override
1402 {
1403 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1404 return false;
1405 return true;
1406 }
1407
1408 void CalculateStaminaAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1409 {
1410 if (Unit* pet = GetUnitOwner())
1411 {
1412 if (pet->IsGuardian())
1413 {
1414 if (Unit* owner = pet->GetOwner())
1415 {
1416 float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * 0.3f;
1417 amount += ownerBonus;
1418 }
1419 }
1420 }
1421 }
1422
1423 void ApplyEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
1424 {
1425 if (Unit* pet = GetUnitOwner())
1426 if (_tempHealth)
1427 pet->SetHealth(_tempHealth);
1428 }
1429
1430 void RemoveEffect(AuraEffect const* /* aurEff */, AuraEffectHandleModes /*mode*/)
1431 {
1432 if (Unit* pet = GetUnitOwner())
1433 _tempHealth = pet->GetHealth();
1434 }
1435
1436 void CalculateStrengthAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1437 {
1438 if (Unit* pet = GetUnitOwner())
1439 {
1440 if (!pet->IsGuardian())
1441 return;
1442
1443 Unit* owner = pet->GetOwner();
1444 if (!owner)
1445 return;
1446
1447 float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * 0.7f;
1448 amount += ownerBonus;
1449 }
1450 }
1451
1452 void Register() override
1453 {
1458 }
1459
1461 };
1462
1463 AuraScript* GetAuraScript() const override
1464 {
1466 }
1467};
1468
1470{
1471public:
1472 spell_dk_pet_scaling_02() : SpellScriptLoader("spell_dk_pet_scaling_02") { }
1473
1475 {
1476 bool Load() override
1477 {
1478 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1479 return false;
1480 return true;
1481 }
1482
1483 void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1484 {
1485 if (!GetCaster() || !GetCaster()->GetOwner())
1486 return;
1487 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1488 {
1489 // For others recalculate it from:
1490 float HasteMelee = 0.0f;
1491 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
1492 HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
1493
1494 amount += int32(HasteMelee);
1495 }
1496 }
1497
1498 void Register() override
1499 {
1501 }
1502 };
1503
1504 AuraScript* GetAuraScript() const override
1505 {
1507 }
1508};
1509
1511{
1512public:
1513 spell_dk_pet_scaling_03() : SpellScriptLoader("spell_dk_pet_scaling_03") { }
1514
1516 {
1517 bool Load() override
1518 {
1519 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1520 return false;
1521 return true;
1522 }
1523
1524 void CalculateAmountMeleeHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1525 {
1526 if (!GetCaster() || !GetCaster()->GetOwner())
1527 return;
1528 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1529 {
1530 // For others recalculate it from:
1531 float HitMelee = 0.0f;
1532 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
1533 HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
1534 // Increase hit melee from meele hit ratings
1535 HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
1536
1537 amount += int32(HitMelee);
1538 }
1539 }
1540
1541 void CalculateAmountSpellHit(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1542 {
1543 if (!GetCaster() || !GetCaster()->GetOwner())
1544 return;
1545 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1546 {
1547 // For others recalculate it from:
1548 float HitSpell = 0.0f;
1549 // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
1550 HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
1551 // Increase hit spell from spell hit ratings
1552 HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
1553
1554 amount += int32(HitSpell);
1555 }
1556 }
1557
1558 void Register() override
1559 {
1562 }
1563 };
1564
1565 AuraScript* GetAuraScript() const override
1566 {
1568 }
1569};
1570
1572{
1573public:
1574 spell_dk_rune_weapon_scaling_02() : SpellScriptLoader("spell_dk_rune_weapon_scaling_02") { }
1575
1577 {
1578 bool Load() override
1579 {
1580 if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
1581 return false;
1582 return true;
1583 }
1584
1585 void CalculateDamageDoneAmount(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1586 {
1587 if (Unit* pet = GetUnitOwner())
1588 {
1589 Unit* owner = pet->GetOwner();
1590 if (!owner)
1591 return;
1592
1593 if (pet->IsGuardian())
1594 ((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK));
1595
1596 amount += owner->CalculateDamage(BASE_ATTACK, true, true);
1597 }
1598 }
1599
1600 void CalculateAmountMeleeHaste(AuraEffect const* /* aurEff */, int32& amount, bool& /*canBeRecalculated*/)
1601 {
1602 if (!GetCaster() || !GetCaster()->GetOwner())
1603 return;
1604 if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
1605 {
1606 // For others recalculate it from:
1607 float HasteMelee = 0.0f;
1608 // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
1609 HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
1610
1611 amount += int32(HasteMelee);
1612 }
1613 }
1614
1615 void Register() override
1616 {
1619 }
1620 };
1621
1622 AuraScript* GetAuraScript() const override
1623 {
1625 }
1626};
1627
1629{
1631}
T GetEntry(std::unordered_map< uint32, T > const &map, CriteriaTreeEntry const *tree)
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1946
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_SCHOOL_MASK_SHADOW
@ SPELL_SCHOOL_MASK_ARCANE
@ SPELL_SCHOOL_MASK_NATURE
@ SPELL_SCHOOL_MASK_FIRE
@ SPELL_SCHOOL_MASK_FROST
@ BASE_ATTACK
@ RANGED_ATTACK
@ STAT_INTELLECT
@ STAT_STRENGTH
@ STAT_STAMINA
@ SPELL_SCHOOL_SHADOW
@ SPELL_SCHOOL_FIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
@ SPELL_AURA_MOD_ATTACK_POWER
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
@ SPELL_AURA_MOD_SPELL_HIT_CHANCE
@ SPELL_AURA_MELEE_SLOW
@ SPELL_AURA_MOD_RESISTANCE
@ SPELL_AURA_MOD_EXPERTISE
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@ SPELL_AURA_MOD_HIT_CHANCE
@ SPELL_AURA_MOD_STAT
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
@ SPELL_AURA_MOD_CRIT_PCT
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
@ SPELL_AURA_MOD_DAMAGE_DONE
@ SPELL_AURA_MOD_ATTACK_POWER_PCT
#define sSpellMgr
Definition: SpellMgr.h:849
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:2058
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ BASE_VALUE
Definition: Unit.h:152
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:211
@ CR_EXPERTISE
Definition: Unit.h:334
@ CR_HIT_MELEE
Definition: Unit.h:316
@ CR_CRIT_MELEE
Definition: Unit.h:319
@ CR_HIT_SPELL
Definition: Unit.h:318
@ CR_CRIT_SPELL
Definition: Unit.h:321
@ BASE_PCT
Definition: Unit.h:160
T AddPct(T &base, U pct)
Definition: Util.h:85
T CalculatePct(T base, U pct)
Definition: Util.h:72
WorldObject * GetOwner() const
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:2057
Unit * GetCaster() const
Difficulty GetCastDifficulty() const
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:2035
Unit * GetUnitOwner() const
Player * GetOwner() const
Definition: Pet.cpp:1794
PetSpellMap m_spells
Definition: Pet.h:127
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
uint32 m_scriptSpellId
Definition: SpellScript.h:134
Definition: Unit.h:627
Pet * ToPet()
Definition: Unit.h:1750
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const
Definition: Unit.cpp:2392
uint32 GetArmor() const
Definition: Unit.h:762
float GetTotalAttackPowerValue(WeaponAttackType attType, bool includeWeapon=true) const
Definition: Unit.cpp:9285
float GetStat(Stats stat) const
Definition: Unit.h:760
int32 GetResistance(SpellSchools school) const
Definition: Unit.h:769
Unit * GetOwner() const
Definition: Object.cpp:2229
void CalculateAvoidanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1366
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1388
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:1430
void CalculateStaminaAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1408
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:1423
void CalculateStrengthAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1436
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1463
void CalculateAmountMeleeHaste(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1483
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1504
void CalculateAmountMeleeHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1524
void CalculateAmountSpellHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1541
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1565
void CalculateDamageDoneAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1585
void CalculateAmountMeleeHaste(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1600
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1622
void CalculateAmountCritMelee(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:120
void CalculateAmountExpertise(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:167
void CalculateAmountSpellHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:152
void CalculateAmountCritSpell(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:103
void CalculateAmountMeleeHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:137
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:211
void CalculateAmountDamageDone(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1327
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1346
void CalculateAmountCritSpell(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1224
void CalculateAmountCritMelee(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1243
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1269
void CalculateAmountDamageDone(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1289
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1307
void CalculateStaminaAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:864
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:894
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:887
void CalculateDamageDoneAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:930
void CalculateAttackPowerAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:900
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:973
void CalculateFireResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1009
void CalculateFrostResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:993
void CalculateNatureResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1025
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1049
void CalculateArcaneResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1085
void CalculateArmorAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1101
void CalculateShadowResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1069
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1125
void CalculateAmountMeleeHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1145
void CalculateAmountSpellHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1162
void CalculateAmountExpertise(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:1179
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:1204
void CalculateAmountMeleeHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:807
void CalculateAmountSpellHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:822
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:844
void CalculateAmountCritSpell(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:656
void CalculateAmountCritMelee(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:676
void CalculateAmountDamageDone(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:723
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:752
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:787
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:703
void CalculateDamageDoneAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:320
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:282
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:250
void CalculateAttackPowerAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:292
void CalculateStaminaAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:238
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:352
void CalculateFireResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:441
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:420
void CalculateIntellectAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:379
void CalculateArmorAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:430
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:392
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:465
void CalculateArcaneResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:496
void CalculateFrostResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:485
void CalculateNatureResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:507
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:526
void CalculateShadowResistanceAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:546
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:563
void CalculateAmountExpertise(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:613
void CalculateAmountSpellHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:598
void CalculateAmountMeleeHit(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:583
AuraScript * GetAuraScript() const override
Definition: spell_pet.cpp:636
DKPetCalculate
Definition: spell_pet.cpp:64
@ SPELL_NIGHT_OF_THE_DEAD
Definition: spell_pet.cpp:69
@ SPELL_DEATH_KNIGHT_RUNE_WEAPON_02
Definition: spell_pet.cpp:65
@ SPELL_DEATH_KNIGHT_PET_SCALING_02
Definition: spell_pet.cpp:67
@ SPELL_DEATH_KNIGHT_PET_SCALING_03
Definition: spell_pet.cpp:68
@ SPELL_DEATH_KNIGHT_PET_SCALING_01
Definition: spell_pet.cpp:66
@ ENTRY_ARMY_OF_THE_DEAD_GHOUL
Definition: spell_pet.cpp:70
WarlockPetCalculate
Definition: spell_pet.cpp:47
@ SPELL_WARLOCK_PET_SCALING_02
Definition: spell_pet.cpp:51
@ SPELL_WARLOCK_GLYPH_OF_VOIDWALKER
Definition: spell_pet.cpp:60
@ SPELL_PET_PASSIVE_CRIT
Definition: spell_pet.cpp:48
@ SPELL_WARLOCK_PET_SCALING_04
Definition: spell_pet.cpp:53
@ SPELL_WARLOCK_PET_SCALING_01
Definition: spell_pet.cpp:50
@ ENTRY_VOIDWALKER
Definition: spell_pet.cpp:56
@ SPELL_WARLOCK_PET_SCALING_05
Definition: spell_pet.cpp:54
@ SPELL_WARLOCK_PET_SCALING_03
Definition: spell_pet.cpp:52
@ ENTRY_FELGUARD
Definition: spell_pet.cpp:55
@ SPELL_PET_PASSIVE_DAMAGE_TAKEN
Definition: spell_pet.cpp:49
@ ENTRY_IMP
Definition: spell_pet.cpp:59
@ ENTRY_FELHUNTER
Definition: spell_pet.cpp:57
@ ENTRY_SUCCUBUS
Definition: spell_pet.cpp:58
ShamanPetCalculate
Definition: spell_pet.cpp:74
@ SPELL_FERAL_SPIRIT_PET_SCALING_04
Definition: spell_pet.cpp:78
@ SPELL_FERAL_SPIRIT_PET_UNK_03
Definition: spell_pet.cpp:77
@ SPELL_FERAL_SPIRIT_PET_UNK_02
Definition: spell_pet.cpp:76
@ SPELL_FERAL_SPIRIT_PET_UNK_01
Definition: spell_pet.cpp:75
MiscPetCalculate
Definition: spell_pet.cpp:82
@ SPELL_MAGE_PET_PASSIVE_ELEMENTAL
Definition: spell_pet.cpp:83
@ SPELL_PET_UNK_01
Definition: spell_pet.cpp:85
@ SPELL_PET_UNK_02
Definition: spell_pet.cpp:86
@ SPELL_PET_HEALTH_SCALING
Definition: spell_pet.cpp:84
HunterPetCalculate
Definition: spell_pet.cpp:33
@ SPELL_HUNTER_ANIMAL_HANDLER
Definition: spell_pet.cpp:43
@ SPELL_HUNTER_PET_SCALING_02
Definition: spell_pet.cpp:40
@ SPELL_TAMED_PET_PASSIVE_07
Definition: spell_pet.cpp:35
@ SPELL_TAMED_PET_PASSIVE_06
Definition: spell_pet.cpp:34
@ SPELL_TAMED_PET_PASSIVE_08
Definition: spell_pet.cpp:36
@ SPELL_HUNTER_PET_SCALING_03
Definition: spell_pet.cpp:41
@ SPELL_TAMED_PET_PASSIVE_09
Definition: spell_pet.cpp:37
@ SPELL_TAMED_PET_PASSIVE_10
Definition: spell_pet.cpp:38
@ SPELL_HUNTER_PET_SCALING_04
Definition: spell_pet.cpp:42
@ SPELL_HUNTER_PET_SCALING_01
Definition: spell_pet.cpp:39
void AddSC_pet_spell_scripts()
Definition: spell_pet.cpp:1628
uint16 health
Definition: ObjectMgr.h:680
uint16 mana
Definition: ObjectMgr.h:681