diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Unit.cpp | 72 |
1 files changed, 57 insertions, 15 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 98d6c35c514..0062283b0df 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1850,6 +1850,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe uint32 healSpell = 0; int32 healAmount = 0; Unit * healCaster = NULL; + // Death Prevention Aura + SpellEntry const* preventDeathSpell = NULL; + int32 preventDeathAmount = 0; // Need remove expired auras after bool existExpired = false; // absorb without mana cost @@ -1935,20 +1938,15 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe } case SPELLFAMILY_ROGUE: { - // Cheat Death - if(spellProto->SpellIconID == 2109) + // Cheat Death (make less prio with Guardian Spirit case) + if (!preventDeathSpell && spellProto->SpellIconID == 2109 && + pVictim->GetTypeId()==TYPEID_PLAYER && // Only players + !((Player*)pVictim)->HasSpellCooldown(31231) && + // Only if no cooldown + roll_chance_i((*i)->GetAmount())) + // Only if roll { - if (pVictim->GetTypeId()==TYPEID_PLAYER && // Only players - pVictim->GetHealth() <= RemainingDamage && // Only if damage kill - !((Player*)pVictim)->HasSpellCooldown(31231) && // Only if no cooldown - roll_chance_i(currentAbsorb)) // Only if roll - { - pVictim->CastSpell(pVictim,31231,true); - ((Player*)pVictim)->AddSpellCooldown(31231,0,time(NULL)+60); - // with health > 10% lost health until health==10%, in other case no losses - uint32 health10 = pVictim->GetMaxHealth()/10; - RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0; - } + preventDeathSpell = (*i)->GetSpellProto(); continue; } break; @@ -1956,7 +1954,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe case SPELLFAMILY_PRIEST: { // Guardian Spirit - if (spellProto->Id==47788) + // Two implementation please check it + /*if (spellProto->Id==47788) { if (pVictim->GetHealth() <= RemainingDamage) // Killing Blow { @@ -1966,7 +1965,14 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe (*i)->SetAmount(0); RemainingDamage=0; } - continue; + continue; + }*/ + + if (spellProto->SpellIconID == 2873) + { + preventDeathSpell = (*i)->GetSpellProto(); + preventDeathAmount = (*i)->GetAmount(); + continue; } // Reflective Shield @@ -2119,6 +2125,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe } } } + // Cast back reflect damage spell if (reflectSpell) pVictim->CastCustomSpell(this, reflectSpell, &reflectDamage, NULL, NULL, true); @@ -2230,6 +2237,41 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe // Ignore absorb - add reduced amount again to damage RemainingDamage += auraAbsorbMod * TotalAbsorb / 100; + // Apply death prevention spells effects + if (preventDeathSpell && RemainingDamage >= pVictim->GetHealth()) + { + switch(preventDeathSpell->SpellFamilyName) + { + // Cheat Death + case SPELLFAMILY_ROGUE: + { + // Cheat Death + if (preventDeathSpell->SpellIconID == 2109) + { + pVictim->CastSpell(pVictim,31231,true); + ((Player*)pVictim)->AddSpellCooldown(31231,0,time(NULL)+60); + // with health > 10% lost health until health==10%, in other case no losses + uint32 health10 = pVictim->GetMaxHealth()/10; + RemainingDamage = pVictim->GetHealth() > health10 ? pVictim->GetHealth() - health10 : 0; + } + break; + } + // Guardian Spirit + case SPELLFAMILY_PRIEST: + { + // Guardian Spirit + if (preventDeathSpell->SpellIconID == 2873) + { + int32 healAmount = pVictim->GetMaxHealth() * preventDeathAmount / 100; + pVictim->CastCustomSpell(pVictim, 48153, &healAmount, NULL, NULL, true); + pVictim->RemoveAurasDueToSpell(preventDeathSpell->Id); + RemainingDamage = 0; + } + break; + } + } + } + *absorb = damage - RemainingDamage - *resist; if (*absorb) |