TrinityCore
Loading...
Searching...
No Matches
spell_shaman.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_SHAMAN and SPELLFAMILY_GENERIC spells used by shaman players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_sha_".
22 */
23
24#include "ScriptMgr.h"
25#include "GridNotifiers.h"
26#include "Item.h"
27#include "ObjectAccessor.h"
28#include "Map.h"
29#include "Player.h"
30#include "SpellAuraEffects.h"
31#include "SpellHistory.h"
32#include "SpellMgr.h"
33#include "SpellScript.h"
34#include "Unit.h"
35
37{
96};
97
104
105// -51556 - Ancestral Awakening
107{
109
110 bool Validate(SpellInfo const* /*spellInfo*/) override
111 {
113 }
114
115 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
116 {
118 HealInfo* healInfo = eventInfo.GetHealInfo();
119 if (!healInfo || !healInfo->GetHeal())
120 return;
121
122 CastSpellExtraArgs args(aurEff);
123 args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()));
124 eventInfo.GetActor()->CastSpell(nullptr, SPELL_SHAMAN_ANCESTRAL_AWAKENING_DUMMY, args);
125 }
126
131};
132
133// 52759 - Ancestral Awakening (Proc)
135{
137
138 bool Validate(SpellInfo const* /*spellInfo*/) override
139 {
141 }
142
143 void FilterTargets(std::list<WorldObject*>& targets)
144 {
145 if (targets.size() < 2)
146 return;
147
148 targets.sort(Trinity::HealthPctOrderPred());
149
150 WorldObject* target = targets.front();
151 targets.clear();
152 targets.push_back(target);
153 }
154
155 void HandleDummy(SpellEffIndex /*effIndex*/)
156 {
157 Unit* target = GetHitUnit();
158 if (!target)
159 return;
160
164 }
165
171};
172
173// 51474 - Astral Shift
175{
177
178public:
180 {
181 absorbPct = 0;
182 }
183
184private:
186
187 bool Load() override
188 {
190 return true;
191 }
192
193 void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
194 {
195 // Set absorbtion amount to unlimited
196 amount = -1;
197 }
198
199 void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
200 {
201 // reduces all damage taken while stun, fear or silence
202 if (GetTarget()->HasUnitFlag(UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->HasUnitFlag(UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
203 absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
204 }
205
211};
212
213// -51474 - Astral Shift aura
215{
217
218 bool CheckProc(ProcEventInfo& eventInfo)
219 {
220 if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
221 if (spellInfo->GetAllEffectsMechanicMask() & ((1 << MECHANIC_SILENCE) | (1 << MECHANIC_STUN) | (1 << MECHANIC_FEAR)))
222 return true;
223
224 return false;
225 }
226
231};
232
233// 52179 - Astral Shift
235{
237
238 void PeriodicTick(AuraEffect const* /*aurEff*/)
239 {
240 // Periodic needed to remove visual on stun/fear/silence lost
242 Remove();
243 }
244
249};
250
251// 2825 - Bloodlust
253{
255
256 bool Validate(SpellInfo const* /*spellInfo*/) override
257 {
259 }
260
261 void RemoveInvalidTargets(std::list<WorldObject*>& targets)
262 {
263 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SHAMAN_SATED));
264 }
265
267 {
268 if (Unit* target = GetHitUnit())
269 target->CastSpell(target, SPELL_SHAMAN_SATED, true);
270 }
271
278};
279
280// -1064 - Chain Heal
282{
284
285public:
287 {
288 firstHeal = true;
289 riptide = false;
290 }
291
292private:
293 void HandleHeal(SpellEffIndex /*effIndex*/)
294 {
295 if (firstHeal)
296 {
297 // Check if the target has Riptide
298 if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID()))
299 {
300 riptide = true;
301 // Consume it
302 GetHitUnit()->RemoveAura(aurEff->GetBase());
303 }
304 firstHeal = false;
305 }
306 // Riptide increases the Chain Heal effect by 25%
307 if (riptide)
308 SetHitHeal(GetHitHeal() * 1.25f);
309 }
310
315
318};
319
320// 8171 - Cleansing Totem (Pulse)
345
346// 16246 - Clearcasting
348{
350
351 bool Validate(SpellInfo const* /*spellInfo*/) override
352 {
354 }
355
356 // Elemental Oath bonus
357 void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
358 {
359 Unit const* owner = GetUnitOwner();
360 if (Aura const* aura = owner->GetAuraOfRankedSpell(SPELL_SHAMAN_ELEMENTAL_OATH, owner->GetGUID()))
361 amount = aura->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue();
362 }
363
368};
369
370// -974 - Earth Shield
372{
374
375 bool Validate(SpellInfo const* /*spellInfo*/) override
376 {
378 }
379
380 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
381 {
383
384 CastSpellExtraArgs args(aurEff);
386 args.AddSpellBP0(aurEff->GetAmount());
388 }
389
394};
395
396// 6474 - Earthbind Totem - Fix Talent: Earthen Power
398{
400
401 bool Validate(SpellInfo const* /*spellInfo*/) override
402 {
404 }
405
406 void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
407 {
408 if (!GetCaster())
409 return;
410 if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
411 if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0))
412 if (roll_chance_i(aur->GetBaseAmount()))
414 }
415
416 void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
417 {
418 if (!GetCaster())
419 return;
421 if (!owner)
422 return;
423 // Storm, Earth and Fire
425 {
426 if (roll_chance_i(aurEff->GetAmount()))
428 }
429 }
430
436};
437
439{
440 public:
442
444 {
445 if (!target->ToUnit())
446 return true;
447
448 if (!target->ToUnit()->HasAuraWithMechanic(1 << MECHANIC_SNARE))
449 return true;
450
451 return false;
452 }
453};
454
455// 59566 - Earthen Power
470
471// -51940 - Earthliving Weapon (Passive)
473{
475
476 bool Validate(SpellInfo const* /*spellInfo*/) override
477 {
479 }
480
481 bool CheckProc(ProcEventInfo& eventInfo)
482 {
483 int32 chance = 20;
484 Unit* caster = eventInfo.GetActor();
487 chance += aurEff->GetAmount();
488
489 return roll_chance_i(chance);
490 }
491
496};
497
498// -1535 - Fire Nova
500{
502
503 bool Validate(SpellInfo const* spellInfo) override
504 {
505 SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FIRE_NOVA_R1);
506 if (!firstRankSpellInfo || !spellInfo->IsRankOf(firstRankSpellInfo))
507 return false;
508
509 uint8 rank = spellInfo->GetRank();
510 if (!sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank, true))
511 return false;
512 return true;
513 }
514
516 {
517 Unit* caster = GetCaster();
518 // fire totem
519 if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]))
520 {
521 if (!caster->IsWithinDistInMap(totem, caster->GetSpellMaxRangeForTarget(totem, GetSpellInfo())))
523 return SPELL_CAST_OK;
524 }
525 else
526 {
529 }
530 }
531
532 void HandleDummy(SpellEffIndex /*effIndex*/)
533 {
534 Unit* caster = GetCaster();
535 if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]))
536 {
537 uint8 rank = GetSpellInfo()->GetRank();
538 if (totem->IsTotem())
539 caster->CastSpell(totem, sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank), true);
540 }
541 }
542
548};
549
550// -8050 - Flame Shock
552{
554
555 bool Validate(SpellInfo const* /*spell*/) override
556 {
558 }
559
560 void HandleDispel(DispelInfo* /*dispelInfo*/)
561 {
562 if (Unit* caster = GetCaster())
563 // Lava Flows
564 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0))
565 {
566 if (SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_R1))
567 if (!aurEff->GetSpellInfo()->IsRankOf(firstRankSpellInfo))
568 return;
569
570 uint8 rank = aurEff->GetSpellInfo()->GetRank();
571 caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true);
572 }
573 }
574
579};
580
581// -10400 - Flametongue Weapon (Passive)
583{
585
586 bool Validate(SpellInfo const* /*spellInfo*/) override
587 {
589 }
590
591 bool CheckProc(ProcEventInfo& eventInfo)
592 {
593 Player* player = eventInfo.GetActor()->ToPlayer();
594 if (!player)
595 return false;
596
597 Item* item = player->GetItemByGuid(GetAura()->GetCastItemGUID());
598 if (!item || !item->IsEquipped())
599 return false;
600
602 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
603 return false;
604
605 if (((attType == BASE_ATTACK) && !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_MAINHAND_ATTACK)) ||
606 ((attType == OFF_ATTACK) && !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK)))
607 return false;
608
609 return true;
610 }
611
612 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
613 {
615
616 Player* player = eventInfo.GetActor()->ToPlayer();
617 Unit* target = eventInfo.GetActionTarget();
620 attType = OFF_ATTACK;
621
622 Item* item = ASSERT_NOTNULL(player->GetWeaponForAttack(attType));
623
624 float basePoints = aurEff->GetSpellEffectInfo().CalcValue();
625
626 // Flametongue max damage is normalized based on a 4.0 speed weapon
627 // Tooltip says max damage = BasePoints / 25, so BasePoints / 25 / 4 to get base damage per 1.0s AS
628 float attackSpeed = player->GetAttackTime(attType) / 1000.f;
629 float fireDamage = basePoints / 100.0f;
630 fireDamage *= attackSpeed;
631
632 // clip value between (BasePoints / 77) and (BasePoints / 25) as the tooltip indicates
633 RoundToInterval(fireDamage, basePoints / 77.0f, basePoints / 25.0f);
634
635 // Calculate Spell Power scaling
636 float spellPowerBonus = player->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
638
639 // calculate penalty from passive aura as is the one with level
640 float const factorMod = player->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo());
641
642 float const spCoeff = 0.03811f;
643 spellPowerBonus *= spCoeff * attackSpeed * factorMod;
644
645 // All done, now proc damage
646 CastSpellExtraArgs args(aurEff);
647 args
648 .SetCastItem(item)
649 .AddSpellBP0(fireDamage + spellPowerBonus);
650 player->CastSpell(target, SPELL_SHAMAN_FLAMETONGUE_ATTACK, args);
651 }
652
658};
659
660// -63373 - Frozen Power
662{
664
665 bool Validate(SpellInfo const* /*spellInfo*/) override
666 {
668 }
669
670 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
671 {
673
674 if (!roll_chance_i(aurEff->GetAmount()))
675 return;
676
677 Unit* caster = eventInfo.GetActor();
678 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_FREEZE);
679 float minDistance(spellInfo->GetEffect(EFFECT_0).CalcValue(caster));
680
681 Unit* target = eventInfo.GetActionTarget();
682 if (caster->GetDistance(target) < minDistance)
683 return;
684
685 caster->CastSpell(target, SPELL_SHAMAN_FREEZE, aurEff);
686 }
687
692};
693
694// 63279 - Glyph of Earth Shield
696{
698
699 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
700 {
702
703 SpellInfo const* earthShield = eventInfo.GetSpellInfo();
704 if (!earthShield)
705 return;
706
707 AuraEffect* earthShieldEffect = eventInfo.GetActionTarget()->GetAuraEffect(earthShield->Id, EFFECT_0, eventInfo.GetActor()->GetGUID());
708 if (!earthShieldEffect)
709 return;
710
711 int32 amount = earthShieldEffect->GetAmount();
712 AddPct(amount, aurEff->GetAmount());
713 earthShieldEffect->SetAmount(amount);
714 }
715
720};
721
722// 55440 - Glyph of Healing Wave
724{
726
727 bool Validate(SpellInfo const* /*spellInfo*/) override
728 {
730 }
731
732 bool CheckProc(ProcEventInfo& eventInfo)
733 {
734 if (eventInfo.GetActor() == eventInfo.GetActionTarget())
735 return false;
736
737 HealInfo* healInfo = eventInfo.GetHealInfo();
738 return healInfo && healInfo->GetHeal();
739 }
740
741 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
742 {
744
745 CastSpellExtraArgs args(aurEff);
746 args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()));
748 }
749
755};
756
757// 63280 - Glyph of Totem of Wrath
759{
761
762 bool Validate(SpellInfo const* /*spellInfo*/) override
763 {
765 }
766
767 bool CheckProc(ProcEventInfo& eventInfo)
768 {
769 // Totem of Wrath shares family flags with other totems
770 // filter by spellIcon instead
771 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
772 if (!spellInfo || spellInfo->SpellIconID != SHAMAN_ICON_ID_TOTEM_OF_WRATH)
773 return false;
774
775 return true;
776 }
777
778 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
779 {
781
782 Unit* caster = eventInfo.GetActor();
783
784 // Fire totem summon slot
785 Creature* totem = ObjectAccessor::GetCreature(*caster, caster->m_SummonSlot[1]);
786 if (!totem)
787 return;
788
789 SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0]);
790 if (!totemSpell)
791 return;
792
793 int32 bp0 = CalculatePct(totemSpell->GetEffect(EFFECT_0).CalcValue(caster), aurEff->GetAmount());
794 int32 bp1 = CalculatePct(totemSpell->GetEffect(EFFECT_1).CalcValue(caster), aurEff->GetAmount());
795 CastSpellExtraArgs args(aurEff);
796 args.AddSpellBP0(bp0);
799 }
800
806};
807
808// 52041, 52046, 52047, 52048, 52049, 52050, 58759, 58760, 58761 - Healing Stream Totem
810{
812
817
818 void HandleDummy(SpellEffIndex /*effIndex*/)
819 {
820 int32 damage = GetEffectValue();
821 if (Unit* target = GetHitUnit())
822 {
823 Unit* caster = GetCaster();
824 ObjectGuid originalCasterGuid = caster->GetGUID();
825
826 if (Player* player = caster->GetAffectingPlayer())
827 {
828 originalCasterGuid = player->GetGUID();
829
830 // Restorative Totems
832 AddPct(damage, aurEff->GetAmount());
833
834 // Glyph of Healing Stream Totem
835 if (AuraEffect const* aurEff = player->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
836 AddPct(damage, aurEff->GetAmount());
837 }
838
839 CastSpellExtraArgs args(originalCasterGuid);
840 args.AddSpellBP0(damage);
842 }
843 }
844
849};
850
851// 32182 - Heroism
853{
855
856 bool Validate(SpellInfo const* /*spellInfo*/) override
857 {
859 }
860
861 void RemoveInvalidTargets(std::list<WorldObject*>& targets)
862 {
863 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SHAMAN_EXHAUSTION));
864 }
865
867 {
868 if (Unit* target = GetHitUnit())
869 target->CastSpell(target, SPELL_SHAMAN_EXHAUSTION, true);
870 }
871
878};
879
880// -16180 - Improved Water Shield
882{
884
885 bool CheckProc(ProcEventInfo& eventInfo)
886 {
887 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
888 if (!spellInfo)
889 return false;
890
891 // If we're here, we've already passed initial aura roll
892 // So just chance based on 100%
893
894 // Default chance for Healing Wave and Riptide
895 int32 chance = 100;
896 // Lesser Healing Wave - 0.6 of default
897 if (spellInfo->SpellFamilyFlags[0] & 0x00000080)
898 chance = 60;
899 // Chain heal - 0.3 of default
900 else if (spellInfo->SpellFamilyFlags[0] & 0x00000100)
901 chance = 30;
902
903 if (!roll_chance_i(chance))
904 return false;
905
906 return true;
907 }
908
909 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
910 {
912 Unit* caster = eventInfo.GetActor();
913 // Get Water Shield
914 AuraEffect const* waterShield = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x00000000, 0x00000020, 0x00000000, caster->GetGUID());
915 if (!waterShield)
916 return;
917
918 uint32 spellId = waterShield->GetSpellEffectInfo().TriggerSpell;
919 caster->CastSpell(nullptr, spellId, aurEff);
920 }
921
927};
928
929// -30675 - Lightning Overload
931{
933
934 bool Validate(SpellInfo const* /*spellInfo*/) override
935 {
936 return ValidateSpellInfo(
937 {
940 });
941 }
942
943 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
944 {
946
947 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
948 if (!spellInfo)
949 return;
950
951 uint32 spellId;
952
953 // Lightning Bolt
954 if (spellInfo->SpellFamilyFlags[0] & 0x00000001)
955 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LIGHTNING_BOLT_OVERLOAD_R1, spellInfo->GetRank());
956 // Chain Lightning
957 else
958 {
959 // Chain lightning has [LightOverload_Proc_Chance] / [Max_Number_of_Targets] chance to proc of each individual target hit.
960 // A maxed LO would have a 33% / 3 = 11% chance to proc of each target.
961 // LO chance was already "accounted" at the proc chance roll, now need to divide the chance by [Max_Number_of_Targets]
962 float chance = 100.0f / spellInfo->GetEffect(EFFECT_0).ChainTargets;
963 if (!roll_chance_f(chance))
964 return;
965
966 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1, spellInfo->GetRank());
967 }
968
969 eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff);
970 }
971
976};
977
978// 23551 - Lightning Shield T2 Bonus
999
1000// 23552 - Lightning Shield T2 Bonus
1021
1022// 23572 - Mana Surge
1024{
1026
1027 bool Validate(SpellInfo const* /*spellInfo*/) override
1028 {
1030 }
1031
1032 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1033 {
1035 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1036 if (!spellInfo)
1037 return;
1038
1039 int32 mana = spellInfo->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask());
1040
1041 CastSpellExtraArgs args(aurEff);
1042 args.AddSpellBP0(CalculatePct(mana, 35));
1044 }
1045
1050};
1051
1052// 40463 - Shaman Tier 6 Trinket
1054{
1056
1057 bool Validate(SpellInfo const* /*spellInfo*/) override
1058 {
1059 return ValidateSpellInfo(
1060 {
1063 });
1064 }
1065
1066 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1067 {
1069 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1070 if (!spellInfo)
1071 return;
1072
1073 uint32 spellId;
1074 int32 chance;
1075
1076 // Lesser Healing Wave
1077 if (spellInfo->SpellFamilyFlags[0] & 0x00000080)
1078 {
1079 spellId = SPELL_SHAMAN_ENERGY_SURGE;
1080 chance = 10;
1081 }
1082 // Lightning Bolt
1083 else if (spellInfo->SpellFamilyFlags[0] & 0x00000001)
1084 {
1085 spellId = SPELL_SHAMAN_ENERGY_SURGE;
1086 chance = 15;
1087 }
1088 // Stormstrike
1089 else if (spellInfo->SpellFamilyFlags[1] & 0x00000010)
1090 {
1091 spellId = SPELL_SHAMAN_POWER_SURGE;
1092 chance = 50;
1093 }
1094 else
1095 return;
1096
1097 if (roll_chance_i(chance))
1098 eventInfo.GetActor()->CastSpell(nullptr, spellId, aurEff);
1099 }
1100
1105};
1106
1107// 70811 - Item - Shaman T10 Elemental 2P Bonus
1109{
1111
1112 bool Validate(SpellInfo const* /*spellInfo*/) override
1113 {
1115 }
1116
1117 void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
1118 {
1120 if (Player* target = GetTarget()->ToPlayer())
1121 target->GetSpellHistory()->ModifyCooldown(SPELL_SHAMAN_ELEMENTAL_MASTERY, -aurEff->GetAmount());
1122 }
1123
1128};
1129
1130// 60103 - Lava Lash
1132{
1134
1135 bool Load() override
1136 {
1137 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
1138 }
1139
1140 void HandleDummy(SpellEffIndex /*effIndex*/)
1141 {
1142 if (Player* caster = GetCaster()->ToPlayer())
1143 {
1144 int32 damage = GetEffectValue();
1145 int32 hitDamage = GetHitDamage();
1146 if (Item* offhand = caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
1147 {
1148 // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
1149 if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
1150 if (aurEff->GetBase()->GetCastItemGUID() == offhand->GetGUID())
1151 AddPct(hitDamage, damage);
1152 SetHitDamage(hitDamage);
1153 }
1154 }
1155 }
1156
1161
1162};
1163
1164// -324 - Lightning Shield
1166{
1168
1169 bool Validate(SpellInfo const* /*spellInfo*/) override
1170 {
1172 }
1173
1174 bool CheckProc(ProcEventInfo& eventInfo)
1175 {
1176 if (eventInfo.GetActionTarget())
1177 return true;
1178 return false;
1179 }
1180
1181 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1182 {
1184 uint32 triggerSpell = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LIGHTNING_SHIELD_R1, aurEff->GetSpellInfo()->GetRank());
1185
1186 eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), triggerSpell, aurEff);
1187 }
1188
1194};
1195
1196// 53817 - Maelstrom Weapon
1198{
1200
1201 bool Validate(SpellInfo const* /*spellInfo*/) override
1202 {
1203 return ValidateSpellInfo(
1204 {
1207 });
1208 }
1209
1210 void HandleBonus(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1211 {
1212 if (GetStackAmount() < GetSpellInfo()->StackAmount)
1213 return;
1214
1215 Unit* caster = GetUnitOwner();
1217 if (!aurEff || !roll_chance_i(aurEff->GetAmount()))
1218 return;
1219
1220 caster->CastSpell(nullptr, SPELL_SHAMAN_MAELSTROM_POWER, aurEff);
1221 }
1222
1227};
1228
1229// 52031, 52033, 52034, 52035, 52036, 58778, 58779, 58780 - Mana Spring Totem
1231{
1233
1234 bool Validate(SpellInfo const* /*spellInfo*/) override
1235 {
1237 }
1238
1239 void HandleDummy(SpellEffIndex /*effIndex*/)
1240 {
1241 if (Unit* target = GetHitUnit())
1242 if (Unit* caster = GetCaster())
1243 if (target->GetPowerType() == POWER_MANA)
1244 {
1245 CastSpellExtraArgs args(GetOriginalCaster()->GetGUID());
1247 caster->CastSpell(target, SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE, args);
1248 }
1249 }
1250
1255
1256};
1257
1258// 16191 - Mana Tide
1260{
1262
1263 bool Validate(SpellInfo const* spellInfo) override
1264 {
1265 return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
1266 }
1267
1268 void PeriodicTick(AuraEffect const* aurEff)
1269 {
1271
1272 CastSpellExtraArgs args(aurEff);
1273 args.AddSpellBP0(aurEff->GetAmount());
1274 GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args);
1275 }
1276
1281};
1282
1283// 39610 - Mana Tide Totem
1285{
1287
1288 bool Validate(SpellInfo const* /*spellInfo*/) override
1289 {
1291 }
1292
1293 void HandleDummy(SpellEffIndex /*effIndex*/)
1294 {
1295 if (Unit* caster = GetCaster())
1296 {
1297 if (Unit* unitTarget = GetHitUnit())
1298 {
1299 if (unitTarget->GetPowerType() == POWER_MANA)
1300 {
1301 int32 effValue = GetEffectValue();
1302 // Glyph of Mana Tide
1303 if (Unit* owner = caster->GetOwner())
1304 if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_MANA_TIDE, 0))
1305 effValue += dummy->GetAmount();
1306 // Regenerate 6% of Total Mana Every 3 secs
1307 CastSpellExtraArgs args(GetOriginalCaster()->GetGUID());
1308 args.AddSpellBP0(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue));
1309 caster->CastSpell(unitTarget, SPELL_SHAMAN_MANA_TIDE_TOTEM, args);
1310 }
1311 }
1312 }
1313 }
1314
1319};
1320
1321// -30881 - Nature's Guardian
1323{
1325
1326 bool Validate(SpellInfo const* /*spellInfo*/) override
1327 {
1328 return ValidateSpellInfo(
1329 {
1332 });
1333 }
1334
1335 bool CheckProc(ProcEventInfo& eventInfo)
1336 {
1337 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1338 if (!damageInfo || !damageInfo->GetDamage())
1339 return false;
1340
1341 int32 healthpct = GetEffectInfo(EFFECT_1).CalcValue();
1342 if (Unit* target = eventInfo.GetActionTarget())
1343 if (target->HealthBelowPctDamaged(healthpct, damageInfo->GetDamage()))
1344 return true;
1345
1346 return false;
1347 }
1348
1349 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1350 {
1352
1353 Unit* target = eventInfo.GetActionTarget();
1354 CastSpellExtraArgs args(aurEff);
1355 args.AddSpellBP0(CalculatePct(target->GetMaxHealth(), aurEff->GetAmount()));
1356 target->CastSpell(target, SPELL_SHAMAN_NATURE_GUARDIAN, args);
1357 if (Unit* attacker = eventInfo.GetActor())
1358 target->CastSpell(attacker, SPELL_SHAMAN_NATURE_GUARDIAN_THREAT, true);
1359 }
1360
1366};
1367
1368// 6495 - Sentry Totem
1370{
1372
1373 bool Validate(SpellInfo const* /*spell*/) override
1374 {
1376 }
1377
1378 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1379 {
1380 if (Unit* caster = GetCaster())
1381 if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[4]))
1382 if (totem->IsTotem())
1383 caster->CastSpell(totem, SPELL_SHAMAN_BIND_SIGHT, true);
1384 }
1385
1386 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1387 {
1388 if (Unit* caster = GetCaster())
1389 if (caster->GetTypeId() == TYPEID_PLAYER)
1390 caster->ToPlayer()->StopCastingBindSight();
1391 }
1392
1398};
1399
1400// 30823 - Shamanistic Rage
1402{
1404
1405 bool Validate(SpellInfo const* /*spellInfo*/) override
1406 {
1408 }
1409
1410 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
1411 {
1413
1414 Unit* target = GetTarget();
1415 int32 amount = CalculatePct(static_cast<int32>(target->GetTotalAttackPowerValue(BASE_ATTACK)), aurEff->GetAmount());
1416 CastSpellExtraArgs args(aurEff);
1417 args.AddSpellBP0(amount);
1418 target->CastSpell(target, SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC, args);
1419 }
1420
1425};
1426
1427// 55278, 55328, 55329, 55330, 55332, 55333, 55335, 58589, 58590, 58591 - Stoneclaw Totem
1429{
1431
1433 {
1434 Unit* target = GetHitUnit();
1435
1436 // Cast Absorb on totems
1437 for (uint8 slot = SUMMON_SLOT_TOTEM_FIRE; slot < MAX_TOTEM_SLOT; ++slot)
1438 {
1439 if (!target->m_SummonSlot[slot])
1440 continue;
1441
1442 Creature* totem = target->GetMap()->GetCreature(target->m_SummonSlot[slot]);
1443 if (totem && totem->IsTotem())
1444 {
1448 }
1449 }
1450
1451 // Glyph of Stoneclaw Totem
1453 {
1455 args.AddSpellMod(SPELLVALUE_BASE_POINT0, GetEffectValue() * aur->GetAmount());
1457 }
1458 }
1459
1464};
1465
1466// 58877 - Spirit Hunt
1468{
1470
1471 bool Validate(SpellInfo const* /*spellInfo*/) override
1472 {
1474 }
1475
1476 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1477 {
1479 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1480 if (!damageInfo || !damageInfo->GetDamage())
1481 return;
1482
1483 Unit* caster = eventInfo.GetActor();
1484 Unit* target = caster->GetOwner();
1485 if (!target)
1486 return;
1487
1488 CastSpellExtraArgs args(aurEff);
1489 args.AddSpellBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount()));
1490 caster->CastSpell(caster, SPELL_SHAMAN_SPIRIT_HUNT_HEAL, args);
1491 caster->CastSpell(target, SPELL_SHAMAN_SPIRIT_HUNT_HEAL, args);
1492 }
1493
1498};
1499
1500// -51525 - Static Shock
1502{
1504
1505 bool Validate(SpellInfo const* /*spellInfo*/) override
1506 {
1508 }
1509
1510 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1511 {
1513
1514 Unit* caster = eventInfo.GetActor();
1515
1516 // Get Lightning Shield
1517 AuraEffect const* lightningShield = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x00000400, 0x00000000, 0x00000000, caster->GetGUID());
1518 if (!lightningShield)
1519 return;
1520
1521 uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1, lightningShield->GetSpellInfo()->GetRank());
1522 eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff);
1523 lightningShield->GetBase()->DropCharge();
1524 }
1525
1530};
1531
1532// 55198 - Tidal Force
1534{
1536
1537 bool Validate(SpellInfo const* /*spellInfo*/) override
1538 {
1540 }
1541
1542 void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
1543 {
1546 }
1547
1552};
1553
1554// -51490 - Thunderstorm
1571
1572// 38443 - Totemic Mastery (Tier 6 - 2P)
1574{
1576
1577 bool Validate(SpellInfo const* /*spellInfo*/) override
1578 {
1580 }
1581
1582 void HandleDummy(AuraEffect const* aurEff)
1583 {
1584 Unit* target = GetTarget();
1585 for (uint8 i = SUMMON_SLOT_TOTEM_FIRE; i < MAX_TOTEM_SLOT; ++i)
1586 if (!target->m_SummonSlot[i])
1587 return;
1588
1589 target->CastSpell(target, SPELL_SHAMAN_TOTEMIC_MASTERY, aurEff);
1591 }
1592
1597};
1598
1599// 28823 - Totemic Power
1601{
1603
1614
1615 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1616 {
1618
1619 uint32 spellId;
1620 Unit* caster = eventInfo.GetActor();
1621 Unit* target = eventInfo.GetActionTarget();
1622
1623 switch (target->GetClass())
1624 {
1625 case CLASS_PALADIN:
1626 case CLASS_PRIEST:
1627 case CLASS_SHAMAN:
1628 case CLASS_DRUID:
1630 break;
1631 case CLASS_MAGE:
1632 case CLASS_WARLOCK:
1634 break;
1635 case CLASS_HUNTER:
1636 case CLASS_ROGUE:
1638 break;
1639 case CLASS_WARRIOR:
1641 break;
1642 default:
1643 return;
1644 }
1645
1646 caster->CastSpell(target, spellId, aurEff);
1647 }
1648
1653};
1654
1655// 28820 - Lightning Shield
1657{
1659
1660 void PeriodicTick(AuraEffect const* /*aurEff*/)
1661 {
1663
1664 // Need remove self if Lightning Shield not active
1665 if (!GetTarget()->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0))
1666 Remove();
1667 }
1668
1673};
1674
1675// 64928 - Item - Shaman T8 Elemental 4P Bonus
1677{
1679
1680 bool Validate(SpellInfo const* /*spellInfo*/) override
1681 {
1683 }
1684
1685 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1686 {
1688
1689 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1690 if (!damageInfo || !damageInfo->GetDamage())
1691 return;
1692
1693 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_ELECTRIFIED);
1694 int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
1695
1696 ASSERT(spellInfo->GetMaxTicks() > 0);
1697 amount /= spellInfo->GetMaxTicks();
1698
1699 Unit* caster = eventInfo.GetActor();
1700 Unit* target = eventInfo.GetActionTarget();
1701
1702 CastSpellExtraArgs args(aurEff);
1703 args.AddSpellBP0(amount);
1704 caster->CastSpell(target, SPELL_SHAMAN_ELECTRIFIED, args);
1705 }
1706
1711};
1712
1713// 67228 - Item - Shaman T9 Elemental 4P Bonus (Lava Burst)
1715{
1717
1718 bool Validate(SpellInfo const* /*spellInfo*/) override
1719 {
1721 }
1722
1723 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1724 {
1726
1727 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1728 if (!damageInfo || !damageInfo->GetDamage())
1729 return;
1730
1731 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE);
1732 int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
1733
1734 ASSERT(spellInfo->GetMaxTicks() > 0);
1735 amount /= spellInfo->GetMaxTicks();
1736
1737 Unit* caster = eventInfo.GetActor();
1738 Unit* target = eventInfo.GetActionTarget();
1739
1740 CastSpellExtraArgs args(aurEff);
1741 args.AddSpellBP0(amount);
1742 caster->CastSpell(target, SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, args);
1743 }
1744
1749};
1750
1751// 70817 - Item - Shaman T10 Elemental 4P Bonus
1753{
1755
1756 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1757 {
1759
1760 Unit* caster = eventInfo.GetActor();
1761 Unit* target = eventInfo.GetActionTarget();
1762
1763 // try to find spell Flame Shock on the target
1764 AuraEffect* flameShock = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x00000000, 0x00000000, caster->GetGUID());
1765 if (!flameShock)
1766 return;
1767
1768 Aura* flameShockAura = flameShock->GetBase();
1769
1770 int32 maxDuration = flameShockAura->GetMaxDuration();
1771 int32 newDuration = flameShockAura->GetDuration() + aurEff->GetAmount() * IN_MILLISECONDS;
1772
1773 flameShockAura->SetDuration(newDuration);
1774 // is it blizzlike to change max duration for FS?
1775 if (newDuration > maxDuration)
1776 flameShockAura->SetMaxDuration(newDuration);
1777 }
1778
1783};
1784
1785// 70808 - Item - Shaman T10 Restoration 4P Bonus
1787{
1789
1790 bool Validate(SpellInfo const* /*spellInfo*/) override
1791 {
1793 }
1794
1795 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1796 {
1798
1799 HealInfo* healInfo = eventInfo.GetHealInfo();
1800 if (!healInfo || !healInfo->GetHeal())
1801 return;
1802
1803 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_CHAINED_HEAL);
1804 int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount());
1805
1806 ASSERT(spellInfo->GetMaxTicks() > 0);
1807 amount /= spellInfo->GetMaxTicks();
1808
1809 Unit* caster = eventInfo.GetActor();
1810 Unit* target = eventInfo.GetActionTarget();
1811
1812 CastSpellExtraArgs args(aurEff);
1813 args.AddSpellBP0(amount);
1814 caster->CastSpell(target, SPELL_SHAMAN_CHAINED_HEAL, args);
1815 }
1816
1821};
1822
1823// 33757 - Windfury Weapon (Passive)
1825{
1827
1828 bool Validate(SpellInfo const* /*spellInfo*/) override
1829 {
1830 return ValidateSpellInfo(
1831 {
1835 });
1836 }
1837
1838 bool CheckProc(ProcEventInfo& eventInfo)
1839 {
1840 Player* player = eventInfo.GetActor()->ToPlayer();
1841 if (!player)
1842 return false;
1843
1844 Item* item = player->GetItemByGuid(GetAura()->GetCastItemGUID());
1845 if (!item || !item->IsEquipped())
1846 return false;
1847
1848 WeaponAttackType attType = static_cast<WeaponAttackType>(player->GetAttackBySlot(item->GetSlot()));
1849 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
1850 return false;
1851
1852 if (((attType == BASE_ATTACK) && !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_MAINHAND_ATTACK)) ||
1853 ((attType == OFF_ATTACK) && !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK)))
1854 return false;
1855
1856 return true;
1857 }
1858
1859 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1860 {
1862
1863 Player* player = eventInfo.GetActor()->ToPlayer();
1864
1865 uint32 spellId = 0;
1866 WeaponAttackType attType = BASE_ATTACK;
1869
1871 {
1873 attType = OFF_ATTACK;
1874 }
1875
1876 Item* item = ASSERT_NOTNULL(player->GetWeaponForAttack(attType));
1877
1878 int32 enchantId = static_cast<int32>(item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT));
1879 int32 extraAttackPower = 0;
1880 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_WINDFURY_WEAPON_R1);
1881 while (spellInfo)
1882 {
1883 if (spellInfo->GetEffect(EFFECT_0).MiscValue == enchantId)
1884 {
1885 extraAttackPower = spellInfo->GetEffect(EFFECT_1).CalcValue(player);
1886 break;
1887 }
1888 spellInfo = spellInfo->GetNextRankSpell();
1889 }
1890
1891 if (!extraAttackPower)
1892 return;
1893
1894 // Value gained from additional AP
1895 int32 amount = static_cast<int32>(extraAttackPower / 14.f * player->GetAttackTime(attType) / 1000.f);
1896
1897 CastSpellExtraArgs args(aurEff);
1898 args.AddSpellBP0(amount);
1899 // Attack twice
1900 for (uint8 i = 0; i < 2; ++i)
1901 player->CastSpell(eventInfo.GetActionTarget(), spellId, args);
1902 }
1903
1909};
1910
1912{
1964}
@ IN_MILLISECONDS
Definition Common.h:35
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define ASSERT_NOTNULL(pointer)
Definition Errors.h:84
#define ASSERT
Definition Errors.h:68
@ TEMP_ENCHANTMENT_SLOT
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:568
#define INVENTORY_SLOT_BAG_0
Definition Player.h:547
bool roll_chance_f(float chance)
Definition Random.h:53
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_HEAL
@ SPELL_EFFECT_KNOCK_BACK
@ TARGET_UNIT_SRC_AREA_ALLY
@ TARGET_UNIT_CASTER_AREA_RAID
@ SPELL_SCHOOL_MASK_FIRE
WeaponAttackType
@ OFF_ATTACK
@ BASE_ATTACK
@ CLASS_HUNTER
@ CLASS_DRUID
@ CLASS_SHAMAN
@ CLASS_PRIEST
@ CLASS_WARRIOR
@ CLASS_WARLOCK
@ CLASS_MAGE
@ CLASS_PALADIN
@ CLASS_ROGUE
@ MECHANIC_FEAR
@ MECHANIC_STUN
@ MECHANIC_SNARE
@ MECHANIC_SILENCE
@ SPELLFAMILY_SHAMAN
@ SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM
@ POWER_MANA
#define MAX_TOTEM_SLOT
@ SUMMON_SLOT_TOTEM_FIRE
@ AURA_STATE_HEALTHLESS_35_PERCENT
#define EFFECT_ALL
SpellCastResult
@ SPELL_FAILED_CUSTOM_ERROR
@ SPELL_FAILED_OUT_OF_RANGE
@ SPELL_CAST_OK
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_ADD_PCT_MODIFIER
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
@ SPELL_AURA_MOD_DAMAGE_TAKEN
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT1
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:738
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition SpellMgr.h:148
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition SpellMgr.h:149
#define SpellCheckCastFn(F)
#define AuraEffectProcFn(F, I, N)
#define SpellEffectFn(F, I, N)
#define AuraEffectCalcAmountFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectAbsorbFn(F, I)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraCheckProcFn(F)
#define SpellHitFn(F)
#define AuraDispelFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_FLAG_STUNNED
@ UNIT_FLAG_FLEEING
@ UNIT_FLAG_SILENCED
T AddPct(T &base, U pct)
Definition Util.h:77
T RoundToInterval(T &num, T floor, T ceil)
Definition Util.h:89
T CalculatePct(T base, U pct)
Definition Util.h:71
SpellInfo const * GetSpellInfo() const
SpellEffectInfo const & GetSpellEffectInfo() const
void SetAmount(int32 amount)
Aura * GetBase() const
int32 GetAmount() const
void PreventDefaultAction()
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
SpellInfo const * GetSpellInfo() const
HookList< EffectApplyHandler > AfterEffectApply
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Unit * GetCaster() const
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
HookList< EffectAbsorbHandler > OnEffectAbsorb
Aura * GetAura() const
Unit * GetTarget() const
ObjectGuid GetCasterGUID() const
HookList< CheckProcHandler > DoCheckProc
HookList< AuraDispelHandler > AfterDispel
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
uint8 GetStackAmount() const
HookList< EffectApplyHandler > OnEffectApply
int32 GetMaxDuration() const
Definition SpellAuras.h:143
int32 GetDuration() const
Definition SpellAuras.h:148
void SetDuration(int32 duration, bool withMods=false)
void SetMaxDuration(int32 duration)
Definition SpellAuras.h:144
bool DropCharge(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.h:160
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:229
uint32 GetDamage() const
Definition Unit.h:464
bool operator()(WorldObject *target)
uint32 GetHeal() const
Definition Unit.h:492
Definition Item.h:62
uint8 GetSlot() const
Definition Item.h:126
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:148
bool IsEquipped() const
Definition Item.cpp:716
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:4397
static Unit * ToUnit(Object *o)
Definition Object.h:192
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
static Player * ToPlayer(Object *o)
Definition Object.h:180
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition Player.cpp:9607
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9518
static WeaponAttackType GetAttackBySlot(uint8 slot)
Definition Player.cpp:9654
HealInfo * GetHealInfo() const
Definition Unit.h:520
SpellSchoolMask GetSchoolMask() const
Definition Unit.cpp:279
Unit * GetActionTarget() const
Definition Unit.h:509
uint32 GetTypeMask() const
Definition Unit.h:511
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:268
Unit * GetActor()
Definition Unit.h:508
DamageInfo * GetDamageInfo() const
Definition Unit.h:519
uint32 TriggerSpell
Definition SpellInfo.h:228
uint32 ChainTargets
Definition SpellInfo.h:226
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
bool IsRankOf(SpellInfo const *spellInfo) const
uint32 GetMaxTicks() const
flag96 SpellFamilyFlags
Definition SpellInfo.h:357
uint32 Id
Definition SpellInfo.h:289
uint8 GetRank() const
int32 CalcPowerCost(WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
uint32 SpellIconID
Definition SpellInfo.h:349
SpellInfo const * GetNextRankSpell() const
HookList< CheckCastHandler > OnCheckCast
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
void SetCustomCastResultMessage(SpellCustomErrors result)
int32 GetHitHeal() const
void SetHitDamage(int32 damage)
void SetHitHeal(int32 heal)
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Unit * GetOriginalCaster() const
Definition Unit.h:769
float CalculateSpellpowerCoefficientLevelPenalty(SpellInfo const *spellInfo) const
Definition Unit.cpp:2326
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4457
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
uint8 GetClass() const
Definition Unit.h:895
uint32 GetMaxHealth() const
Definition Unit.h:914
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4359
bool HasAuraWithMechanic(uint32 mechanicMask) const
Definition Unit.cpp:4602
int32 GetTotalAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask) const
Definition Unit.cpp:4812
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition Unit.cpp:5815
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4373
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3800
uint32 GetAttackTime(WeaponAttackType att) const
Definition Unit.cpp:8471
bool IsTotem() const
Definition Unit.h:886
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
Definition Unit.cpp:6987
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition Unit.h:1487
float GetTotalAttackPowerValue(WeaponAttackType attType) const
Definition Unit.cpp:9312
Map * GetMap() const
Definition Object.h:449
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
Unit * GetOwner() const
Definition Object.cpp:2180
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Object.cpp:2203
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
float GetSpellMaxRangeForTarget(Unit const *target, SpellInfo const *spellInfo) const
Definition Object.cpp:2253
Player * GetAffectingPlayer() const
Definition Object.cpp:2212
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_sha_ancestral_awakening_proc)
PrepareAuraScript(spell_sha_ancestral_awakening)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_astral_shift_aura)
bool CheckProc(ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_astral_shift_visual_dummy)
void PeriodicTick(AuraEffect const *)
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
void Register() override
PrepareAuraScript(spell_sha_astral_shift)
void Absorb(AuraEffect *, DamageInfo &dmgInfo, uint32 &absorbAmount)
void RemoveInvalidTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_sha_bloodlust)
void Register() override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_sha_chain_heal)
void HandleHeal(SpellEffIndex)
void Register() override
PrepareSpellScript(spell_sha_cleansing_totem_pulse)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_clearcasting)
void CalculateAmount(AuraEffect const *, int32 &amount, bool &)
void Register() override
bool Validate(SpellInfo const *) override
void Register() override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_earth_shield)
void HandleEffectPeriodic(AuraEffect const *)
PrepareAuraScript(spell_sha_earthbind_totem)
void Apply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_sha_earthen_power)
void FilterTargets(std::list< WorldObject * > &unitList)
PrepareAuraScript(spell_sha_earthliving_weapon)
bool CheckProc(ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
PrepareSpellScript(spell_sha_fire_nova)
SpellCastResult CheckFireTotem()
void Register() override
void Register() override
PrepareAuraScript(spell_sha_flame_shock)
bool Validate(SpellInfo const *) override
void HandleDispel(DispelInfo *)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_flametongue_weapon)
bool CheckProc(ProcEventInfo &eventInfo)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_frozen_power)
bool Validate(SpellInfo const *) override
void Register() override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_glyph_of_earth_shield)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool CheckProc(ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_glyph_of_healing_wave)
PrepareAuraScript(spell_sha_glyph_of_totem_of_wrath)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool CheckProc(ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_sha_healing_stream_totem)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void RemoveInvalidTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void Register() override
PrepareSpellScript(spell_sha_heroism)
bool CheckProc(ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_imp_water_shield)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_item_lightning_shield_trigger)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_item_lightning_shield)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_item_mana_surge)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_item_t10_elemental_2p_bonus)
void HandleEffectProc(AuraEffect const *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_item_t6_trinket)
void Register() override
PrepareSpellScript(spell_sha_lava_lash)
bool Load() override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_lightning_overload)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool CheckProc(ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_lightning_shield)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleBonus(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_sha_maelstrom_weapon)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_sha_mana_spring_totem)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_sha_mana_tide_totem)
void HandleDummy(SpellEffIndex)
void PeriodicTick(AuraEffect const *aurEff)
void Register() override
bool Validate(SpellInfo const *spellInfo) override
PrepareAuraScript(spell_sha_mana_tide)
bool CheckProc(ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_nature_guardian)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_sha_sentry_totem)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_shamanistic_rage)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
PrepareAuraScript(spell_sha_spirit_hunt)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_static_shock)
void HandleScriptEffect(SpellEffIndex)
PrepareSpellScript(spell_sha_stoneclaw_totem)
PrepareAuraScript(spell_sha_t10_elemental_4p_bonus)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_t10_restoration_4p_bonus)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_t3_6p_bonus)
void Register() override
PrepareAuraScript(spell_sha_t3_8p_bonus)
void PeriodicTick(AuraEffect const *)
void Register() override
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_t8_elemental_4p_bonus)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_t9_elemental_4p_bonus)
PrepareSpellScript(spell_sha_thunderstorm)
void HandleKnockBack(SpellEffIndex effIndex)
void HandleProc(AuraEffect const *, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_sha_tidal_force_dummy)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_totemic_mastery)
void HandleDummy(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_sha_windfury_weapon)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
bool CheckProc(ProcEventInfo &eventInfo)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void AddSC_shaman_spell_scripts()
ShamanSpellIcons
@ SHAMAN_ICON_ID_TOTEM_OF_WRATH
@ SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW
@ SHAMAN_ICON_ID_RESTORATIVE_TOTEMS
@ SPELL_SHAMAN_ANCESTRAL_AWAKENING_DUMMY
@ SPELL_SHAMAN_TOTEM_OF_WRATH_SPELL_POWER
@ SPELL_SHAMAN_TOTEM_EARTHBIND_EARTHGRAB
@ SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL
@ SPELL_SHAMAN_SPIRIT_HUNT_HEAL
@ SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM
@ SPELL_SHAMAN_NATURE_GUARDIAN
@ SPELL_SHAMAN_NATURE_GUARDIAN_THREAT
@ SPELL_SHAMAN_FLAMETONGUE_ATTACK
@ SPELL_SHAMAN_BIND_SIGHT
@ SPELL_SHAMAN_WINDFURY_ATTACK_OH
@ SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1
@ SPELL_SHAMAN_TOTEMIC_POWER_SPELL_POWER
@ SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD
@ SPELL_SHAMAN_TOTEM_EARTHBIND_TOTEM
@ SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE
@ SPELL_SHAMAN_MANA_TIDE_TOTEM
@ SPELL_SHAMAN_SATED
@ SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC
@ SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE
@ SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS
@ SPELL_SHAMAN_POWER_SURGE
@ SPELL_SHAMAN_TOTEMIC_POWER_MP5
@ SPELL_SHAMAN_STONECLAW_TOTEM
@ SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD
@ SPELL_SHAMAN_ELEMENTAL_MASTERY
@ SPELL_SHAMAN_FIRE_NOVA_R1
@ SPELL_SHAMAN_CHAINED_HEAL
@ SPELL_SHAMAN_MAELSTROM_POWER
@ SPELL_SHAMAN_GLYPH_OF_THUNDERSTORM
@ SPELL_SHAMAN_TOTEMIC_MASTERY
@ SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL
@ SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1
@ SPELL_SHAMAN_LAVA_FLOWS_R1
@ SPELL_SHAMAN_GLYPH_OF_MANA_TIDE
@ SPELL_SHAMAN_WINDFURY_WEAPON_R1
@ SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC
@ SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE
@ SPELL_SHAMAN_TOTEMIC_POWER_ARMOR
@ SPELL_SHAMAN_LIGHTNING_SHIELD_R1
@ SPELL_SHAMAN_GLYPH_OF_STONECLAW_TOTEM
@ SPELL_SHAMAN_ELECTRIFIED
@ SPELL_SHAMAN_EXHAUSTION
@ SPELL_SHAMAN_TOTEM_EARTHEN_POWER
@ SPELL_SHAMAN_STORM_EARTH_AND_FIRE
@ SPELL_SHAMAN_TOTEMIC_POWER_ATTACK_POWER
@ SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT
@ SPELL_SHAMAN_ENERGY_SURGE
@ SPELL_SHAMAN_FREEZE
@ SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1
@ SPELL_SHAMAN_TIDAL_FORCE_CRIT
@ SPELL_SHAMAN_ELEMENTAL_OATH
@ SPELL_SHAMAN_EARTH_SHIELD_HEAL
@ SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1
@ SPELL_SHAMAN_ITEM_MANA_SURGE
@ SPELL_SHAMAN_WINDFURY_ATTACK_MH
@ SPELL_SHAMAN_LIGHTNING_BOLT_OVERLOAD_R1
@ SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1
CastSpellExtraArgs & AddSpellBP0(int32 val)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
ObjectGuid OriginalCaster
CastSpellExtraArgs & SetCastItem(Item *item)