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

@@ -37,6 +37,7 @@ enum WarlockSpells
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD = 54508,
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509,
SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444,
SPELL_WARLOCK_DEMONIC_PACT_PROC = 48090,
SPELL_WARLOCK_FEL_SYNERGY_HEAL = 54181,
SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME = 63311,
SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE = 63106,
@@ -58,13 +59,29 @@ enum WarlockSpells
SPELL_WARLOCK_NETHER_PROTECTION_NATURE = 54375,
SPELL_WARLOCK_SOULSHATTER = 32835,
SPELL_WARLOCK_SIPHON_LIFE_HEAL = 63106,
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117
SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
SPELL_WARLOCK_GLYPH_OF_LIFE_TAP_TRIGGERED = 63321,
SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1 = 27285,
SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC = 32865,
SPELL_WARLOCK_SHADOW_TRANCE = 17941,
SPELL_WARLOCK_SOUL_LEECH_HEAL = 30294,
SPELL_WARLOCK_IMP_SOUL_LEECH_R1 = 54117,
SPELL_WARLOCK_SOUL_LEECH_PET_MANA_1 = 54607,
SPELL_WARLOCK_SOUL_LEECH_PET_MANA_2 = 59118,
SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_1 = 54300,
SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_2 = 59117,
SPELL_REPLENISHMENT = 57669,
SPELL_WARLOCK_SHADOWFLAME = 37378,
SPELL_WARLOCK_FLAMESHADOW = 37379,
SPELL_WARLOCK_GLYPH_OF_SUCCUBUS = 56250,
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC = 18371
};
enum WarlockSpellIcons
{
WARLOCK_ICON_ID_IMPROVED_LIFE_TAP = 208,
WARLOCK_ICON_ID_MANA_FEED = 1982
WARLOCK_ICON_ID_MANA_FEED = 1982,
WARLOCK_ICON_ID_DEMONIC_PACT = 3220
};
// -710 - Banish
@@ -250,6 +267,36 @@ class spell_warl_curse_of_doom : public SpellScriptLoader
}
};
class spell_warl_decimation : public SpellScriptLoader
{
public:
spell_warl_decimation() : SpellScriptLoader("spell_warl_decimation") { }
class spell_warl_decimation_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_decimation_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
{
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
if (eventInfo.GetActionTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellInfo, eventInfo.GetActor()))
return true;
return false;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_warl_decimation_AuraScript::CheckProc);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_decimation_AuraScript();
}
};
// 48018 - Demonic Circle: Summon
class spell_warl_demonic_circle_summon : public SpellScriptLoader
{
@@ -480,6 +527,79 @@ class spell_warl_fel_synergy : public SpellScriptLoader
}
};
// -18094 - Nightfall
// 56218 - Glyph of Corruption
class spell_warl_glyph_of_corruption_nightfall : public SpellScriptLoader
{
public:
spell_warl_glyph_of_corruption_nightfall() : SpellScriptLoader("spell_warl_glyph_of_corruption_nightfall") { }
class spell_warl_glyph_of_corruption_nightfall_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_glyph_of_corruption_nightfall_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SHADOW_TRANCE))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(caster, SPELL_WARLOCK_SHADOW_TRANCE, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_glyph_of_corruption_nightfall_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_glyph_of_corruption_nightfall_AuraScript();
}
};
// 63320 - Glyph of Life Tap
class spell_warl_glyph_of_life_tap : public SpellScriptLoader
{
public:
spell_warl_glyph_of_life_tap() : SpellScriptLoader("spell_warl_glyph_of_life_tap") { }
class spell_warl_glyph_of_life_tap_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_glyph_of_life_tap_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_LIFE_TAP_TRIGGERED))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(caster, SPELL_WARLOCK_GLYPH_OF_LIFE_TAP_TRIGGERED, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_glyph_of_life_tap_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_glyph_of_life_tap_AuraScript();
}
};
// 63310 - Glyph of Shadowflame
class spell_warl_glyph_of_shadowflame : public SpellScriptLoader
{
@@ -618,6 +738,44 @@ class spell_warl_health_funnel : public SpellScriptLoader
}
};
// -18213 - Improved Drain Soul
class spell_warl_improved_drain_soul : public SpellScriptLoader
{
public:
spell_warl_improved_drain_soul() : SpellScriptLoader("spell_warl_improved_drain_soul") { }
class spell_warl_improved_drain_soul_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_improved_drain_soul_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
Unit* target = GetTarget();
int32 bp0 = CalculatePct(target->GetMaxPower(POWER_MANA), GetSpellInfo()->Effects[EFFECT_2].BasePoints);
target->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, bp0, target, true, nullptr, aurEff);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_improved_drain_soul_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_improved_drain_soul_AuraScript();
}
};
// -1454 - Life Tap
class spell_warl_life_tap : public SpellScriptLoader
{
@@ -779,6 +937,55 @@ public:
}
};
// 54909, 53646 - Demonic Pact
class spell_warl_demonic_pact : public SpellScriptLoader
{
public:
spell_warl_demonic_pact() : SpellScriptLoader("spell_warl_demonic_pact") { }
class spell_warl_demonic_pact_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_demonic_pact_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_DEMONIC_PACT_PROC))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActor() && eventInfo.GetActor()->IsPet();
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (Unit* owner = eventInfo.GetActor()->GetOwner())
{
if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_DEMONIC_PACT, EFFECT_0))
{
int32 bp0 = static_cast<int32>((aurEff->GetAmount() * owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_MAGIC) + 100.0f) / 100.0f);
owner->CastCustomSpell(SPELL_WARLOCK_DEMONIC_PACT_PROC, SPELLVALUE_BASE_POINT0, bp0, (Unit*)nullptr, true, nullptr, aurEff);
}
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_warl_demonic_pact_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_warl_demonic_pact_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_demonic_pact_AuraScript();
}
};
// 18541 - Ritual of Doom Effect
class spell_warl_ritual_of_doom_effect : public SpellScriptLoader
{
@@ -807,6 +1014,47 @@ class spell_warl_ritual_of_doom_effect : public SpellScriptLoader
}
};
// 6358 - Seduction
class spell_warl_seduction : public SpellScriptLoader
{
public:
spell_warl_seduction() : SpellScriptLoader("spell_warl_seduction") { }
class spell_warl_seduction_SpellScript : public SpellScript
{
PrepareSpellScript(spell_warl_seduction_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SUCCUBUS))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* owner = GetCaster()->GetOwner();
if (!owner || !owner->HasAura(SPELL_WARLOCK_GLYPH_OF_SUCCUBUS))
return;
Unit* target = GetHitUnit();
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
void Register() override
{
OnEffectLaunchTarget += SpellEffectFn(spell_warl_seduction_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_warl_seduction_SpellScript();
}
};
// -27285 - Seed of Corruption
class spell_warl_seed_of_corruption : public SpellScriptLoader
{
@@ -835,6 +1083,118 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader
}
};
// -27243 - Seed of Corruption
class spell_warl_seed_of_corruption_dummy : public SpellScriptLoader
{
public:
spell_warl_seed_of_corruption_dummy() : SpellScriptLoader("spell_warl_seed_of_corruption_dummy") { }
class spell_warl_seed_of_corruption_dummy_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_seed_of_corruption_dummy_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo)
return;
int32 amount = aurEff->GetAmount() - damageInfo->GetDamage();
if (amount > 0)
{
const_cast<AuraEffect*>(aurEff)->SetAmount(amount);
if (!GetTarget()->HealthBelowPctDamaged(1, damageInfo->GetDamage()))
return;
}
Remove();
Unit* caster = GetCaster();
if (!caster)
return;
uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE_R1, GetSpellInfo()->GetRank());
caster->CastSpell(eventInfo.GetActionTarget(), spellId, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_seed_of_corruption_dummy_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_seed_of_corruption_dummy_AuraScript();
}
};
// 32863 - Seed of Corruption
// 36123 - Seed of Corruption
// 38252 - Seed of Corruption
// 39367 - Seed of Corruption
// 44141 - Seed of Corruption
// 70388 - Seed of Corruption
// Monster spells, triggered only on amount drop (not on death)
class spell_warl_seed_of_corruption_generic : public SpellScriptLoader
{
public:
spell_warl_seed_of_corruption_generic() : SpellScriptLoader("spell_warl_seed_of_corruption_generic") { }
class spell_warl_seed_of_corruption_generic_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_seed_of_corruption_generic_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo)
return;
int32 amount = aurEff->GetAmount() - damageInfo->GetDamage();
if (amount > 0)
{
const_cast<AuraEffect*>(aurEff)->SetAmount(amount);
return;
}
Remove();
Unit* caster = GetCaster();
if (!caster)
return;
caster->CastSpell(eventInfo.GetActionTarget(), SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_seed_of_corruption_generic_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_seed_of_corruption_generic_AuraScript();
}
};
// -7235 - Shadow Ward
class spell_warl_shadow_ward : public SpellScriptLoader
{
@@ -921,6 +1281,71 @@ class spell_warl_siphon_life : public SpellScriptLoader
}
};
// -30293 - Soul Leech
class spell_warl_soul_leech : public SpellScriptLoader
{
public:
spell_warl_soul_leech() : SpellScriptLoader("spell_warl_soul_leech") { }
class spell_warl_soul_leech_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_soul_leech_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_HEAL) ||
!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMP_SOUL_LEECH_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_PET_MANA_1) ||
!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_PET_MANA_2) ||
!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_1) ||
!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_2) ||
!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
static uint32 const casterMana[2] = { SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_1, SPELL_WARLOCK_SOUL_LEECH_CASTER_MANA_2 };
static uint32 const petMana[2] = { SPELL_WARLOCK_SOUL_LEECH_PET_MANA_1, SPELL_WARLOCK_SOUL_LEECH_PET_MANA_2 };
PreventDefaultAction();
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetDamage())
return;
Unit* caster = eventInfo.GetActor();
int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount());
caster->CastCustomSpell(SPELL_WARLOCK_SOUL_LEECH_HEAL, SPELLVALUE_BASE_POINT0, bp, caster, true);
// Improved Soul Leech code below
AuraEffect const* impSoulLeech = GetTarget()->GetAuraEffectOfRankedSpell(SPELL_WARLOCK_IMP_SOUL_LEECH_R1, EFFECT_1, aurEff->GetCasterGUID());
if (!impSoulLeech)
return;
uint8 impSoulLeechRank = impSoulLeech->GetSpellInfo()->GetRank();
uint32 selfSpellId = casterMana[impSoulLeechRank - 1];
uint32 petSpellId = petMana[impSoulLeechRank - 1];
caster->CastSpell((Unit*)nullptr, selfSpellId, true);
caster->CastSpell((Unit*)nullptr, petSpellId, true);
if (roll_chance_i(impSoulLeech->GetAmount()))
caster->CastSpell((Unit*)nullptr, SPELL_REPLENISHMENT, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_soul_leech_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_soul_leech_AuraScript();
}
};
// 29858 - Soulshatter
class spell_warl_soulshatter : public SpellScriptLoader
{
@@ -960,6 +1385,45 @@ class spell_warl_soulshatter : public SpellScriptLoader
}
};
// 37377 - Shadowflame
// 39437 - Shadowflame Hellfire and RoF
template <uint32 TriggerSpellId>
class spell_warl_t4_2p_bonus : public SpellScriptLoader
{
public:
spell_warl_t4_2p_bonus(char const* ScriptName) : SpellScriptLoader(ScriptName) { }
template <uint32 Trigger>
class spell_warl_t4_2p_bonus_AuraScript : public AuraScript
{
PrepareAuraScript(spell_warl_t4_2p_bonus_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(Trigger))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* caster = eventInfo.GetActor();
caster->CastSpell(caster, Trigger, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_t4_2p_bonus_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_warl_t4_2p_bonus_AuraScript<TriggerSpellId>();
}
};
// -30108 - Unstable Affliction
class spell_warl_unstable_affliction : public SpellScriptLoader
{
@@ -1005,20 +1469,31 @@ void AddSC_warlock_spell_scripts()
new spell_warl_banish();
new spell_warl_create_healthstone();
new spell_warl_curse_of_doom();
new spell_warl_decimation();
new spell_warl_demonic_circle_summon();
new spell_warl_demonic_circle_teleport();
new spell_warl_demonic_empowerment();
new spell_warl_demonic_pact();
new spell_warl_everlasting_affliction();
new spell_warl_fel_synergy();
new spell_warl_glyph_of_life_tap();
new spell_warl_glyph_of_shadowflame();
new spell_warl_haunt();
new spell_warl_health_funnel();
new spell_warl_glyph_of_corruption_nightfall();
new spell_warl_improved_drain_soul();
new spell_warl_life_tap();
new spell_warl_nether_protection();
new spell_warl_ritual_of_doom_effect();
new spell_warl_seduction();
new spell_warl_seed_of_corruption();
new spell_warl_seed_of_corruption_dummy();
new spell_warl_seed_of_corruption_generic();
new spell_warl_shadow_ward();
new spell_warl_siphon_life();
new spell_warl_soul_leech();
new spell_warl_soulshatter();
new spell_warl_t4_2p_bonus<SPELL_WARLOCK_FLAMESHADOW>("spell_warl_t4_2p_bonus_shadow");
new spell_warl_t4_2p_bonus<SPELL_WARLOCK_SHADOWFLAME>("spell_warl_t4_2p_bonus_fire");
new spell_warl_unstable_affliction();
}