Core/Spells: Convert Gift of the Naaru in spell script

Closes #6545
This commit is contained in:
Vincent-Michael committed 2012-09-09 04:02:47 +02:00
1 parent d04f155b65
commit 2317af8dd3
4 files changed
+72 -10

No files matched your search

@@ -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();
}