Convert for mangos, ty n0n4m3 for patch. http://bitbucket.org/n0n4m3/
KAPATEJIb i miss that, sry. Test new patch please, work perfect i think. I just correct visual part for this spell. Time to add this spell for mangos source
diff --git a/.gitignore b/.gitignore
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 4d1feeb..59c8965 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1857,20 +1857,43 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
break;
}
case SPELLFAMILY_PALADIN:
- {
- // Ardent Defender
- if (spellProto->SpellIconID == 2135)
- {
- // uses 66233 as a cooldown for healing effect
- if (!((Player*)pVictim)->HasAura(66233))
- preventDeathSpell = (*i)->GetSpellProto();
-
- if(pVictim->GetHealth() - RemainingDamage <= pVictim->GetMaxHealth() * 0.7f)
- RemainingDamage -= RemainingDamage * currentAbsorb / 100;
-
- continue;
- }
- }
+ {
+ // 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_PRIEST:
{
// Guardian Spirit
@@ -2180,31 +2203,6 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
}
break;
}
- // Ardent Defender
- case SPELLFAMILY_PALADIN:
- {
- // Ardent Defender
- if (preventDeathSpell->SpellIconID == 2135)
- {
- int32 healAmount = preventDeathSpell->EffectBasePoints[1]; // get from dummy aura instead?
- int32 defRate = pVictim->GetDefenseSkillValue();
- defRate -= (pVictim->getLevel() * 5);
-
- // if no defence rating bonus don't absorb
- if (!defRate || defRate < 0)
- break;
-
- int32 heal = int32(defRate * pVictim->GetMaxHealth() * healAmount / 14000) - pVictim->GetHealth();
- if(heal > 0)
- {
- //cast heal
- pVictim->CastCustomSpell(pVictim, 66235, &heal, NULL, NULL, true);
- pVictim->CastSpell(pVictim, 66233, true);
- }
- RemainingDamage = 0;
- }
- break;
- }
// Guardian Spirit
case SPELLFAMILY_PRIEST:
{