aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2012-09-09 03:59:34 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2012-09-09 04:02:47 +0200
commit2317af8dd3faac12b583978e14e47fd90ade4520 (patch)
tree2a9b8111470b78331bb0e4dc1bc24ec913a9e3bb /src
parentd04f155b6529e3d86fca931075775fd34b544e29 (diff)
Core/Spells: Convert Gift of the Naaru in spell script
Closes #6545
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp10
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp53
2 files changed, 53 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 737d75cdf1c..52e282157b8 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -11263,16 +11263,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- // Gift of the Naaru
- if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
- {
- int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
- if (apBonus > DoneAdvertisedBenefit)
- DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
- else
- DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
- }
-
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (spellProto->Effects[i].ApplyAuraName)
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index ed4148cd033..0a947afaa25 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3250,6 +3250,58 @@ class spell_gen_bonked : public SpellScriptLoader
}
};
+class spell_gen_gift_of_naaru : public SpellScriptLoader
+{
+ public:
+ spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { }
+
+ class spell_gen_gift_of_naaru_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript);
+
+ void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster())
+ return;
+
+ float heal = 0.0f;
+ switch (GetSpellInfo()->SpellFamilyName)
+ {
+ case SPELLFAMILY_MAGE:
+ case SPELLFAMILY_WARLOCK:
+ case SPELLFAMILY_PRIEST:
+ heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()));
+ break;
+ case SPELLFAMILY_PALADIN:
+ case SPELLFAMILY_SHAMAN:
+ heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
+ break;
+ case SPELLFAMILY_WARRIOR:
+ case SPELLFAMILY_HUNTER:
+ case SPELLFAMILY_DEATHKNIGHT:
+ heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK)));
+ break;
+ case SPELLFAMILY_GENERIC:
+ default:
+ break;
+ }
+
+ int32 healTick = floor(heal / aurEff->GetTotalTicks());
+ amount += int32(std::max(heal, 0.0f));
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_gift_of_naaru_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3325,4 +3377,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
new spell_gen_upper_deck_create_foam_sword();
new spell_gen_bonked();
+ new spell_gen_gift_of_naaru();
}