[8369] Some step back in triggered effect caster selection. Author: VladimirMangos

(I do not know what spells this will fix)

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-17 15:54:39 -05:00
parent 168a986950
commit 6a9693a1e4
5 changed files with 59 additions and 18 deletions
+8 -8
View File
@@ -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;
+7 -3
View File
@@ -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)
+2
View File
@@ -30,6 +30,8 @@
#include "CreatureAI.h"
bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS];
SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS];
SpellMgr::SpellMgr()
{
+35 -4
View File
@@ -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
{
+7 -3
View File
@@ -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)