diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 30 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 36 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 35 | ||||
-rw-r--r-- | src/game/Unit.cpp | 5 |
5 files changed, 37 insertions, 70 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 27b6ea337df..65cc7b3bd31 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17073,10 +17073,36 @@ void Player::RestoreSpellMods(Spell * spell) void Player::RemoveSpellMods(Spell * spell) { - if (!spell || spell->m_appliedMods.empty()) + if (!spell) + return; + std::set <Aura *> checkedSpells; + + AuraEffectList const & auraList = GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE); + for(AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr) + { + if (!(*itr)->GetParentAura()->GetAuraCharges()) + continue; + SpellEntry const * spellInfo = (*itr)->GetSpellProto(); + + if (spellInfo->SpellFamilyName != spell->m_spellInfo->SpellFamilyName || + checkedSpells.find((*itr)->GetParentAura()) != checkedSpells.end()) + continue; + flag96 const * mask = spellmgr.GetSpellAffect((*itr)->GetId(), (*itr)->GetEffIndex()); + if (!mask) + mask = &spellInfo->EffectSpellClassMask[(*itr)->GetEffIndex()]; + + if (spell->m_spellInfo->SpellFamilyFlags & *mask) + { + checkedSpells.insert((*itr)->GetParentAura()); + spell->m_appliedMods.erase((*itr)->GetParentAura()); + if ((*itr)->GetParentAura()->DropAuraCharge()) + itr = auraList.begin(); + } + } + + if (spell->m_appliedMods.empty()) return; - std::set <uint32> checkedSpells; for(int i=0;i<MAX_SPELLMOD;++i) { for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8e1ab386ae2..7c3fc42f32a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -161,7 +161,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleAuraHover, //106 SPELL_AURA_HOVER &AuraEffect::HandleAddModifier, //107 SPELL_AURA_ADD_FLAT_MODIFIER &AuraEffect::HandleAddModifier, //108 SPELL_AURA_ADD_PCT_MODIFIER - &AuraEffect::HandleAddTargetTrigger, //109 SPELL_AURA_ADD_TARGET_TRIGGER + &AuraEffect::HandleNoImmediateEffect, //109 SPELL_AURA_ADD_TARGET_TRIGGER &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT &AuraEffect::HandleNoImmediateEffect, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS @@ -1513,8 +1513,13 @@ bool AuraEffect::isAffectedOnSpell(SpellEntry const *spell) const // Check family name if (spell->SpellFamilyName != m_spellProto->SpellFamilyName) return false; - // Check EffectClassMask - if (m_spellProto->EffectSpellClassMask[m_effIndex] & spell->SpellFamilyFlags) + + // Check EffectClassMask and Spell_Affect table + flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); + if (!spellAffect) + spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex]; + + if (*spellAffect & spell->SpellFamilyFlags) return true; return false; } @@ -1589,7 +1594,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount) Aura * aur = iter->second; // only passive auras-active auras should have amount set on spellcast and not be affected // if aura is casted by others, it will not be affected - if (aur->IsPassive() && aur->GetCasterGUID() == guid && isAffectedOnSpell(aur->GetSpellProto())) + if (aur->IsPassive() && aur->GetCasterGUID() == guid && spellmgr.IsAffectedByMod(aur->GetSpellProto(), m_spellmod)) { if (modOp == SPELLMOD_ALL_EFFECTS) { @@ -1621,29 +1626,6 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount) break; } } -void AuraEffect::HandleAddTargetTrigger(bool apply, bool Real, bool /*changeAmount*/) -{ - // Use SpellModifier structure for check - // used only fields: - // spellId, mask, mask2 - if (apply) - { - SpellModifier *mod = new SpellModifier; - mod->spellId = GetId(); - - flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); - if (!spellAffect) - spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex]; - - mod->mask = *spellAffect; - m_spellmod = mod; - } - else - { - delete m_spellmod; - m_spellmod = NULL; - } -} void AuraEffect::TriggerSpell() { diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index ed6bb37fe2a..9deb25772d4 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -209,7 +209,6 @@ class TRINITY_DLL_SPEC AuraEffect void HandleAuraFeatherFall(bool Apply, bool Real, bool changeAmount); void HandleAuraHover(bool Apply, bool Real, bool changeAmount); void HandleAddModifier(bool Apply, bool Real, bool changeAmount); - void HandleAddTargetTrigger(bool Apply, bool Real, bool changeAmount); void HandleAuraModStun(bool Apply, bool Real, bool changeAmount); void HandleModDamageDone(bool Apply, bool Real, bool changeAmount); void HandleAuraUntrackable(bool Apply, bool Real, bool changeAmount); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index f356a2ea1a5..ae3f72cdcad 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1078,15 +1078,6 @@ void SpellMgr::LoadSpellAffects() continue; } - if( spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA || - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER ) - { - sLog.outErrorDb("Spell %u listed in `spell_affect` have not SPELL_AURA_ADD_FLAT_MODIFIER (%u) or SPELL_AURA_ADD_PCT_MODIFIER (%u) or SPELL_AURA_ADD_TARGET_TRIGGER (%u) for effect index (%u)", entry,SPELL_AURA_ADD_FLAT_MODIFIER,SPELL_AURA_ADD_PCT_MODIFIER,SPELL_AURA_ADD_TARGET_TRIGGER,effectId); - continue; - } - flag96 affect(fields[2].GetUInt32(), fields[3].GetUInt32(), fields[4].GetUInt32()); // Spell.dbc have own data @@ -1111,32 +1102,6 @@ void SpellMgr::LoadSpellAffects() sLog.outString(); sLog.outString( ">> Loaded %u custom spell affect definitions", count ); - - for (uint32 id = 0; id < sSpellStore.GetNumRows(); ++id) - { - SpellEntry const* spellInfo = sSpellStore.LookupEntry(id); - if (!spellInfo) - continue; - - for (int effectId = 0; effectId < 3; ++effectId) - { - if( spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA || - (spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER) ) - continue; - - flag96 dbc_affect; - dbc_affect = spellInfo->EffectSpellClassMask[effectId]; - if(dbc_affect) - continue; - - if(mSpellAffectMap.find((id<<8) + effectId) != mSpellAffectMap.end()) - continue; - - sLog.outErrorDb("Spell %u (%s) misses spell_affect for effect %u",id,spellInfo->SpellName[sWorld.GetDefaultDbcLocale()], effectId); - } - } } bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b838ec90e44..aca3ea92ce5 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9168,10 +9168,6 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM if (!pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) break; crit_chance+=modChance; - // Fingers of Frost - // TODO: Change this code to less hacky - if (Aura * aur = GetAura(44544)) - aur->DropAuraCharge(); break; case 7917: // Glyph of Shadowburn if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this)) @@ -12035,7 +12031,6 @@ bool InitTriggerAuraData() isTriggerAura[SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE] = true; isTriggerAura[SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE] = true; isTriggerAura[SPELL_AURA_MOD_DAMAGE_FROM_CASTER] = true; - isTriggerAura[SPELL_AURA_ABILITY_IGNORE_AURASTATE] = true; isTriggerAura[SPELL_AURA_MOD_SPELL_CRIT_CHANCE] = true; isNonTriggerAura[SPELL_AURA_MOD_POWER_REGEN]=true; |