[8468] Move TARGET_EFFECT_SELECT target selection to normal place for target modes.

* Make from TARGET_EFFECT_SELECT code normal Spell::SetTargetMap case
* In additional for old 0/TARGET_EFFECT_SELECT pairs call it in case coordinate targets.
This commit is contained in:
VladimirMangos 2009-09-05 02:05:39 +04:00
parent a65d3a1560
commit b145659b31
3 changed files with 227 additions and 191 deletions

View file

@ -509,6 +509,38 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
break;
default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break;
}
break;
case TARGET_EFFECT_SELECT:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break;
case TARGET_INNKEEPER_COORDINATES:
case TARGET_TABLE_X_Y_Z_COORDINATES:
case TARGET_CASTER_COORDINATES:
case TARGET_SCRIPT_COORDINATES:
case TARGET_CURRENT_ENEMY_COORDINATES:
case TARGET_DUELVSPLAYER_COORDINATES:
case TARGET_DYNAMIC_OBJECT_COORDINATES:
case TARGET_POINT_AT_NORTH:
case TARGET_POINT_AT_SOUTH:
case TARGET_POINT_AT_EAST:
case TARGET_POINT_AT_WEST:
case TARGET_POINT_AT_NE:
case TARGET_POINT_AT_NW:
case TARGET_POINT_AT_SE:
case TARGET_POINT_AT_SW:
// need some target for proccesing
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
break; break;
default: default:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -519,6 +551,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break; break;
case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact
@ -536,18 +569,29 @@ void Spell::FillTargetMap()
} }
break; break;
case TARGET_CASTER_COORDINATES: case TARGET_CASTER_COORDINATES:
// Note: this hack with search required until GO casting not implemented switch(m_spellInfo->EffectImplicitTargetB[i])
// environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
// currently each enemy selected explicitly and self cast damage
if(m_spellInfo->EffectImplicitTargetB[i] == TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
{ {
if(m_targets.getUnitTarget()) case TARGET_ALL_ENEMY_IN_AREA:
tmpUnitMap.push_back(m_targets.getUnitTarget()); // Note: this hack with search required until GO casting not implemented
} // environment damage spells already have around enemies targeting but this not help in case not existed GO casting support
else // currently each enemy selected explicitly and self cast damage
{ if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE)
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); {
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
}
break;
default:
{
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
}
break;
} }
break; break;
case TARGET_TABLE_X_Y_Z_COORDINATES: case TARGET_TABLE_X_Y_Z_COORDINATES:
@ -557,10 +601,7 @@ void Spell::FillTargetMap()
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
// need some target for proccesing // need some target for proccesing
if(m_targets.getUnitTarget()) SetTargetMap(i, TARGET_EFFECT_SELECT, tmpUnitMap);
tmpUnitMap.push_back(m_targets.getUnitTarget());
else
tmpUnitMap.push_back(m_caster);
break; break;
case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code
SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap);
@ -575,6 +616,7 @@ void Spell::FillTargetMap()
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
case 0: case 0:
case TARGET_EFFECT_SELECT:
SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap);
break; break;
case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case
@ -588,165 +630,6 @@ void Spell::FillTargetMap()
break; break;
} }
if( (m_spellInfo->EffectImplicitTargetA[i] == 0 || m_spellInfo->EffectImplicitTargetA[i] == TARGET_EFFECT_SELECT) &&
(m_spellInfo->EffectImplicitTargetB[i] == 0 || m_spellInfo->EffectImplicitTargetB[i] == TARGET_EFFECT_SELECT) )
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[i])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
tmpUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if(Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
tmpUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if(m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
tmpUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if(m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2)
{
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if(Pet* pet = m_caster->GetPet())
tmpUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[i])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
tmpUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(i,TARGET_AREAEFFECT_PARTY, tmpUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if(m_targets.getUnitTarget())
{
tmpUnitMap.push_back(m_targets.getUnitTarget());
}
else if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
tmpUnitMap.push_back(owner);
}
}
break;
default:
break;
}
}
if(m_caster->GetTypeId() == TYPEID_PLAYER) if(m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
Player *me = (Player*)m_caster; Player *me = (Player*)m_caster;
@ -1395,11 +1278,11 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
} }
}; };
void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
{ {
float radius; float radius;
if (m_spellInfo->EffectRadiusIndex[i]) if (m_spellInfo->EffectRadiusIndex[effIndex])
radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
else else
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
@ -1407,7 +1290,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(Player* modOwner = m_originalCaster->GetSpellModOwner()) if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this);
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[effIndex];
if(m_originalCaster) if(m_originalCaster)
if(Player* modOwner = m_originalCaster->GetSpellModOwner()) if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this);
@ -1435,7 +1318,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
unMaxTargets+=(*m)->GetModifier()->m_amount; unMaxTargets+=(*m)->GetModifier()->m_amount;
} }
switch(cur) switch(targetMode)
{ {
case TARGET_TOTEM_EARTH: case TARGET_TOTEM_EARTH:
case TARGET_TOTEM_WATER: case TARGET_TOTEM_WATER:
@ -1678,7 +1561,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{ {
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE; SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect // Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, i)) if (IsPositiveEffect(m_spellInfo->Id, effIndex))
targetB = SPELL_TARGETS_FRIENDLY; targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB); FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
@ -1690,7 +1573,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
case TARGET_ALL_ENEMY_IN_AREA_INSTANT: case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{ {
// targets the ground, not the units in the area // targets the ground, not the units in the area
switch(m_spellInfo->Effect[i]) switch(m_spellInfo->Effect[effIndex])
{ {
case SPELL_EFFECT_PERSISTENT_AREA_AURA: case SPELL_EFFECT_PERSISTENT_AREA_AURA:
break; break;
@ -1832,7 +1715,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
} }
case TARGET_GAMEOBJECT: case TARGET_GAMEOBJECT:
if(m_targets.getGOTarget()) if(m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), i); AddGOTarget(m_targets.getGOTarget(), effIndex);
break; break;
case TARGET_IN_FRONT_OF_CASTER: case TARGET_IN_FRONT_OF_CASTER:
{ {
@ -1865,9 +1748,9 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
} }
case TARGET_GAMEOBJECT_ITEM: case TARGET_GAMEOBJECT_ITEM:
if(m_targets.getGOTargetGUID()) if(m_targets.getGOTargetGUID())
AddGOTarget(m_targets.getGOTarget(), i); AddGOTarget(m_targets.getGOTarget(), effIndex);
else if(m_targets.getItemTarget()) else if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i); AddItemTarget(m_targets.getItemTarget(), effIndex);
break; break;
case TARGET_MASTER: case TARGET_MASTER:
if(Unit* owner = m_caster->GetCharmerOrOwner()) if(Unit* owner = m_caster->GetCharmerOrOwner())
@ -1875,11 +1758,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
break; break;
case TARGET_ALL_ENEMY_IN_AREA_CHANNELED: case TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
// targets the ground, not the units in the area // targets the ground, not the units in the area
if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) if (m_spellInfo->Effect[effIndex]!=SPELL_EFFECT_PERSISTENT_AREA_AURA)
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
break; break;
case TARGET_MINION: case TARGET_MINION:
if(m_spellInfo->Effect[i] != SPELL_EFFECT_DUEL) if(m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL)
TagUnitMap.push_back(m_caster); TagUnitMap.push_back(m_caster);
break; break;
case TARGET_SINGLE_ENEMY: case TARGET_SINGLE_ENEMY:
@ -1962,7 +1845,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
if(m_targets.getUnitTarget()) if(m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget()); TagUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getItemTarget()) if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i); AddItemTarget(m_targets.getItemTarget(), effIndex);
break; break;
} }
case TARGET_SELF_FISHING: case TARGET_SELF_FISHING:
@ -2036,7 +1919,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{ {
TagUnitMap.push_back(currentTarget); TagUnitMap.push_back(currentTarget);
m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA_INSTANT) if(m_spellInfo->EffectImplicitTargetB[effIndex]==TARGET_ALL_ENEMY_IN_AREA_INSTANT)
FillAreaTargets(TagUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE); FillAreaTargets(TagUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE);
} }
break; break;
@ -2125,7 +2008,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster;
float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation(); float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation();
switch(cur) switch(targetMode)
{ {
case TARGET_POINT_AT_NORTH: break; case TARGET_POINT_AT_NORTH: break;
case TARGET_POINT_AT_SOUTH: angle += M_PI; break; case TARGET_POINT_AT_SOUTH: angle += M_PI; break;
@ -2160,6 +2043,159 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
TagUnitMap.push_back(m_caster); TagUnitMap.push_back(m_caster);
break; break;
} }
case TARGET_EFFECT_SELECT:
{
// add here custom effects that need default target.
// FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
switch(m_spellInfo->Effect[effIndex])
{
case SPELL_EFFECT_DUMMY:
{
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
{
WorldObject* result = FindCorpseUsing<MaNGOS::CannibalizeObjectCheck> ();
if(result)
{
switch(result->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
TagUnitMap.push_back((Unit*)result);
break;
case TYPEID_CORPSE:
m_targets.setCorpseTarget((Corpse*)result);
if (Player* owner = ObjectAccessor::FindPlayer(((Corpse*)result)->GetOwnerGUID()))
TagUnitMap.push_back(owner);
break;
}
}
else
{
// clear cooldown at fail
if (m_caster->GetTypeId() == TYPEID_PLAYER)
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
break;
}
default:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
}
case SPELL_EFFECT_RESURRECT:
case SPELL_EFFECT_PARRY:
case SPELL_EFFECT_BLOCK:
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_TRIGGER_SPELL:
case SPELL_EFFECT_TRIGGER_MISSILE:
case SPELL_EFFECT_LEARN_SPELL:
case SPELL_EFFECT_SKILL_STEP:
case SPELL_EFFECT_PROFICIENCY:
case SPELL_EFFECT_SUMMON_OBJECT_WILD:
case SPELL_EFFECT_SELF_RESURRECT:
case SPELL_EFFECT_REPUTATION:
case SPELL_EFFECT_SEND_TAXI:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_TRIGGER_SPELL)
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
{
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
if(target)
TagUnitMap.push_back(target);
}
break;
case SPELL_EFFECT_RESURRECT_NEW:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
if (m_targets.getCorpseTargetGUID())
{
Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
if(owner)
TagUnitMap.push_back(owner);
}
}
break;
case SPELL_EFFECT_SUMMON:
if (m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED ||
m_spellInfo->EffectMiscValueB[effIndex] == SUMMON_TYPE_POSESSED2)
{
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
}
else
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL:
TagUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_LEARN_PET_SPELL:
if (Pet* pet = m_caster->GetPet())
TagUnitMap.push_back(pet);
break;
case SPELL_EFFECT_ENCHANT_ITEM:
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
case SPELL_EFFECT_DISENCHANT:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
if (m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), effIndex);
break;
case SPELL_EFFECT_APPLY_AURA:
switch(m_spellInfo->EffectApplyAuraName[effIndex])
{
case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example)
case SPELL_AURA_ADD_PCT_MODIFIER:
TagUnitMap.push_back(m_caster);
break;
default: // apply to target in other case
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
// AreaAura
if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000)
SetTargetMap(effIndex,TARGET_AREAEFFECT_PARTY, TagUnitMap);
break;
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
if (m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
else if (m_targets.getCorpseTargetGUID())
{
if (Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()))
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()))
TagUnitMap.push_back(owner);
}
break;
default:
break;
}
break;
}
default: default:
break; break;
} }

View file

@ -369,7 +369,7 @@ class Spell
typedef std::list<Unit*> UnitList; typedef std::list<Unit*> UnitList;
void FillTargetMap(); void FillTargetMap();
void SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap); void SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap);
void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets ); void FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets );
void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster ); void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster );

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8467" #define REVISION_NR "8468"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__