aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp16
-rw-r--r--src/game/SpellEffects.cpp10
-rw-r--r--src/game/SpellMgr.cpp2
-rw-r--r--src/game/SpellMgr.h39
-rw-r--r--src/game/Unit.cpp10
5 files changed, 59 insertions, 18 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 845c816e986..92de692da5e 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -519,7 +519,7 @@ void Spell::FillTargetMap()
if(!m_spellInfo->Effect[i])
continue;
- uint32 effectTargetType = spellmgr.EffectTargetType[m_spellInfo->Effect[i]];
+ uint32 effectTargetType = EffectTargetType[m_spellInfo->Effect[i]];
// is it possible that areaaura is not applied to caster?
if(effectTargetType == SPELL_REQUIRE_NONE)
@@ -1812,7 +1812,7 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
if(m_originalCaster)
modOwner = m_originalCaster->GetSpellModOwner();
- switch(spellmgr.SpellTargetType[cur])
+ switch(SpellTargetType[cur])
{
case TARGET_TYPE_UNIT_CASTER:
{
@@ -2224,7 +2224,7 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
else if(pushType)
{
// Dummy, just for client
- if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
+ if(EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
return;
float radius;
@@ -2695,7 +2695,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
for(uint32 i = 0; i < 3; ++i)
{
- if(spellmgr.EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_UNIT)
+ if(EffectTargetType[m_spellInfo->Effect[i]] == SPELL_REQUIRE_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
break;
@@ -3097,14 +3097,14 @@ void Spell::_handle_immediate_phase()
// process ground
for(uint32 j = 0; j < 3; ++j)
{
- if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
+ if(EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
{
if(!m_targets.HasDst()) // FIXME: this will ignore dest set in effect
m_targets.setDestination(m_caster);
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
}
- else if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
+ else if(EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_NONE)
{
HandleEffects(m_originalCaster, NULL, NULL, j);
m_effectMask |= (1<<j);
@@ -5202,8 +5202,8 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
for(uint32 i = 0; i < 3; ++i)
{
- if(spellmgr.SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
- || spellmgr.SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET)
+ if(SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
+ || SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET)
{
if(!target)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index c3503d35683..10562bbd4fb 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2028,7 +2028,7 @@ void Spell::EffectForceCast(uint32 i)
unitTarget->CastSpell(unitTarget, spellInfo, true, NULL, NULL, m_originalCasterGUID);
}
-void Spell::EffectTriggerSpell(uint32 i)
+void Spell::EffectTriggerSpell(uint32 effIndex)
{
// only unit case known
if (!unitTarget)
@@ -2038,7 +2038,7 @@ void Spell::EffectTriggerSpell(uint32 i)
return;
}
- uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[i];
+ uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex];
// special cases
switch(triggered_spell_id)
@@ -2184,7 +2184,11 @@ void Spell::EffectTriggerSpell(uint32 i)
&& m_spellInfo->Category == spellInfo->Category)
((Player*)m_caster)->RemoveSpellCooldown(spellInfo->Id);
- m_caster->CastSpell(unitTarget,spellInfo,true,NULL,NULL,m_originalCasterGUID);
+ // Note: not exist spells with weapon req. and IsSpellHaveCasterSourceTargets == true
+ // so this just for speedup places in else
+ Unit *caster = IsSpellWithCasterSourceTargetsOnly(spellInfo) ? unitTarget : m_caster;
+
+ caster->CastSpell(unitTarget,spellInfo,true,NULL,NULL,m_originalCasterGUID);
}
void Spell::EffectTriggerMissileSpell(uint32 effect_idx)
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 321e9e26673..9e5a2aecab6 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -30,6 +30,8 @@
#include "CreatureAI.h"
bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
+SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
+SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
SpellMgr::SpellMgr()
{
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 4bb966f16e3..cb7e00d6e5f 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -275,8 +275,42 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de
bool IsSingleTargetSpell(SpellEntry const *spellInfo);
bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2);
-
extern bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
+extern SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
+extern SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
+
+inline bool IsCasterSourceTarget(uint32 target)
+{
+ switch (SpellTargetType[target])
+ {
+ case TARGET_TYPE_UNIT_CASTER:
+ case TARGET_TYPE_AREA_SRC:
+ case TARGET_TYPE_AREA_CONE:
+ case TARGET_TYPE_DEST_CASTER:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
+{
+ for(int i = 0; i < 3; ++i)
+ {
+ uint32 targetA = spellInfo->EffectImplicitTargetA[i];
+ if(targetA && !IsCasterSourceTarget(targetA))
+ return false;
+
+ uint32 targetB = spellInfo->EffectImplicitTargetB[i];
+ if(targetB && !IsCasterSourceTarget(targetB))
+ return false;
+
+ if(!targetA && !targetB)
+ return false;
+ }
+ return true;
+}
inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo)
{
@@ -1023,9 +1057,6 @@ class SpellMgr
return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
}
- SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
- SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
-
// < 0 for petspelldata id, > 0 for creature_id
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const
{
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 57d38054df2..a5d2acfd008 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -906,7 +906,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
//if(targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2))
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
+ if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
{
/*SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
if(srange && GetSpellMaxRange(srange) == 0.0f)
@@ -978,7 +978,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit*
//check unit target
for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
- if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
+ if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
{
if(!Victim)
{
@@ -6076,6 +6076,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Judgements of the Wise
if (dummySpell->SpellIconID == 3017)
{
+ //Mangos code, do not know if we need it
+ // triggered only at casted Judgement spells, not at additional Judgement effects
+ //if(!procSpell || procSpell->Category != 1210)
+ // return;
target = this;
triggered_spell_id = 31930;
// replenishment
@@ -12181,7 +12185,7 @@ void CharmInfo::InitCharmCreateSpells()
{
bool autocast = false;
for(uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i)
- if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
+ if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
autocast = true;
if(autocast)