[10345] Fix passive spells that are active without shapeshift and certain shapeshift forms only.

Currently, 63411 is the only affected spell, but implementation is hopefully generic enough to cover future cases.
This commit is contained in:
Lynx3d 2010-08-11 19:34:02 +02:00
parent 29383e6b7b
commit 29281d476a
3 changed files with 44 additions and 14 deletions

View file

@ -769,7 +769,7 @@ void AreaAura::Update(uint32 diff)
actualBasePoints = actualSpellInfo->CalculateSimpleValue(m_effIndex);
SpellAuraHolder *holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGUID());
bool addedToExisting = true;
if (!holder)
{
@ -3989,7 +3989,7 @@ void Aura::HandleInvisibility(bool apply, bool Real)
void Aura::HandleInvisibilityDetect(bool apply, bool Real)
{
Unit *target = GetTarget();
if(apply)
{
target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue);
@ -4182,7 +4182,7 @@ void Aura::HandleModTaunt(bool apply, bool Real)
// only at real add/remove aura
if (!Real)
return;
Unit *target = GetTarget();
if (!target->isAlive() || !target->CanHaveThreatList())
@ -5917,11 +5917,27 @@ void Aura::HandleShapeshiftBoosts(bool apply)
if (itr->second.state == PLAYERSPELL_REMOVED) continue;
if (itr->first==spellId1 || itr->first==spellId2) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7))))
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7)))
continue;
if (spellInfo->Stances & (1<<(form-1)))
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
if (spellInfo->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT))
target->CastSpell(target, itr->first, true, NULL, this);
}
// remove auras that do not require shapeshift, but are not active in this specific form (like Improved Barkskin)
Unit::SpellAuraHolderMap& tAuras = target->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
SpellEntry const *spellInfo = itr->second->GetSpellProto();
if (itr->second->IsPassive() && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)
&& (spellInfo->StancesNot & (1<<(form-1))))
{
target->RemoveAurasDueToSpell(itr->second->GetId());
itr = tAuras.begin();
}
else
++itr;
}
// Master Shapeshifter
if (MasterShaperSpellId)
@ -6005,6 +6021,19 @@ void Aura::HandleShapeshiftBoosts(bool apply)
if(MasterShaperSpellId)
target->RemoveAurasDueToSpell(MasterShaperSpellId);
// re-apply passive spells that don't need shapeshift but were inactive in current form:
const PlayerSpellMap& sp_list = ((Player *)target)->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if (itr->second.state == PLAYERSPELL_REMOVED) continue;
if (itr->first==spellId1 || itr->first==spellId2) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !IsPassiveSpell(spellInfo))
continue;
if ((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->StancesNot & (1<<(form-1)))
target->CastSpell(target, itr->first, true, NULL, this);
}
Unit::SpellAuraHolderMap& tAuras = target->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
@ -7542,7 +7571,7 @@ void Aura::HandlePhase(bool apply, bool Real)
return;
Unit *target = GetTarget();
// always non stackable
if(apply)
{
@ -7699,12 +7728,12 @@ bool Aura::IsLastAuraOnHolder()
SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) : m_caster_guid(0), m_target(target),
m_castItemGuid(castItem?castItem->GetGUID():0), m_permanent(false),
m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_auraSlot(MAX_AURAS),
m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_auraSlot(MAX_AURAS),
m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1)
{
ASSERT(target);
ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
if(!caster)
m_caster_guid = target->GetGUID();
else
@ -7811,7 +7840,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
}
flags |= ((GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_NOT_CASTER : AFLAG_NONE) | ((GetSpellMaxDuration(m_spellProto) > 0) ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE);
SetAuraFlags(flags);
SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
if (IsNeedVisibleSlot(caster))
@ -7867,7 +7896,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
// Enrage aura state
if(m_spellProto->Dispel == DISPEL_ENRAGE)
m_target->ModifyAuraState(AURA_STATE_ENRAGE, true);
}
}
@ -8759,7 +8788,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
if (spellId4)
m_target->RemoveAurasByCasterSpell(spellId4, GetCasterGUID());
}
SetInUse(false);
}
@ -8877,4 +8906,4 @@ void SpellAuraHolder::UnregisterSingleCastHolder()
}
m_isSingleTarget = false;
}
}
}