/*
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2017-2018 AshamaneProject <https://github.com/AshamaneProject>
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
*
*
* This program is free software; you can redistribute it and/or modify it
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* more details.
*
*
* You should have received a copy of the GNU General Public License along
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
/*
/*
* Scripts for spells with SPELLFAMILY_DEMONHUNTER and SPELLFAMILY_GENERIC spells used by demon hunter players.
* Scripts for spells with SPELLFAMILY_DEMON_HUNTER and SPELLFAMILY_GENERIC spells used by demon hunter players.
* Ordered alphabetically using scriptname.
* Ordered alphabetically using scriptname.
* Scriptnames of files in this file should be prefixed with "spell_dh_".
* Scriptnames of files in this file should be prefixed with "spell_dh_".
*/
*/
#include <chrono>
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "ObjectAccessor.h"
#include "PathGenerator.h"
#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellMgr.h"
#include "SpellAuraEffects.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "SpellHistory.h"
#include "SpellScript.h"
#include "SpellPackets.h"
#include "TemporarySummon.h"
#include "Unit.h"
#include "World.h"
enum DHSpells
{
SPELL_DH_EYE_BEAM = 198013,
SPELL_DH_EYE_BEAM_DAMAGE = 198030,
SPELL_DH_EYE_BEAM_VISUAL = 194326,
SPELL_DH_METAMORPHOSIS = 191427,
SPELL_DH_METAMORPHOSIS_STUN = 200166,
SPELL_DH_METAMORPHOSIS_LEAP = 191428,
SPELL_DH_METAMORPHOSIS_BUFFS = 162264,
SPELL_DH_FEL_RUSH_DASH = 197922,
SPELL_DH_FEL_RUSH_AIR = 197923,
SPELL_DH_FEL_RUSH = 195072,
SPELL_DH_FEL_RUSH_DAMAGE = 192611,
SPELL_DH_DEMON_SPIKES = 203720,
SPELL_DH_DEMON_SPIKES_BUFF = 203819,
SPELL_DH_MOMENTUM = 206476,
SPELL_DH_MOMENTUM_BUFF = 208628,
SPELL_DH_VENGEFUL_RETREAT = 198793,
SPELL_DH_IMMOLATION_AURA = 178740,
SPELL_DH_IMMOLATION_AURA_VISUAL = 201122,
SPELL_DH_DARKNESS_BUFF = 209426,
SPELL_DH_VENGEFUL_RETREAT_FURY = 203650,
SPELL_DH_VENGEFUL_RETREAT_TRIGGER = 198813,
SPELL_DH_PREPARED = 203551,
SPELL_DH_DEMONIC = 213410,
SPELL_DH_DEMON_REBORN = 193897,
SPELL_DH_CHAOS_NOVA = 179057,
SPELL_DH_BLUR = 198589,
SPELL_DH_FEL_ERUPTION = 211881,
SPELL_DH_FEL_ERUPTION_DAMAGE = 225102,
SPELL_DH_ANNIHILATION = 201427,
SPELL_DH_ANNIHILATION_MAINHAIND = 201428,
SPELL_DH_ANNIHILATION_OFFHAND = 227518,
SPELL_DH_FEL_BARRAGE = 211053,
SPELL_DH_FEL_BARRAGE_TRIGGER = 211052,
SPELL_DH_DEMONS_BITE = 162243,
SPELL_DH_FELBLADE = 213241,
SPELL_DH_SHEAR = 203782,
SPELL_DH_FEL_MASTERY = 192939,
SPELL_DH_DEMON_BLADES = 203555,
SPELL_DH_DEMON_BLADES_TRIGGER = 203796,
SPELL_DH_BLOODLET = 206473,
SPELL_DH_BLOODLET_DOT = 207690,
SPELL_DH_THROW_GLAIVE = 185123,
SPELL_DH_GLIDE = 131347,
SPELL_DH_GLIDE_KNOCKBACK = 196353,
SPELL_DH_BLIND_FURY = 203550,
SPELL_DH_METAMORPHOSIS_VENGEANCE = 187827,
SPELL_DH_NEMESIS = 206491,
SPELL_DH_BLADE_DANCE = 188499,
SPELL_DH_FIRST_BLOOD = 206416,
SPELL_DH_SOUL_RENDING_HAVOC = 204909,
SPELL_DH_SOUL_RENDING_VENGEANCE = 217996,
SPELL_DH_FEL_RUSH_DASH2 = 208101,
SPELL_DH_CONSUME_MAGIC = 183752,
SPELL_DH_CHAOS_STRIKE_PROC = 193840,
SPELL_DH_SHATTERED_SOULS = 178940,
SPELL_DH_SHATTERED_SOULS_MISSILE = 209651,
SPELL_DH_SHATTERED_SOULS_AT_NORMAL = 228537,
SPELL_DH_SHATTERED_SOULS_AT_DEMON = 203795,
SPELL_DH_SHATTERED_SOULS_LESSER = 204256,
SPELL_DH_CONSUME_SOUL_25 = 178963,
SPELL_DH_CONSUME_SOUL_10 = 228532,
SPELL_DH_CONSUME_SOUL_DEMON = 202644,
SPELL_DH_DEMONIC_APPETITE = 206478,
SPELL_DH_DEMONIC_APPETITE_FURY = 210041,
SPELL_DH_CHAOS_STRIKE = 162794,
SPELL_DH_CHAOS_STRIKE_MAIN_HAND = 199547,
SPELL_DH_CHAOS_STRIKE_OFF_HAND = 222031,
SPELL_DH_INFERNAL_STRIKE_JUMP = 189111,
SPELL_DH_INFERNAL_STRIKE_DAMAGE = 189112,
SPELL_DH_INFERNAL_STRIKE_VISUAL = 208461,
SPELL_DH_INFERNAL_STRIKE = 189110,
SPELL_DH_METAMORPHOSIS_IMMUNITY = 201453,
SPELL_DH_LAST_RESORT_DEBUFF = 209261,
SPELL_DH_SIGIL_OF_FLAME_TRIGGER = 204598,
SPELL_DH_SIGIL_OF_CHAINS_TRIGGER = 208674,
SPELL_DH_SIGIL_OF_CHAINS_SLOW = 204843,
SPELL_DH_SIGIL_OF_MISERY_TRIGGER = 207685,
SPELL_DH_CONSUME_SOUL_25_VENG = 210042,
SPELL_DH_CONSUME_SOUL_10_VENG = 203794,
SPELL_DH_CONSUME_SOUL_DEMON_VENG = 208015,
SPELL_DH_SOUL_CLEAVE_DAMAGE = 228478,
SPELL_DH_RAZOR_SPIKES_SLOW = 210003,
SPELL_DH_FEAST_OF_SOULS = 207697,
SPELL_DH_FEAST_OF_SOULS_HEAL = 207693,
SPELL_DH_FLAME_CRASH = 227322,
SPELL_DH_SIGIL_OF_FLAME_NO_DEST = 204513,
SPELL_DH_GLUTTONY = 227327,
SPELL_DH_GLUTTONY_BUFF = 227330,
SPELL_DH_FEED_THE_DEMON = 218612,
SPELL_DH_FIERY_BRAND_DOT = 207771,
SPELL_DH_BURNING_ALIVE = 207739,
SPELL_DH_FEL_DEVASTATION_DAMAGE = 212105,
SPELL_DH_FEL_DEVASTATION_HEAL = 212106,
SPELL_DH_SPIRIT_BOMB_DAMAGE = 218677,
SPELL_DH_FRAILITY = 224509,
SPELL_DH_SPIRIT_BOMB_HEAL = 227255,
SPELL_DH_SOUL_BARRIER = 227225,
SPELL_DH_NETHER_BOND = 207810,
SPELL_DH_NETHER_BOND_PERIODIC = 207811,
SPELL_DH_NETHER_BOND_DAMAGE = 207812,
SPELL_DH_SIGIL_OF_SILENCE_TRIGGER = 204490,
SPELL_DH_CONSUME_SOUL_MISSILE = 210047,
SPELL_DH_SIGIL_OF_MISERY_EXPLOSION = 208714,
SPELL_DH_SIGIL_OF_SILENCE_EXPLOSION = 208709,
SPELL_DH_SIGIL_OF_CHAINS_EXPLOSION = 208673,
SPELL_DH_SIGIL_OF_FLAME_EXPLOSION = 208710
};
enum DemonHunterSpells
enum NemesisTargets
{
{
SPELL_CHAOS_STRIKE_ENERGIZE = 193840,
NEMESIS_ABERRATION = 208607,
NEMESIS_ELEMENTAL = 208611,
NEMESIS_MECHANICAL = 208616,
NEMESIS_DRAGONKIN = 208610,
NEMESIS_HUMANOID = 208605,
NEMESIS_CRITTERS = 208609,
NEMESIS_DEMONS = 208579,
NEMESIS_GIANTS = 208612,
NEMESIS_UNDEAD = 208614,
NEMESIS_BEASTS = 208608
};
};
// 197125 - Chaos Strike
// Nether Bond - 207810
class spell_dh_chaos_strike : public SpellScriptLoader
class spell_dh_nether_bond : public SpellScriptLoader
{
{
public:
public:
spell_dh_chaos_strike() : SpellScriptLoader("spell_dh_chaos_strike") { }
spell_dh_nether_bond() : SpellScriptLoader("spell_dh_nether_bond") {}
class spell_dh_chaos_strike_AuraScript : public AuraScript
class spell_dh_nether_bond_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_nether_bond_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
{
PrepareAuraScript(spell_dh_chaos_strike_AuraScript);
if (!sSpellMgr->GetSpellInfo(SPELL_DH_NETHER_BOND_DAMAGE) ||
!sSpellMgr->GetSpellInfo(SPELL_DH_NETHER_BOND_PERIODIC))
return false;
return true;
}
bool Validate(SpellInfo const* /*spellInfo*/) override
void HandleDummy()
{
Unit* caster = GetCaster();
if (!caster)
return;
caster->CastSpell(caster, SPELL_DH_NETHER_BOND_PERIODIC, true);
}
void Register() override
{
OnCast += SpellCastFn(spell_dh_nether_bond_SpellScript::HandleDummy);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dh_nether_bond_SpellScript();
}
};
// Nether Bond periodic - 207811
class spell_dh_nether_bond_periodic : public SpellScriptLoader
{
public:
spell_dh_nether_bond_periodic() : SpellScriptLoader("spell_dh_nether_bond_periodic") {}
class spell_dh_nether_bond_periodic_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dh_nether_bond_periodic_AuraScript);
Unit* m_BondUnit;
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (!m_BondUnit)
m_BondUnit = GetBondUnit();
if (!m_BondUnit)
return;
int32 casterHealBp = 0;
int32 casterDamageBp = 0;
int32 targetHealBp = 0;
int32 targetDamageBp = 0;
float casterHp = caster->GetHealthPct();
float targetHp = m_BondUnit->GetHealthPct();
float healthPct = (casterHp + targetHp) / 2.0f;
if (casterHp < targetHp)
{
casterHealBp = caster->CountPctFromMaxHealth(healthPct) - caster->GetHealth();
targetDamageBp = m_BondUnit->GetHealth() - m_BondUnit->CountPctFromMaxHealth(healthPct);
}
else
{
{
return ValidateSpellInfo({ SPELL_CHAOS_STRIKE_ENERGIZE });
casterDamageBp = caster->GetHealth() - caster->CountPctFromMaxHealth(healthPct);
targetHealBp = m_BondUnit->CountPctFromMaxHealth(healthPct) - m_BondUnit->GetHealth();
}
}
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
CustomSpellValues casterValues;
CustomSpellValues targetValues;
casterValues.AddSpellMod(SPELLVALUE_BASE_POINT0, casterDamageBp);
casterValues.AddSpellMod(SPELLVALUE_BASE_POINT1, casterHealBp);
targetValues.AddSpellMod(SPELLVALUE_BASE_POINT0, targetDamageBp);
targetValues.AddSpellMod(SPELLVALUE_BASE_POINT1, targetHealBp);
caster->CastCustomSpell(SPELL_DH_NETHER_BOND_DAMAGE, casterValues, caster, TRIGGERED_FULL_MASK);
caster->CastCustomSpell(SPELL_DH_NETHER_BOND_DAMAGE, targetValues, m_BondUnit, TRIGGERED_FULL_MASK);
}
Unit* GetBondUnit()
{
Unit* caster = GetCaster();
if (!caster)
return nullptr;
std::list<Unit*> units;
Trinity::AnyUnitInObjectRangeCheck check(caster, 100.0f);
Trinity::UnitListSearcher<Trinity::AnyUnitInObjectRangeCheck> search(caster, units, check);
Cell::VisitAllObjects(caster, search, 100.0f);
for (Unit* u : units)
if (u->HasAura(SPELL_DH_NETHER_BOND, caster->GetGUID()))
return u;
return nullptr;
}
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
m_BondUnit = GetBondUnit();
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dh_nether_bond_periodic_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dh_nether_bond_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dh_nether_bond_periodic_AuraScript();
}
};
// Soul Barrier - 227225
class spell_dh_soul_barrier : public SpellScriptLoader
{
public:
spell_dh_soul_barrier() : SpellScriptLoader("spell_dh_soul_barrier") {}
class spell_dh_soul_barrier_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dh_soul_barrier_AuraScript);
void CalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
if (Player* player = caster->ToPlayer())
amount = 15 * player->GetUInt32Value(UNIT_FIELD_ATTACK_POWER);
std::list<WorldObject*> units;
Trinity::AllWorldObjectsInRange check(caster, 25.0f);
Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(caster, units, check);
Cell::VisitAllObjects(caster, searcher, 25.0f);
for (WorldObject* obj : units)
{
{
PreventDefaultAction();
if (obj->GetTypeId() != TYPEID_AREATRIGGER)
GetTarget()->CastCustomSpell(SPELL_CHAOS_STRIKE_ENERGIZE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff);
continue;
AreaTrigger* at = obj->ToAreaTrigger();
if (at->GetCaster() != caster)
continue;
switch (at->GetEntry())
{
case 8867:
caster->CastSpell(caster, SPELL_DH_CONSUME_SOUL_25_VENG, true);
break;
case 6710:
caster->CastSpell(caster, SPELL_DH_CONSUME_SOUL_DEMON_VENG, true);
break;
case 6007:
caster->CastSpell(caster, SPELL_DH_CONSUME_SOUL_10_VENG, true);
break;
}
at->SetDuration(0);
}
}
void Register() override
if (AuraApplication* app = caster->GetAuraApplication(SPELL_DH_SOUL_BARRIER))
app->ClientUpdate();
}
void HandleAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
Unit* caster = GetCaster();
if (!caster)
return;
uint32 threshold = caster->GetUInt32Value(UNIT_FIELD_ATTACK_POWER) * 2;
if (absorbAmount < dmgInfo.GetDamage())
aurEff->SetAmount(absorbAmount+threshold);
if (AuraApplication* app = caster->GetAuraApplication(SPELL_DH_SOUL_BARRIER))
app->ClientUpdate();
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dh_soul_barrier_AuraScript::CalcAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dh_soul_barrier_AuraScript::HandleAbsorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dh_soul_barrier_AuraScript();
}
};
// Fraility - 224509
class spell_dh_fraility : public SpellScriptLoader
{
public:
spell_dh_fraility() : SpellScriptLoader("spell_dh_fraility") {}
class spell_dh_fraility_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dh_fraility_AuraScript);
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
Unit* caster = aurEff->GetCaster();
if (!caster)
return;
int32 healAmount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), 10);
caster->CastCustomSpell(caster, SPELL_DH_SPIRIT_BOMB_HEAL, &healAmount, NULL, NULL, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dh_fraility_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dh_fraility_AuraScript();
}
};
// Spirit Bomb damage - 218677
class spell_dh_spirit_bomb_damage : public SpellScriptLoader
{
public:
spell_dh_spirit_bomb_damage() : SpellScriptLoader("spell_dh_spirit_bomb_damage") {}
class spell_dh_spirit_bomb_damage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_spirit_bomb_damage_SpellScript);
void HandleDamage(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
return;
caster->CastSpell(target, SPELL_DH_FRAILITY, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dh_spirit_bomb_damage_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dh_spirit_bomb_damage_SpellScript();
}
};
// Spirit Bomb - 218679
class spell_dh_spirit_bomb : public SpellScriptLoader
{
public:
spell_dh_spirit_bomb() : SpellScriptLoader("spell_dh_spirit_bomb") {}
class spell_dh_spirit_bomb_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_spirit_bomb_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DH_SPIRIT_BOMB_DAMAGE) ||
!sSpellMgr->GetSpellInfo(SPELL_DH_SPIRIT_BOMB_HEAL))
return false;
return true;
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (!caster)
return SPELL_FAILED_DONT_REPORT;
std::list<WorldObject*> units;
Trinity::AllWorldObjectsInRange check(caster, 25.0f);
Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(caster, units, check);
Cell::VisitAllObjects(caster, searcher, 25.0f);
for (WorldObject* unit : units)
{
{
OnEffectProc += AuraEffectProcFn(spell_dh_chaos_strike_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
if (unit->GetTypeId() != TYPEID_AREATRIGGER)
continue;
if (unit->ToAreaTrigger()->GetCaster() == caster)
{
unit->ToAreaTrigger()->SetDuration(0);
return SPELL_CAST_OK;
}
}
}
};
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
return;
caster->CastSpell(target, SPELL_DH_SPIRIT_BOMB_DAMAGE, true);
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_dh_spirit_bomb_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_dh_spirit_bomb_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dh_spirit_bomb_SpellScript();
}
};
// Blade Turning - 203753
class spell_dh_blade_turning : public SpellScriptLoader
{
public:
spell_dh_blade_turning() : SpellScriptLoader("spell_dh_blade_turning") {}
class spell_dh_blade_turning_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dh_blade_turning_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetHitMask() & PROC_HIT_PARRY)
return true;
return false;
}
AuraScript* GetAuraScript() const override
void Register() override
{
{
return new spell_dh_chaos_strike_AuraScript();
DoCheckProc += AuraCheckProcFn(spell_dh_blade_turning_AuraScript::CheckProc);
}
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dh_blade_turning_AuraScript();
}
};
};
void AddSC_demon_hunter_spell_scripts()
// Fel Devastation - 212084
class spell_dh_fel_devastation : public SpellScriptLoader
{
{
new spell_dh_chaos_strike();
public:
}
spell_dh_fel_devastation() : SpellScriptLoader("spell_dh_fel_devastation") {}
class spell_dh_fel_devastation_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dh_fel_devastation_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DH_FEL_DEVASTATION_DAMAGE) ||
!sSpellMgr->GetSpellInfo(SPELL_DH_FEL_DEVASTATION_HEAL))
return false;
return true;
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
caster->CastSpell(caster, SPELL_DH_FEL_DEVASTATION_DAMAGE, true);
caster->CastSpell(caster, SPELL_DH_FEL_DEVASTATION_HEAL, true);
}
void Demorph(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
caster->SetDisplayId(caster->GetNativeDisplayId());
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dh_fel_devastation_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
OnEffectRemove += AuraEffectRemoveFn(spell_dh_fel_devastation_AuraScript::Demorph, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_dh_fel_devastation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_fel_devastation_SpellScript);
void Morph()
{
Unit* caster = GetCaster();
if (!caster)
return;
caster->SetDisplayId(68671);
}
void Register() override
{
OnPrepare += SpellOnPrepareFn(spell_dh_fel_devastation_SpellScript::Morph);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dh_fel_devastation_SpellScript();
}
AuraScript* GetAuraScript() const override
{
return new spell_dh_fel_devastation_AuraScript();
}
};
// Fracture - 209795
class spell_dh_fracture : public SpellScriptLoader
{
public:
spell_dh_fracture() : SpellScriptLoader("spell_dh_fracture") {}
class spell_dh_fracture_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_fracture_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
int32 bp = SPELL_DH_SHATTERED_SOULS_LESSER;
caster->CastCustomSpell(caster, SPELL_DH_SHATTERED_SOULS_MISSILE, &bp, NULL, NULL, true);
caster->CastCustomSpell(caster, SPELL_DH_SHATTERED_SOULS_MISSILE, &bp, NULL, NULL, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_dh_fracture_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dh_fracture_SpellScript();
}
};
// Consume Soul vengeance - 210042, 203794, 208015
class spell_dh_consume_soul_vengeance : public SpellScriptLoader
{
public:
spell_dh_consume_soul_vengeance() : SpellScriptLoader("spell_dh_consume_soul_vengeance") {}
class spell_dh_consume_soul_vengeance_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dh_consume_soul_vengeance_SpellScript);
void HandleCast()
{
Unit* caster = GetCaster();
if (!caster)
return;
if (caster->HasAura(SPELL_DH_GLUTTONY))
caster->CastSpell(caster, SPELL_DH_GLUTTONY_BUFF, true);
//if (caster->HasAura(SPELL_DH_FEED_THE_DEMON))
// caster->GetSpellHistory()->ReduceChargeCooldown(sSpellCategoryStore.LookupEntry(sSpellMgr->GetSpellInfo(SPELL_DH_DEMON_SPIKES)->ChargeCategoryId), 1 * IN_MILLISECONDS);
if (Aura* soulBarrier = caster->GetAura(SPELL_DH_SOUL_BARRIER))
if (AuraEffect* aurEff = soulBarrier->GetEffect(EFFECT_0))
aurEff->SetAmount((float)aurEff->GetAmount() + (float)caster->GetUInt32Value(UNIT_FIELD_ATTACK_POWER)*2.5f);
}
void Register() override
{
OnCast += SpellCastFn(spell_dh_consume_soul_vengeance_SpellScript::HandleCa