[7661] Fixed problem with not remove health regeneration from polymorph.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also fixed problem with remembering transform spell in case possible stacked negative and positive transforms.
This commit is contained in:
False.Genesis 2009-04-13 05:54:34 +04:00 committed by VladimirMangos
parent cce772c08c
commit f89c2052ea
2 changed files with 21 additions and 18 deletions

View file

@ -2762,13 +2762,13 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
if (apply) if (apply)
{ {
// special case (spell specific functionality) // special case (spell specific functionality)
if(m_modifier.m_miscvalue==0) if (m_modifier.m_miscvalue==0)
{ {
// player applied only // player applied only
if(m_target->GetTypeId()!=TYPEID_PLAYER) if (m_target->GetTypeId()!=TYPEID_PLAYER)
return; return;
switch(GetId()) switch (GetId())
{ {
// Orb of Deception // Orb of Deception
case 16739: case 16739:
@ -2828,7 +2828,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
else else
{ {
CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue);
if(!ci) if (!ci)
{ {
//pig pink ^_^ //pig pink ^_^
m_target->SetDisplayId(16358); 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()) 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->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 // 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) // for players, start regeneration after 1s (in polymorph fast regeneration case)
// only if caster is Player (after patch 2.4.2) // 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); ((Player*)m_target)->setRegenTimer(1*IN_MILISECONDS);
//dismount polymorphed target (after patch 2.4.2) //dismount polymorphed target (after patch 2.4.2)
@ -2861,20 +2864,20 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
} }
else 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); Unit::AuraList const& otherTransforms = m_target->GetAurasByType(SPELL_AURA_TRANSFORM);
if(otherTransforms.empty()) if (!otherTransforms.empty())
{
m_target->SetDisplayId(m_target->GetNativeDisplayId());
m_target->setTransForm(0);
}
else
{ {
// look for other transform auras // look for other transform auras
Aura* handledAura = *otherTransforms.begin(); Aura* handledAura = *otherTransforms.begin();
for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i) for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i)
{ {
// negative auras are preferred // negative auras are preferred
if(!IsPositiveSpell((*i)->GetSpellProto()->Id)) if (!IsPositiveSpell((*i)->GetSpellProto()->Id))
{ {
handledAura = *i; handledAura = *i;
break; break;
@ -2884,12 +2887,12 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
} }
// Dragonmaw Illusion (restore mount model) // 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; 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; uint32 team = 0;
if (m_target->GetTypeId()==TYPEID_PLAYER) if (m_target->GetTypeId()==TYPEID_PLAYER)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7660" #define REVISION_NR "7661"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__