Core/Unit: Move spell specific code from Unit::CalcAbsorbResist to AuraScripts.
This commit is contained in:
1 parent
51b46987c3
commit
c8adcc95f9
18 files changed
+756
-291
No files matched your search
@@ -31,6 +31,66 @@ enum PriestSpells
|
||||
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
|
||||
};
|
||||
|
||||
// Guardian Spirit
|
||||
class spell_pri_guardian_spirit : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pri_guardian_spirit() : SpellScriptLoader("spell_pri_guardian_spirit") { }
|
||||
|
||||
class spell_pri_guardian_spirit_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pri_guardian_spirit_AuraScript);
|
||||
|
||||
uint32 healPct;
|
||||
|
||||
enum Spell
|
||||
{
|
||||
PRI_SPELL_GUARDIAN_SPIRIT_HEAL = 48153,
|
||||
};
|
||||
|
||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
||||
{
|
||||
return sSpellStore.LookupEntry(PRI_SPELL_GUARDIAN_SPIRIT_HEAL);
|
||||
}
|
||||
|
||||
bool Load()
|
||||
{
|
||||
healPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated)
|
||||
{
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit * target = GetTarget();
|
||||
if (dmgInfo.GetDamage() < target->GetHealth())
|
||||
return;
|
||||
|
||||
int32 healAmount = int32(target->CountPctFromMaxHealth(healPct));
|
||||
// remove the aura now, we don't want 40% healing bonus
|
||||
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
target->CastCustomSpell(target, PRI_SPELL_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true);
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_guardian_spirit_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_pri_guardian_spirit_AuraScript::Absorb, EFFECT_1);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript *GetAuraScript() const
|
||||
{
|
||||
return new spell_pri_guardian_spirit_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_pri_mana_burn : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -148,9 +208,59 @@ class spell_pri_penance : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// Reflective Shield
|
||||
class spell_pri_reflective_shield_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pri_reflective_shield_trigger() : SpellScriptLoader("spell_pri_reflective_shield_trigger") { }
|
||||
|
||||
class spell_pri_reflective_shield_trigger_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pri_reflective_shield_trigger_AuraScript);
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_PRI_REFLECTIVE_SHIELD_TRIGGERED = 33619,
|
||||
SPELL_PRI_REFLECTIVE_SHIELD_R1 = 33201,
|
||||
};
|
||||
|
||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
||||
{
|
||||
return sSpellStore.LookupEntry(SPELL_PRI_REFLECTIVE_SHIELD_TRIGGERED) && sSpellStore.LookupEntry(SPELL_PRI_REFLECTIVE_SHIELD_R1);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit * target = GetTarget();
|
||||
if (dmgInfo.GetAttacker() == target)
|
||||
return;
|
||||
Unit * caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PRI_REFLECTIVE_SHIELD_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRI_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_pri_reflective_shield_trigger_AuraScript::Trigger, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript *GetAuraScript() const
|
||||
{
|
||||
return new spell_pri_reflective_shield_trigger_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_priest_spell_scripts()
|
||||
{
|
||||
new spell_pri_guardian_spirit();
|
||||
new spell_pri_mana_burn;
|
||||
new spell_pri_pain_and_suffering_proc;
|
||||
new spell_pri_penance;
|
||||
new spell_pri_reflective_shield_trigger();
|
||||
}
|
||||
Reference in new issue
Block a user