[11004] Fixed not apply spell for current form at learning.

Some non-passive spells autocasted at shapeshift but without fix
in case already active form at like spell learning it not has been casted
in different from passive similar spells.

This is fix apply dodge chance part of spell 17002 for described case.
This commit is contained in:
VladimirMangos 2011-01-14 03:46:21 +03:00
parent 75846d28eb
commit 8d62e9dbf7
5 changed files with 29 additions and 16 deletions

View file

@ -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)));

View file

@ -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);

View file

@ -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();

View file

@ -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));

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11003"
#define REVISION_NR "11004"
#endif // __REVISION_NR_H__