fix(Scripts/Spells): warlock demonic pact (#19386)

* add Demonic Pact Aura script

2ff855054f (diff-ea612aafadff90005e88b243eb000369be9e5cb6f8dc85a008d31e42b156e0ec)

Co-authored-by: ariel- <ariel-@users.noreply.github.com>

* spell_warlock aura:spell_warl_demonic_pact_aura

* fixup! spell_warlock aura:spell_warl_demonic_pact_aura

* remove not needed spell correction, flag is already set

* subtract current proc bonus before calculating new bonus

* also increase healing done

* remove Demonic Pact handling in Unit

* refactor indent, remove bonus from spell group effects e.g. totem of wrath

* Revert "refactor indent, remove bonus from spell group effects e.g. totem of wrath"

This reverts commit 104041172d34f542cc934e9f468407c36912cc7f.

* refactor indent

* manually set proc cooldown

---------

Co-authored-by: ariel- <ariel-@users.noreply.github.com>
This commit is contained in:
Jelle Meeus
2024-07-13 17:38:59 +02:00
committed by GitHub
parent 98cb352dc0
commit a69d02e513
4 changed files with 57 additions and 31 deletions

View File

@@ -65,12 +65,14 @@ enum WarlockSpells
SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC = 18371,
SPELL_WARLOCK_EYE_OF_KILROGG_FLY = 58083,
SPELL_WARLOCK_PET_VOID_STAR_TALISMAN = 37386, // Void Star Talisman
SPELL_WARLOCK_DEMONIC_PACT_PROC = 48090,
};
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
};
class spell_warl_eye_of_kilrogg : public AuraScript
@@ -1321,6 +1323,54 @@ class spell_warl_glyph_of_voidwalker : public AuraScript
}
};
// 54909, 53646 - Demonic Pact
class spell_warl_demonic_pact_aura : public AuraScript
{
PrepareAuraScript(spell_warl_demonic_pact_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARLOCK_DEMONIC_PACT_PROC });
}
bool AfterCheckProc(ProcEventInfo& eventInfo, bool isTriggeredAtSpellProcEvent)
{
return isTriggeredAtSpellProcEvent && eventInfo.GetActor() && eventInfo.GetActor()->IsPet();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (eventInfo.GetActor()->HasSpellCooldown(aurEff->GetId()))
return;
if (Unit* owner = eventInfo.GetActor()->GetOwner())
{
int32 currentBonus = 0;
if (AuraEffect* demonicAurEff = owner->GetAuraEffect(SPELL_WARLOCK_DEMONIC_PACT_PROC, EFFECT_0))
{
currentBonus = demonicAurEff->GetAmount();
}
if (AuraEffect* talentAurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, WARLOCK_ICON_ID_DEMONIC_PACT, EFFECT_0))
{
int32 spellDamageMinusBonus = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_MAGIC) - currentBonus;
if (spellDamageMinusBonus < 0)
return;
int32 bp = int32((talentAurEff->GetAmount() / 100.0f) * spellDamageMinusBonus);
owner->CastCustomSpell((Unit*)nullptr, SPELL_WARLOCK_DEMONIC_PACT_PROC, &bp, &bp, 0, true, nullptr, talentAurEff);
eventInfo.GetActor()->AddSpellCooldown(aurEff->GetId(), 0, eventInfo.GetProcCooldown());
}
}
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_warl_demonic_pact_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
void AddSC_warlock_spell_scripts()
{
RegisterSpellScript(spell_warl_eye_of_kilrogg);
@@ -1354,5 +1404,6 @@ void AddSC_warlock_spell_scripts()
RegisterSpellScript(spell_warl_shadowburn);
RegisterSpellScript(spell_warl_glyph_of_felguard);
RegisterSpellScript(spell_warl_glyph_of_voidwalker);
RegisterSpellScript(spell_warl_demonic_pact_aura);
}