TrinityCore
spell_rogue.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_ROGUE and SPELLFAMILY_GENERIC spells used by rogue players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_rog_".
22 */
23
24#include "ScriptMgr.h"
25#include "Containers.h"
26#include "DB2Stores.h"
27#include "Item.h"
28#include "Log.h"
29#include "ObjectAccessor.h"
30#include "Player.h"
31#include "Spell.h"
32#include "SpellAuraEffects.h"
33#include "SpellHistory.h"
34#include "SpellMgr.h"
35#include "SpellScript.h"
36
38{
86};
87
88/* Returns true if the spell is a finishing move.
89 * A finishing move is a spell that cost combo points */
91{
92 if (!spell)
93 return { };
94
96}
97
98/* Return true if the spell is a finishing move.
99 * A finishing move is a spell that cost combo points */
100bool IsFinishingMove(Spell const* spell)
101{
102 return GetFinishingMoveCPCost(spell).has_value();
103}
104
105// 53 - Backstab
107{
108 bool Validate(SpellInfo const* spellInfo) override
109 {
110 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_3 } });
111 }
112
114 {
115 Unit* hitUnit = GetHitUnit();
116 if (!hitUnit)
117 return;
118
119 Unit* caster = GetCaster();
120 if (hitUnit->isInBack(caster))
121 {
122 float currDamage = float(GetHitDamage());
123 float newDamage = AddPct(currDamage, float(GetEffectInfo(EFFECT_3).CalcValue(caster)));
124 SetHitDamage(newDamage);
125 }
126 }
127
128 void Register() override
129 {
131 }
132};
133
134// 379005 - Blackjack
135// Called by Sap - 6770 and Blind - 2094
137{
138 bool Validate(SpellInfo const* /*spellInfo*/) override
139 {
141 }
142
143 void EffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
144 {
145 if (Unit* caster = GetCaster())
146 if (caster->HasAura(SPELL_ROGUE_BLACKJACK_TALENT))
147 caster->CastSpell(GetTarget(), SPELL_ROGUE_BLACKJACK, true);
148 }
149
150 void Register() override
151 {
153 }
154};
155
156// 13877, 33735, (check 51211, 65956) - Blade Flurry
158{
159 bool Validate(SpellInfo const* /*spellInfo*/) override
160 {
162 }
163
164 bool CheckProc(ProcEventInfo& eventInfo)
165 {
167 return _procTarget && eventInfo.GetDamageInfo();
168 }
169
170 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
171 {
173
174 if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
175 {
176 CastSpellExtraArgs args(aurEff);
177 args.AddSpellBP0(damageInfo->GetDamage());
179 }
180 }
181
182 void Register() override
183 {
187 else
189 }
190
191 Unit* _procTarget = nullptr;
192};
193
194// 31230 - Cheat Death
196{
197 bool Validate(SpellInfo const* spellInfo) override
198 {
200 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
201 }
202
203 void HandleAbsorb(AuraEffect const* /*aurEff*/, DamageInfo const& /*dmgInfo*/, uint32& absorbAmount)
204 {
205 Unit* target = GetTarget();
207 {
208 absorbAmount = 0;
209 return;
210 }
211
213
217
218 target->SetHealth(target->CountPctFromMaxHealth(GetEffectInfo(EFFECT_1).CalcValue(target)));
219 }
220
221 void Register() override
222 {
224 }
225};
226
227// 2818 - Deadly Poison
229{
230 bool Load() override
231 {
232 // at this point CastItem must already be initialized
233 return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
234 }
235
237 {
238 if (missInfo != SPELL_MISS_NONE)
239 return;
240
241 if (Unit* target = GetHitUnit())
242 // Deadly Poison
243 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, flag128(0x10000, 0x80000, 0), GetCaster()->GetGUID()))
244 _stackAmount = aurEff->GetBase()->GetStackAmount();
245 }
246
248 {
249 if (_stackAmount < 5)
250 return;
251
252 Player* player = GetCaster()->ToPlayer();
253
254 if (Unit* target = GetHitUnit())
255 {
256
258
259 if (item == GetCastItem())
261
262 if (!item)
263 return;
264
265 // item combat enchantments
266 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
267 {
269 if (!enchant)
270 continue;
271
272 for (uint8 s = 0; s < 3; ++s)
273 {
275 continue;
276
277 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->EffectArg[s], DIFFICULTY_NONE);
278 if (!spellInfo)
279 {
280 TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant {}, player (Name: {}, {}) cast unknown spell {}", enchant->ID, player->GetName(), player->GetGUID().ToString(), enchant->EffectArg[s]);
281 continue;
282 }
283
284 // Proc only rogue poisons
285 if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
286 continue;
287
288 // Do not reproc deadly
289 if (spellInfo->SpellFamilyFlags & flag128(0x10000))
290 continue;
291
292 if (spellInfo->IsPositive())
293 player->CastSpell(player, enchant->EffectArg[s], item);
294 else
295 player->CastSpell(target, enchant->EffectArg[s], item);
296 }
297 }
298 }
299 }
300
301 void Register() override
302 {
305 }
306
308};
309
310// 32645 - Envenom
312{
313 void CalculateDamage(Unit* /*victim*/, int32& /*damage*/, int32& flatMod, float& pctMod) const
314 {
315 pctMod *= GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS).value_or(0);
316
317 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
318 flatMod += t5->GetAmount();
319 }
320
321 void Register() override
322 {
324 }
325};
326
327// 196819 - Eviscerate
329{
330 void CalculateDamage(Unit* /*victim*/, int32& /*damage*/, int32& flatMod, float& pctMod) const
331 {
332 pctMod *= GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS).value_or(0);
333
334 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
335 flatMod += t5->GetAmount();
336 }
337
338 void Register() override
339 {
341 }
342};
343
344// 193358 - Grand Melee
346{
347 bool Validate(SpellInfo const* /*spellInfo*/) override
348 {
350 }
351
353 {
354 Spell const* procSpell = eventInfo.GetProcSpell();
355 return procSpell && procSpell->HasPowerTypeCost(POWER_COMBO_POINTS);
356 }
357
358 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
359 {
360 Spell const* procSpell = procInfo.GetProcSpell();
361 int32 amount = aurEff->GetAmount() * *procSpell->GetPowerTypeCostAmount(POWER_COMBO_POINTS) * 1000;
362
363 if (Unit* target = GetTarget())
364 {
365 if (Aura* aura = target->GetAura(SPELL_ROGUE_SLICE_AND_DICE))
366 aura->SetDuration(aura->GetDuration() + amount);
367 else
368 {
371 args.AddSpellMod(SPELLVALUE_DURATION, amount);
372 target->CastSpell(target, SPELL_ROGUE_SLICE_AND_DICE, args);
373 }
374 }
375 }
376
377 void Register() override
378 {
381 }
382};
383
384// 198031 - Honor Among Thieves
387{
388 bool Validate(SpellInfo const* /*spellInfo*/) override
389 {
391 }
392
393 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
394 {
396
397 Unit* target = GetTarget();
399 }
400
401 void Register() override
402 {
404 }
405};
406
407// 51690 - Killing Spree
409{
410 bool Validate(SpellInfo const* /*spellInfo*/) override
411 {
412 return ValidateSpellInfo(
413 {
417 });
418 }
419
420 void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
421 {
423 }
424
425 void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
426 {
427 while (!_targets.empty())
428 {
430 if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
431 {
434 break;
435 }
436 else
437 _targets.remove(guid);
438 }
439 }
440
441 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
442 {
444 }
445
446 void Register() override
447 {
451 }
452
453public:
454 void AddTarget(Unit* target)
455 {
456 _targets.push_back(target->GetGUID());
457 }
458
459private:
461};
462
464{
465 void FilterTargets(std::list<WorldObject*>& targets)
466 {
467 if (targets.empty() || GetCaster()->GetVehicleBase())
469 }
470
471 void HandleDummy(SpellEffIndex /*effIndex*/)
472 {
473 if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE))
474 if (spell_rog_killing_spree_aura* script = aura->GetScript<spell_rog_killing_spree_aura>())
475 script->AddTarget(GetHitUnit());
476 }
477
478 void Register() override
479 {
482 }
483};
484
485// 385627 - Kingsbane
487{
488 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& procInfo)
489 {
490 return procInfo.GetActionTarget()->HasAura(GetId(), GetCasterGUID());
491 }
492
493 void Register() override
494 {
496 }
497};
498
499// 76806 - Mastery: Main Gauche
501{
502 bool Validate(SpellInfo const* /*spellInfo*/) override
503 {
505 }
506
508 {
509 return eventInfo.GetDamageInfo() && eventInfo.GetDamageInfo()->GetVictim();
510 }
511
512 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
513 {
514 if (Unit* target = GetTarget())
515 target->CastSpell(procInfo.GetDamageInfo()->GetVictim(), SPELL_ROGUE_MAIN_GAUCHE, aurEff);
516 }
517
518 void Register() override
519 {
522 }
523};
524
526{
528 {
529 if (!GetExplTargetUnit() || !GetCaster()->IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
531
532 return SPELL_CAST_OK;
533 }
534
535 void Register() override
536 {
538 }
539};
540
541// 131511 - Prey on the Weak
542// Called by Cheap Shot - 1833 and Kidney Shot - 408
544{
545 bool Validate(SpellInfo const* /*spellInfo*/) override
546 {
548 }
549
550 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
551 {
552 if (Unit* caster = GetCaster())
553 if (caster->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK_TALENT))
554 caster->CastSpell(GetTarget(), SPELL_ROGUE_PREY_ON_THE_WEAK, true);
555 }
556
557 void Register() override
558 {
560 }
561};
562
563// 79096 - Restless Blades
565{
568
569 bool Validate(SpellInfo const* /*spellInfo*/) override
570 {
572 }
573
574 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
575 {
576 if (Optional<int32> spentCP = GetFinishingMoveCPCost(procInfo.GetProcSpell()))
577 {
578 int32 cdExtra = -(float(aurEff->GetAmount() * *spentCP) * 0.1f);
579
580 SpellHistory* history = GetTarget()->GetSpellHistory();
581 for (uint32 spellId : Spells)
582 history->ModifyCooldown(spellId, Seconds(cdExtra), true);
583 }
584 }
585
586 void Register() override
587 {
589 }
590};
591
592// 315508 - Roll the Bones
594{
597
598 bool Validate(SpellInfo const* /*spellInfo*/) override
599 {
601 }
602
603 void HandleDummy(SpellEffIndex /*effIndex*/)
604 {
605 int32 currentDuration = 0;
606 for (uint32 spellId : Spells)
607 {
608 if (Aura* aura = GetCaster()->GetAura(spellId))
609 {
610 currentDuration = aura->GetDuration();
611 GetCaster()->RemoveAura(aura);
612 }
613 }
614
615 std::vector<uint32> possibleBuffs(std::begin(Spells), std::end(Spells));
617
618 // https://www.icy-veins.com/wow/outlaw-rogue-pve-dps-rotation-cooldowns-abilities
619 // 1 Roll the Bones buff : 100.0 % chance;
620 // 2 Roll the Bones buffs : 19 % chance;
621 // 5 Roll the Bones buffs : 1 % chance.
622 int32 chance = irand(1, 100);
623 int32 numBuffs = 1;
624 if (chance <= 1)
625 numBuffs = 5;
626 else if (chance <= 20)
627 numBuffs = 2;
628
629 for (int32 i = 0; i < numBuffs; ++i)
630 {
631 uint32 spellId = possibleBuffs[i];
634 args.AddSpellMod(SPELLVALUE_DURATION, GetSpellInfo()->GetDuration() + currentDuration);
635 GetCaster()->CastSpell(GetCaster(), spellId, args);
636 }
637 }
638
639 void Register() override
640 {
642 }
643};
644
645// 1943 - Rupture
647{
648 bool Validate(SpellInfo const* /*spellInfo*/) override
649 {
651 }
652
653 void OnEffectRemoved(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
654 {
655 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
656 return;
657
658 Aura* aura = GetAura();
659 Unit* caster = aura->GetCaster();
660 if (!caster)
661 return;
662
663 Aura* auraVenomousWounds = caster->GetAura(SPELL_ROGUE_VENOMOUS_WOUNDS);
664 if (!auraVenomousWounds)
665 return;
666
667 // Venomous Wounds: if unit dies while being affected by rupture, regain energy based on remaining duration
668 Optional<SpellPowerCost> cost = GetSpellInfo()->CalcPowerCost(POWER_ENERGY, false, caster, GetSpellInfo()->GetSchoolMask(), nullptr);
669 if (!cost)
670 return;
671
672 float pct = float(aura->GetDuration()) / float(aura->GetMaxDuration());
673 int32 extraAmount = float(cost->Amount) * pct;
674 caster->ModifyPower(POWER_ENERGY, extraAmount);
675 }
676
677 void Register() override
678 {
680 }
681};
682
683// 14161 - Ruthlessness
685{
686 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
687 {
688 Unit* target = GetTarget();
689
691 if (roll_chance_i(aurEff->GetSpellEffectInfo().PointsPerResource * (*cost)))
693 }
694
695 void Register() override
696 {
698 }
699};
700
701// 185438 - Shadowstrike
703{
704 bool Validate(SpellInfo const* /*spellInfo*/) override
705 {
708 }
709
711 {
712 // Because the premeditation aura is removed when we're out of stealth,
713 // when we reach HandleEnergize the aura won't be there, even if it was when player launched the spell
716 }
717
718 void HandleEnergize(SpellEffIndex /*effIndex*/)
719 {
720 Unit* caster = GetCaster();
722 {
724 if (Aura* premeditationPassive = caster->GetAura(SPELL_ROGUE_PREMEDITATION_PASSIVE))
725 if (AuraEffect const* auraEff = premeditationPassive->GetEffect(EFFECT_1))
726 SetHitDamage(GetHitDamage() + auraEff->GetAmount());
727
728 // Grant 10 seconds of slice and dice
729 int32 duration = sSpellMgr->AssertSpellInfo(SPELL_ROGUE_PREMEDITATION_PASSIVE, DIFFICULTY_NONE)->GetEffect(EFFECT_0).CalcValue(GetCaster());
730
734 caster->CastSpell(caster, SPELL_ROGUE_SLICE_AND_DICE, args);
735 }
736 }
737
738 void Register() override
739 {
742 }
743
744private:
746};
747
748// 193315 - Sinister Strike
750{
751 bool Validate(SpellInfo const* /*spellInfo*/) override
752 {
754 }
755
756 void HandleDummy(SpellEffIndex /*effIndex*/)
757 {
758 int32 damagePerCombo = GetHitDamage();
759 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
760 damagePerCombo += t5->GetAmount();
761
762 int32 finalDamage = damagePerCombo;
763 std::vector<SpellPowerCost> const& costs = GetSpell()->GetPowerCost();
764 auto c = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_COMBO_POINTS; });
765 if (c != costs.end())
766 finalDamage *= c->Amount;
767
768 SetHitDamage(finalDamage);
769 }
770
771 void Register() override
772 {
774 }
775};
776
777// 1784 - Stealth
779{
780 bool Validate(SpellInfo const* /*spellInfo*/) override
781 {
782 return ValidateSpellInfo(
783 {
791 });
792 }
793
794 void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
795 {
796 Unit* target = GetTarget();
797
798 // Master of Subtlety
801
802 // Shadow Focus
805
806 // Premeditation
808 target->CastSpell(target, SPELL_ROGUE_PREMEDITATION_AURA, true);
809
813 }
814
815 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
816 {
817 Unit* target = GetTarget();
818
819 // Master of Subtlety
820 if (AuraEffect* masterOfSubtletyPassive = GetTarget()->GetAuraEffect(SPELL_ROGUE_MASTER_OF_SUBTLETY_PASSIVE, EFFECT_0))
821 {
823 {
824 masterOfSubtletyAura->SetMaxDuration(masterOfSubtletyPassive->GetAmount());
825 masterOfSubtletyAura->RefreshDuration();
826 }
827 }
828
829 // Premeditation
831
835 }
836
837 void Register() override
838 {
841 }
842};
843
844// 212283 - Symbols of Death
846{
847 bool Validate(SpellInfo const* /*spellInfo*/) override
848 {
850 }
851
853 {
856 }
857
858 void Register() override
859 {
861 }
862};
863
864// 57934 - Tricks of the Trade
866{
867 bool Validate(SpellInfo const* /*spellInfo*/) override
868 {
870 }
871
872 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
873 {
876 }
877
878 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
879 {
881
882 Unit* rogue = GetTarget();
884 rogue->CastSpell(rogue, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC, aurEff);
886 }
887
888 void Register() override
889 {
892 }
893
895public:
897};
898
899// 57934 - Tricks of the Trade
901{
903 {
904 if (Aura* aura = GetHitAura())
906 {
907 if (Unit* explTarget = GetExplTargetUnit())
908 script->SetRedirectTarget(explTarget->GetGUID());
909 else
910 script->SetRedirectTarget(ObjectGuid::Empty);
911 }
912 }
913
914 void Register() override
915 {
917 }
918};
919
920// 59628 - Tricks of the Trade (Proc)
922{
923 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
924 {
926 }
927
928 void Register() override
929 {
931 }
932};
933
934// 198020 - Turn the Tables (PvP Talent)
936{
937 bool CheckForStun(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
938 {
939 return eventInfo.GetProcSpell() && eventInfo.GetProcSpell()->GetSpellInfo()->HasAura(SPELL_AURA_MOD_STUN);
940 }
941
942 void Register() override
943 {
945 }
946};
947
948// 198023 - Turn the Tables (periodic)
950{
951 bool Validate(SpellInfo const*) override
952 {
954 }
955
956 void CheckForStun(AuraEffect const* aurEff)
957 {
958 Unit* target = GetTarget();
959 if (!target->HasAuraType(SPELL_AURA_MOD_STUN))
960 {
961 target->CastSpell(target, SPELL_ROGUE_TURN_THE_TABLES_BUFF, aurEff);
963 Remove();
964 }
965 }
966
967 void Register() override
968 {
970 }
971};
972
973// 1856 - Vanish - SPELL_ROGUE_VANISH
975{
976 bool Validate(SpellInfo const* /*spellInfo*/) override
977 {
979 }
980
982 {
983 PreventHitDefaultEffect(effIndex);
984
985 Unit* target = GetHitUnit();
986
988 if (target->GetTypeId() != TYPEID_PLAYER)
989 return;
990
991 if (target->HasAura(SPELL_ROGUE_VANISH_AURA))
992 return;
993
996 }
997
998 void Register() override
999 {
1001 }
1002};
1003
1004// 11327 - Vanish
1006{
1007 bool Validate(SpellInfo const* /*spellInfo*/) override
1008 {
1010 }
1011
1012 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1013 {
1015 }
1016
1017 void Register() override
1018 {
1020 }
1021};
1022
1023// 79134 - Venomous Wounds - SPELL_ROGUE_VENOMOUS_WOUNDS
1025{
1026 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
1027 {
1028 int32 extraEnergy = aurEff->GetAmount();
1029 GetTarget()->ModifyPower(POWER_ENERGY, extraEnergy);
1030 }
1031
1032 void Register() override
1033 {
1035 }
1036};
1037
1039{
1069}
@ IN_MILLISECONDS
Definition: Common.h:35
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", &SpellItemEnchantmentLoadInfo::Instance)
@ ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL
Definition: DBCEnums.h:1002
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
EnchantmentSlot
Definition: ItemDefines.h:178
@ MAX_ENCHANTMENT_SLOT
Definition: ItemDefines.h:195
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:394
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Spells
Definition: PlayerAI.cpp:32
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:646
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:647
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
int32 irand(int32 min, int32 max)
Definition: Random.cpp:35
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition: ScriptMgr.h:1371
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_3
Definition: SharedDefines.h:33
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_4
Definition: SharedDefines.h:34
@ EFFECT_2
Definition: SharedDefines.h:32
SpellMissInfo
@ SPELL_MISS_NONE
@ TARGET_UNIT_DEST_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_TRIGGER_SPELL
@ SPELL_EFFECT_ENERGIZE
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_EFFECT_APPLY_AURA
@ POWER_ENERGY
@ POWER_COMBO_POINTS
SpellCastResult
@ SPELL_FAILED_OUT_OF_RANGE
@ SPELL_FAILED_SUCCESS
@ SPELL_FAILED_BAD_TARGETS
@ SPELL_CAST_OK
@ SPELLFAMILY_ROGUE
@ DISPEL_POISON
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEFAULT
@ AURA_REMOVE_BY_DEATH
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_MOD_MELEE_HASTE
@ SPELL_AURA_MOD_STALKED
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_POWER_REGEN_PERCENT
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_MOD_STUN
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
Definition: SpellDefines.h:252
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:265
@ SPELLVALUE_DURATION
Definition: SpellDefines.h:234
#define sSpellMgr
Definition: SpellMgr.h:849
#define BeforeSpellHitFn(F)
Definition: SpellScript.h:847
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraCheckEffectProcFn(F, I, N)
Definition: SpellScript.h:2136
#define SpellCalcDamageFn(F)
Definition: SpellScript.h:879
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
#define AuraEffectAbsorbOverkillFn(F, I)
Definition: SpellScript.h:2091
#define AuraCheckProcFn(F)
Definition: SpellScript.h:2130
#define SpellHitFn(F)
Definition: SpellScript.h:854
#define SPELL_AURA_ANY
Definition: SpellScript.h:59
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
T AddPct(T &base, U pct)
Definition: Util.h:85
SpellEffectInfo const & GetSpellEffectInfo() const
int32 GetAmount() const
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< CheckEffectProcHandler > DoCheckEffectProc
Definition: SpellScript.h:2135
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
SpellInfo const * GetSpellInfo() const
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
Unit * GetCaster() const
SpellEffectInfo const & GetEffectInfo(SpellEffIndex effIndex) const
HookList< EffectAbsorbHandler > OnEffectAbsorb
Definition: SpellScript.h:2089
Aura * GetAura() const
Unit * GetTarget() const
ObjectGuid GetCasterGUID() const
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:2129
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:2035
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
uint32 GetId() const
int32 GetMaxDuration() const
Definition: SpellAuras.h:168
int32 GetDuration() const
Definition: SpellAuras.h:173
Unit * GetCaster() const
Definition: SpellAuras.cpp:513
Unit * GetVictim() const
Definition: Unit.h:441
Definition: Item.h:170
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:298
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
std::string ToString() const
Definition: ObjectGuid.cpp:554
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
Item * GetItemByPos(uint16 pos) const
Definition: Player.cpp:9582
Unit * GetActionTarget() const
Definition: Unit.h:494
Spell const * GetProcSpell() const
Definition: Unit.h:508
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetProcTarget() const
Definition: Unit.h:495
float PointsPerResource
Definition: SpellInfo.h:223
void ModifyCooldown(uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown=false)
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3870
uint32 const Id
Definition: SpellInfo.h:325
uint32 Dispel
Definition: SpellInfo.h:328
flag128 SpellFamilyFlags
Definition: SpellInfo.h:409
bool IsPositive() const
Definition: SpellInfo.cpp:1709
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:1400
uint32 SpellFamilyName
Definition: SpellInfo.h:408
uint32 m_scriptSpellId
Definition: SpellScript.h:134
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
HookList< DamageAndHealingCalcHandler > CalcDamage
Definition: SpellScript.h:878
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
Definition: SpellScript.h:852
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Item * GetCastItem() const
Aura * GetHitAura(bool dynObjAura=false) const
Spell * GetSpell() const
Definition: SpellScript.h:987
void FinishCast(SpellCastResult result, int32 *param1=nullptr, int32 *param2=nullptr)
HookList< EffectHandler > OnEffectLaunchTarget
Definition: SpellScript.h:838
HookList< BeforeHitHandler > BeforeHit
Definition: SpellScript.h:846
void SetHitDamage(int32 damage)
Unit * GetExplTargetUnit() const
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
Definition: Spell.h:255
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:650
bool HasPowerTypeCost(Powers power) const
Definition: Spell.cpp:7953
Optional< int32 > GetPowerTypeCostAmount(Powers power) const
Definition: Spell.cpp:7958
std::vector< SpellPowerCost > const & GetPowerCost() const
Definition: Spell.h:652
void UnregisterRedirectThreat(uint32 spellId)
Definition: Unit.h:627
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:8280
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
Unit * SelectNearbyTarget(Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
Definition: Unit.cpp:10272
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4674
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
SpellHistory * GetSpellHistory()
Definition: Unit.h:1457
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
std::string const & GetName() const
Definition: Object.h:555
bool isInBack(WorldObject const *target, float arc=float(M_PI)) const
Definition: Object.cpp:1326
void HandleHitDamage(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *spellInfo) override
void Register() override
bool Validate(SpellInfo const *) override
void EffectRemove(AuraEffect const *, AuraEffectHandleModes) const
bool CheckProc(ProcEventInfo &eventInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *spellInfo) override
void Register() override
void HandleAbsorb(AuraEffect const *, DamageInfo const &, uint32 &absorbAmount)
void Register() override
bool Load() override
void HandleBeforeHit(SpellMissInfo missInfo)
void Register() override
void CalculateDamage(Unit *, int32 &, int32 &flatMod, float &pctMod) const
void Register() override
void CalculateDamage(Unit *, int32 &, int32 &flatMod, float &pctMod) const
bool HandleCheckProc(ProcEventInfo &eventInfo)
void Register() override
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
void AddTarget(Unit *target)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
void HandleEffectPeriodic(AuraEffect const *)
bool Validate(SpellInfo const *) override
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
void HandleDummy(SpellEffIndex)
void FilterTargets(std::list< WorldObject * > &targets)
void Register() override
void Register() override
bool CheckProc(AuraEffect const *, ProcEventInfo &procInfo)
bool Validate(SpellInfo const *) override
bool HandleCheckProc(ProcEventInfo &eventInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
void Register() override
SpellCastResult CheckCast()
void OnApply(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
void Register() override
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
void OnEffectRemoved(AuraEffect const *, AuraEffectHandleModes)
void Register() override
void Register() override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
bool Validate(SpellInfo const *) override
void Register() override
void HandleEnergize(SpellEffIndex)
SpellCastResult HandleCheckCast()
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void HandleEffectApply(AuraEffect const *, AuraEffectHandleModes)
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
void Register() override
void HandleEffectHitTarget(SpellEffIndex)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void SetRedirectTarget(ObjectGuid guid)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void CheckForStun(AuraEffect const *aurEff)
void Register() override
bool CheckForStun(AuraEffect const *, ProcEventInfo &eventInfo)
void Register() override
bool Validate(SpellInfo const *) override
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void Register() override
void OnLaunchTarget(SpellEffIndex effIndex)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
Definition: Containers.h:170
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
bool IsFinishingMove(Spell const *spell)
void AddSC_rogue_spell_scripts()
Optional< int32 > GetFinishingMoveCPCost(Spell const *spell)
Definition: spell_rogue.cpp:90
@ SPELL_ROGUE_PREY_ON_THE_WEAK
Definition: spell_rogue.cpp:64
@ SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC
Definition: spell_rogue.cpp:82
@ SPELL_ROGUE_ADRENALINE_RUSH
Definition: spell_rogue.cpp:39
@ SPELL_ROGUE_SLICE_AND_DICE
Definition: spell_rogue.cpp:70
@ SPELL_ROGUE_TRUE_BEARING
Definition: spell_rogue.cpp:77
@ SPELL_ROGUE_DEATH_FROM_ABOVE
Definition: spell_rogue.cpp:50
@ SPELL_ROGUE_PREMEDITATION_PASSIVE
Definition: spell_rogue.cpp:61
@ SPELL_ROGUE_TURN_THE_TABLES_BUFF
Definition: spell_rogue.cpp:78
@ SPELL_ROGUE_MAIN_GAUCHE
Definition: spell_rogue.cpp:60
@ SPELL_ROGUE_PREY_ON_THE_WEAK_TALENT
Definition: spell_rogue.cpp:63
@ SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG
Definition: spell_rogue.cpp:55
@ SPELL_ROGUE_SHADOW_FOCUS_EFFECT
Definition: spell_rogue.cpp:69
@ SPELL_ROGUE_BURIED_TREASURE
Definition: spell_rogue.cpp:46
@ SPELL_ROGUE_PREMEDITATION_AURA
Definition: spell_rogue.cpp:62
@ SPELL_ROGUE_BLADE_FLURRY
Definition: spell_rogue.cpp:43
@ SPELL_ROGUE_SANCTUARY
Definition: spell_rogue.cpp:66
@ SPELL_ROGUE_GRAND_MELEE
Definition: spell_rogue.cpp:51
@ SPELL_ROGUE_MASTER_OF_SUBTLETY_PASSIVE
Definition: spell_rogue.cpp:59
@ SPELL_ROGUE_GRAPPLING_HOOK
Definition: spell_rogue.cpp:52
@ SPELL_ROGUE_CHEATING_DEATH
Definition: spell_rogue.cpp:49
@ SPELL_ROGUE_BLACKJACK
Definition: spell_rogue.cpp:42
@ SPELL_ROGUE_TRICKS_OF_THE_TRADE
Definition: spell_rogue.cpp:81
@ SPELL_ROGUE_RUTHLESS_PRECISION
Definition: spell_rogue.cpp:65
@ SPELL_ROGUE_SYMBOLS_OF_DEATH_RANK2
Definition: spell_rogue.cpp:76
@ SPELL_ROGUE_STEALTH_SHAPESHIFT_AURA
Definition: spell_rogue.cpp:74
@ SPELL_ROGUE_SHADOW_FOCUS
Definition: spell_rogue.cpp:68
@ SPELL_ROGUE_KILLING_SPREE
Definition: spell_rogue.cpp:53
@ SPELL_ROGUE_STEALTH_STEALTH_AURA
Definition: spell_rogue.cpp:73
@ SPELL_ROGUE_T5_2P_SET_BONUS
Definition: spell_rogue.cpp:84
@ SPELL_ROGUE_VANISH_AURA
Definition: spell_rogue.cpp:80
@ SPELL_ROGUE_KILLING_SPREE_DMG_BUFF
Definition: spell_rogue.cpp:56
@ SPELL_ROGUE_MASTER_OF_SUBTLETY_DAMAGE_PERCENT
Definition: spell_rogue.cpp:58
@ SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK
Definition: spell_rogue.cpp:44
@ SPELL_ROGUE_CHEATED_DEATH
Definition: spell_rogue.cpp:48
@ SPELL_ROGUE_KILLING_SPREE_TELEPORT
Definition: spell_rogue.cpp:54
@ SPELL_ROGUE_SKULL_AND_CROSSBONES
Definition: spell_rogue.cpp:67
@ SPELL_ROGUE_MARKED_FOR_DEATH
Definition: spell_rogue.cpp:57
@ SPELL_ROGUE_HONOR_AMONG_THIEVES_ENERGIZE
Definition: spell_rogue.cpp:83
@ SPELL_ROGUE_BLACKJACK_TALENT
Definition: spell_rogue.cpp:41
@ SPELL_ROGUE_SYMBOLS_OF_DEATH_CRIT_AURA
Definition: spell_rogue.cpp:75
@ SPELL_ROGUE_BETWEEN_THE_EYES
Definition: spell_rogue.cpp:40
@ SPELL_ROGUE_BROADSIDE
Definition: spell_rogue.cpp:45
@ SPELL_ROGUE_VENOMOUS_WOUNDS
Definition: spell_rogue.cpp:85
@ SPELL_ROGUE_VANISH
Definition: spell_rogue.cpp:79
@ SPELL_ROGUE_SPRINT
Definition: spell_rogue.cpp:71
@ SPELL_ROGUE_CHEAT_DEATH_DUMMY
Definition: spell_rogue.cpp:47
@ SPELL_ROGUE_STEALTH
Definition: spell_rogue.cpp:72
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:478
CastSpellExtraArgs & AddSpellBP0(int32 val)
Definition: SpellDefines.h:475
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
std::array< uint32, MAX_ITEM_ENCHANTMENT_EFFECTS > EffectArg
std::array< uint8, MAX_ITEM_ENCHANTMENT_EFFECTS > Effect