From 44de012148eda14fd3286b04a933ad9f9e286105 Mon Sep 17 00:00:00 2001 From: QAston Date: Sun, 1 Mar 2009 16:29:40 +0100 Subject: [PATCH] *Fix drain mana, judgement of widsom and viper sting damage amount. Patch by Maxxie. *Add one more rank of Devour Magic. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 11 +++++++++++ src/game/SpellEffects.cpp | 6 +++--- src/game/Unit.cpp | 5 ++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index fc9b4d3214..e0e9befbb7 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5682,6 +5682,17 @@ void Aura::PeriodicTick() int32 drain_amount = m_target->GetPower(power) > pdamage ? pdamage : m_target->GetPower(power); + //Viper sting and Drain Life take mana % amount from target, but not bigger than amount*2 of caster mana + if ((m_spellProto->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags[0]&0x10) + || (m_spellProto->SpellFamilyName==SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags[1]&0x80)) + { + uint32 drain = m_target->GetMaxPower(power) * drain_amount /100; + if(drain > pCaster->GetMaxPower(power) * drain_amount / 50) + drain_amount = pCaster->GetMaxPower(power) * drain_amount / 50; + else + drain_amount = drain; + } + // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) if (power == POWER_MANA && m_target->GetTypeId() == TYPEID_PLAYER) drain_amount -= ((Player*)m_target)->GetSpellCritDamageReduction(drain_amount); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 948b3cb775..fa33d76571 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2440,16 +2440,15 @@ void Spell::EffectPowerBurn(uint32 i) int32 curPower = int32(unitTarget->GetPower(powertype)); - uint32 power = damage; - // Priest's Mana Burn, burn max amount of 26% of caster's mana + //Mana burn take mana % amount from target, but not bigger than amount*2 of caster mana if ( m_spellInfo->SpellFamilyName==SPELLFAMILY_PRIEST && m_spellInfo->SpellFamilyFlags[0] & 0x10) { // Burn percentage of target's mana power = damage * curPower / 100; if (caster) { - casterPower = caster->GetPower(powertype)*0.26f + uint32 casterPower = damage * caster->GetPower(powertype) / 50; if (casterPowerId); break; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 625cc148ba..bbb7ffb9fb 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -5765,7 +5765,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 20186: { if (pVictim->getPowerType() == POWER_MANA) - pVictim->CastSpell(pVictim, 20268, true, 0, triggeredByAura); + { + int32 gainMana = pVictim->GetCreateMana() * triggeredByAura->GetBasePoints() / 100; + pVictim->CastCustomSpell(pVictim, 20268, &gainMana, 0, 0, true, 0, triggeredByAura); + } return true; } // Holy Power (Redemption Armor set)