diff options
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 57 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 159 |
2 files changed, 125 insertions, 91 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9cf3e6bdadf..67fc8576bd4 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -321,6 +321,31 @@ class spell_gen_aura_of_anger : public AuraScript } }; +// 28313 - Aura of Fear +class spell_gen_aura_of_fear : public AuraScript +{ + PrepareAuraScript(spell_gen_aura_of_fear); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + } + + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (!roll_chance_i(GetSpellInfo()->ProcChance)) + return; + + GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_aura_of_fear::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + enum ServiceUniform { // Spells @@ -795,6 +820,36 @@ class spell_gen_chaos_blast : public SpellScript } }; +enum ChokingVines +{ + SPELL_CHOKING_WOUND = 35247 +}; + +// 35244 - Choking Vines +class spell_gen_choking_vines : public AuraScript +{ + PrepareAuraScript(spell_gen_choking_vines); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CHOKING_WOUND }); + } + + void HandleChoke(AuraEffect const* /*aurEff*/) + { + if (GetStackAmount() != GetSpellInfo()->StackAmount) + return; + + GetTarget()->CastSpell(nullptr, SPELL_CHOKING_WOUND, true); + Remove(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_choking_vines::HandleChoke, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } +}; + class spell_gen_clone : public SpellScript { PrepareSpellScript(spell_gen_clone); @@ -3745,6 +3800,7 @@ void AddSC_generic_spell_scripts() RegisterAuraScript(spell_gen_animal_blood); RegisterAuraScript(spell_gen_arena_drink); RegisterAuraScript(spell_gen_aura_of_anger); + RegisterAuraScript(spell_gen_aura_of_fear); RegisterAuraScript(spell_gen_aura_service_uniform); RegisterAuraScript(spell_gen_av_drekthar_presence); RegisterSpellScript(spell_gen_bandage); @@ -3758,6 +3814,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_cannibalize); RegisterAuraScript(spell_gen_chains_of_ice); RegisterSpellScript(spell_gen_chaos_blast); + RegisterAuraScript(spell_gen_choking_vines); RegisterSpellScript(spell_gen_clone); RegisterSpellScript(spell_gen_clone_weapon); RegisterAuraScript(spell_gen_clone_weapon_aura); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 29398c5dc35..811778eacc5 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -63,9 +63,6 @@ enum PaladinSpells SPELL_PALADIN_AVENGING_WRATH_MARKER = 61987, SPELL_PALADIN_IMMUNE_SHIELD_MARKER = 61988, - SPELL_PALADIN_HAND_OF_SACRIFICE = 6940, - SPELL_PALADIN_DIVINE_SACRIFICE = 64205, - SPELL_PALADIN_ITEM_HEALING_TRANCE = 37706, SPELL_PALADIN_JUDGEMENT_DAMAGE = 54158, @@ -510,58 +507,55 @@ class spell_pal_divine_purpose : public SpellScriptLoader }; // 64205 - Divine Sacrifice -class spell_pal_divine_sacrifice : public SpellScriptLoader +class spell_pal_divine_sacrifice : public AuraScript { - public: - spell_pal_divine_sacrifice() : SpellScriptLoader("spell_pal_divine_sacrifice") { } + PrepareAuraScript(spell_pal_divine_sacrifice); - class spell_pal_divine_sacrifice_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_divine_sacrifice_AuraScript); + uint32 groupSize = 0, minHpPct = 0; + uint32 remainingAmount = 0; - uint32 groupSize, minHpPct; - int32 remainingAmount; - - bool Load() override - { - if (Unit* caster = GetCaster()) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - if (caster->ToPlayer()->GetGroup()) - groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); - else - groupSize = 1; - } - else - return false; - - remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); - minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); - return true; - } - return false; - } - - void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) + bool Load() override + { + if (Unit* caster = GetCaster()) + { + if (caster->GetTypeId() == TYPEID_PLAYER) { - remainingAmount -= splitAmount; - // break when absorbed everything it could, or if the casters hp drops below 20% - if (Unit* caster = GetCaster()) - if (remainingAmount <= 0 || (caster->GetHealthPct() < minHpPct)) - caster->RemoveAura(SPELL_PALADIN_DIVINE_SACRIFICE); + if (caster->ToPlayer()->GetGroup()) + groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); + else + groupSize = 1; } + else + return false; - void Register() override - { - OnEffectSplit += AuraEffectSplitFn(spell_pal_divine_sacrifice_AuraScript::Split, EFFECT_0); - } - }; + remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); + minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); + return true; + } + return false; + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_divine_sacrifice_AuraScript(); + void Split(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& splitAmount) + { + // break when splitted everything it could, or if the casters hp drops below 20% + if (remainingAmount >= splitAmount) + remainingAmount -= splitAmount; + else + { + splitAmount = remainingAmount; + Remove(); + return; } + + if (Unit* caster = GetCaster()) + if (caster->HealthBelowPct(minHpPct)) + Remove(); + } + + void Register() override + { + OnEffectSplit += AuraEffectSplitFn(spell_pal_divine_sacrifice::Split, EFFECT_0); + } }; // 53385 - Divine Storm @@ -876,54 +870,37 @@ class spell_pal_guarded_by_the_light : public SpellScriptLoader }; // 6940 - Hand of Sacrifice -class spell_pal_hand_of_sacrifice : public SpellScriptLoader +class spell_pal_hand_of_sacrifice : public AuraScript { - public: - spell_pal_hand_of_sacrifice() : SpellScriptLoader("spell_pal_hand_of_sacrifice") { } + PrepareAuraScript(spell_pal_hand_of_sacrifice); - class spell_pal_hand_of_sacrifice_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript); - - public: - spell_pal_hand_of_sacrifice_AuraScript() - { - remainingAmount = 0; - } - - private: - int32 remainingAmount; - - bool Load() override - { - if (Unit* caster = GetCaster()) - { - remainingAmount = caster->GetMaxHealth(); - return true; - } - return false; - } - - void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) - { - remainingAmount -= splitAmount; - - if (remainingAmount <= 0) - { - GetTarget()->RemoveAura(SPELL_PALADIN_HAND_OF_SACRIFICE); - } - } + uint32 remainingAmount = 0; - void Register() override - { - OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice_AuraScript::Split, EFFECT_0); - } - }; + bool Load() override + { + if (Unit* caster = GetCaster()) + { + remainingAmount = caster->GetMaxHealth(); + return true; + } + return false; + } - AuraScript* GetAuraScript() const override + void Split(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& splitAmount) + { + if (remainingAmount >= splitAmount) + remainingAmount -= splitAmount; + else { - return new spell_pal_hand_of_sacrifice_AuraScript(); + splitAmount = remainingAmount; + Remove(); } + } + + void Register() override + { + OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice::Split, EFFECT_0); + } }; // 1038 - Hand of Salvation @@ -2397,7 +2374,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_blessing_of_faith(); new spell_pal_blessing_of_sanctuary(); new spell_pal_divine_purpose(); - new spell_pal_divine_sacrifice(); + RegisterAuraScript(spell_pal_divine_sacrifice); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); new spell_pal_exorcism_and_holy_wrath_damage(); @@ -2406,7 +2383,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_glyph_of_holy_light(); new spell_pal_glyph_of_holy_light_dummy(); new spell_pal_guarded_by_the_light(); - new spell_pal_hand_of_sacrifice(); + RegisterAuraScript(spell_pal_hand_of_sacrifice); new spell_pal_hand_of_salvation(); new spell_pal_heart_of_the_crusader(); new spell_pal_holy_shock(); |
