Fix Argent Defender
This commit is contained in:
@@ -293,21 +293,36 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader
|
||||
// 31850 - Ardent Defender
|
||||
class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
public:
|
||||
spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { }
|
||||
|
||||
class spell_pal_ardent_defender_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pal_ardent_defender_AuraScript);
|
||||
|
||||
public:
|
||||
spell_pal_ardent_defender_AuraScript()
|
||||
{
|
||||
absorbPct = 0;
|
||||
healPct = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 absorbPct, healPct;
|
||||
|
||||
enum Spell
|
||||
{
|
||||
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235,
|
||||
PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235
|
||||
};
|
||||
|
||||
bool Load()
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(PAL_SPELL_ARDENT_DEFENDER_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
|
||||
@@ -331,21 +346,16 @@ class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
// Cast healing spell, completely avoid damage
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
|
||||
// xinef: fix logics
|
||||
uint32 defenseSkillValue = victim->GetDefenseSkillValue();
|
||||
// Max heal when defense skill denies critical hits from raid bosses
|
||||
// Formula: max defense at level + 140 (raiting from gear)
|
||||
uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
|
||||
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal);
|
||||
if (pctFromDefense < 0.0f)
|
||||
pctFromDefense = 0.0f;
|
||||
else if (pctFromDefense > 1.0f)
|
||||
pctFromDefense = 1.0f;
|
||||
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
|
||||
? 1.0f
|
||||
: float(defenseSkillValue) / float(reqDefForMaxHeal);
|
||||
|
||||
int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
|
||||
if (healAmount)
|
||||
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
|
||||
|
||||
victim->CastCustomSpell(PAL_SPELL_ARDENT_DEFENDER_HEAL, SPELLVALUE_BASE_POINT0, healAmount, victim, true, nullptr, aurEff);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000);
|
||||
}
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
@@ -358,14 +368,14 @@ class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_pal_ardent_defender_AuraScript();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user