Skip to content

Commit

Permalink
[9276] Prevent gain/lost health/powers form death persistent periodic…
Browse files Browse the repository at this point in the history
… affects.

This must solve bugs with inconsistent death states also.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
laise authored and VladimirMangos committed Jan 31, 2010
1 parent 2db34b6 commit e727512
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
38 changes: 37 additions & 1 deletion src/game/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -7069,13 +7097,21 @@ 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());
break;
}
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;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9275"
#define REVISION_NR "9276"
#endif // __REVISION_NR_H__

0 comments on commit e727512

Please sign in to comment.