[9276] Prevent gain/lost health/powers form death persistent periodic affects.

This must solve bugs with inconsistent death states also.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
laise 2010-01-31 20:09:51 +03:00 committed by VladimirMangos
parent cc7a53ae16
commit dfd5299d7e
2 changed files with 38 additions and 2 deletions

View file

@ -6604,6 +6604,10 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
{
// don't damage target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
Unit *pCaster = GetCaster();
if(!pCaster)
return;
@ -6735,6 +6739,10 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_PERIODIC_HEALTH_FUNNEL:
{
// don't damage target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
Unit *pCaster = GetCaster();
if(!pCaster)
return;
@ -6815,10 +6823,14 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
{
// don't heal target if not alive, mostly death persistent effects from items
if (!m_target->isAlive())
return;
Unit *pCaster = GetCaster();
if(!pCaster)
return;
// heal for caster damage (must be alive)
if(m_target != pCaster && GetSpellProto()->SpellVisual[0] == 163 && !pCaster->isAlive())
return;
@ -6903,6 +6915,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
{
// don't damage target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
return;
@ -6976,6 +6992,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_PERIODIC_ENERGIZE:
{
// don't energize target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
// ignore non positive values (can be result apply spellmods to aura damage
uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
@ -7001,6 +7021,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_OBS_MOD_MANA:
{
// don't energize target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
// ignore non positive values (can be result apply spellmods to aura damage
uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
@ -7023,6 +7047,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_POWER_BURN_MANA:
{
// don't mana burn target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
Unit *pCaster = GetCaster();
if(!pCaster)
return;
@ -7069,6 +7097,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_MOD_REGEN:
{
// don't heal target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
int32 gain = m_target->ModifyHealth(m_modifier.m_amount);
if (Unit *caster = GetCaster())
m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
@ -7076,6 +7108,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_MOD_POWER_REGEN:
{
// don't energize target if not alive, possible death persistent effects
if (!m_target->isAlive())
return;
Powers pt = m_target->getPowerType();
if(int32(pt) != m_modifier.m_miscvalue)
return;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9275"
#define REVISION_NR "9276"
#endif // __REVISION_NR_H__