diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f1abb1bd2..db450604c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3061,7 +3061,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if(active) { - if (IsPassiveSpell(spellInfo) && IsNeedCastPassiveSpellAtLearn(spellInfo)) + if (IsNeedCastPassiveLikeSpellAtLearn(spellInfo)) CastSpell (this, spell_id, true); } else if(IsInWorld()) @@ -3251,11 +3251,10 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // ignore stance requirement for talent learn spell (stance set for spell only for client spell description show) CastSpell(this, spell_id, true); } - // also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks - else if (IsPassiveSpell(spellInfo)) + // also cast passive (and passive like) spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks + else if (IsNeedCastPassiveLikeSpellAtLearn(spellInfo)) { - if (IsNeedCastPassiveSpellAtLearn(spellInfo)) - CastSpell(this, spell_id, true); + CastSpell(this, spell_id, true); } else if (IsSpellHaveEffect(spellInfo,SPELL_EFFECT_SKILL_STEP)) { @@ -3349,13 +3348,19 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen return active && !disabled && !superceded_old; } -bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const +bool Player::IsNeedCastPassiveLikeSpellAtLearn(SpellEntry const* spellInfo) const { + ShapeshiftForm form = GetShapeshiftForm(); + + if (IsNeedCastSpellAtFormApply(spellInfo, form)) // SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 spells + return true; // all stance req. cases, not have auarastate cases + + if (!(spellInfo->Attributes & SPELL_ATTR_PASSIVE)) + return false; + // 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 - ShapeshiftForm form = GetShapeshiftForm(); - bool need_cast = (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) || - (!form && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT))); + bool need_cast = (!spellInfo->Stances || !form && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)); // Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); diff --git a/src/game/Player.h b/src/game/Player.h index ab43e7d10..53583cb7f 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1634,7 +1634,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool HasActiveSpell(uint32 spell) const; // show in spellbook TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; bool IsSpellFitByClassAndRace( uint32 spell_id ) const; - bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const; + bool IsNeedCastPassiveLikeSpellAtLearn(SpellEntry const* spellInfo) const; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const; void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 0c9588c4b..4f7dce435 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6050,7 +6050,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) uint32 HotWSpellId = 0; uint32 MasterShaperSpellId = 0; - uint32 form = GetModifier()->m_miscvalue; + ShapeshiftForm form = ShapeshiftForm(GetModifier()->m_miscvalue); Unit *target = GetTarget(); @@ -6145,11 +6145,9 @@ 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 | SPELL_ATTR_UNK7))) + if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form)) continue; - // 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); + 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(); diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 40e45a5ef..21379815c 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -443,6 +443,16 @@ inline bool IsChanneledSpell(SpellEntry const* spellInfo) return (spellInfo->AttributesEx & (SPELL_ATTR_EX_CHANNELED_1 | SPELL_ATTR_EX_CHANNELED_2)); } +inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form) +{ + if (!(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7)) || !form) + return false; + + // passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast! + return (spellInfo->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)); +} + + inline bool NeedsComboPoints(SpellEntry const* spellInfo) { return (spellInfo->AttributesEx & (SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS | SPELL_ATTR_EX_REQ_COMBO_POINTS)); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a155024ba..97d311dd1 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 "11003" + #define REVISION_NR "11004" #endif // __REVISION_NR_H__