From 6683ae58c9e2cbea5f43089b739d7e50eacd4465 Mon Sep 17 00:00:00 2001 From: QAston Date: Wed, 11 Mar 2009 22:27:07 +0100 Subject: [PATCH] * Fix mind flay target requirements. --HG-- branch : trunk --- src/game/SpellMgr.cpp | 9 ++++++--- src/game/SpellMgr.h | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fb482f9daa..ccc6cc85f5 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -513,7 +513,7 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB) return true; } -bool IsPositiveEffect(uint32 spellId, uint32 effIndex) +bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) { SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); if (!spellproto) return false; @@ -702,11 +702,14 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE) return false; + if (!deep && spellproto->EffectTriggerSpell[effIndex] && !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true)) + return false; + // ok, positive return true; } -bool IsPositiveSpell(uint32 spellId) +bool IsPositiveSpell(uint32 spellId, bool deep) { SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); if (!spellproto) return false; @@ -714,7 +717,7 @@ bool IsPositiveSpell(uint32 spellId) // spells with at least one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. for (int i = 0; i < 3; i++) - if (!IsPositiveEffect(spellId, i)) + if (!IsPositiveEffect(spellId, i, deep)) return false; return true; } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index e512af4b85..ddbbf92de1 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -408,8 +408,8 @@ inline bool IsNonCombatSpell(SpellEntry const *spellInfo) return (spellInfo->Attributes & SPELL_ATTR_CANT_USED_IN_COMBAT) != 0; } -bool IsPositiveSpell(uint32 spellId); -bool IsPositiveEffect(uint32 spellId, uint32 effIndex); +bool IsPositiveSpell(uint32 spellId, bool deep = false); +bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep = false); bool IsPositiveTarget(uint32 targetA, uint32 targetB); bool IsSingleTargetSpell(SpellEntry const *spellInfo);