From 78287ab7f4b892ed98b549deb320b8cdef1c2504 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Mon, 13 Apr 2009 05:54:34 +0400 Subject: [PATCH] [7661] Fixed problem with not remove health regeneration from polymorph. Signed-off-by: VladimirMangos Also fixed problem with remembering transform spell in case possible stacked negative and positive transforms. --- src/game/SpellAuras.cpp | 37 ++++++++++++++++++++----------------- src/shared/revision_nr.h | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c60809ec..5cf94037 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2762,13 +2762,13 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (apply) { // special case (spell specific functionality) - if(m_modifier.m_miscvalue==0) + if (m_modifier.m_miscvalue==0) { // player applied only - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if (m_target->GetTypeId()!=TYPEID_PLAYER) return; - switch(GetId()) + switch (GetId()) { // Orb of Deception case 16739: @@ -2828,7 +2828,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) else { CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); - if(!ci) + if (!ci) { //pig pink ^_^ m_target->SetDisplayId(16358); @@ -2843,15 +2843,18 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if(GetId()==42016 && m_target->GetMountID() && !m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED).empty()) m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); } - m_target->setTransForm(GetId()); } + // update active transform spell only not set or not overwriting negative by positive case + if (!m_target->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(m_target->getTransForm())) + m_target->setTransForm(GetId()); + // polymorph case - if( Real && m_target->GetTypeId() == TYPEID_PLAYER && m_target->IsPolymorphed()) + if (Real && m_target->GetTypeId() == TYPEID_PLAYER && m_target->IsPolymorphed()) { // for players, start regeneration after 1s (in polymorph fast regeneration case) // only if caster is Player (after patch 2.4.2) - if(IS_PLAYER_GUID(GetCasterGUID()) ) + if (IS_PLAYER_GUID(GetCasterGUID()) ) ((Player*)m_target)->setRegenTimer(1*IN_MILISECONDS); //dismount polymorphed target (after patch 2.4.2) @@ -2861,20 +2864,20 @@ void Aura::HandleAuraTransform(bool apply, bool Real) } else { + // ApplyModifier(true) will reapply it if need + m_target->setTransForm(0); + m_target->SetDisplayId(m_target->GetNativeDisplayId()); + + // re-aplly some from still active with preference negative cases Unit::AuraList const& otherTransforms = m_target->GetAurasByType(SPELL_AURA_TRANSFORM); - if(otherTransforms.empty()) - { - m_target->SetDisplayId(m_target->GetNativeDisplayId()); - m_target->setTransForm(0); - } - else + if (!otherTransforms.empty()) { // look for other transform auras Aura* handledAura = *otherTransforms.begin(); for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i) { // negative auras are preferred - if(!IsPositiveSpell((*i)->GetSpellProto()->Id)) + if (!IsPositiveSpell((*i)->GetSpellProto()->Id)) { handledAura = *i; break; @@ -2884,12 +2887,12 @@ void Aura::HandleAuraTransform(bool apply, bool Real) } // Dragonmaw Illusion (restore mount model) - if(GetId()==42016 && m_target->GetMountID()==16314) + if (GetId()==42016 && m_target->GetMountID()==16314) { - if(!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) + if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) { uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue; - if(CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id)) + if (CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id)) { uint32 team = 0; if (m_target->GetTypeId()==TYPEID_PLAYER) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c00ed7fd..a23865a8 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 "7660" + #define REVISION_NR "7661" #endif // __REVISION_NR_H__ -- 2.11.4.GIT