mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[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:
parent
29383e6b7b
commit
29281d476a
3 changed files with 44 additions and 14 deletions
|
|
@ -3352,7 +3352,8 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
|
|||
{
|
||||
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
|
||||
// talent dependent passives activated at form apply have proper stance data
|
||||
bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
|
||||
bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))) ||
|
||||
(m_form == 0 && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)));
|
||||
|
||||
//Check CasterAuraStates
|
||||
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
|
||||
|
|
|
|||
|
|
@ -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();)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10344"
|
||||
#define REVISION_NR "10345"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue