Scripts/Spell: Share some code for Incantner's Absorbtion script.
This commit is contained in:
@@ -259,39 +259,43 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Spells
|
||||||
|
{
|
||||||
|
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
||||||
|
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Validate(SpellEntry const * /*spellEntry*/)
|
||||||
|
{
|
||||||
|
return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
||||||
|
&& sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
||||||
|
{
|
||||||
|
Unit * target = GetTarget();
|
||||||
|
|
||||||
|
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
||||||
|
{
|
||||||
|
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||||
|
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Incanter's Absorption
|
// Incanter's Absorption
|
||||||
class spell_mage_incanters_absorbtion_absorb : public SpellScriptLoader
|
class spell_mage_incanters_absorbtion_absorb : public SpellScriptLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
spell_mage_incanters_absorbtion_absorb() : SpellScriptLoader("spell_mage_incanters_absorbtion_absorb") { }
|
spell_mage_incanters_absorbtion_absorb() : SpellScriptLoader("spell_mage_incanters_absorbtion_absorb") { }
|
||||||
|
|
||||||
class spell_mage_incanters_absorbtion_absorb_AuraScript : public AuraScript
|
class spell_mage_incanters_absorbtion_absorb_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_mage_incanters_absorbtion_absorb_AuraScript);
|
PrepareAuraScript(spell_mage_incanters_absorbtion_absorb_AuraScript);
|
||||||
|
|
||||||
enum Spells
|
|
||||||
{
|
|
||||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
|
||||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
|
||||||
{
|
|
||||||
return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
|
||||||
&& sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
|
||||||
{
|
|
||||||
Unit * target = GetTarget();
|
|
||||||
|
|
||||||
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
|
||||||
{
|
|
||||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
|
||||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register()
|
void Register()
|
||||||
{
|
{
|
||||||
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_incanters_absorbtion_absorb_AuraScript::Trigger, EFFECT_0);
|
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_incanters_absorbtion_absorb_AuraScript::Trigger, EFFECT_0);
|
||||||
@@ -310,33 +314,10 @@ class spell_mage_incanters_absorbtion_manashield : public SpellScriptLoader
|
|||||||
public:
|
public:
|
||||||
spell_mage_incanters_absorbtion_manashield() : SpellScriptLoader("spell_mage_incanters_absorbtion_manashield") { }
|
spell_mage_incanters_absorbtion_manashield() : SpellScriptLoader("spell_mage_incanters_absorbtion_manashield") { }
|
||||||
|
|
||||||
class spell_mage_incanters_absorbtion_manashield_AuraScript : public AuraScript
|
class spell_mage_incanters_absorbtion_manashield_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript
|
||||||
{
|
{
|
||||||
PrepareAuraScript(spell_mage_incanters_absorbtion_manashield_AuraScript);
|
PrepareAuraScript(spell_mage_incanters_absorbtion_manashield_AuraScript);
|
||||||
|
|
||||||
enum Spells
|
|
||||||
{
|
|
||||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
|
||||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
|
||||||
{
|
|
||||||
return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
|
||||||
&& sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
|
|
||||||
{
|
|
||||||
Unit * target = GetTarget();
|
|
||||||
|
|
||||||
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
|
||||||
{
|
|
||||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
|
||||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Register()
|
void Register()
|
||||||
{
|
{
|
||||||
AfterEffectManaShield += AuraEffectManaShieldFn(spell_mage_incanters_absorbtion_manashield_AuraScript::Trigger, EFFECT_0);
|
AfterEffectManaShield += AuraEffectManaShieldFn(spell_mage_incanters_absorbtion_manashield_AuraScript::Trigger, EFFECT_0);
|
||||||
|
|||||||
Reference in New Issue
Block a user