aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp82
1 files changed, 59 insertions, 23 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index bc36ca8aaf4..e72a0024f24 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
@@ -5812,7 +5850,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Divine Aegis
if (dummySpell->SpellIconID == 2820)
{
- basepoints0 = damage * triggerAmount/100;
+ // Multiple effects stack, so let's try to find this aura.
+ int32 bonus = 0;
+ if (AuraEffect *aurEff = target->GetAuraEffect(47753, 0))
+ bonus = aurEff->GetAmount();
+
+ basepoints0 = damage * triggerAmount/100 + bonus;
+ if (basepoints0 > target->getLevel() * 125)
+ basepoints0 = target->getLevel() * 125;
+
triggered_spell_id = 47753;
break;
}
@@ -6136,30 +6182,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Eclipse
if (dummySpell->SpellIconID == 2856 && GetTypeId() == TYPEID_PLAYER)
{
- if (!procSpell)
+ if (!procSpell || effIndex != 0)
return false;
- // Only 0 aura can proc
- if (effIndex!=0)
+
+ bool isWrathSpell = (procSpell->SpellFamilyFlags[1] & 0x00000001);
+
+ if (!roll_chance_f(dummySpell->procChance * (isWrathSpell ? 0.6f : 1.0f)))
return false;
- // Wrath crit
- if (procSpell->SpellFamilyFlags[0] & 0x1)
- {
- if (!roll_chance_i(60))
- return false;
- ((Player*)this)->AddSpellCooldown(48517,0,time(NULL) + cooldown);
- triggered_spell_id = 48518;
- target = this;
- break;
- }
- // Starfire crit
- if (procSpell->SpellFamilyFlags[0] & 0x4)
- {
- ((Player*)this)->AddSpellCooldown(48518,0,time(NULL) + cooldown);
- triggered_spell_id = 48517;
- target = this;
- break;
- }
- return false;
+
+ target = this;
+ if (target->HasAura(isWrathSpell ? 48517 : 48518))
+ return false;
+
+ triggered_spell_id = isWrathSpell ? 48518 : 48517;
+ break;
}
// Living Seed
else if (dummySpell->SpellIconID == 2860)