aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-24 18:59:11 -0500
committermegamage <none@none>2009-08-24 18:59:11 -0500
commit8dcfa4302b876263cdde5914c6d210f6f4f93455 (patch)
treec71052599eb6ac0aa118c893f82a40a45eee04d6 /src/game/Spell.cpp
parent3675c397435d32e07250c942ec6d402731b6b7e0 (diff)
[8394] Fixes for some non-self only positive spells. Author: VladimirMangos
* Propertly reject self targeting for pet spell 2947 and ranks, and spell 54646. * Some related fixes for pet spells with target mode TARGET_SINGLE_FRIEND_2 * Implement original caster bonus part of spell 54646. --HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 8752bf41b41..5d7e57d2c34 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4464,19 +4464,34 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_LINE_OF_SIGHT;
}
- else if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster
+ else if (m_caster == target)
{
- // Additional check for some spells
- // If 0 spell effect empty - client not send target data (need use selection)
- // TODO: check it on next client version
- if (m_targets.m_targetMask == TARGET_FLAG_SELF &&
- m_spellInfo->EffectImplicitTargetA[1] == TARGET_UNIT_TARGET_ENEMY)
+
+ if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster
{
- if (target = m_caster->GetUnit(*m_caster, ((Player *)m_caster)->GetSelection()))
- m_targets.setUnitTarget(target);
- else
- return SPELL_FAILED_BAD_TARGETS;
+ // Additional check for some spells
+ // If 0 spell effect empty - client not send target data (need use selection)
+ // TODO: check it on next client version
+ if (m_targets.m_targetMask == TARGET_FLAG_SELF &&
+ m_spellInfo->EffectImplicitTargetA[1] == TARGET_UNIT_TARGET_ENEMY)
+ {
+ if (target = m_caster->GetUnit(*m_caster, ((Player *)m_caster)->GetSelection()))
+ m_targets.setUnitTarget(target);
+ else
+ return SPELL_FAILED_BAD_TARGETS;
+ }
}
+
+ // Some special spells with non-caster only mode
+
+ // Fire Shield
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK &&
+ m_spellInfo->SpellIconID == 16)
+ return SPELL_FAILED_BAD_TARGETS;
+
+ // Focus Magic (main spell)
+ if (m_spellInfo->Id == 54646)
+ return SPELL_FAILED_BAD_TARGETS;
}
// check pet presents
@@ -6631,7 +6646,6 @@ void Spell::SelectTrajTargets()
}
#define CHECK_DIST {\
- //sLog.outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);
if(dist < objDist2d + size && dist > objDist2d - size)\
{ bestDist = dist; break; }\
}