mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[7451] Implement correct work SPELL_AURA_PERIODIC_MANA_LEECH for percent mana cost spells.
This is fix work of spell 3034 and 5138.
This commit is contained in:
parent
3a5d59c0c7
commit
037840d5ba
2 changed files with 21 additions and 10 deletions
|
|
@ -5919,6 +5919,15 @@ void Aura::PeriodicTick()
|
||||||
}
|
}
|
||||||
case SPELL_AURA_PERIODIC_MANA_LEECH:
|
case SPELL_AURA_PERIODIC_MANA_LEECH:
|
||||||
{
|
{
|
||||||
|
if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Powers power = Powers(m_modifier.m_miscvalue);
|
||||||
|
|
||||||
|
// power type might have changed between aura applying and tick (druid's shapeshift)
|
||||||
|
if(m_target->getPowerType() != power)
|
||||||
|
return;
|
||||||
|
|
||||||
Unit *pCaster = GetCaster();
|
Unit *pCaster = GetCaster();
|
||||||
if(!pCaster)
|
if(!pCaster)
|
||||||
return;
|
return;
|
||||||
|
|
@ -5937,18 +5946,20 @@ void Aura::PeriodicTick()
|
||||||
// ignore non positive values (can be result apply spellmods to aura damage
|
// ignore non positive values (can be result apply spellmods to aura damage
|
||||||
uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
|
uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
|
||||||
|
|
||||||
|
// Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
|
||||||
|
// It's mana percent cost spells, m_modifier.m_amount is percent drain from target
|
||||||
|
if (m_spellProto->ManaCostPercentage)
|
||||||
|
{
|
||||||
|
// max value
|
||||||
|
uint32 maxmana = pCaster->GetMaxPower(power) * pdamage * 2 / 100;
|
||||||
|
pdamage = m_target->GetMaxPower(power) * pdamage / 100;
|
||||||
|
if(pdamage > maxmana)
|
||||||
|
pdamage = maxmana;
|
||||||
|
}
|
||||||
|
|
||||||
sLog.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
|
sLog.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
|
||||||
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
|
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
|
||||||
|
|
||||||
if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Powers power = Powers(m_modifier.m_miscvalue);
|
|
||||||
|
|
||||||
// power type might have changed between aura applying and tick (druid's shapeshift)
|
|
||||||
if(m_target->getPowerType() != power)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int32 drain_amount = m_target->GetPower(power) > pdamage ? pdamage : m_target->GetPower(power);
|
int32 drain_amount = m_target->GetPower(power) > pdamage ? pdamage : m_target->GetPower(power);
|
||||||
|
|
||||||
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7450"
|
#define REVISION_NR "7451"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue