TrinityCore
Loading...
Searching...
No Matches
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 "ObjectAccessor.h"
27#include "Player.h"
28#include "Spell.h"
29#include "SpellAuraEffects.h"
30#include "SpellHistory.h"
31#include "SpellMgr.h"
32#include "SpellScript.h"
33
35{
117};
118
129
130/* Returns true if the spell is a finishing move.
131 * A finishing move is a spell that cost combo points */
133{
134 if (!spell)
135 return { };
136
138}
139
140/* Return true if the spell is a finishing move.
141 * A finishing move is a spell that cost combo points */
142bool IsFinishingMove(Spell const* spell)
143{
144 return GetFinishingMoveCPCost(spell).has_value();
145}
146
147static constexpr bool IsLethalPoison(uint32 spellId)
148{
149 switch (spellId)
150 {
155 return true;
156 default:
157 return false;
158 }
159}
160
161// 455143 - Acrobatic Strikes
182
183// Called by 2094 - Blind
209
210// 427773 - Blind
223
224// 53 - Backstab
226{
227 bool Validate(SpellInfo const* spellInfo) override
228 {
229 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_3 } });
230 }
231
233 {
234 Unit* hitUnit = GetHitUnit();
235 if (!hitUnit)
236 return;
237
238 Unit* caster = GetCaster();
239 if (hitUnit->isInBack(caster))
240 {
241 float currDamage = float(GetHitDamage());
242 float newDamage = AddPct(currDamage, GetEffectInfo(EFFECT_3).CalcValue(caster));
243 SetHitDamage(newDamage);
244 }
245 }
246
251};
252
253// 379005 - Blackjack
254// Called by Sap - 6770 and Blind - 2094
256{
257 bool Validate(SpellInfo const* /*spellInfo*/) override
258 {
260 }
261
262 void EffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
263 {
264 if (Unit* caster = GetCaster())
265 if (caster->HasAura(SPELL_ROGUE_BLACKJACK_TALENT))
266 caster->CastSpell(GetTarget(), SPELL_ROGUE_BLACKJACK, true);
267 }
268
273};
274
275// 13877, 33735, (check 51211, 65956) - Blade Flurry
277{
278 bool Validate(SpellInfo const* /*spellInfo*/) override
279 {
281 }
282
283 bool CheckProc(ProcEventInfo& eventInfo)
284 {
286 return _procTarget && eventInfo.GetDamageInfo();
287 }
288
289 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
290 {
292
293 if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
294 {
295 CastSpellExtraArgs args(aurEff);
296 args.AddSpellBP0(damageInfo->GetDamage());
298 }
299 }
300
309
310 Unit* _procTarget = nullptr;
311};
312
313// 31230 - Cheat Death
315{
316 bool Validate(SpellInfo const* spellInfo) override
317 {
319 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
320 }
321
322 void HandleAbsorb(AuraEffect const* /*aurEff*/, DamageInfo const& /*dmgInfo*/, uint32& absorbAmount)
323 {
324 Unit* target = GetTarget();
326 {
327 absorbAmount = 0;
328 return;
329 }
330
332
336
337 target->SetHealth(target->CountPctFromMaxHealth(GetEffectInfo(EFFECT_1).CalcValue(target)));
338 }
339
344};
345
346// 382515 - Cloaked in Shadows (attached to 1856 - Vanish)
348{
354
355 bool Load() override
356 {
358 }
359
361 {
362 Unit* caster = GetCaster();
363
365 if (!cloakedInShadows)
366 return;
367
368 SpellEffectValue amount = caster->CountPctFromMaxHealth(cloakedInShadows->GetAmount());
369
372 .TriggeringSpell = GetSpell(),
373 .SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, amount } }
374 });
375 }
376
381};
382
383// 2818 - Deadly Poison
406
407// 185314 - Deepening Shadows
409{
410 bool Validate(SpellInfo const* /*spellInfo*/) override
411 {
413 }
414
415 static bool CheckProc(AuraScript const&, AuraEffect const* /*aurEff*/, ProcEventInfo const& procEvent)
416 {
417 if (Spell const* procSpell = procEvent.GetProcSpell())
418 return procSpell->GetPowerTypeCostAmount(POWER_COMBO_POINTS) > 0;
419
420 return false;
421 }
422
423 void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& procInfo) const
424 {
425 Milliseconds amount = duration_cast<Milliseconds>(-FloatSeconds(aurEff->GetAmount()) * *procInfo.GetProcSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS));
426 GetTarget()->GetSpellHistory()->ModifyChargeRecoveryTime(sSpellMgr->AssertSpellInfo(SPELL_ROGUE_SHADOW_DANCE, GetCastDifficulty())->ChargeCategoryId, amount / 10);
427 }
428
434};
435
436// 32645 - Envenom
438{
439 void CalculateDamage(SpellEffectInfo const& /*spellEffectInfo*/, Unit* /*victim*/, int32& /*damage*/, int32& flatMod, float& pctMod) const
440 {
441 pctMod *= GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS).value_or(0);
442
443 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
444 flatMod += t5->GetAmountAsInt();
445 }
446
451};
452
453// 196819 - Eviscerate
455{
456 void CalculateDamage(SpellEffectInfo const& /*spellEffectInfo*/, Unit* /*victim*/, int32& /*damage*/, int32& flatMod, float& pctMod) const
457 {
458 pctMod *= GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS).value_or(0);
459
460 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
461 flatMod += t5->GetAmountAsInt();
462 }
463
468};
469
470// 193358 - Grand Melee
472{
473 bool Validate(SpellInfo const* /*spellInfo*/) override
474 {
476 }
477
479 {
480 Spell const* procSpell = eventInfo.GetProcSpell();
481 return procSpell && procSpell->HasPowerTypeCost(POWER_COMBO_POINTS);
482 }
483
484 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
485 {
486 Spell const* procSpell = procInfo.GetProcSpell();
487 int32 amount = aurEff->GetAmount() * *procSpell->GetPowerTypeCostAmount(POWER_COMBO_POINTS) * 1000;
488
489 if (Unit* target = GetTarget())
490 {
491 if (Aura* aura = target->GetAura(SPELL_ROGUE_SLICE_AND_DICE))
492 aura->SetDuration(aura->GetDuration() + amount);
493 else
494 {
497 args.AddSpellMod(SPELLVALUE_DURATION, amount);
498 target->CastSpell(target, SPELL_ROGUE_SLICE_AND_DICE, args);
499 }
500 }
501 }
502
508};
509
510// 198031 - Honor Among Thieves
513{
514 bool Validate(SpellInfo const* /*spellInfo*/) override
515 {
517 }
518
519 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
520 {
522
523 Unit* target = GetTarget();
525 }
526
531};
532
533// Called by 1784 - Stealth
535{
545
546 bool Load() override
547 {
549 }
550
551 void HandleBuff(uint32 spellToCast, uint32 auraToRemove) const
552 {
553 Unit* target = GetTarget();
554
555 target->RemoveAurasDueToSpell(auraToRemove);
556 target->CastSpell(target, spellToCast, CastSpellExtraArgsInit{
558 });
559
560 }
561
566
571
577};
578
579// 703 - Garrote
581{
591
592 void CalculateBonus(AuraEffect const* /*aurEff*/, SpellEffectValue& /*amount*/, bool& /*canBeRecalculated*/)
593 {
594 _pctMod = 1.0f;
595 Unit* caster = GetCaster();
596 if (!caster)
597 return;
598
599 if (AuraEffect const* improvedGarroteStealth = caster->GetAuraEffect(SPELL_ROGUE_IMPROVED_GARROTE_AFTER_STEALTH, EFFECT_1))
600 AddPct(_pctMod, improvedGarroteStealth->GetAmount());
601 else if (AuraEffect const* improvedGarroteAfterStealth = caster->GetAuraEffect(SPELL_ROGUE_IMPROVED_GARROTE_STEALTH, EFFECT_1))
602 AddPct(_pctMod, improvedGarroteAfterStealth->GetAmount());
603 }
604
605 void CalculateDamage(AuraEffect const* /*aurEff*/, Unit const* /*victim*/, int32& /*damage*/, int32& /*flatMod*/, float& pctMod) const
606 {
607 pctMod *= _pctMod;
608 }
609
615
616private:
617 float _pctMod = 1.0f;
618};
619
620// 5938 - Shiv
622{
623 bool Validate(SpellInfo const* /*spellInfo*/) override
624 {
626 }
627
628 bool Load() override
629 {
631 }
632
639
644};
645
646// 51690 - Killing Spree
648{
649 bool Validate(SpellInfo const* /*spellInfo*/) override
650 {
651 return ValidateSpellInfo(
652 {
656 });
657 }
658
659 void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
660 {
662 }
663
664 void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
665 {
666 while (!_targets.empty())
667 {
669 if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
670 {
673 break;
674 }
675 else
676 _targets.remove(guid);
677 }
678 }
679
684
691
692public:
693 void AddTarget(Unit* target)
694 {
695 _targets.push_back(target->GetGUID());
696 }
697
698private:
700};
701
703{
704 void FilterTargets(std::list<WorldObject*>& targets)
705 {
706 if (targets.empty() || GetCaster()->GetVehicleBase())
708 }
709
710 void HandleDummy(SpellEffIndex /*effIndex*/)
711 {
712 if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE))
713 if (spell_rog_killing_spree_aura* script = aura->GetScript<spell_rog_killing_spree_aura>())
714 script->AddTarget(GetHitUnit());
715 }
716
722};
723
724// 385627 - Kingsbane
726{
727 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& procInfo)
728 {
729 return procInfo.GetActionTarget()->HasAura(GetId(), GetCasterGUID());
730 }
731
736};
737
738// 2823 - Deadly Poison
739// 8679 - Wound Poison
740// 315584 - Instant Poison
741// 381664 - Amplifying Poison
779
780// 76806 - Mastery: Main Gauche
782{
783 bool Validate(SpellInfo const* /*spellInfo*/) override
784 {
786 }
787
789 {
790 return eventInfo.GetDamageInfo() && eventInfo.GetDamageInfo()->GetVictim();
791 }
792
793 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
794 {
795 if (Unit* target = GetTarget())
796 target->CastSpell(procInfo.GetDamageInfo()->GetVictim(), SPELL_ROGUE_MAIN_GAUCHE, aurEff);
797 }
798
804};
805
806// 277953 - Night Terrors (attached to 197835 - Shuriken Storm)
832
834{
836 {
837 if (!GetExplTargetUnit() || !GetCaster()->IsValidAttackTarget(GetExplTargetUnit(), GetSpellInfo()))
839
840 return SPELL_CAST_OK;
841 }
842
847};
848
849// 185565 - Poisoned Knife
889
890// Called by 1784 - Stealth
916
917// 343173 - Premeditation (proc)
938
939// 131511 - Prey on the Weak
940// Called by Cheap Shot - 1833 and Kidney Shot - 408
942{
943 bool Validate(SpellInfo const* /*spellInfo*/) override
944 {
946 }
947
948 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
949 {
950 if (Unit* caster = GetCaster())
951 if (caster->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK_TALENT))
952 caster->CastSpell(GetTarget(), SPELL_ROGUE_PREY_ON_THE_WEAK, true);
953 }
954
959};
960
961// 79096 - Restless Blades
963{
966
967 bool Validate(SpellInfo const* /*spellInfo*/) override
968 {
970 }
971
972 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
973 {
974 if (Optional<int32> spentCP = GetFinishingMoveCPCost(procInfo.GetProcSpell()))
975 {
976 Milliseconds cdExtra = -duration_cast<Milliseconds>(FloatSeconds(aurEff->GetAmount() * *spentCP * 0.1));
977
978 SpellHistory* history = GetTarget()->GetSpellHistory();
979 for (uint32 spellId : Spells)
980 history->ModifyCooldown(spellId, cdExtra, true);
981 }
982 }
983
988};
989
990// 315508 - Roll the Bones
992{
995
996 bool Validate(SpellInfo const* /*spellInfo*/) override
997 {
999 }
1000
1001 void HandleDummy(SpellEffIndex /*effIndex*/)
1002 {
1003 int32 currentDuration = 0;
1004 for (uint32 spellId : Spells)
1005 {
1006 if (Aura* aura = GetCaster()->GetAura(spellId))
1007 {
1008 currentDuration = aura->GetDuration();
1009 GetCaster()->RemoveAura(aura);
1010 }
1011 }
1012
1013 std::vector<uint32> possibleBuffs(std::begin(Spells), std::end(Spells));
1015
1016 // https://www.icy-veins.com/wow/outlaw-rogue-pve-dps-rotation-cooldowns-abilities
1017 // 1 Roll the Bones buff : 100.0 % chance;
1018 // 2 Roll the Bones buffs : 19 % chance;
1019 // 5 Roll the Bones buffs : 1 % chance.
1020 int32 chance = irand(1, 100);
1021 int32 numBuffs = 1;
1022 if (chance <= 1)
1023 numBuffs = 5;
1024 else if (chance <= 20)
1025 numBuffs = 2;
1026
1027 for (int32 i = 0; i < numBuffs; ++i)
1028 {
1029 uint32 spellId = possibleBuffs[i];
1030 CastSpellExtraArgs args;
1032 args.AddSpellMod(SPELLVALUE_DURATION, GetSpellInfo()->GetDuration() + currentDuration);
1033 GetCaster()->CastSpell(GetCaster(), spellId, args);
1034 }
1035 }
1036
1041};
1042
1043// 1943 - Rupture
1045{
1046 bool Validate(SpellInfo const* /*spellInfo*/) override
1047 {
1049 }
1050
1051 void OnEffectRemoved(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
1052 {
1053 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
1054 return;
1055
1056 Aura* aura = GetAura();
1057 Unit* caster = aura->GetCaster();
1058 if (!caster)
1059 return;
1060
1061 Aura* auraVenomousWounds = caster->GetAura(SPELL_ROGUE_VENOMOUS_WOUNDS);
1062 if (!auraVenomousWounds)
1063 return;
1064
1065 // Venomous Wounds: if unit dies while being affected by rupture, regain energy based on remaining duration
1066 Optional<SpellPowerCost> cost = GetSpellInfo()->CalcPowerCost(POWER_ENERGY, false, caster, GetSpellInfo()->GetSchoolMask(), nullptr);
1067 if (!cost)
1068 return;
1069
1070 float pct = float(aura->GetDuration()) / float(aura->GetMaxDuration());
1071 int32 extraAmount = float(cost->Amount) * pct;
1072 caster->ModifyPower(POWER_ENERGY, extraAmount);
1073 }
1074
1079};
1080
1081// 14161 - Ruthlessness
1083{
1084 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
1085 {
1086 Unit* target = GetTarget();
1087
1089 if (roll_chance(aurEff->GetSpellEffectInfo().PointsPerResource * *cost))
1090 target->ModifyPower(POWER_COMBO_POINTS, 1);
1091 }
1092
1097};
1098
1099// 185438 - Shadowstrike
1101{
1107
1109 {
1110 // Because the premeditation aura is removed when we're out of stealth,
1111 // when we reach HandleEnergize the aura won't be there, even if it was when player launched the spell
1113 return SPELL_FAILED_SUCCESS;
1114 }
1115
1117 {
1118 Unit* caster = GetCaster();
1120 {
1122 if (Aura* premeditationPassive = caster->GetAura(SPELL_ROGUE_PREMEDITATION_PASSIVE))
1123 if (AuraEffect const* auraEff = premeditationPassive->GetEffect(EFFECT_1))
1124 SetHitDamage(GetHitDamage() + auraEff->GetAmountAsInt());
1125
1126 // Grant 10 seconds of slice and dice
1127 int32 duration = sSpellMgr->AssertSpellInfo(SPELL_ROGUE_PREMEDITATION_PASSIVE, DIFFICULTY_NONE)->GetEffect(EFFECT_0).CalcValueAsInt(GetCaster());
1128
1129 CastSpellExtraArgs args;
1132 caster->CastSpell(caster, SPELL_ROGUE_SLICE_AND_DICE, args);
1133 }
1134 }
1135
1141
1142private:
1144};
1145
1146// Called by 1784 - Stealth and 185313 - Shadow Dance
1178
1179// 257505 - Shot in the Dark (attached to 1784 - Stealth and 185313 - Shadow Dance)
1181{
1182 bool Validate(SpellInfo const* /*spellInfo*/) override
1183 {
1185 }
1186
1187 bool Load() override
1188 {
1190 }
1191
1192 void HandleAfterCast() const
1193 {
1194 Unit* caster = GetCaster();
1197 .TriggeringSpell = GetSpell()
1198 });
1199 }
1200
1205};
1206
1207// 257506 - Shot in the Dark (attached to 185422 - Shadow Dance and 158185 - Stealth)
1225
1226// 197835 - Shuriken Storm
1228{
1229 bool Validate(SpellInfo const* /*spellInfo*/) override
1230 {
1232 }
1233
1242
1247};
1248
1249// 277925 - Shuriken Tornado
1270
1271// 193315 - Sinister Strike
1273{
1274 bool Validate(SpellInfo const* /*spellInfo*/) override
1275 {
1277 }
1278
1279 void HandleDummy(SpellEffIndex /*effIndex*/)
1280 {
1281 int32 damagePerCombo = GetHitDamage();
1282 if (AuraEffect const* t5 = GetCaster()->GetAuraEffect(SPELL_ROGUE_T5_2P_SET_BONUS, EFFECT_0))
1283 damagePerCombo += t5->GetAmountAsInt();
1284
1285 int32 finalDamage = damagePerCombo;
1286 if (Optional<int32> comboPointCost = GetSpell()->GetPowerTypeCostAmount(POWER_COMBO_POINTS))
1287 finalDamage *= *comboPointCost;
1288
1289 SetHitDamage(finalDamage);
1290 }
1291
1296};
1297
1298// Called by 1856 - Vanish
1300{
1301 bool Validate(SpellInfo const* /*spellInfo*/) override
1302 {
1304 }
1305
1306 bool Load() override
1307 {
1309 }
1310
1318
1319 void Register() override
1320 {
1322 }
1323};
1324
1325// 1784 - Stealth
1327{
1328 bool Validate(SpellInfo const* /*spellInfo*/) override
1329 {
1330 return ValidateSpellInfo(
1331 {
1335 });
1336 }
1337
1355
1363
1369};
1370
1371// 212283 - Symbols of Death
1390
1391// 57934 - Tricks of the Trade
1425
1426// 57934 - Tricks of the Trade
1428{
1430 {
1431 if (Aura* aura = GetHitAura())
1433 {
1434 if (Unit* explTarget = GetExplTargetUnit())
1435 script->SetRedirectTarget(explTarget->GetGUID());
1436 else
1437 script->SetRedirectTarget(ObjectGuid::Empty);
1438 }
1439 }
1440
1445};
1446
1447// 59628 - Tricks of the Trade (Proc)
1460
1461// 198020 - Turn the Tables (PvP Talent)
1463{
1464 bool CheckForStun(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
1465 {
1466 return eventInfo.GetProcSpell() && eventInfo.GetProcSpell()->GetSpellInfo()->HasAura(SPELL_AURA_MOD_STUN);
1467 }
1468
1473};
1474
1475// 198023 - Turn the Tables (periodic)
1477{
1478 bool Validate(SpellInfo const*) override
1479 {
1481 }
1482
1483 void CheckForStun(AuraEffect const* aurEff)
1484 {
1485 Unit* target = GetTarget();
1486 if (!target->HasAuraType(SPELL_AURA_MOD_STUN))
1487 {
1488 target->CastSpell(target, SPELL_ROGUE_TURN_THE_TABLES_BUFF, aurEff);
1490 Remove();
1491 }
1492 }
1493
1498};
1499
1500// 1856 - Vanish - SPELL_ROGUE_VANISH
1502{
1503 bool Validate(SpellInfo const* /*spellInfo*/) override
1504 {
1506 }
1507
1509 {
1510 PreventHitDefaultEffect(effIndex);
1511
1512 Unit* target = GetHitUnit();
1513
1515 if (target->GetTypeId() != TYPEID_PLAYER)
1516 return;
1517
1518 if (target->HasAura(SPELL_ROGUE_VANISH_AURA))
1519 return;
1520
1523 }
1524
1529};
1530
1531// 11327 - Vanish
1549
1550// 79134 - Venomous Wounds
1552{
1553 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
1554 {
1555 int32 extraEnergy = aurEff->GetAmountAsInt();
1556 GetTarget()->ModifyPower(POWER_ENERGY, extraEnergy);
1557 }
1558
1563};
1564
1566{
1615}
@ IN_MILLISECONDS
Definition Common.h:38
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::duration< double, Seconds::period > FloatSeconds
Definition Duration.h:29
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:433
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
Spells
Definition PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition Random.cpp:35
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_3
@ EFFECT_1
@ EFFECT_0
@ EFFECT_4
@ EFFECT_2
@ 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
#define EFFECT_ALL
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_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_STUN
@ SPELLVALUE_DURATION
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_IGNORE_POWER_COST
Will ignore power and reagent cost.
@ TRIGGERED_IGNORE_GCD
Will ignore GCD.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:812
#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 AuraCheckEffectProcFn(F, I, N)
#define SpellCalcDamageFn(F)
#define SpellCastFn(F)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectAbsorbOverkillFn(F, I)
#define AuraCheckProcFn(F)
#define SpellHitFn(F)
#define AuraEffectCalcDamageFn(F, I, N)
#define SPELL_AURA_ANY
Definition SpellScript.h:61
#define AuraEffectRemoveFn(F, I, N, M)
T AddPct(T &base, U pct)
Definition Util.h:85
SpellEffectInfo const & GetSpellEffectInfo() const
int32 GetAmountAsInt() const
SpellEffectValue GetAmount() const
HookList< EffectCalcDamageAndHealingHandler > DoEffectCalcDamageAndHealing
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< CheckEffectProcHandler > DoCheckEffectProc
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
Difficulty GetCastDifficulty() const
HookList< CheckProcHandler > DoCheckProc
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectProcHandler > OnEffectProc
uint32 GetId() const
int32 GetMaxDuration() const
Definition SpellAuras.h:217
uint32 GetId() const
Definition SpellAuras.h:183
int32 GetDuration() const
Definition SpellAuras.h:222
Unit * GetCaster() const
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
Unit * GetVictim() const
Definition Unit.h:447
static ObjectGuid const Empty
Definition ObjectGuid.h:314
Unit * GetActionTarget() const
Definition Unit.h:500
Spell const * GetProcSpell() const
Definition Unit.h:514
DamageInfo * GetDamageInfo() const
Definition Unit.h:511
Unit * GetProcTarget() const
Definition Unit.h:501
float PointsPerResource
Definition SpellInfo.h:220
void ModifyChargeRecoveryTime(uint32 chargeCategoryId, Duration cooldownMod)
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
uint32 const Id
Definition SpellInfo.h:328
bool HasAura(AuraType aura) const
uint32 m_scriptSpellId
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
HookList< DamageAndHealingCalcHandler > CalcDamage
HookList< CastHandler > AfterCast
HookList< CheckCastHandler > OnCheckCast
Aura * GetHitAura(bool dynObjAura=false, bool withRemoved=false) const
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
int64 GetUnitTargetCountForEffect(SpellEffIndex effect) const
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
void FinishCast(SpellCastResult result, int32 *param1=nullptr, int32 *param2=nullptr)
WorldObject * GetExplTargetWorldObject() const
HookList< EffectHandler > OnEffectLaunchTarget
void SetHitDamage(int32 damage)
Unit * GetExplTargetUnit() const
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition Spell.h:277
SpellInfo const * GetSpellInfo() const
Definition Spell.h:702
bool HasPowerTypeCost(Powers power) const
Definition Spell.cpp:8152
Optional< int32 > GetPowerTypeCostAmount(Powers power) const
Definition Spell.cpp:8157
void UnregisterRedirectThreat(uint32 spellId)
Definition Unit.h:635
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8697
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3955
void SetHealth(uint64 val)
Definition Unit.cpp:9973
uint64 CountPctFromMaxHealth(float pct) const
Definition Unit.h:797
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
ThreatManager & GetThreatManager()
Definition Unit.h:1078
Unit * SelectNearbyTarget(Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
Definition Unit.cpp:10903
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4604
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:4774
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4700
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4814
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
SpellHistory * GetSpellHistory()
Definition Unit.h:1498
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool isInBack(WorldObject const *target, float arc=float(M_PI)) const
Definition Object.cpp:675
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &) const
void FilterTargets(std::list< WorldObject * > &targets) const
bool Validate(SpellInfo const *) override
void HandleHit(SpellEffIndex) const
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)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
void HandleInstantDamage(SpellEffIndex) const
void HandleProc(AuraEffect const *aurEff, ProcEventInfo const &procInfo) const
bool Validate(SpellInfo const *) override
static bool CheckProc(AuraScript const &, AuraEffect const *, ProcEventInfo const &procEvent)
void Register() override
void CalculateDamage(SpellEffectInfo const &, Unit *, int32 &, int32 &flatMod, float &pctMod) const
void CalculateDamage(SpellEffectInfo const &, Unit *, int32 &, int32 &flatMod, float &pctMod) const
void Register() override
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 CalculateDamage(AuraEffect const *, Unit const *, int32 &, int32 &, float &pctMod) const
bool Validate(SpellInfo const *) override
void CalculateBonus(AuraEffect const *, SpellEffectValue &, bool &)
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes) const
void HandleEffectApply(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
void HandleBuff(uint32 spellToCast, uint32 auraToRemove) const
bool Validate(SpellInfo const *) override
void Register() override
void HandleDummy(SpellEffIndex) const
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)
void HandleOnApply(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandleOnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool HandleCheckProc(ProcEventInfo &eventInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
bool Validate(SpellInfo const *) override
void Register() override
void HandleEnergize(SpellEffIndex) const
void Register() override
SpellCastResult CheckCast()
void HandleHit(SpellEffIndex) const
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
void HandleEffectApply(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void Register() override
void OnApply(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
bool Validate(SpellInfo const *) override
static uint32 constexpr Spells[]
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
static uint32 constexpr Spells[]
bool Validate(SpellInfo const *) override
void OnEffectRemoved(AuraEffect const *, AuraEffectHandleModes)
void Register() override
void Register() override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
void Register() override
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
void HandleEffectApply(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
void HandleEnergize(SpellEffIndex)
SpellCastResult HandleCheckCast()
bool Validate(SpellInfo const *) override
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleEnergize(SpellEffIndex effIndex) const
bool Validate(SpellInfo const *) override
void HandlePeriodicEffect(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
void HandleEffectApply(AuraEffect const *aurEff, 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)
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:171
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
static constexpr std::array< std::pair< uint32, uint32 >, 7 > PoisonAuraToDebuff
bool IsFinishingMove(Spell const *spell)
void AddSC_rogue_spell_scripts()
Optional< int32 > GetFinishingMoveCPCost(Spell const *spell)
@ SPELL_ROGUE_PREY_ON_THE_WEAK
@ SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC
@ SPELL_ROGUE_SHURIKEN_STORM_DAMAGE
@ SPELL_ROGUE_AIRBORNE_IRRITANT
@ SPELL_ROGUE_ADRENALINE_RUSH
@ SPELL_ROGUE_SLICE_AND_DICE
@ SPELL_ROGUE_IMPROVED_SHIV
@ SPELL_ROGUE_WOUND_POISON_DEBUFF
@ SPELL_ROGUE_DEADLY_POISON
@ SPELL_ROGUE_TRUE_BEARING
@ SPELL_ROGUE_PREMEDITATION_PASSIVE
@ SPELL_ROGUE_IMPROVED_GARROTE_STEALTH
@ SPELL_ROGUE_TURN_THE_TABLES_BUFF
@ SPELL_ROGUE_MAIN_GAUCHE
@ SPELL_ROGUE_WOUND_POISON
@ SPELL_ROGUE_SHIV_NATURE_DAMAGE
@ SPELL_ROGUE_PREY_ON_THE_WEAK_TALENT
@ SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG
@ SPELL_ROGUE_SHADOW_FOCUS_EFFECT
@ SPELL_ROGUE_BURIED_TREASURE
@ SPELL_ROGUE_PREMEDITATION_AURA
@ SPELL_ROGUE_BLADE_FLURRY
@ SPELL_ROGUE_SANCTUARY
@ SPELL_ROGUE_ATROPHIC_POISON_DEBUFF
@ SPELL_ROGUE_GRAND_MELEE
@ SPELL_ROGUE_GRAPPLING_HOOK
@ SPELL_ROGUE_CHEATING_DEATH
@ SPELL_ROGUE_BLACKJACK
@ SPELL_ROGUE_IMPROVED_GARROTE_AFTER_STEALTH
@ SPELL_ROGUE_CRIPPLING_POISON
@ SPELL_ROGUE_TRICKS_OF_THE_TRADE
@ SPELL_ROGUE_RUTHLESS_PRECISION
@ SPELL_ROGUE_SYMBOLS_OF_DEATH_RANK2
@ SPELL_ROGUE_BLIND_AREA
@ SPELL_ROGUE_NUMBING_POISON_DEBUFF
@ SPELL_ROGUE_STEALTH_SHAPESHIFT_AURA
@ SPELL_ROGUE_SHADOW_FOCUS
@ SPELL_ROGUE_CLOAKED_IN_SHADOWS_TALENT
@ SPELL_ROGUE_ATROPHIC_POISON
@ SPELL_ROGUE_KILLING_SPREE
@ SPELL_ROGUE_STEALTH_STEALTH_AURA
@ SPELL_ROGUE_AMPLIFYING_POISON
@ SPELL_ROGUE_T5_2P_SET_BONUS
@ SPELL_ROGUE_INSTANT_POISON
@ SPELL_ROGUE_NUMBING_POISON
@ SPELL_ROGUE_VANISH_AURA
@ SPELL_ROGUE_SOOTHING_DARKNESS_TALENT
@ SPELL_ROGUE_SOOTHING_DARKNESS_HEAL
@ SPELL_ROGUE_CRIPPLING_POISON_DEBUFF
@ SPELL_ROGUE_IMPROVED_GARROTE_TALENT
@ SPELL_ROGUE_KILLING_SPREE_DMG_BUFF
@ SPELL_ROGUE_DEADLY_POISON_DEBUFF
@ SPELL_ROGUE_LEECHING_POISON_AURA
@ SPELL_ROGUE_LEECHING_POISON_TALENT
@ SPELL_ROGUE_SHOT_IN_THE_DARK_BUFF
@ SPELL_ROGUE_SHOT_IN_THE_DARK_TALENT
@ SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK
@ SPELL_ROGUE_SHURIKEN_STORM_ENERGIZE
@ SPELL_ROGUE_CHEATED_DEATH
@ SPELL_ROGUE_KILLING_SPREE_TELEPORT
@ SPELL_ROGUE_SKULL_AND_CROSSBONES
@ SPELL_ROGUE_MARKED_FOR_DEATH
@ SPELL_ROGUE_HONOR_AMONG_THIEVES_ENERGIZE
@ SPELL_ROGUE_BLACKJACK_TALENT
@ SPELL_ROGUE_SYMBOLS_OF_DEATH_CRIT_AURA
@ SPELL_ROGUE_SHADOWS_GRASP
@ SPELL_ROGUE_BETWEEN_THE_EYES
@ SPELL_ROGUE_SHADOW_DANCE
@ SPELL_ROGUE_CLOAKED_IN_SHADOWS_ABSORB
@ SPELL_ROGUE_PREMEDITATION_ENERGIZE
@ SPELL_ROGUE_BROADSIDE
@ SPELL_ROGUE_ACROBATIC_STRIKES_PROC
@ SPELL_ROGUE_INSTANT_POISON_DAMAGE
@ SPELL_ROGUE_VENOMOUS_WOUNDS
@ SPELL_ROGUE_VANISH
@ SPELL_ROGUE_DEADLY_POISON_INSTANT_DAMAGE
@ SPELL_ROGUE_SPRINT
@ SPELL_ROGUE_CHEAT_DEATH_DUMMY
@ SPELL_ROGUE_STEALTH
@ SPELL_ROGUE_AMPLIFYING_POISON_DEBUFF
@ SPELL_ROGUE_NIGHT_TERRORS
static constexpr bool IsLethalPoison(uint32 spellId)
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & AddSpellBP0(SpellEffectValue val)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)