Fixed spell Ardent Defender
--HG-- branch : trunk
This commit is contained in:
@@ -1984,6 +1984,44 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SPELLFAMILY_PALADIN:
|
||||||
|
{
|
||||||
|
// Ardent Defender
|
||||||
|
if (spellProto->SpellIconID == 2135 && pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
|
int32 remainingHealth = pVictim->GetHealth() - RemainingDamage;
|
||||||
|
uint32 allowedHealth = pVictim->GetMaxHealth() * 0.35f;
|
||||||
|
// If damage kills us
|
||||||
|
if (remainingHealth <= 0 && !((Player*)pVictim)->HasSpellCooldown(66235))
|
||||||
|
{
|
||||||
|
// Cast healing spell, completely avoid damage
|
||||||
|
RemainingDamage = 0;
|
||||||
|
|
||||||
|
uint32 defenseSkillValue = pVictim->GetDefenseSkillValue();
|
||||||
|
// Max heal when defense skill denies critical hits from raid bosses
|
||||||
|
// Formula: max defense at level + 140 (raiting from gear)
|
||||||
|
uint32 reqDefForMaxHeal = pVictim->getLevel() * 5 + 140;
|
||||||
|
float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
|
||||||
|
? 1.0f
|
||||||
|
: float(defenseSkillValue) / float(reqDefForMaxHeal);
|
||||||
|
|
||||||
|
int32 healAmount = pVictim->GetMaxHealth() * ((*i)->GetSpellProto()->EffectBasePoints[1] + 1) / 100.0f * pctFromDefense;
|
||||||
|
pVictim->CastCustomSpell(pVictim, 66235, &healAmount, NULL, NULL, true);
|
||||||
|
((Player*)pVictim)->AddSpellCooldown(66235,0,time(NULL) + 120);
|
||||||
|
}
|
||||||
|
else if (remainingHealth < allowedHealth)
|
||||||
|
{
|
||||||
|
// Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
|
||||||
|
uint32 damageToReduce = (pVictim->GetHealth() < allowedHealth)
|
||||||
|
? RemainingDamage
|
||||||
|
: allowedHealth - remainingHealth;
|
||||||
|
RemainingDamage -= damageToReduce * currentAbsorb / 100;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SPELLFAMILY_SHAMAN:
|
case SPELLFAMILY_SHAMAN:
|
||||||
{
|
{
|
||||||
// Astral Shift
|
// Astral Shift
|
||||||
|
|||||||
Reference in New Issue
Block a user