aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2012_09_18_02_world_spell_script_names.sql3
-rw-r--r--sql/updates/world/2012_09_24_00_world_spell_script_names.sql3
-rw-r--r--sql/updates/world/2012_09_24_01_world_spell_script_names.sql3
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp58
4 files changed, 62 insertions, 5 deletions
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();
}