diff options
| author | offl <11556157+offl@users.noreply.github.com> | 2021-11-20 21:49:56 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-22 23:17:09 +0100 |
| commit | 5eac5ee2dbee289acbde48506b04ef35a0b1d5b2 (patch) | |
| tree | 02b8ea55c44c4de5b7f49d231b196e3a88045651 /src/server/scripts/Spells | |
| parent | 8f02596162715b273b1a830425ae783bd00561c9 (diff) | |
Scripts/Spells: Void Zone's Consumption (#27265)
(cherry picked from commit 44a6d393d7969adf3357ea74c61561c60c6c5a31)
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 26876ea5ade..a3074e46dae 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1030,6 +1030,32 @@ private: int32 _damagePct; }; +// 28865 - Consumption +// 64208 - Consumption +class spell_gen_consumption : public SpellScript +{ + PrepareSpellScript(spell_gen_consumption); + + void HandleDamageCalc(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster || caster->GetTypeId() != TYPEID_UNIT) + return; + + int32 damage = 0; + if (SpellInfo const* createdBySpell = sSpellMgr->GetSpellInfo(caster->m_unitData->CreatedBySpell, GetCastDifficulty())) + damage = createdBySpell->GetEffect(EFFECT_1).CalcValue(); + + if (damage) + SetEffectValue(damage); + } + + void Register() override + { + OnEffectLaunchTarget += SpellEffectFn(spell_gen_consumption::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } +}; + // 63845 - Create Lance enum CreateLanceSpells { @@ -4853,6 +4879,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_clone); RegisterSpellScript(spell_gen_clone_weapon); RegisterSpellScript(spell_gen_clone_weapon_aura); + RegisterSpellScript(spell_gen_consumption); RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_default_count_pct_from_max_hp"); RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_50pct_count_pct_from_max_hp", 50); RegisterSpellScript(spell_gen_create_lance); |
