From e727512e71b421b7a73e26122d2c213b77ea2c86 Mon Sep 17 00:00:00 2001 From: laise Date: Sun, 31 Jan 2010 20:09:51 +0300 Subject: [PATCH] [9276] Prevent gain/lost health/powers form death persistent periodic affects. This must solve bugs with inconsistent death states also. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 38 +++++++++++++++++++++++++++++++++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 2f7d05fcc..616df5822 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -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; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 762a02a4e..c34008666 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9275" + #define REVISION_NR "9276" #endif // __REVISION_NR_H__ -- 2.11.4.GIT