TrinityCore
ahnkahet.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#include "DB2Stores.h"
19#include "Player.h"
20#include "ScriptMgr.h"
21#include "SpellInfo.h"
22#include "SpellScript.h"
23#include "UnitAI.h"
24
25// 56584 - Combined Toxins
27{
28 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
29 {
30 // only procs on poisons (damage class check to exclude stuff like Envenom)
31 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
32 return (spellInfo && spellInfo->Dispel == DISPEL_POISON && spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE);
33 }
34
35 void Register() override
36 {
38 }
39};
40
42{
45};
46
47// 56702, 59103 - Shadow Sickle
49{
50 bool Validate(SpellInfo const* /*spellInfo*/) override
51 {
53 }
54
55 void HandlePeriodic(AuraEffect const* aurEff)
56 {
57 Unit* owner = GetUnitOwner();
58
59 uint32 spellId = 0;
60
61 switch (GetId())
62 {
63 case 56702:
65 break;
66 case 59103:
68 break;
69 default:
70 return;
71 }
72
73 if (owner->IsAIEnabled())
74 if (Unit* target = owner->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 40.f))
75 owner->CastSpell(target, spellId, CastSpellExtraArgs(aurEff).SetTriggerFlags(TRIGGERED_FULL_MASK));
76 }
77
78 void Register() override
79 {
81 }
82};
83
84// 58906, 58908, 58909, 58910 - Creature - Yogg-Saron Whisper
86{
87 bool Validate(SpellInfo const* spellInfo) override
88 {
89 return sBroadcastTextStore.HasRecord(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) &&
90 sSoundKitStore.HasRecord(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()));
91 }
92
93 void HandleScript(SpellEffIndex /*effIndex*/)
94 {
95 if (Player* player = GetHitPlayer())
96 GetCaster()->Unit::Whisper(uint32(GetEffectValue()), player, false);
97 }
98
99 void HandleDummy(SpellEffIndex /*effIndex*/)
100 {
101 if (Player* player = GetHitPlayer())
102 player->PlayDistanceSound(uint32(GetEffectValue()), player);
103 }
104
105 void Register() override
106 {
109 }
110};
111
113{
117}
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", &BroadcastTextLoadInfo::Instance)
DB2Storage< SoundKitEntry > sSoundKitStore("SoundKit.db2", &SoundKitLoadInfo::Instance)
uint32_t uint32
Definition: Define.h:142
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_DAMAGE_CLASS_MELEE
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ DISPEL_POISON
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraCheckEffectProcFn(F, I, N)
Definition: SpellScript.h:2136
void AddSC_ahnkahet()
Definition: ahnkahet.cpp:112
ShadowSickle
Definition: ahnkahet.cpp:42
@ SPELL_SHADOW_SICKLE_TRIGGERED
Definition: ahnkahet.cpp:43
@ SPELL_SHADOW_SICKLE_TRIGGERED_H
Definition: ahnkahet.cpp:44
HookList< CheckEffectProcHandler > DoCheckEffectProc
Definition: SpellScript.h:2135
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetUnitOwner() const
uint32 GetId() const
SpellInfo const * GetSpellInfo() const
Definition: Unit.cpp:280
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
uint32 Dispel
Definition: SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
uint32 DmgClass
Definition: SpellInfo.h:410
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Player * GetHitPlayer() const
Unit * GetCaster() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
Definition: Unit.h:627
UnitAI * GetAI() const
Definition: Unit.h:660
bool IsAIEnabled() const
Definition: Unit.h:658
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool CheckProc(AuraEffect const *, ProcEventInfo &eventInfo)
Definition: ahnkahet.cpp:28
void Register() override
Definition: ahnkahet.cpp:78
void HandlePeriodic(AuraEffect const *aurEff)
Definition: ahnkahet.cpp:55
bool Validate(SpellInfo const *) override
Definition: ahnkahet.cpp:50
void HandleScript(SpellEffIndex)
Definition: ahnkahet.cpp:93
bool Validate(SpellInfo const *spellInfo) override
Definition: ahnkahet.cpp:87
void HandleDummy(SpellEffIndex)
Definition: ahnkahet.cpp:99