From 0e7ed5ec857706f27378b00773aa46b8825c3f27 Mon Sep 17 00:00:00 2001 From: Faq Date: Tue, 18 Sep 2012 23:19:31 +0300 Subject: Core/Spells: Implementing some hooks for split damage taken, fixes the limitation of dmg such auras can split, for example at Hand of Sacrifice. Might have unexpected results, but they are called unexpected for a reason.. .Author Tibbi closes #6025 Made new one as https://github.com/TrinityCore/TrinityCore/pull/7423/ was closed. --- src/server/scripts/Spells/spell_paladin.cpp | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 0bf2e5664a0..43c4dc139a3 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -47,6 +47,8 @@ enum PaladinSpells SPELL_FORBEARANCE = 25771, SPELL_AVENGING_WRATH_MARKER = 61987, SPELL_IMMUNE_SHIELD_MARKER = 61988, + + SPELL_HAND_OF_SACRIFICE = 6940, }; // 31850 - Ardent Defender @@ -566,6 +568,52 @@ class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader } }; +class spell_pal_hand_of_sacrifice : public SpellScriptLoader +{ + public: + spell_pal_hand_of_sacrifice() : SpellScriptLoader("spell_pal_hand_of_sacrifice") { } + + class spell_pal_hand_of_sacrifice_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript); + + uint32 splitPct; + int32 remainingAmount; + Unit* caster; + + bool Load() + { + caster = GetCaster(); + if (!caster) + return false; + remainingAmount = caster->GetMaxHealth(); + splitPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + return true; + } + + void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) + { + remainingAmount -= splitAmount; + + if (remainingAmount <= 0) + { + Unit* target = GetTarget(); + target->RemoveAura(SPELL_HAND_OF_SACRIFICE); + } + } + + void Register() + { + OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice_AuraScript::Split, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pal_hand_of_sacrifice_AuraScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -579,4 +627,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_lay_on_hands(); new spell_pal_righteous_defense(); new spell_pal_exorcism_and_holy_wrath_damage(); + new spell_pal_hand_of_sacrifice(); } -- cgit v1.2.3 From da4067cb30f3bf45f1456dd1411cf9f4c1df8c5c Mon Sep 17 00:00:00 2001 From: faq Date: Mon, 24 Sep 2012 18:05:00 +0300 Subject: Implementing split dmg cap to Divine Sacrifice. Author Tibbi +correcting previos sql Closes #6024 --- .../2012_09_18_02_world_spell_script_names.sql | 3 -- .../2012_09_24_00_world_spell_script_names.sql | 3 ++ .../2012_09_24_01_world_spell_script_names.sql | 3 ++ src/server/scripts/Spells/spell_paladin.cpp | 58 +++++++++++++++++++++- 4 files changed, 62 insertions(+), 5 deletions(-) delete mode 100644 sql/updates/world/2012_09_18_02_world_spell_script_names.sql create mode 100644 sql/updates/world/2012_09_24_00_world_spell_script_names.sql create mode 100644 sql/updates/world/2012_09_24_01_world_spell_script_names.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2012_09_18_02_world_spell_script_names.sql b/sql/updates/world/2012_09_18_02_world_spell_script_names.sql deleted file mode 100644 index 00734753691..00000000000 --- a/sql/updates/world/2012_09_18_02_world_spell_script_names.sql +++ /dev/null @@ -1,3 +0,0 @@ -DELETE FROM spell_script_names WHERE spell_id = 6940; -INSERT INTO spell_script_names (spell_id, ScriptName) VALUES -(6940, 'spell_pal_hand_of_sacrifice'); diff --git a/sql/updates/world/2012_09_24_00_world_spell_script_names.sql b/sql/updates/world/2012_09_24_00_world_spell_script_names.sql new file mode 100644 index 00000000000..611325d4b11 --- /dev/null +++ b/sql/updates/world/2012_09_24_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=6940; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(6940, 'spell_pal_hand_of_sacrifice'); diff --git a/sql/updates/world/2012_09_24_01_world_spell_script_names.sql b/sql/updates/world/2012_09_24_01_world_spell_script_names.sql new file mode 100644 index 00000000000..e14b6833a09 --- /dev/null +++ b/sql/updates/world/2012_09_24_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=64205; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(64205, 'spell_pal_divine_sacrifice'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 43c4dc139a3..ad0ed6a7e20 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -24,6 +24,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" +#include "Group.h" enum PaladinSpells @@ -49,6 +50,7 @@ enum PaladinSpells SPELL_IMMUNE_SHIELD_MARKER = 61988, SPELL_HAND_OF_SACRIFICE = 6940, + SPELL_DIVINE_SACRIFICE = 64205, }; // 31850 - Ardent Defender @@ -577,7 +579,6 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader { PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript); - uint32 splitPct; int32 remainingAmount; Unit* caster; @@ -587,7 +588,6 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader if (!caster) return false; remainingAmount = caster->GetMaxHealth(); - splitPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); return true; } @@ -614,6 +614,59 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader } }; +class spell_pal_divine_sacrifice : public SpellScriptLoader +{ + public: + spell_pal_divine_sacrifice() : SpellScriptLoader("spell_pal_divine_sacrifice") { } + + class spell_pal_divine_sacrifice_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_divine_sacrifice_AuraScript); + + uint32 splitPct, groupSize, minHpPct; + int32 remainingAmount; + Unit* caster; + + bool Load() + { + caster = GetCaster(); + if (!caster) + return false; + + if (caster->ToPlayer()->GetGroup()) + groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); + else + groupSize = 1; + + remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); + splitPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster); + minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); + + return true; + } + + void Split(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & splitAmount) + { + splitAmount = CalculatePctN(dmgInfo.GetDamage(), splitPct); + remainingAmount -= splitAmount; + + // break when absorbed everything it could, or if the casters hp drops below 20% + if (remainingAmount <= 0 || (GetCaster()->GetHealthPct() < minHpPct)) + GetCaster()->RemoveAura(SPELL_DIVINE_SACRIFICE); + } + + void Register() + { + OnEffectSplit += AuraEffectSplitFn(spell_pal_divine_sacrifice_AuraScript::Split, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pal_divine_sacrifice_AuraScript(); + } +}; + void AddSC_paladin_spell_scripts() { new spell_pal_ardent_defender(); @@ -628,4 +681,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_righteous_defense(); new spell_pal_exorcism_and_holy_wrath_damage(); new spell_pal_hand_of_sacrifice(); + new spell_pal_divine_sacrifice(); } -- cgit v1.2.3 From 58d3758f4c8913ffd734b2d963a22bccd55b879a Mon Sep 17 00:00:00 2001 From: faq Date: Mon, 24 Sep 2012 18:33:54 +0300 Subject: Core/Spell: Correcting previos PR. splitamount is already calculated in core and removing not in. variable --- src/server/scripts/Spells/spell_paladin.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index ad0ed6a7e20..e2f449e38a1 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -623,7 +623,7 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader { PrepareAuraScript(spell_pal_divine_sacrifice_AuraScript); - uint32 splitPct, groupSize, minHpPct; + uint32 groupSize, minHpPct; int32 remainingAmount; Unit* caster; @@ -639,15 +639,13 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader groupSize = 1; remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); - splitPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster); minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); return true; } - void Split(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & splitAmount) + void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) { - splitAmount = CalculatePctN(dmgInfo.GetDamage(), splitPct); remainingAmount -= splitAmount; // break when absorbed everything it could, or if the casters hp drops below 20% -- cgit v1.2.3 From 3cf359068ef642ff0959fdf2dc2e29939708b275 Mon Sep 17 00:00:00 2001 From: Kandera Date: Mon, 24 Sep 2012 12:16:37 -0400 Subject: Core/Spells: Fix things from commit da4067cb30f3bf45f1456dd1411cf9f4c1df8c5c thx dracosvk --- src/server/scripts/Spells/spell_paladin.cpp | 51 +++++++++++++++-------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index e2f449e38a1..0102c3cb1ae 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -580,15 +580,15 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript); int32 remainingAmount; - Unit* caster; bool Load() { - caster = GetCaster(); - if (!caster) - return false; - remainingAmount = caster->GetMaxHealth(); - return true; + if (Unit* caster = GetCaster()) + { + remainingAmount = caster->GetMaxHealth(); + return true; + } + return false; } void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) @@ -597,8 +597,7 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader if (remainingAmount <= 0) { - Unit* target = GetTarget(); - target->RemoveAura(SPELL_HAND_OF_SACRIFICE); + GetTarget()->RemoveAura(SPELL_HAND_OF_SACRIFICE); } } @@ -625,32 +624,36 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader uint32 groupSize, minHpPct; int32 remainingAmount; - Unit* caster; bool Load() { - caster = GetCaster(); - if (!caster) - return false; - - if (caster->ToPlayer()->GetGroup()) - groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); - else - groupSize = 1; - - remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); - minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); + + if (Unit* caster = GetCaster()) + { + if (caster->GetTypeId() == TYPEID_PLAYER) + { + if (caster->ToPlayer()->GetGroup()) + groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); + else + groupSize = 1; + } + else + return false; - return true; + 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) { remainingAmount -= splitAmount; - // break when absorbed everything it could, or if the casters hp drops below 20% - if (remainingAmount <= 0 || (GetCaster()->GetHealthPct() < minHpPct)) - GetCaster()->RemoveAura(SPELL_DIVINE_SACRIFICE); + if (Unit* caster = GetCaster()) + if (remainingAmount <= 0 || (caster->GetHealthPct() < minHpPct)) + caster->RemoveAura(SPELL_DIVINE_SACRIFICE); } void Register() -- cgit v1.2.3 From 1c1405cb25cc9152c1477b9769cf45aa43ba4bc8 Mon Sep 17 00:00:00 2001 From: Xanvial Date: Mon, 24 Sep 2012 12:35:09 -0400 Subject: Core/Scripts: fix rotface oozes from spawning after death. Closes #7736 --- src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 5a0560293da..03427a4cfc2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -124,9 +124,9 @@ class boss_rotface : public CreatureScript void JustDied(Unit* /*killer*/) { + instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); _JustDied(); Talk(SAY_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) professor->AI()->DoAction(ACTION_ROTFACE_DEATH); } -- cgit v1.2.3 From 118825601b101eb6d3b9c1678afed1c405235d8e Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 24 Sep 2012 12:39:02 -0400 Subject: Core/Spells: fix misdirection removal on cancel. Closes #7776 --- src/server/scripts/Spells/spell_hunter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index a2ee6c1c3a3..e445f68cfba 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -574,7 +574,7 @@ class spell_hun_misdirection : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - if (!GetDuration()) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT) caster->SetReducedThreatPercent(0, 0); } -- cgit v1.2.3