TrinityCore
Loading...
Searching...
No Matches
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 "DBCStores.h"
19#include "ObjectMgr.h"
20#include "Player.h"
21#include "ScriptMgr.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24#include "SpellScript.h"
25#include "SpellMgr.h"
26#include "UnitAI.h"
27
28// 56584 - Combined Toxins
30{
32
33 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
34 {
35 // only procs on poisons (damage class check to exclude stuff like Envenom)
36 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
37 return (spellInfo && spellInfo->Dispel == DISPEL_POISON && spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE);
38 }
39
44};
45
46// 56698, 59102 - Shadow Blast
48{
50
52 {
53 Unit* target = GetHitUnit();
54 if (!target)
55 return;
56
57 SetHitDamage(target->GetMaxHealth() * GetEffectInfo().BasePoints / 100);
58 }
59
64};
65
70
71// 56702, 59103 - Shadow Sickle
73{
75
76 bool Validate(SpellInfo const* /*spellInfo*/) override
77 {
79 }
80
81 void HandlePeriodic(AuraEffect const* aurEff)
82 {
83 Unit* owner = GetUnitOwner();
84
85 uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SHADOW_SICKLE_TRIGGERED, owner);
86 if (!spellId)
87 return;
88
89 if (owner->IsAIEnabled())
90 if (Unit* target = owner->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 40.f))
91 owner->CastSpell(target, spellId, CastSpellExtraArgs(aurEff).SetTriggerFlags(TRIGGERED_FULL_MASK));
92 }
93
98};
99
100// 58906, 58908, 58909, 58910 - Creature - Yogg-Saron Whisper
102{
104
105 bool Validate(SpellInfo const* spellInfo) override
106 {
107 return sObjectMgr->GetBroadcastText(uint32(spellInfo->GetEffect(EFFECT_0).CalcValue())) &&
108 sSoundEntriesStore.LookupEntry(uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()));
109 }
110
111 void HandleScript(SpellEffIndex /*effIndex*/)
112 {
113 if (Creature* caster = GetCaster()->ToCreature())
114 if (Player* player = GetHitPlayer())
115 caster->Unit::Whisper(uint32(GetEffectValue()), player, false);
116 }
117
118 void HandleDummy(SpellEffIndex /*effIndex*/)
119 {
120 if (Player* player = GetHitPlayer())
121 player->PlayDistanceSound(uint32(GetEffectValue()), player);
122 }
123
129};
130
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
uint32_t uint32
Definition Define.h:133
#define sObjectMgr
Definition ObjectMgr.h:1721
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELL_DAMAGE_CLASS_MELEE
@ DISPEL_POISON
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define sSpellMgr
Definition SpellMgr.h:738
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraCheckEffectProcFn(F, I, N)
void AddSC_ahnkahet()
Definition ahnkahet.cpp:131
ShadowSickle
Definition ahnkahet.cpp:67
@ SPELL_SHADOW_SICKLE_TRIGGERED
Definition ahnkahet.cpp:68
HookList< CheckEffectProcHandler > DoCheckEffectProc
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetUnitOwner() const
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:268
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
uint32 Dispel
Definition SpellInfo.h:291
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
uint32 DmgClass
Definition SpellInfo.h:358
Player * GetHitPlayer() const
Unit * GetCaster() const
Unit * GetHitUnit() const
int32 GetEffectValue() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
void SetHitDamage(int32 damage)
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
Definition Unit.h:769
uint32 GetMaxHealth() const
Definition Unit.h:914
UnitAI * GetAI() const
Definition Unit.h:800
bool IsAIEnabled() const
Definition Unit.h:798
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool CheckProc(AuraEffect const *, ProcEventInfo &eventInfo)
Definition ahnkahet.cpp:33
PrepareAuraScript(spell_ahnkahet_combined_toxins)
void Register() override
Definition ahnkahet.cpp:60
void HandleDamageCalc(SpellEffIndex)
Definition ahnkahet.cpp:51
PrepareSpellScript(spell_ahnkahet_shadow_blast)
void HandlePeriodic(AuraEffect const *aurEff)
Definition ahnkahet.cpp:81
PrepareAuraScript(spell_ahnkahet_shadow_sickle)
bool Validate(SpellInfo const *) override
Definition ahnkahet.cpp:76
void HandleScript(SpellEffIndex)
Definition ahnkahet.cpp:111
bool Validate(SpellInfo const *spellInfo) override
Definition ahnkahet.cpp:105
void HandleDummy(SpellEffIndex)
Definition ahnkahet.cpp:118
PrepareSpellScript(spell_ahnkahet_yogg_saron_whisper)