TrinityCore
Loading...
Searching...
No Matches
spell_hunter.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_HUNTER, SPELLFAMILY_PET and SPELLFAMILY_GENERIC spells used by hunter players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_hun_".
22 */
23
24#include "ScriptMgr.h"
25#include "AreaTriggerAI.h"
26#include "CellImpl.h"
27#include "DB2Stores.h"
28#include "GridNotifiersImpl.h"
29#include "ObjectAccessor.h"
30#include "Pet.h"
31#include "SpellAuraEffects.h"
32#include "SpellHistory.h"
33#include "SpellMgr.h"
34#include "SpellScript.h"
35#include "TaskScheduler.h"
36
38{
126
127// 131894 - A Murder of Crows
129{
140
141 void HandleDummyTick(AuraEffect const* /*aurEff*/)
142 {
143 Unit* target = GetTarget();
144
145 if (Unit* caster = GetCaster())
146 caster->CastSpell(target, SPELL_HUNTER_A_MURDER_OF_CROWS_DAMAGE, true);
147
151 target->CastSpell(target, SPELL_HUNTER_A_MURDER_OF_CROWS_VISUAL_3, true); // not a mistake, it is intended to cast twice
152 }
153
154 void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
155 {
156 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
157 if (Unit* caster = GetCaster())
158 caster->GetSpellHistory()->ResetCooldown(GetId(), true);
159 }
160
166};
167
168// 186257 - Aspect of the Cheetah
190
191// 1219162 - Aspect of the Fox (attached to 186257 - Aspect of the Cheetah)
193{
194 bool Validate(SpellInfo const* spellInfo) override
195 {
197 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } })
199 }
200
201 bool Load() override
202 {
204 }
205
206 static void HandleCastWhileWalking(SpellScript const&, WorldObject*& target)
207 {
208 target = nullptr;
209 }
210
215};
216
217// 186265 - Aspect of the Turtle
241
242// 109248 - Binding Shot
260
261// 109248 - Binding Shot
262// Id - 1524
264{
266
267 void OnInitialize() override
268 {
269 if (Unit* caster = at->GetCaster())
270 for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_BINDING_SHOT))
271 other->SetDuration(0);
272 }
273
274 void OnCreate(Spell const* /*creatingSpell*/) override
275 {
276 _scheduler.Schedule(1s, [this](TaskContext& task)
277 {
278 for (ObjectGuid const& guid : at->GetInsideUnits())
279 {
280 Unit* unit = ObjectAccessor::GetUnit(*at, guid);
282 continue;
283
285 }
286
287 task.Repeat(1s);
288 });
289 }
290
291 void OnUnitEnter(Unit* unit) override
292 {
293 if (Unit* caster = at->GetCaster())
294 {
295 if (caster->IsValidAttackTarget(unit) && !unit->HasAura(SPELL_HUNTER_BINDING_SHOT_IMMUNE, caster->GetGUID()))
296 {
299 }
300 }
301 }
302
303 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
304 {
306
307 if (at->IsRemoved())
308 return;
309
310 if (Unit* caster = at->GetCaster())
311 {
312 if (caster->IsValidAttackTarget(unit) && !unit->HasAura(SPELL_HUNTER_BINDING_SHOT_IMMUNE, caster->GetGUID()))
313 {
316
317 if (caster->HasAura(SPELL_HUNTER_HORSEHAIR_TETHER_TALENT))
319 }
320 }
321 }
322
323 void OnUpdate(uint32 diff) override
324 {
325 _scheduler.Update(diff);
326 }
327
328private:
330};
331
332// 466930 - Black Arrow
350
351// 467749 - Bleak Arrows
353{
354 bool Validate(SpellInfo const* spellInfo) override
355 {
356 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } })
357 && ValidateSpellInfo({ SPELL_HUNTER_AUTO_SHOT, spellInfo->GetEffect(EFFECT_0).TriggerSpell });
358 }
359
360 bool Load() override
361 {
362 return GetUnitOwner()->IsPlayer();
363 }
364
366 {
367 Player* target = GetUnitOwner()->ToPlayer();
368 target->RemoveSpell(SPELL_HUNTER_AUTO_SHOT, false, false, true);
369 target->LearnSpell(aurEff->GetSpellEffectInfo().TriggerSpell, true, 0, true);
370 target->AddOverrideSpell(SPELL_HUNTER_AUTO_SHOT, aurEff->GetSpellEffectInfo().TriggerSpell); // this is a hack to work around auto shot being relearned on level change
371 }
372
374 {
375 Player* target = GetUnitOwner()->ToPlayer();
377 target->RemoveSpell(aurEff->GetSpellEffectInfo().TriggerSpell, false, false, true);
378 target->LearnSpell(SPELL_HUNTER_AUTO_SHOT, true, 0, true);
379 }
380
386};
387
388// 467911 - Bleak Powder
390{
391 bool Validate(SpellInfo const* /*spellInfo*/) override
392 {
394 }
395
400
401 void Register() override
402 {
404 }
405};
406
407// 467912 - Bleak Powder
422
423// 467912 - Bleak Powder
445
446// 389019 - Bulletstorm
448{
449 bool Validate(SpellInfo const* /*spellInfo*/) override
450 {
452 }
453
454 void HandleProc(ProcEventInfo const& eventInfo) const
455 {
457 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
458 .TriggeringSpell = eventInfo.GetProcSpell()
459 });
460 }
461
462 void Register() override
463 {
465 }
466};
467
468// 204089 - Bullseye
470{
471 static bool CheckEffectProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
472 {
473 return eventInfo.GetActionTarget()->HealthBelowPct(aurEff->GetAmount());
474 }
475
480};
481
482// 378750 - Cobra Sting
484{
485 bool Validate(SpellInfo const* spellInfo) override
486 {
487 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
488 }
489
490 bool RollProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*procInfo*/)
491 {
492 return roll_chance(GetEffect(EFFECT_1)->GetAmount());
493 }
494
499};
500
501// 5116 - Concussive Shot (attached to 193455 - Cobra Shot and 56641 - Steady Shot)
503{
504 bool Validate(SpellInfo const* /*spellInfo*/) override
505 {
508 }
509
510 void HandleDuration(SpellEffIndex /*effIndex*/) const
511 {
512 Unit* caster = GetCaster();
513
514 if (Aura* concussiveShot = GetHitUnit()->GetAura(SPELL_HUNTER_CONCUSSIVE_SHOT, caster->GetGUID()))
515 {
516 SpellInfo const* steadyShot = sSpellMgr->AssertSpellInfo(SPELL_HUNTER_STEADY_SHOT, GetCastDifficulty());
517 Milliseconds extraDuration = duration_cast<Milliseconds>(FloatSeconds(steadyShot->GetEffect(EFFECT_2).CalcValue(caster) / 10));
518 Milliseconds newDuration = Milliseconds(concussiveShot->GetDuration()) + extraDuration;
519 concussiveShot->SetDuration(newDuration.count());
520 concussiveShot->SetMaxDuration(newDuration.count());
521 }
522 }
523
528};
529
530// 343244 - Disruptive Rounds
532{
533 bool Validate(SpellInfo const* /*spellInfo*/) override
534 {
536 }
537
538 static void HandleProc(AuraScript const&, ProcEventInfo const& eventInfo)
539 {
541 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
542 .TriggeringSpell = eventInfo.GetProcSpell()
543 });
544 }
545
550};
551
552// 459517 - Concussive Shot (attached to 186265 - Aspect of the Turtle and 5384 - Feign Death)
578
579// 109304 - Exhilaration
581{
582 bool Validate(SpellInfo const* /*spellInfo*/) override
583 {
585 }
586
592
593 void Register() override
594 {
596 }
597};
598
599// 212431 - Explosive Shot
601{
602 bool Validate(SpellInfo const* /*spellInfo*/) override
603 {
605 }
606
607 void HandlePeriodic(AuraEffect const* /*aurEff*/)
608 {
609 if (Unit* caster = GetCaster())
611 }
612
617};
618
619// 1543 - Flare
621{
622 bool Validate(SpellInfo const* /*spellInfo*/) override
623 {
625 }
626
627 void PlayVisual(SpellEffIndex /*effIndex*/) const
628 {
629 Unit* caster = GetCaster();
630 uint32 spellXSpellVisualId = caster->GetCastSpellXSpellVisualId(sSpellMgr->AssertSpellInfo(SPELL_HUNTER_FLARE_VISUAL, DIFFICULTY_NONE));
631 SpellXSpellVisualEntry const* sxsv = sSpellXSpellVisualStore.LookupEntry(spellXSpellVisualId);
632 if (!sxsv)
633 return;
634
635 FloatSeconds travelTime = FloatMilliseconds(GetSpell()->GetDelayMoment()) + FloatSeconds(GetEffectValue());
636 caster->SendPlaySpellVisual(*GetHitDest(), sxsv->SpellVisualID, SPELL_MISS_NONE, SPELL_MISS_NONE, travelTime.count(), true);
637 }
638
643};
644
645// 132950 - Flare
646// Ids - 510 and 35958
648{
650
651 void OnUnitEnter(Unit* unit) override
652 {
653 if (Unit* caster = at->GetCaster())
654 if (caster->IsValidAttackTarget(unit))
656 }
657
658 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
659 {
661 }
662};
663
664// 378767 - Focused Aim (attached to 260242 - Precise Shots)
666{
667 bool Validate(SpellInfo const* /*spellInfo*/) override
668 {
670 }
671
672 static void HandleProc(AuraScript const&, ProcEventInfo const& eventInfo)
673 {
674 if (AuraEffect const* focusedAim = eventInfo.GetActor()->GetAuraEffect(SPELL_HUNTER_FOCUSED_AIM, EFFECT_0))
675 eventInfo.GetActor()->GetSpellHistory()->ModifyCooldown(SPELL_HUNTER_AIMED_SHOT, -Milliseconds(focusedAim->GetAmountAsInt()));
676 }
677
678 void Register() override
679 {
681 }
682};
683
684// 236775 - High Explosive Trap
685// 9810 - AreatriggerId
687{
689
690 void OnInitialize() override
691 {
692 if (Unit* caster = at->GetCaster())
693 for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_HIGH_EXPLOSIVE_TRAP))
694 other->SetDuration(0);
695 }
696
697 void OnUnitEnter(Unit* unit) override
698 {
699 if (Unit* caster = at->GetCaster())
700 {
701 if (caster->IsValidAttackTarget(unit))
702 {
704 at->Remove();
705 }
706 }
707 }
708};
709
710// 212658 - Hunting Party
712{
713 bool Validate(SpellInfo const* /*spellInfo*/) override
714 {
715 return ValidateSpellInfo(
716 {
719 });
720 }
721
722 void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
723 {
725 GetTarget()->GetSpellHistory()->ModifyCooldown(SPELL_HUNTER_EXHILARATION, duration_cast<Milliseconds>(FloatSeconds(-aurEff->GetAmount())));
726 GetTarget()->GetSpellHistory()->ModifyCooldown(SPELL_HUNTER_EXHILARATION_PET, duration_cast<Milliseconds>(FloatSeconds(-aurEff->GetAmount())));
727 }
728
733};
734
735// 462032 - Implosive Trap
736// 34378 - AreatriggerId
738{
740
741 void OnInitialize() override
742 {
743 if (Unit* caster = at->GetCaster())
744 for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_IMPLOSIVE_TRAP))
745 other->SetDuration(0);
746 }
747
748 void OnUnitEnter(Unit* unit) override
749 {
750 if (Unit* caster = at->GetCaster())
751 {
752 if (caster->IsValidAttackTarget(unit))
753 {
755 at->Remove();
756 }
757 }
758 }
759};
760
761// 459506 - Kindling Flare (attached to 132950 - Flare)
787
788// 378016 - Latent Poison
790{
791 bool Validate(SpellInfo const* /*spellInfo*/) override
792 {
794 }
795
797 {
798 if (Aura* stack = GetHitUnit()->GetAura(SPELL_HUNTER_LATENT_POISON_STACK, GetCaster()->GetGUID()))
799 {
800 SetHitDamage(GetHitDamage() * stack->GetStackAmount());
801 stack->Remove();
802 }
803 }
804
809};
810
811// 19434 - Aimed Shot
812// 186270 - Raptor Strike
813// 217200 - Barbed Shot
814// 259387 - Mongoose Bite
833
834// 336904 - Latent Poison Injectors
836{
837 bool Validate(SpellInfo const* /*spellInfo*/) override
838 {
840 }
841
843 {
844 if (Aura* stack = GetHitUnit()->GetAura(SPELL_HUNTER_LATENT_POISON_INJECTORS_STACK, GetCaster()->GetGUID()))
845 {
846 SetHitDamage(GetHitDamage() * stack->GetStackAmount());
847 stack->Remove();
848 }
849 }
850
855};
856
857// 186270 - Raptor Strike
858// 259387 - Mongoose Bite
877
878// 194595 - Lock and Load
880{
881 bool Validate(SpellInfo const* /*spellInfo*/) override
882 {
884 }
885
886 static bool CheckProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& /*eventInfo*/)
887 {
888 return roll_chance(aurEff->GetAmount());
889 }
890
891 static void HandleProc(AuraScript const&, AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo)
892 {
893 Unit* caster = eventInfo.GetActor();
896 });
897 }
898
904};
905
906// 1217788 - Manhunter
908{
909 bool Validate(SpellInfo const* /*spellInfo*/) override
910 {
912 }
913
914 static bool CheckProc(AuraScript const&, ProcEventInfo const& eventInfo)
915 {
916 return eventInfo.GetActionTarget()->IsPlayer();
917 }
918
919 static void HandleEffectProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
920 {
922 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
923 .TriggeringAura = aurEff
924 });
925 }
926
932};
933
934// 260309 - Master Marksman
936{
937 bool Validate(SpellInfo const* /*spellInfo*/) override
938 {
940 && sSpellMgr->AssertSpellInfo(SPELL_HUNTER_MASTER_MARKSMAN, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount() > 0;
941 }
942
943 static void HandleProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
944 {
945 uint32 ticks = sSpellMgr->AssertSpellInfo(SPELL_HUNTER_MASTER_MARKSMAN, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount();
946 SpellEffectValue damage = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / ticks;
947
949 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
950 .SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, damage } }
951 });
952 }
953
958};
959
960// 53271 - Masters Call
962{
963 bool Validate(SpellInfo const* spellInfo) override
964 {
965 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } })
967 }
968
969 bool Load() override
970 {
971 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
972 }
973
975 {
977 ASSERT(pet); // checked in Spell::CheckCast
978
979 if (!pet->IsPet() || !pet->IsAlive())
980 return SPELL_FAILED_NO_PET;
981
982 // Do a mini Spell::CheckCasterAuras on the pet, no other way of doing this
984 uint32 const unitflag = pet->m_unitData->Flags;
985 if (!pet->GetCharmerGUID().IsEmpty())
986 result = SPELL_FAILED_CHARMED;
987 else if (unitflag & UNIT_FLAG_STUNNED)
988 result = SPELL_FAILED_STUNNED;
989 else if (unitflag & UNIT_FLAG_FLEEING)
990 result = SPELL_FAILED_FLEEING;
991 else if (unitflag & UNIT_FLAG_CONFUSED)
992 result = SPELL_FAILED_CONFUSED;
993
994 if (result != SPELL_CAST_OK)
995 return result;
996
997 Unit* target = GetExplTargetUnit();
998 if (!target)
1000
1001 if (!pet->IsWithinLOSInMap(target))
1003
1004 return SPELL_CAST_OK;
1005 }
1006
1007 void HandleDummy(SpellEffIndex /*effIndex*/)
1008 {
1010 }
1011
1013 {
1015 }
1016
1024};
1025
1026// 34477 - Misdirection
1055
1056// 35079 - Misdirection (Proc)
1069
1070// 459546 - No Hard Feelings (attached to 34477 - Misdirection)
1072{
1073 bool Validate(SpellInfo const* /*spellInfo*/) override
1074 {
1076 }
1077
1078 bool Load() override
1079 {
1081 }
1082
1083 void HandleHitTarget(SpellEffIndex /*effIndex*/) const
1084 {
1085 Unit* caster = GetCaster();
1086 Unit* target = GetHitUnit();
1087 if (!target->IsPet() || target->GetOwnerGUID() != caster->GetGUID())
1088 return;
1089
1092 .TriggeringSpell = GetSpell()
1093 });
1094 }
1095
1100};
1101
1102// 473385 - No Scope (attached to 257044 - Rapid Fire)
1104{
1105 bool Validate(SpellInfo const* /*spellInfo*/) override
1106 {
1108 }
1109
1110 bool Load() override
1111 {
1113 }
1114
1122
1127};
1128
1129// 459783 - Penetrating Shots
1131{
1132 void CalcAmount(AuraEffect const* /*aurEff*/, SpellEffectValue& amount, bool const& /*canBeRecalculated*/) const
1133 {
1134 if (AuraEffect const* amountHolder = GetEffect(EFFECT_1))
1135 {
1136 float critChanceDone = GetUnitOwner()->GetUnitCriticalChanceDone(BASE_ATTACK);
1137 amount = CalculatePct(critChanceDone, amountHolder->GetAmount());
1138 }
1139 }
1140
1141 void UpdatePeriodic(AuraEffect const* aurEff) const
1142 {
1143 if (AuraEffect* bonus = GetEffect(EFFECT_0))
1144 bonus->RecalculateAmount(aurEff);
1145 }
1146
1152};
1153
1154// 55709 - Pet Heart of the Phoenix
1156{
1157 bool Load() override
1158 {
1159 if (!GetCaster()->IsPet())
1160 return false;
1161 return true;
1162 }
1163
1168
1169 void HandleScript(SpellEffIndex /*effIndex*/)
1170 {
1171 Unit* caster = GetCaster();
1172 if (Unit* owner = caster->GetOwner())
1173 {
1175 {
1177 args.AddSpellBP0(100);
1178 owner->CastSpell(caster, SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, args);
1180 }
1181 }
1182 }
1183
1188};
1189
1190// 109215 Posthaste (attached to 781 - Disengage)
1217
1218// 260240 - Precise Shots
1220{
1221 bool Validate(SpellInfo const* /*spellInfo*/) override
1222 {
1224 }
1225
1226 void HandleProc(ProcEventInfo const& eventInfo) const
1227 {
1229 .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
1230 .TriggeringSpell = eventInfo.GetProcSpell()
1231 });
1232 }
1233
1234 void Register() override
1235 {
1237 }
1238};
1239
1240// 459794 - Quick Draw
1242{
1243 bool Validate(SpellInfo const* /*spellInfo*/) override
1244 {
1246 }
1247
1252
1253 void Register() override
1254 {
1256 }
1257};
1258
1259// 1279347 - Quick Draw
1261{
1262 static constexpr SpellEffectValue SpeedAmount = 5;
1263
1264 bool Validate(SpellInfo const* spellInfo) override
1265 {
1266 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } })
1268 }
1269
1270 void UpdateSpeed(AuraEffect const* /*aurEff*/) const
1271 {
1272 if (AuraEffect* speed = GetEffect(EFFECT_0))
1273 speed->ChangeAmount(speed->GetAmount() - SpeedAmount);
1274 }
1275
1280};
1281
1282// 257044 - Rapid Fire
1284{
1285 bool Validate(SpellInfo const* /*spellInfo*/) override
1286 {
1288 }
1289
1290 void HandlePeriodic(AuraEffect const* /*aurEff*/) const
1291 {
1292 if (Unit* caster = GetCaster())
1294 }
1295
1300};
1301
1302// 257045 - Rapid Fire Damage
1323
1324// 385539 - Rejuvenating Wind
1326{
1327 bool Validate(SpellInfo const* /*spellInfo*/) override
1328 {
1330 && sSpellMgr->AssertSpellInfo(SPELL_HUNTER_REJUVENATING_WIND_HEAL, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount() > 0;
1331 }
1332
1333 void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& /*procEvent*/)
1334 {
1336
1337 Unit* caster = GetTarget();
1338
1339 uint32 ticks = sSpellMgr->AssertSpellInfo(SPELL_HUNTER_REJUVENATING_WIND_HEAL, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount();
1340 SpellEffectValue heal = CalculatePct(caster->GetMaxHealth(), aurEff->GetAmount()) / ticks;
1341
1344 .SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, heal } }
1345 });
1346 }
1347
1352};
1353
1354// 53480 - Roar of Sacrifice
1356{
1357 bool Validate(SpellInfo const* /*spellInfo*/) override
1358 {
1360 }
1361
1362 bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
1363 {
1364 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1365 if (!damageInfo || !(damageInfo->GetSchoolMask() & aurEff->GetMiscValue()))
1366 return false;
1367
1368 if (!GetCaster())
1369 return false;
1370
1371 return true;
1372 }
1373
1374 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
1375 {
1377
1378 CastSpellExtraArgs args(aurEff);
1379 args.AddSpellBP0(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()));
1381 }
1382
1388};
1389
1390// 37506 - Scatter Shot
1392{
1393 bool Load() override
1394 {
1395 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
1396 }
1397
1398 void HandleDummy(SpellEffIndex /*effIndex*/)
1399 {
1400 Player* caster = GetCaster()->ToPlayer();
1401 // break Auto Shot and autohit
1403 caster->AttackStop();
1405 }
1406
1411};
1412
1413// 459455 - Scout's Instincts (attached to 186257 - Aspect of the Cheetah)
1415{
1416 bool Validate(SpellInfo const* spellInfo) override
1417 {
1419 && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } })
1421 }
1422
1423 bool Load() override
1424 {
1426 }
1427
1428 static void HandleMinSpeed(SpellScript const&, WorldObject*& target)
1429 {
1430 target = nullptr;
1431 }
1432
1437};
1438
1439// 459533 - Scrappy
1441{
1443
1444 bool Validate(SpellInfo const* /*spellInfo*/) override
1445 {
1447 }
1448
1449 void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo const& /*eventInfo*/) const
1450 {
1451 for (uint32 spellId : AffectedSpellIds)
1453 }
1454
1459};
1460
1461// 473520 - Shrapnel Shot
1463{
1464 bool Validate(SpellInfo const* /*spellInfo*/) override
1465 {
1467 }
1468
1478
1479 void Register() override
1480 {
1482 }
1483};
1484
1485// 56641 - Steady Shot
1514
1515// 260367 - Streamline (attached to 257044 - Rapid Fire)
1517{
1518 bool Validate(SpellInfo const* /*spellInfo*/) override
1519 {
1521 }
1522
1523 bool Load() override
1524 {
1526 }
1527
1535
1540};
1541
1542// 391559 - Surging Shots
1544{
1545 bool Validate(SpellInfo const* /*spellInfo*/) override
1546 {
1548 }
1549
1550 static bool RollProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& /*procInfo*/)
1551 {
1552 return roll_chance(aurEff->GetAmount());
1553 }
1554
1555 static void HandleProc(AuraScript const&, AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo)
1556 {
1557 Unit* caster = eventInfo.GetActor();
1560 }
1561
1567};
1568
1569// 1273132 Take Aim (attached to 257045 - Rapid Fire)
1571{
1572 bool Validate(SpellInfo const* /*spellInfo*/) override
1573 {
1575 }
1576
1577 bool Load() override
1578 {
1579 if (AuraEffect const* takeAim = GetCaster()->GetAuraEffect(SPELL_HUNTER_TAKE_AIM, EFFECT_1))
1580 {
1581 _aimedShotCooldownReduction = Milliseconds(-takeAim->GetAmountAsInt());
1582 return true;
1583 }
1584 return false;
1585 }
1586
1591
1592 void Register() override
1593 {
1595 }
1596
1598};
1599
1600// 1515 - Tame Beast
1602{
1604 {
1605 883,
1606 83242,
1607 83243,
1608 83244,
1609 83245,
1610 };
1611
1613 {
1614 Player* caster = GetCaster()->ToPlayer();
1615 if (!caster)
1617
1618 if (!GetExplTargetUnit())
1620
1621 if (Creature* target = GetExplTargetUnit()->ToCreature())
1622 {
1623 if (target->GetLevelForTarget(caster) > caster->GetLevel())
1625
1626 // use SMSG_PET_TAME_FAILURE?
1627 if (!target->GetCreatureTemplate()->IsTameable(caster->CanTameExoticPets(), target->GetCreatureDifficulty()))
1629
1630 if (PetStable const* petStable = caster->GetPetStable())
1631 {
1632 if (petStable->CurrentPetIndex)
1634
1635 auto freeSlotItr = std::find_if(petStable->ActivePets.begin(), petStable->ActivePets.end(), [](Optional<PetStable::PetInfo> const& petInfo)
1636 {
1637 return !petInfo.has_value();
1638 });
1639
1640 if (freeSlotItr == petStable->ActivePets.end())
1641 {
1644 }
1645
1646 // Check for known Call Pet X spells
1647 std::size_t freeSlotIndex = std::distance(petStable->ActivePets.begin(), freeSlotItr);
1648 if (!caster->HasSpell(CallPetSpellIds[freeSlotIndex]))
1649 {
1652 }
1653 }
1654
1655 if (!caster->GetCharmedGUID().IsEmpty())
1657
1658 if (!target->GetOwnerGUID().IsEmpty())
1659 {
1662 }
1663 }
1664 else
1666
1667 return SPELL_CAST_OK;
1668 }
1669
1674};
1675
1676// 187700 - Tar Trap
1677// 4436 - AreatriggerId
1679{
1681
1682 void OnCreate(Spell const* /*creatingSpell*/) override
1683 {
1684 if (Unit* caster = at->GetCaster())
1685 {
1686 if (caster->HasAura(SPELL_HUNTER_ENTRAPMENT_TALENT))
1688 }
1689 }
1690
1691 void OnUnitEnter(Unit* unit) override
1692 {
1693 if (Unit* caster = at->GetCaster())
1694 {
1695 if (caster->IsValidAttackTarget(unit))
1697 }
1698 }
1699
1700 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
1701 {
1703 }
1704};
1705
1706// 187699 - Tar Trap
1707// 4435 - AreatriggerId
1709{
1711
1712 void OnInitialize() override
1713 {
1714 if (Unit* caster = at->GetCaster())
1715 for (AreaTrigger* other : caster->GetAreaTriggers(SPELL_HUNTER_TAR_TRAP))
1716 other->SetDuration(0);
1717 }
1718
1719 void OnUnitEnter(Unit* unit) override
1720 {
1721 if (Unit* caster = at->GetCaster())
1722 {
1723 if (caster->IsValidAttackTarget(unit))
1724 {
1726 at->Remove();
1727 }
1728 }
1729 }
1730};
1731
1732// 471366 - Tensile Bowstring (attached to 288613 - Trueshot)
1734{
1735 bool Validate(SpellInfo const* /*spellInfo*/) override
1736 {
1738 }
1739
1740 void CalcCastTimeReduction(AuraEffect const* /*aurEff*/, SpellEffectValue& amount, bool& /*canBeRecalculated*/) const
1741 {
1742 if (AuraEffect const* tensileBowstring = GetUnitOwner()->GetAuraEffect(SPELL_HUNTER_TENSILE_BOWSTRING, EFFECT_0))
1743 amount = -tensileBowstring->GetAmount();
1744 }
1745
1746 void CalcPowerCostReduction(AuraEffect const* /*aurEff*/, SpellEffectValue& amount, bool& /*canBeRecalculated*/) const
1747 {
1748 if (AuraEffect const* tensileBowstring = GetUnitOwner()->GetAuraEffect(SPELL_HUNTER_TENSILE_BOWSTRING, EFFECT_1))
1749 amount = -tensileBowstring->GetAmount();
1750 }
1751
1757};
1758
1759// 199921 - Trailblazer
1761{
1762 bool Validate(SpellInfo const* /*spellInfo*/) override
1763 {
1765 }
1766
1767 static void CalcPeriodic(AuraScript const&, AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
1768 {
1769 isPeriodic = true;
1770 amplitude = 3 * IN_MILLISECONDS;
1771 }
1772
1773 void HandleDummyTick(AuraEffect const* /*aurEff*/) const
1774 {
1775 Unit* caster = GetTarget();
1776
1777 if (!caster->HasAura(SPELL_HUNTER_TRAILBLAZER))
1779 }
1780
1781 static void HandleProc(AuraScript const&, AuraEffect* aurEff, ProcEventInfo const& eventInfo)
1782 {
1783 aurEff->ResetPeriodic(true);
1785 }
1786
1787 void HandleOnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
1788 {
1790 }
1791
1799};
1800
1801// 67151 - Item - Hunter T9 4P Bonus (Steady Shot)
1803{
1804 bool Validate(SpellInfo const* /*spellInfo*/) override
1805 {
1807 }
1808
1809 bool CheckProc(ProcEventInfo& eventInfo)
1810 {
1811 if (eventInfo.GetActor()->GetTypeId() == TYPEID_PLAYER && eventInfo.GetActor()->ToPlayer()->GetPet())
1812 return true;
1813 return false;
1814 }
1815
1816 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
1817 {
1819 Unit* caster = eventInfo.GetActor();
1820
1821 caster->CastSpell(caster->ToPlayer()->GetPet(), SPELL_HUNTER_T9_4P_GREATNESS, aurEff);
1822 }
1823
1829};
1830
1831// 394366 - Find The Mark
1833{
1834 bool Validate(SpellInfo const* /*spellInfo*/) override
1835 {
1837 && sSpellMgr->AssertSpellInfo(SPELL_HUNTER_T29_2P_MARKSMANSHIP_DAMAGE, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount();
1838 }
1839
1840 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
1841 {
1843
1844 Unit* caster = eventInfo.GetActor();
1845 uint32 ticks = sSpellMgr->AssertSpellInfo(SPELL_HUNTER_T29_2P_MARKSMANSHIP_DAMAGE, DIFFICULTY_NONE)->GetEffect(EFFECT_0).GetPeriodicTickCount();
1846 SpellEffectValue damage = CalculatePct(eventInfo.GetDamageInfo()->GetOriginalDamage(), aurEff->GetAmount()) / ticks;
1847
1849 .SetTriggeringSpell(eventInfo.GetProcSpell())
1851 }
1852
1857};
1858
1859// 343242 Wilderness Medicine (attached to 136 - Mend Pet)
1861{
1866
1867 bool Load() override
1868 {
1869 Unit const* caster = GetCaster();
1870 if (!caster)
1871 return false;
1872
1874 if (!wildernessMedicine)
1875 return false;
1876
1877 _dispelChance = wildernessMedicine->GetAmount();
1878 return true;
1879 }
1880
1881 void OnPeriodic(AuraEffect const* aurEff) const
1882 {
1883 if (Unit* caster = GetCaster())
1887 .TriggeringAura = aurEff
1888 });
1889 }
1890
1895
1897};
1898
1899// 473523 - Windrunner Quiver
1901{
1902 bool Validate(SpellInfo const* /*spellInfo*/) override
1903 {
1905 }
1906
1907 static bool CheckProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& /*eventInfo*/)
1908 {
1909 return roll_chance(aurEff->GetAmount());
1910 }
1911
1912 static void HandleProc(AuraScript const&, AuraEffect const* /*aurEff*/, ProcEventInfo const& eventInfo)
1913 {
1915 }
1916
1922};
1923
1925{
1991}
AreaTriggerExitReason
Definition AreaTrigger.h:70
@ IN_MILLISECONDS
Definition Common.h:38
DB2Storage< SpellXSpellVisualEntry > sSpellXSpellVisualStore("SpellXSpellVisual.db2", &SpellXSpellVisualLoadInfo::Instance)
@ DIFFICULTY_NONE
Definition DBCEnums.h:936
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::chrono::duration< double, Milliseconds::period > FloatMilliseconds
Definition Duration.h:25
#define ASSERT
Definition Errors.h:72
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
#define MAX_ACTIVE_PETS
Definition PetDefines.h:36
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_6
@ EFFECT_1
@ EFFECT_5
@ EFFECT_0
@ EFFECT_2
#define EFFECT_FIRST_FOUND
@ SPELL_EFFECT_CREATE_AREATRIGGER
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_TRIGGER_MISSILE
@ SPELL_EFFECT_REDIRECT_THREAT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_MISS_NONE
@ TARGET_DEST_TARGET_ENEMY
@ TARGET_UNIT_CASTER
@ BASE_ATTACK
SpellCastResult
@ SPELL_FAILED_STUNNED
@ SPELL_FAILED_BAD_IMPLICIT_TARGETS
@ SPELL_FAILED_ALREADY_HAVE_SUMMON
@ SPELL_FAILED_ALREADY_HAVE_CHARM
@ SPELL_FAILED_HIGHLEVEL
@ SPELL_FAILED_DONT_REPORT
@ SPELL_FAILED_BAD_TARGETS
@ SPELL_FAILED_CONFUSED
@ SPELL_CAST_OK
@ SPELL_FAILED_CHARMED
@ SPELL_FAILED_LINE_OF_SIGHT
@ SPELL_FAILED_FLEEING
@ SPELL_FAILED_NO_PET
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEFAULT
@ AURA_REMOVE_BY_DEATH
@ AURA_REMOVE_BY_EXPIRE
@ AURA_REMOVE_BY_INTERRUPT
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_ADD_PCT_MODIFIER
@ SPELL_AURA_MOD_INCREASE_SPEED
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_CAST_WHILE_WALKING
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
@ SPELL_AURA_MOD_MINIMUM_SPEED
@ SPELL_AURA_PERIODIC_DUMMY
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_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:812
#define AuraProcFn(F)
#define SpellObjectTargetSelectFn(F, I, N)
#define SpellCheckCastFn(F)
#define AuraEffectProcFn(F, I, N)
#define SpellEffectFn(F, I, N)
#define AuraEffectCalcAmountFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraCheckEffectProcFn(F, I, N)
#define SpellCastFn(F)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraCheckProcFn(F)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_FLAG_STUNNED
@ UNIT_FLAG_CONFUSED
@ UNIT_FLAG_FLEEING
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:612
T CalculatePct(T base, U pct)
Definition Util.h:72
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
GuidUnorderedSet const & GetInsideUnits() const
ObjectGuid const & GetCasterGuid() const
bool IsRemoved() const
Unit * GetCaster() const
SpellEffectInfo const & GetSpellEffectInfo() const
int32 GetAmountAsInt() const
int32 GetMiscValue() const
void ResetPeriodic(bool resetPeriodicTimer=false)
SpellEffectValue GetAmount() const
void PreventDefaultAction()
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< CheckEffectProcHandler > DoCheckEffectProc
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Unit * GetCaster() const
AuraEffect * GetEffect(uint8 effIndex) const
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectProcHandler > OnEffectProc
Unit * GetUnitOwner() const
HookList< AuraProcHandler > OnProc
uint32 GetId() const
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsPlayer() const
Definition BaseEntity.h:173
TypeID GetTypeId() const
Definition BaseEntity.h:166
uint32 GetOriginalDamage() const
Definition Unit.h:467
SpellSchoolMask GetSchoolMask() const
Definition Unit.h:463
uint32 GetDamage() const
Definition Unit.h:466
bool IsEmpty() const
Definition ObjectGuid.h:362
Player * ToPlayer()
Definition Object.h:126
ChrSpecialization GetPrimarySpecialization() const
Definition Player.h:1993
void SendAttackSwingCancelAttack() const
Definition Player.cpp:21788
bool CanTameExoticPets() const
Definition Player.h:2482
PetStable * GetPetStable()
Definition Player.h:1339
Pet * GetPet() const
Definition Player.cpp:22007
void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill=0, bool suppressMessaging=false, Optional< PlayerSpellTrait > trait={})
Definition Player.cpp:3083
void SendTameFailure(PetTameResult result)
Definition Player.cpp:22168
void RemoveOverrideSpell(uint32 overridenSpellId, uint32 newSpellId)
Definition Player.cpp:30622
void RemoveSpell(uint32 spell_id, bool disabled=false, bool learn_low_rank=true, bool suppressMessaging=false)
Definition Player.cpp:3128
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3626
void AddOverrideSpell(uint32 overridenSpellId, uint32 newSpellId)
Definition Player.cpp:30617
Unit * GetActionTarget() const
Definition Unit.h:514
Spell const * GetProcSpell() const
Definition Unit.h:527
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetActor() const
Definition Unit.h:513
SpellEffectValue CalcValue(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
uint32 TriggerSpell
Definition SpellInfo.h:234
bool IsAura() const
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
void ResetCooldown(uint32 spellId, bool update=false)
void ModifyCooldown(uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown=false)
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:590
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
HookList< CastHandler > AfterCast
WorldLocation * GetHitDest() const
HookList< CheckCastHandler > OnCheckCast
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > AfterHit
SpellEffectValue GetEffectValue() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
int32 GetEffectValueAsInt() const
HookList< HitHandler > OnHit
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
void PreventHitEffect(SpellEffIndex effIndex)
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
HookList< CastHandler > OnCast
Spell * GetSpell() const
Difficulty GetCastDifficulty() const
void SetHitDamage(int32 damage)
WorldLocation const * GetExplTargetDest() const
HookList< EffectHandler > OnEffectLaunch
Unit * GetExplTargetUnit() const
Definition Spell.h:277
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
void UnregisterRedirectThreat(uint32 spellId)
Definition Unit.h:647
uint32 GetCastSpellXSpellVisualId(SpellInfo const *spellInfo) const override
Definition Unit.cpp:14656
void SendPlaySpellVisual(Unit *target, uint32 spellVisualId, uint8 missReason, uint8 reflectStatus, float travelSpeed, bool speedAsTime=false, float launchDelay=0.0f)
Definition Unit.cpp:12400
ThreatManager & GetThreatManager()
Definition Unit.h:1093
ObjectGuid GetOwnerGUID() const override
Definition Unit.h:1211
bool IsPet() const
Definition Unit.h:763
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={}, ObjectGuid const &interrupter=ObjectGuid::Empty)
Definition Unit.cpp:3158
ObjectGuid GetCharmedGUID() const
Definition Unit.h:1231
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4622
bool IsAlive() const
Definition Unit.h:1205
uint64 GetMaxHealth() const
Definition Unit.h:801
float GetUnitCriticalChanceDone(WeaponAttackType attackType) const
Definition Unit.cpp:2863
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
Definition Unit.h:1897
bool HealthBelowPct(float pct) const
Definition Unit.h:804
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
SpellHistory * GetSpellHistory()
Definition Unit.h:1521
ObjectGuid GetCharmerGUID() const
Definition Unit.h:1228
void RemoveMovementImpairingAuras(bool withRoot)
Definition Unit.cpp:4312
Guardian * GetGuardianPet() const
Definition Unit.cpp:6250
bool AttackStop()
Definition Unit.cpp:5984
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
uint8 GetLevel() const
Definition Unit.h:769
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2329
Unit * GetOwner() const
Definition Object.cpp:1603
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition Object.cpp:533
void HandleDummyTick(AuraEffect const *)
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleOnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *spellInfo) override
static void HandleCastWhileWalking(SpellScript const &, WorldObject *&target)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
void Register() override
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex) const
bool Validate(SpellInfo const *spellInfo) override
void Register() override
void ReplaceAutoShot(AuraEffect const *aurEff, AuraEffectHandleModes)
void RestoreAutoShot(AuraEffect const *aurEff, AuraEffectHandleModes)
void UpdateOrientation(SpellDestination &target) const
static void HandleProc(AuraScript const &, ProcEventInfo const &eventInfo)
bool Validate(SpellInfo const *) override
void Register() override
void HandleProc(ProcEventInfo const &eventInfo) const
void Register() override
bool Validate(SpellInfo const *) override
static bool CheckEffectProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &eventInfo)
void Register() override
bool RollProc(AuraEffect const *, ProcEventInfo &)
bool Validate(SpellInfo const *spellInfo) override
void Register() override
void HandleDuration(SpellEffIndex) const
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
static void HandleProc(AuraScript const &, ProcEventInfo const &eventInfo)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *)
void Register() override
void PlayVisual(SpellEffIndex) const
bool Validate(SpellInfo const *) override
static void HandleProc(AuraScript const &, ProcEventInfo const &eventInfo)
void Register() override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
bool Validate(SpellInfo const *) override
void HandleKindlingFlare(SpellEffIndex effIndex)
void HandleFlare(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
static void HandleProc(AuraScript const &, AuraEffect const *, ProcEventInfo const &eventInfo)
static bool CheckProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &)
static bool CheckProc(AuraScript const &, ProcEventInfo const &eventInfo)
static void HandleEffectProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &eventInfo)
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
static void HandleProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &eventInfo)
SpellCastResult DoCheckCast()
void HandleDummy(SpellEffIndex)
void HandleScriptEffect(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &)
void HandleHitTarget(SpellEffIndex) const
bool Validate(SpellInfo const *) override
bool Load() override
void Register() override
bool Validate(SpellInfo const *) override
void HandleAfterCast() const
void CalcAmount(AuraEffect const *, SpellEffectValue &amount, bool const &) const
void UpdatePeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void HandleAfterCast() const
bool Load() override
void Register() override
void HandleProc(ProcEventInfo const &eventInfo) const
bool Validate(SpellInfo const *) override
void UpdateSpeed(AuraEffect const *) const
static constexpr SpellEffectValue SpeedAmount
bool Validate(SpellInfo const *spellInfo) override
void Register() override
bool Validate(SpellInfo const *) override
static void HandleProc(AuraScript const &, ProcEventInfo const &eventInfo)
bool Validate(SpellInfo const *) override
void HandleHit(SpellEffIndex) const
void Register() override
bool Validate(SpellInfo const *) override
void HandlePeriodic(AuraEffect const *) const
void HandleProc(AuraEffect const *aurEff, ProcEventInfo const &)
bool Validate(SpellInfo const *) override
bool CheckProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void HandleDummy(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
static void HandleMinSpeed(SpellScript const &, WorldObject *&target)
bool Validate(SpellInfo const *) override
void HandleEffectProc(AuraEffect const *aurEff, ProcEventInfo const &) const
static constexpr std::array< uint32, 3 > AffectedSpellIds
void Register() override
bool Validate(SpellInfo const *) override
void HandleProc(ProcEventInfo const &) const
bool Validate(SpellInfo const *) override
void Register() override
void Register() override
bool Validate(SpellInfo const *) override
void HandleAfterCast() const
static void HandleProc(AuraScript const &, AuraEffect const *, ProcEventInfo const &eventInfo)
static bool RollProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
bool CheckProc(ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
void HandleOnHit() const
bool Load() override
Milliseconds _aimedShotCooldownReduction
void Register() override
void Register() override
static constexpr uint32 CallPetSpellIds[MAX_ACTIVE_PETS]
SpellCastResult CheckCast()
void CalcCastTimeReduction(AuraEffect const *, SpellEffectValue &amount, bool &) const
bool Validate(SpellInfo const *) override
void CalcPowerCostReduction(AuraEffect const *, SpellEffectValue &amount, bool &) const
void HandleOnRemove(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
void Register() override
static void CalcPeriodic(AuraScript const &, AuraEffect const *, bool &isPeriodic, int32 &amplitude)
static void HandleProc(AuraScript const &, AuraEffect *aurEff, ProcEventInfo const &eventInfo)
void HandleDummyTick(AuraEffect const *) const
void OnPeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
static bool CheckProc(AuraScript const &, AuraEffect const *aurEff, ProcEventInfo const &)
static void HandleProc(AuraScript const &, AuraEffect const *, ProcEventInfo const &eventInfo)
bool Validate(SpellInfo const *) override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
@ SPELL_HUNTER_MASTER_MARKSMAN
@ SPELL_HUNTER_ASPECT_OF_THE_TURTLE_PACIFY_AURA
@ SPELL_HUNTER_AUTO_SHOT
@ SPELL_HUNTER_NO_SCOPE
@ SPELL_HUNTER_ENTRAPMENT_TALENT
@ SPELL_HUNTER_A_MURDER_OF_CROWS_DAMAGE
@ SPELL_HUNTER_QUICK_DRAW_SPEED
@ SPELL_HUNTER_BINDING_SHOT_VISUAL_ARROW
@ SPELL_HUNTER_MARKSMANSHIP_HUNTER_AURA
@ SPELL_HUNTER_GREVIOUS_INJURY
@ SPELL_HUNTER_EMERGENCY_SALVE_TALENT
@ SPELL_HUNTER_NO_HARD_FEELINGS_AURA
@ SPELL_HUNTER_BINDING_SHOT_VISUAL
@ SPELL_HUNTER_FLARE_VISUAL
@ SPELL_HUNTER_A_MURDER_OF_CROWS_VISUAL_1
@ SPELL_HUNTER_FLARE_DISPEL
@ SPELL_HUNTER_BINDING_SHOT_MARKER
@ SPELL_HUNTER_TAR_TRAP_SLOW
@ SPELL_HUNTER_SHRAPNEL_SHOT_TALENT
@ SPELL_HUNTER_STEADY_SHOT_FOCUS
@ SPELL_HUNTER_WILDERNESS_MEDICINE_DISPEL
@ SPELL_HUNTER_MISDIRECTION_PROC
@ SPELL_HUNTER_CONCUSSIVE_SHOT
@ SPELL_HUNTER_SHRAPNEL_SHOT_DEBUFF
@ SPELL_HUNTER_BINDING_SHOT
@ SPELL_HUNTER_LOCK_AND_LOAD
@ SPELL_HUNTER_FOCUSED_AIM
@ SPELL_HUNTER_TRAILBLAZER
@ SPELL_HUNTER_POSTHASTE_TALENT
@ SPELL_HUNTER_MISDIRECTION
@ SPELL_HUNTER_A_MURDER_OF_CROWS_VISUAL_2
@ SPELL_HUNTER_SCOUTS_INSTINCTS
@ SPELL_HUNTER_BULLETSTORM
@ SPELL_HUNTER_RAPID_FIRE_DAMAGE
@ SPELL_HUNTER_TENSILE_BOWSTRING
@ SPELL_HUNTER_BLEAK_POWDER_DAMAGE_MARKSMANSHIP
@ SPELL_HUNTER_MASTERS_CALL_TRIGGERED
@ SPELL_HUNTER_RAPID_FIRE_ENERGIZE
@ SPELL_HUNTER_RAPID_FIRE
@ SPELL_HUNTER_BINDING_SHOT_STUN
@ SPELL_HUNTER_BLEAK_POWDER_DAMAGE_BEAST_MASTERY
@ SPELL_HUNTER_EXHILARATION_PET
@ SPELL_HUNTER_A_MURDER_OF_CROWS_VISUAL_3
@ SPELL_HUNTER_SURGING_SHOTS_ACTION_BAR_GLOW
@ SPELL_HUNTER_INTIMIDATION
@ SPELL_HUNTER_EXHILARATION
@ SPELL_HUNTER_BINDING_SHOT_IMMUNE
@ SPELL_HUNTER_TAR_TRAP
@ SPELL_HUNTER_LATENT_POISON_STACK
@ SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF
@ SPELL_HUNTER_LATENT_POISON_INJECTORS_DAMAGE
@ SPELL_HUNTER_NO_HARD_FEELINGS_TALENT
@ SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED
@ SPELL_HUNTER_EXPLOSIVE_SHOT_AREA
@ SPELL_HUNTER_ASPECT_CHEETAH_SLOW
@ SPELL_HUNTER_STEADY_SHOT
@ SPELL_HUNTER_EXHILARATION_R2
@ SPELL_HUNTER_AIMED_SHOT
@ SPELL_HUNTER_STREAMLINE_BUFF
@ SPELL_ROAR_OF_SACRIFICE_TRIGGERED
@ SPELL_HUNTER_STREAMLINE_TALENT
@ SPELL_HUNTER_HORSEHAIR_TETHER_GRIP
@ SPELL_HUNTER_IMPLOSIVE_TRAP
@ SPELL_HUNTER_ASPECT_OF_THE_FOX
@ SPELL_HUNTER_TAKE_AIM
@ SPELL_HUNTER_POSTHASTE_INCREASE_SPEED
@ SPELL_HUNTER_HORSEHAIR_TETHER_TALENT
@ SPELL_HUNTER_LATENT_POISON_DAMAGE
@ SPELL_HUNTER_REJUVENATING_WIND_HEAL
@ SPELL_HUNTER_DISRUPTIVE_ROUNDS_ENERGIZE
@ SPELL_HUNTER_ENTRAPMENT_ROOT
@ SPELL_HUNTER_BLEAK_POWDER_AREATRIGGER
@ SPELL_HUNTER_BLACK_ARROW_PERIODIC_DAMAGE
@ SPELL_HUNTER_KINDLING_FLARE
@ SPELL_HUNTER_LONE_WOLF
@ SPELL_HUNTER_HIGH_EXPLOSIVE_TRAP
@ SPELL_HUNTER_TAR_TRAP_AREATRIGGER
@ SPELL_HUNTER_PRECISE_SHOTS
@ SPELL_HUNTER_T29_2P_MARKSMANSHIP_DAMAGE
@ SPELL_HUNTER_T9_4P_GREATNESS
@ SPELL_HUNTER_IMPLOSIVE_TRAP_DAMAGE
@ SPELL_HUNTER_HIGH_EXPLOSIVE_TRAP_DAMAGE
@ SPELL_HUNTER_LATENT_POISON_INJECTORS_STACK
@ SPELL_HUNTER_WILDERNESS_MEDICINE_TALENT
@ SPELL_HUNTER_INTIMIDATION_MARKSMANSHIP
@ SPELL_HUNTER_EMERGENCY_SALVE_DISPEL
void AddSC_hunter_spell_scripts()
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & AddSpellBP0(SpellEffectValue val)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
constexpr void SetOrientation(float orientation)
Definition Position.h:82
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
WorldLocation _position
void Relocate(Position const &pos)
Definition Spell.cpp:82
void OnUnitEnter(Unit *unit) override
void OnUnitEnter(Unit *unit) override
void OnUnitEnter(Unit *unit) override
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnCreate(Spell const *) override
void OnUpdate(uint32 diff) override
TaskScheduler _scheduler
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnCreate(Spell const *) override
void OnUnitEnter(Unit *unit) override
void OnInitialize() override
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnUnitEnter(Unit *unit) override