Example #1
1
        void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
        {
            Unit* victim = GetTarget();
            int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
            uint32 allowedHealth = victim->CountPctFromMaxHealth(35);
            // If damage kills us
            if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
            {
                // Cast healing spell, completely avoid damage
                absorbAmount = dmgInfo.GetDamage();

                uint32 defenseSkillValue = victim->GetDefenseSkillValue();
                // Max heal when defense skill denies critical hits from raid bosses
                // Formula: max defense at level + 140 (raiting from gear)
                uint32 reqDefForMaxHeal  = victim->getLevel() * 5 + 140;
                float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal)
                                       ? 1.0f
                                       : float(defenseSkillValue) / float(reqDefForMaxHeal);

                int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
                victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
                victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
            }
            else if (remainingHealth < int32(allowedHealth))
            {
                // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
                uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
                                        ? dmgInfo.GetDamage()
                                        : allowedHealth - remainingHealth;
                absorbAmount = CalculatePctN(damageToReduce, absorbPct);
            }
        }
Example #2
1
 void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
     {
         int32 basePoints1 = aurEff->GetAmount();
         target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff);
     }
 }
Example #3
1
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     int32 damage = GetEffectValue();
     Unit* caster = GetCaster();
     if (Unit* target = GetHitUnit())
     {
         if (caster->IsFriendlyTo(target))
         {
             int32 bp = int32(damage * 1.5f);
             caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
         }
         else
         {
             if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_SIGIL_VENGEFUL_HEART, EFFECT_1))
                 damage += auraEffect->GetBaseAmount();
             caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
         }
     }
 }
Example #4
1
 void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
 {
     Unit* target = GetTarget();
     if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
     {
         // Not listed as any effect, only base points set in dbc
         int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
         target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff);
     }
 }
Example #5
1
 void HandleDummy(SpellEffIndex /* effIndex */)
 {
     Unit* caster = GetCaster();
     if (Unit* target = GetHitUnit())
     {
         uint32 count = target->GetDiseasesByCaster(caster->GetGUID());
         int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
         // Improved Death Strike
         if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
             AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
         caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
     }
 }
 void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
 {
     Unit * target = GetTarget();
     // damage absorbed by Anti-Magic Shell energizes the DK with additional runic power.
     // This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power.
     int32 bp = absorbAmount * 2 / 10;
     target->CastCustomSpell(target, DK_SPELL_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff);
 }
Example #7
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Unit* caster = GetCaster();
     if (Unit* unitTarget = GetHitUnit())
     {
         int32 bp = CalculatePctN(GetHitDamage(), GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()));
         caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
     }
 }