mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 12:42:43 -04:00
Core/Unit: Big cleanup in Unit::CalcAbsorbResist
Core/AuraScript: Fix compile time check for AuraScript functions Remove AuraApplication from hook functions parameter list, use GetTarget() and GetTargetApplication() instead Add OnEffectAbsorb hook Scripts: move handlers of Spell Deflection, Savage Defense, Primal Tenacity, Nerves of Steel, Astral shift from core to scripts. --HG-- branch : trunk
This commit is contained in:
@@ -157,9 +157,49 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 49145 - Spell Deflection
|
||||
class spell_dk_spell_deflection : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_spell_deflection() : SpellScriptLoader("spell_dk_spell_deflection") { }
|
||||
|
||||
class spell_dk_spell_deflection_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dk_spell_deflection_AuraScript);
|
||||
|
||||
uint32 absorbPct;
|
||||
void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated)
|
||||
{
|
||||
absorbPct = amount;
|
||||
// Set absorbtion amount to unlimited
|
||||
amount = -1;
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
// You have a chance equal to your Parry chance
|
||||
if ((dmgInfo.GetDamageType() == DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance()))
|
||||
absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript *GetAuraScript() const
|
||||
{
|
||||
return new spell_dk_spell_deflection_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void AddSC_deathknight_spell_scripts()
|
||||
{
|
||||
new spell_dk_corpse_explosion();
|
||||
new spell_dk_runic_power_feed();
|
||||
new spell_dk_scourge_strike();
|
||||
new spell_dk_spell_deflection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user