aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Unit.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5ac280f2add..2efe4397206 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1984,6 +1984,44 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
}
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:
{
// Astral Shift