Core/Scripts: Convert spells to new proc system

- Converted Unit::HandleDummyAuraProc function to AuraScripts
  * Extra: DMC: Madness now uses DB texts. yay!
  * Extra: improvements on Imp. Spell Reflection (range and max targets, filter caster with conditions)

- Fixed Glyph of Succubus. (Closes #6599)

- Changed old (not-blizz) behavior of Vampiric Embrace:
  * Before: party heal affected the priest too and self heal was reduced by that amount to not over-heal
  * Now: self heal amount not affected, rather filter the priest out of the party heal using conditions :)

- Solve bug in AQ 3p set bonus, it should only trigger when healing others, not self heals.
- Priest T10 2p bonus (heal) now rolls its effect properly

- Use brand new GetEffectiveHeal to fix #17142
- While we're at it, also close #17034 for good
- Converted Unit::HandleAuraProc function to AuraScripts (#17941)
- Converted Unit::HandleAuraProc function to AuraScripts (cont'd) (#17955)
- Corrected Flametongue weapon damage formula
- Actually check offhand weapon for flametongue in Lava Lash script
- Implemented halved proc chance for Missile Barrage on Arcane Barrage, Fireball, Frostbolt and Frostfire Bolt cast
- Converted Unit::HandleProcTriggerSpell function to AuraScripts (#17956)
- De-hack Earth shield. Fixes #13808
- Updated Honor among Thieves
- Implemented mana proc for Mark of Conquest in case of ranged attack
- Fixed Scent of Blood giving more stacks than the talent rank currently learnt.
- Ported old proc table. Proc system is dead. Long live the proc system!
- Recklessness should get charges removed per cast. Closes #15529
- Use proc system to remove Molten Core charges on Incinerate/Soul Fire cast. Closes #15942

Closes #3463
Closes #5401
Closes #15595
Closes #15974
Closes #16679
Closes #17925
This commit is contained in:
ariel-
2016-09-25 20:48:31 -03:00
parent e641d0c7d7
commit 2ff855054f
28 changed files with 9190 additions and 323 deletions

View File

@@ -73,7 +73,24 @@ enum DeathKnightSpells
SPELL_DK_UNHOLY_PRESENCE_TRIGGERED = 49772,
SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189,
SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284,
SPELL_DK_GHOUL_THRASH = 47480
SPELL_DK_GHOUL_THRASH = 47480,
SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT = 69961,
SPELL_DK_BUTCHERY_RUNIC_POWER = 50163,
SPELL_DK_MARK_OF_BLOOD_HEAL = 61607,
SPELL_DK_UNHOLY_BLIGHT_DAMAGE = 50536,
SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT = 63332,
SPELL_DK_VENDETTA_HEAL = 50181,
SPELL_DK_NECROSIS_DAMAGE = 51460,
SPELL_DK_OBLITERATE_OFF_HAND_R1 = 66198,
SPELL_DK_FROST_STRIKE_OFF_HAND_R1 = 66196,
SPELL_DK_PLAGUE_STRIKE_OFF_HAND_R1 = 66216,
SPELL_DK_DEATH_STRIKE_OFF_HAND_R1 = 66188,
SPELL_DK_RUNE_STRIKE_OFF_HAND_R1 = 66217,
SPELL_DK_BLOOD_STRIKE_OFF_HAND_R1 = 66215,
SPELL_DK_RUNIC_RETURN = 61258,
SPELL_DK_WANDERING_PLAGUE_DAMAGE = 50526,
SPELL_DK_DEATH_COIL_R1 = 47541,
SPELL_DK_DEATH_GRIP_INITIAL = 49576
};
enum DeathKnightSpellIcons
@@ -83,7 +100,9 @@ enum DeathKnightSpellIcons
enum Misc
{
NPC_DK_GHOUL = 26125
NPC_DK_GHOUL = 26125,
NPC_DK_DANCING_RUNE_WEAPON = 27893,
SPELL_CATEGORY_HOWLING_BLAST = 1248
};
// -49200 - Acclimation
@@ -393,6 +412,38 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
}
};
// -49182 - Blade Barrier
class spell_dk_blade_barrier : public SpellScriptLoader
{
public:
spell_dk_blade_barrier() : SpellScriptLoader("spell_dk_blade_barrier") { }
class spell_dk_blade_barrier_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_blade_barrier_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetSpellInfo() != nullptr)
if (Player* player = eventInfo.GetActor()->ToPlayer())
if (player->getClass() == CLASS_DEATH_KNIGHT && player->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD))
return true;
return false;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_blade_barrier_AuraScript::CheckProc);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_blade_barrier_AuraScript();
}
};
// 48721 - Blood Boil
class spell_dk_blood_boil : public SpellScriptLoader
{
@@ -525,6 +576,41 @@ class spell_dk_bloodworms : public SpellScriptLoader
}
};
// -48979 - Butchery
class spell_dk_butchery : public SpellScriptLoader
{
public:
spell_dk_butchery() : SpellScriptLoader("spell_dk_butchery") { }
class spell_dk_butchery_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_butchery_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BUTCHERY_RUNIC_POWER))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->CastCustomSpell(SPELL_DK_BUTCHERY_RUNIC_POWER, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), (Unit*)nullptr, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_butchery_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_butchery_AuraScript();
}
};
class CorpseExplosionCheck
{
public:
@@ -649,6 +735,69 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
}
};
// 49028 - Dancing Rune Weapon
class spell_dk_dancing_rune_weapon : public SpellScriptLoader
{
public:
spell_dk_dancing_rune_weapon() : SpellScriptLoader("spell_dk_dancing_rune_weapon") { }
class spell_dk_dancing_rune_weapon_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_dancing_rune_weapon_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sObjectMgr->GetCreatureTemplate(NPC_DK_DANCING_RUNE_WEAPON))
return false;
return true;
}
// This is a port of the old switch hack in Unit.cpp, it's not correct
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
Unit* drw = nullptr;
for (Unit* controlled : caster->m_Controlled)
{
if (controlled->GetEntry() == NPC_DK_DANCING_RUNE_WEAPON)
{
drw = controlled;
break;
}
}
if (!drw || !drw->GetVictim())
return;
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return;
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
return;
int32 amount = static_cast<int32>(damageInfo->GetDamage()) / 2;
drw->SendSpellNonMeleeDamageLog(drw->GetVictim(), spellInfo->Id, amount, spellInfo->GetSchoolMask(), 0, 0, false, 0, false);
drw->DealDamage(drw->GetVictim(), amount, nullptr, SPELL_DIRECT_DAMAGE, spellInfo->GetSchoolMask(), spellInfo, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_dancing_rune_weapon_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_dancing_rune_weapon_AuraScript();
}
};
class spell_dk_death_and_decay : public SpellScriptLoader
{
public:
@@ -874,6 +1023,84 @@ class spell_dk_death_pact : public SpellScriptLoader
}
};
// -54639 - Blood of the North
// -49208 - Reaping
// -49467 - Death Rune Mastery
class spell_dk_death_rune : public SpellScriptLoader
{
public:
spell_dk_death_rune() : SpellScriptLoader("spell_dk_death_rune") { }
class spell_dk_death_rune_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_death_rune_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
Unit* caster = eventInfo.GetActor();
if (caster->GetTypeId() != TYPEID_PLAYER)
return false;
Player* player = caster->ToPlayer();
if (player->getClass() != CLASS_DEATH_KNIGHT)
return false;
return true;
}
void HandleProc(ProcEventInfo& eventInfo)
{
Player* player = eventInfo.GetActor()->ToPlayer();
AuraEffect* aurEff = GetEffect(EFFECT_0);
if (!aurEff)
return;
// Reset amplitude - set death rune remove timer to 30s
aurEff->ResetPeriodic(true);
uint32 runesLeft = 1;
// Death Rune Mastery
if (GetSpellInfo()->SpellIconID == 2622)
runesLeft = 2;
for (uint8 i = 0; i < MAX_RUNES && runesLeft; ++i)
{
if (GetSpellInfo()->SpellIconID == 2622)
{
if (player->GetBaseRune(i) == RUNE_BLOOD)
continue;
}
else
{
if (player->GetBaseRune(i) != RUNE_BLOOD)
continue;
}
if (player->GetRuneCooldown(i) != (player->GetRuneBaseCooldown(i) - player->GetLastRuneGraceTimer(i)))
continue;
--runesLeft;
// Mark aura as used
player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_death_rune_AuraScript::CheckProc);
OnProc += AuraProcFn(spell_dk_death_rune_AuraScript::HandleProc);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_death_rune_AuraScript();
}
};
// -49998 - Death Strike
class spell_dk_death_strike : public SpellScriptLoader
{
@@ -966,6 +1193,116 @@ class spell_dk_ghoul_explode : public SpellScriptLoader
}
};
// 62259 - Glyph of Death Grip
class spell_dk_glyph_of_death_grip : public SpellScriptLoader
{
public:
spell_dk_glyph_of_death_grip() : SpellScriptLoader("spell_dk_glyph_of_death_grip") { }
class spell_dk_glyph_of_death_grip_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_glyph_of_death_grip_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_GRIP_INITIAL))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->GetSpellHistory()->ResetCooldown(SPELL_DK_DEATH_GRIP_INITIAL, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_glyph_of_death_grip_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_glyph_of_death_grip_AuraScript();
}
};
// 58642 - Glyph of Scourge Strike
class spell_dk_glyph_of_scourge_strike : public SpellScriptLoader
{
public:
spell_dk_glyph_of_scourge_strike() : SpellScriptLoader("spell_dk_glyph_of_scourge_strike") { }
class spell_dk_glyph_of_scourge_strike_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_glyph_of_scourge_strike_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_glyph_of_scourge_strike_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_glyph_of_scourge_strike_AuraScript();
}
};
// 51209 - Hungering Cold
class spell_dk_hungering_cold : public SpellScriptLoader
{
public:
spell_dk_hungering_cold() : SpellScriptLoader("spell_dk_hungering_cold") { }
class spell_dk_hungering_cold_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_hungering_cold_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo) // probably melee damage so let's proc
return true;
return (spellInfo->Dispel != DISPEL_DISEASE);
}
void HandleDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
// Prevent console spam
PreventDefaultAction();
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_hungering_cold_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_dk_hungering_cold_AuraScript::HandleDummy, EFFECT_1, SPELL_AURA_DUMMY);
OnEffectProc += AuraEffectProcFn(spell_dk_hungering_cold_AuraScript::HandleDummy, EFFECT_2, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_hungering_cold_AuraScript();
}
};
// 48792 - Icebound Fortitude
class spell_dk_icebound_fortitude : public SpellScriptLoader
{
@@ -1049,10 +1386,18 @@ class spell_dk_improved_blood_presence : public SpellScriptLoader
target->RemoveAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
// Prevent console spam
PreventDefaultAction();
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectProc += AuraEffectProcFn(spell_dk_improved_blood_presence_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
@@ -1213,6 +1558,127 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
}
};
// 61257 - Runic Power Back on Snare/Root
class spell_dk_pvp_4p_bonus : public SpellScriptLoader
{
public:
spell_dk_pvp_4p_bonus() : SpellScriptLoader("spell_dk_pvp_4p_bonus") { }
class spell_dk_pvp_4p_bonus_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_pvp_4p_bonus_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_RETURN))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return false;
return (spellInfo->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_SNARE))) != 0;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_DK_RUNIC_RETURN, true);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_pvp_4p_bonus_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_dk_pvp_4p_bonus_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_pvp_4p_bonus_AuraScript();
}
};
// 49005 - Mark of Blood
class spell_dk_mark_of_blood : public SpellScriptLoader
{
public:
spell_dk_mark_of_blood() : SpellScriptLoader("spell_dk_mark_of_blood") { }
class spell_dk_mark_of_blood_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_mark_of_blood_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_MARK_OF_BLOOD_HEAL))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_mark_of_blood_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_mark_of_blood_AuraScript();
}
};
// -51459 - Necrosis
class spell_dk_necrosis : public SpellScriptLoader
{
public:
spell_dk_necrosis() : SpellScriptLoader("spell_dk_necrosis") { }
class spell_dk_necrosis_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_necrosis_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_NECROSIS_DAMAGE))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
return;
int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
eventInfo.GetActor()->CastCustomSpell(SPELL_DK_NECROSIS_DAMAGE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_necrosis_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_necrosis_AuraScript();
}
};
// ID - 50842 Pestilence
class spell_dk_pestilence : public SpellScriptLoader
{
@@ -1565,6 +2031,43 @@ class spell_dk_raise_dead : public SpellScriptLoader
}
};
// -49188 - Rime
class spell_dk_rime : public SpellScriptLoader
{
public:
spell_dk_rime() : SpellScriptLoader("spell_dk_rime") { }
class spell_dk_blade_barrier_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_blade_barrier_AuraScript);
bool CheckProc(ProcEventInfo& /*eventInfo*/)
{
return GetTarget()->GetTypeId() == TYPEID_PLAYER;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
{
GetTarget()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
return spellInfo && spellInfo->GetCategory() == SPELL_CATEGORY_HOWLING_BLAST;
}, true);
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_blade_barrier_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_dk_blade_barrier_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_blade_barrier_AuraScript();
}
};
// 59754 Rune Tap - Party
class spell_dk_rune_tap_party : public SpellScriptLoader
{
@@ -1613,7 +2116,7 @@ class spell_dk_scent_of_blood : public SpellScriptLoader
{
PreventDefaultAction();
GetTarget()->CastSpell(GetTarget(), SPELL_DK_SCENT_OF_BLOOD, true, NULL, aurEff);
GetTarget()->RemoveAuraFromStack(GetSpellInfo()->Id);
ModStackAmount(-1);
}
void Register() override
@@ -1628,6 +2131,37 @@ class spell_dk_scent_of_blood : public SpellScriptLoader
}
};
// -49004 - Scent of Blood trigger
class spell_dk_scent_of_blood_trigger : public SpellScriptLoader
{
public:
spell_dk_scent_of_blood_trigger() : SpellScriptLoader("spell_dk_scent_of_blood_trigger") { }
class spell_dk_scent_of_blood_trigger_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_scent_of_blood_trigger_AuraScript);
// Each rank of Scent of Blood adds a trigger spell effect
// thus each effect adds one stack when proccing
// We need to remove the old buff before proccing again
// or we would be adding stacks to a possibly existing aura
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
GetTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_scent_of_blood_trigger_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_scent_of_blood_trigger_AuraScript();
}
};
// 55090 - Scourge Strike (55265, 55270, 55271)
class spell_dk_scourge_strike : public SpellScriptLoader
{
@@ -1744,6 +2278,188 @@ class spell_dk_spell_deflection : public SpellScriptLoader
}
};
// -49018 - Sudden Doom
class spell_dk_sudden_doom : public SpellScriptLoader
{
public:
spell_dk_sudden_doom() : SpellScriptLoader("spell_dk_sudden_doom") { }
class spell_dk_sudden_doom_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_sudden_doom_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_R1))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DK_DEATH_COIL_R1);
uint32 spellId = 0;
while (spellInfo)
{
if (!caster->HasSpell(spellInfo->Id))
break;
spellId = spellInfo->Id;
spellInfo = spellInfo->GetNextRankSpell();
}
if (!spellId)
return;
caster->CastSpell(eventInfo.GetProcTarget(), spellId, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_sudden_doom_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_sudden_doom_AuraScript();
}
};
// -65661 Threat of Thassarian
class spell_dk_threat_of_thassarian : public SpellScriptLoader
{
public:
spell_dk_threat_of_thassarian() : SpellScriptLoader("spell_dk_threat_of_thassarian") { }
class spell_dk_threat_of_thassarian_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_threat_of_thassarian_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_OBLITERATE_OFF_HAND_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_FROST_STRIKE_OFF_HAND_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_PLAGUE_STRIKE_OFF_HAND_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_OFF_HAND_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_RUNE_STRIKE_OFF_HAND_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_STRIKE_OFF_HAND_R1))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (!roll_chance_i(aurEff->GetAmount()))
return;
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return;
// Must dual wield
Unit* caster = eventInfo.GetActor();
if (!caster->haveOffhandWeapon())
return;
uint32 spellId = 0;
// Plague Strike
if (spellInfo->SpellFamilyFlags[0] & 0x00000001)
spellId = SPELL_DK_PLAGUE_STRIKE_OFF_HAND_R1;
// Death Strike
else if (spellInfo->SpellFamilyFlags[0] & 0x00000010)
spellId = SPELL_DK_DEATH_STRIKE_OFF_HAND_R1;
// Blood Strike
else if (spellInfo->SpellFamilyFlags[0] & 0x00400000)
spellId = SPELL_DK_BLOOD_STRIKE_OFF_HAND_R1;
// Frost Strike
else if (spellInfo->SpellFamilyFlags[1] & 0x00000004)
spellId = SPELL_DK_FROST_STRIKE_OFF_HAND_R1;
// Obliterate
else if (spellInfo->SpellFamilyFlags[1] & 0x00020000)
spellId = SPELL_DK_OBLITERATE_OFF_HAND_R1;
// Rune Strike
else if (spellInfo->SpellFamilyFlags[1] & 0x20000000)
spellId = SPELL_DK_RUNE_STRIKE_OFF_HAND_R1;
if (!spellId)
return;
spellId = sSpellMgr->GetSpellWithRank(spellId, spellInfo->GetRank());
caster->CastSpell(eventInfo.GetProcTarget(), spellId, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_threat_of_thassarian_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_threat_of_thassarian_AuraScript();
}
};
// 49194 - Unholy Blight
class spell_dk_unholy_blight : public SpellScriptLoader
{
public:
spell_dk_unholy_blight() : SpellScriptLoader("spell_dk_unholy_blight") { }
class spell_dk_unholy_blight_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_unholy_blight_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_BLIGHT_DAMAGE) ||
!sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
return;
Unit* caster = eventInfo.GetActor();
Unit* target = eventInfo.GetProcTarget();
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DK_UNHOLY_BLIGHT_DAMAGE);
int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
if (AuraEffect const* glyph = caster->GetAuraEffect(SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT, EFFECT_0, caster->GetGUID()))
AddPct(amount, glyph->GetAmount());
amount /= spellInfo->GetMaxTicks();
// Add remaining ticks to healing done
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_DK_UNHOLY_BLIGHT_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE);
caster->CastCustomSpell(SPELL_DK_UNHOLY_BLIGHT_DAMAGE, SPELLVALUE_BASE_POINT0, amount, target, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_unholy_blight_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_unholy_blight_AuraScript();
}
};
// 55233 - Vampiric Blood
class spell_dk_vampiric_blood : public SpellScriptLoader
{
@@ -1771,6 +2487,88 @@ class spell_dk_vampiric_blood : public SpellScriptLoader
}
};
// -49015 - Vendetta
class spell_dk_vendetta : public SpellScriptLoader
{
public:
spell_dk_vendetta() : SpellScriptLoader("spell_dk_vendetta") { }
class spell_dk_vendetta_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_vendetta_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_VENDETTA_HEAL))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
int32 amount = caster->CountPctFromMaxHealth(aurEff->GetAmount());
caster->CastCustomSpell(SPELL_DK_VENDETTA_HEAL, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_vendetta_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_vendetta_AuraScript();
}
};
// -49217 - Wandering Plague
class spell_dk_wandering_plague : public SpellScriptLoader
{
public:
spell_dk_wandering_plague() : SpellScriptLoader("spell_dk_wandering_plague") { }
class spell_dk_wandering_plague_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_wandering_plague_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_WANDERING_PLAGUE_DAMAGE))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
Unit* target = eventInfo.GetProcTarget();
if (!roll_chance_f(caster->GetUnitCriticalChance(BASE_ATTACK, target)))
return;
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
return;
int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
caster->CastCustomSpell(SPELL_DK_WANDERING_PLAGUE_DAMAGE, SPELLVALUE_BASE_POINT0, amount, target, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_dk_wandering_plague_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_dk_wandering_plague_AuraScript();
}
};
// 52284 - Will of the Necropolis
class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
@@ -2200,30 +2998,47 @@ void AddSC_deathknight_spell_scripts()
new spell_dk_anti_magic_shell_raid();
new spell_dk_anti_magic_shell_self();
new spell_dk_anti_magic_zone();
new spell_dk_blade_barrier();
new spell_dk_blood_boil();
new spell_dk_blood_gorged();
new spell_dk_bloodworms();
new spell_dk_butchery();
new spell_dk_corpse_explosion();
new spell_dk_dancing_rune_weapon();
new spell_dk_death_and_decay();
new spell_dk_death_coil();
new spell_dk_death_gate();
new spell_dk_death_grip();
new spell_dk_death_pact();
new spell_dk_death_rune();
new spell_dk_death_strike();
new spell_dk_ghoul_explode();
new spell_dk_glyph_of_death_grip();
new spell_dk_glyph_of_scourge_strike();
new spell_dk_hungering_cold();
new spell_dk_icebound_fortitude();
new spell_dk_improved_blood_presence();
new spell_dk_improved_blood_presence_triggered();
new spell_dk_improved_frost_presence();
new spell_dk_improved_unholy_presence();
new spell_dk_pvp_4p_bonus();
new spell_dk_mark_of_blood();
new spell_dk_necrosis();
new spell_dk_pestilence();
new spell_dk_presence();
new spell_dk_raise_dead();
new spell_dk_rime();
new spell_dk_rune_tap_party();
new spell_dk_scent_of_blood();
new spell_dk_scent_of_blood_trigger();
new spell_dk_scourge_strike();
new spell_dk_spell_deflection();
new spell_dk_sudden_doom();
new spell_dk_threat_of_thassarian();
new spell_dk_unholy_blight();
new spell_dk_vampiric_blood();
new spell_dk_vendetta();
new spell_dk_wandering_plague();
new spell_dk_will_of_the_necropolis();
new spell_dk_death_grip_initial();
new spell_dk_raise_ally_initial();