mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9083] Rename maps naming used in spell targeting code for easier readability
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
70c8eb5906
commit
663f8df849
3 changed files with 164 additions and 164 deletions
|
|
@ -1284,7 +1284,7 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
|
|||
}
|
||||
};
|
||||
|
||||
void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
||||
void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUnitMap)
|
||||
{
|
||||
float radius;
|
||||
if (m_spellInfo->EffectRadiusIndex[effIndex])
|
||||
|
|
@ -1361,7 +1361,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
m_caster->GetClosePoint(dest_x, dest_y, dest_z, 0.0f, radius, angle);
|
||||
m_targets.setDestination(dest_x, dest_y, dest_z);
|
||||
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
}
|
||||
case TARGET_RANDOM_NEARBY_DEST:
|
||||
|
|
@ -1377,10 +1377,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
if (radius > 0.0f)
|
||||
{
|
||||
// caster included here?
|
||||
FillAreaTargets(TagUnitMap, dest_x, dest_y, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, dest_x, dest_y, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
}
|
||||
else
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1393,7 +1393,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
case TARGET_AREAEFFECT_CUSTOM:
|
||||
case TARGET_AREAEFFECT_CUSTOM_2:
|
||||
case TARGET_SUMMON:
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case TARGET_RANDOM_ENEMY_CHAIN_IN_AREA:
|
||||
{
|
||||
|
|
@ -1406,11 +1406,11 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Unit *> tempUnitMap;
|
||||
std::list<Unit *> tempTargetUnitMap;
|
||||
|
||||
{
|
||||
MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(m_caster, m_caster, max_range);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempUnitMap, u_check);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempTargetUnitMap, u_check);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
|
@ -1420,34 +1420,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
}
|
||||
|
||||
if(tempUnitMap.empty())
|
||||
if(tempTargetUnitMap.empty())
|
||||
break;
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(m_caster));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(m_caster));
|
||||
|
||||
//Now to get us a random target that's in the initial range of the spell
|
||||
uint32 t = 0;
|
||||
std::list<Unit *>::iterator itr = tempUnitMap.begin();
|
||||
while(itr!= tempUnitMap.end() && (*itr)->IsWithinDist(m_caster,radius))
|
||||
std::list<Unit *>::iterator itr = tempTargetUnitMap.begin();
|
||||
while(itr!= tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius))
|
||||
++t, ++itr;
|
||||
|
||||
if(!t)
|
||||
break;
|
||||
|
||||
itr = tempUnitMap.begin();
|
||||
itr = tempTargetUnitMap.begin();
|
||||
std::advance(itr, rand()%t);
|
||||
Unit *pUnitTarget = *itr;
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
|
||||
tempUnitMap.erase(itr);
|
||||
tempTargetUnitMap.erase(itr);
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
|
||||
t = unMaxTargets - 1;
|
||||
Unit *prev = pUnitTarget;
|
||||
std::list<Unit*>::iterator next = tempUnitMap.begin();
|
||||
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
|
||||
|
||||
while(t && next != tempUnitMap.end() )
|
||||
while(t && next != tempTargetUnitMap.end() )
|
||||
{
|
||||
if(!prev->IsWithinDist(*next,CHAIN_SPELL_JUMP_RADIUS))
|
||||
break;
|
||||
|
|
@ -1459,10 +1459,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
}
|
||||
|
||||
prev = *next;
|
||||
TagUnitMap.push_back(prev);
|
||||
tempUnitMap.erase(next);
|
||||
tempUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempUnitMap.begin();
|
||||
targetUnitMap.push_back(prev);
|
||||
tempTargetUnitMap.erase(next);
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempTargetUnitMap.begin();
|
||||
|
||||
--t;
|
||||
}
|
||||
|
|
@ -1477,10 +1477,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
std::list<Unit *> tempUnitMap;
|
||||
std::list<Unit *> tempTargetUnitMap;
|
||||
{
|
||||
MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, max_range);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(m_caster, tempUnitMap, u_check);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(m_caster, tempTargetUnitMap, u_check);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
|
@ -1490,34 +1490,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
}
|
||||
|
||||
if(tempUnitMap.empty())
|
||||
if(tempTargetUnitMap.empty())
|
||||
break;
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(m_caster));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(m_caster));
|
||||
|
||||
//Now to get us a random target that's in the initial range of the spell
|
||||
uint32 t = 0;
|
||||
std::list<Unit *>::iterator itr = tempUnitMap.begin();
|
||||
while(itr!= tempUnitMap.end() && (*itr)->IsWithinDist(m_caster,radius))
|
||||
std::list<Unit *>::iterator itr = tempTargetUnitMap.begin();
|
||||
while(itr!= tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius))
|
||||
++t, ++itr;
|
||||
|
||||
if(!t)
|
||||
break;
|
||||
|
||||
itr = tempUnitMap.begin();
|
||||
itr = tempTargetUnitMap.begin();
|
||||
std::advance(itr, rand()%t);
|
||||
Unit *pUnitTarget = *itr;
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
|
||||
tempUnitMap.erase(itr);
|
||||
tempTargetUnitMap.erase(itr);
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
|
||||
t = unMaxTargets - 1;
|
||||
Unit *prev = pUnitTarget;
|
||||
std::list<Unit*>::iterator next = tempUnitMap.begin();
|
||||
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
|
||||
|
||||
while(t && next != tempUnitMap.end() )
|
||||
while(t && next != tempTargetUnitMap.end())
|
||||
{
|
||||
if(!prev->IsWithinDist(*next,CHAIN_SPELL_JUMP_RADIUS))
|
||||
break;
|
||||
|
|
@ -1528,10 +1528,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
continue;
|
||||
}
|
||||
prev = *next;
|
||||
TagUnitMap.push_back(prev);
|
||||
tempUnitMap.erase(next);
|
||||
tempUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempUnitMap.begin();
|
||||
targetUnitMap.push_back(prev);
|
||||
tempTargetUnitMap.erase(next);
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempTargetUnitMap.begin();
|
||||
--t;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1540,7 +1540,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
Pet* tmpUnit = m_caster->GetPet();
|
||||
if (!tmpUnit) break;
|
||||
TagUnitMap.push_back(tmpUnit);
|
||||
targetUnitMap.push_back(tmpUnit);
|
||||
break;
|
||||
}
|
||||
case TARGET_CHAIN_DAMAGE:
|
||||
|
|
@ -1550,7 +1550,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
|
||||
{
|
||||
m_targets.setUnitTarget(pUnitTarget);
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1574,10 +1574,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Unit *> tempUnitMap;
|
||||
std::list<Unit *> tempTargetUnitMap;
|
||||
{
|
||||
MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range, false);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempUnitMap, u_check);
|
||||
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempTargetUnitMap, u_check);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer> world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer> grid_unit_searcher(searcher);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
|
|
@ -1585,20 +1585,20 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
}
|
||||
if (tempUnitMap.empty())
|
||||
if (tempTargetUnitMap.empty())
|
||||
break;
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
|
||||
if (*tempUnitMap.begin() == pUnitTarget)
|
||||
tempUnitMap.erase (tempUnitMap.begin());
|
||||
if (*tempTargetUnitMap.begin() == pUnitTarget)
|
||||
tempTargetUnitMap.erase(tempTargetUnitMap.begin());
|
||||
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
uint32 t = unMaxTargets - 1;
|
||||
Unit *prev = pUnitTarget;
|
||||
std::list<Unit*>::iterator next = tempUnitMap.begin();
|
||||
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
|
||||
|
||||
while (t && next != tempUnitMap.end())
|
||||
while (t && next != tempTargetUnitMap.end())
|
||||
{
|
||||
if (!prev->IsWithinDist (*next,CHAIN_SPELL_JUMP_RADIUS))
|
||||
break;
|
||||
|
|
@ -1608,17 +1608,17 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
continue;
|
||||
}
|
||||
prev = *next;
|
||||
TagUnitMap.push_back(prev);
|
||||
tempUnitMap.erase(next);
|
||||
tempUnitMap.sort (TargetDistanceOrder(prev));
|
||||
next = tempUnitMap.begin();
|
||||
targetUnitMap.push_back(prev);
|
||||
tempTargetUnitMap.erase(next);
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempTargetUnitMap.begin();
|
||||
--t;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TARGET_ALL_ENEMY_IN_AREA:
|
||||
FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
case TARGET_AREAEFFECT_INSTANT:
|
||||
{
|
||||
|
|
@ -1627,10 +1627,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
if (IsPositiveEffect(m_spellInfo->Id, effIndex))
|
||||
targetB = SPELL_TARGETS_FRIENDLY;
|
||||
|
||||
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius, PUSH_DEST_CENTER, targetB);
|
||||
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_DEST_CENTER, targetB);
|
||||
|
||||
// exclude caster
|
||||
TagUnitMap.remove(m_caster);
|
||||
targetUnitMap.remove(m_caster);
|
||||
break;
|
||||
}
|
||||
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
|
||||
|
|
@ -1641,10 +1641,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
case SPELL_EFFECT_PERSISTENT_AREA_AURA:
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON:
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
default:
|
||||
FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1654,34 +1654,34 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
if(Unit* currentTarget = m_targets.getUnitTarget())
|
||||
{
|
||||
m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
|
||||
TagUnitMap.push_back(currentTarget);
|
||||
targetUnitMap.push_back(currentTarget);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TARGET_ALL_PARTY_AROUND_CASTER:
|
||||
case TARGET_ALL_PARTY_AROUND_CASTER_2:
|
||||
case TARGET_ALL_PARTY:
|
||||
FillRaidOrPartyTargets(TagUnitMap, m_caster, m_caster, radius, false, true, true);
|
||||
FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, false, true, true);
|
||||
break;
|
||||
case TARGET_ALL_RAID_AROUND_CASTER:
|
||||
{
|
||||
if(m_spellInfo->Id == 57669) // Replenishment (special target selection)
|
||||
FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 10, true, false, true);
|
||||
FillRaidOrPartyManaPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 10, true, false, true);
|
||||
else if (m_spellInfo->Id==52759) // Ancestral Awakening (special target selection)
|
||||
FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 1, true, false, true);
|
||||
FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 1, true, false, true);
|
||||
else
|
||||
FillRaidOrPartyTargets(TagUnitMap, m_caster, m_caster, radius, true, true, true);
|
||||
FillRaidOrPartyTargets(targetUnitMap, m_caster, m_caster, radius, true, true, true);
|
||||
break;
|
||||
}
|
||||
case TARGET_SINGLE_FRIEND:
|
||||
case TARGET_SINGLE_FRIEND_2:
|
||||
if(m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
break;
|
||||
case TARGET_NONCOMBAT_PET:
|
||||
if(Unit* target = m_targets.getUnitTarget())
|
||||
if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet() && ((Pet*)target)->getPetType() == MINI_PET)
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
break;
|
||||
case TARGET_CASTER_COORDINATES:
|
||||
{
|
||||
|
|
@ -1696,21 +1696,21 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
break;
|
||||
}
|
||||
case TARGET_ALL_HOSTILE_UNITS_AROUND_CASTER:
|
||||
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_HOSTILE);
|
||||
FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_HOSTILE);
|
||||
break;
|
||||
case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER:
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 64844: // Divine Hymn
|
||||
// target amount stored in parent spell dummy effect but hard to access
|
||||
FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 3, true, false, false);
|
||||
FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 3, true, false, false);
|
||||
break;
|
||||
case 64904: // Hymn of Hope
|
||||
// target amount stored in parent spell dummy effect but hard to access
|
||||
FillRaidOrPartyManaPriorityTargets(TagUnitMap, m_caster, m_caster, radius, 3, true, false, false);
|
||||
FillRaidOrPartyManaPriorityTargets(targetUnitMap, m_caster, m_caster, radius, 3, true, false, false);
|
||||
break;
|
||||
default:
|
||||
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1721,7 +1721,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
// checked in Spell::CheckCast
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
if (Unit* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelection()))
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
// Wild Growth
|
||||
else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellIconID == 2864)
|
||||
|
|
@ -1731,10 +1731,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
target = m_caster;
|
||||
uint32 count = CalculateDamage(2,m_caster); // stored in dummy effect, affected by mods
|
||||
|
||||
FillRaidOrPartyHealthPriorityTargets(TagUnitMap, m_caster, target, radius, count, true, false, true);
|
||||
FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, target, radius, count, true, false, true);
|
||||
}
|
||||
else
|
||||
FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
FillAreaTargets(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
break;
|
||||
// TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..)
|
||||
case TARGET_SINGLE_PARTY:
|
||||
|
|
@ -1754,7 +1754,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
if( target == owner )
|
||||
{
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
break;
|
||||
}
|
||||
pGroup = ((Player*)owner)->GetGroup();
|
||||
|
|
@ -1764,7 +1764,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
if( targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet())
|
||||
{
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
break;
|
||||
}
|
||||
pGroup = ((Player*)m_caster)->GetGroup();
|
||||
|
|
@ -1780,13 +1780,13 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
target->GetOwnerGUID() == targetOwner->GetGUID() &&
|
||||
pGroup->IsMember(((Player*)targetOwner)->GetGUID()))
|
||||
{
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
}
|
||||
// 1Our target can be a player who is on our group
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && pGroup->IsMember(((Player*)target)->GetGUID()))
|
||||
{
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1799,17 +1799,17 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
case TARGET_IN_FRONT_OF_CASTER:
|
||||
{
|
||||
bool inFront = m_spellInfo->SpellVisual[0] != 3879;
|
||||
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),radius,inFront ? PUSH_IN_FRONT : PUSH_IN_BACK,SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, inFront ? PUSH_IN_FRONT : PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
}
|
||||
case TARGET_LARGE_FRONTAL_CONE:
|
||||
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_90, SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_90, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
case TARGET_NARROW_FRONTAL_CONE:
|
||||
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_15, SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_15, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
case TARGET_IN_FRONT_OF_CASTER_30:
|
||||
FillAreaTargets(TagUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_30, SPELL_TARGETS_AOE_DAMAGE);
|
||||
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_IN_FRONT_30, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
case TARGET_DUELVSPLAYER:
|
||||
{
|
||||
|
|
@ -1818,14 +1818,14 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
if(m_caster->IsFriendlyTo(target))
|
||||
{
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
|
||||
{
|
||||
m_targets.setUnitTarget(pUnitTarget);
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1839,23 +1839,23 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
break;
|
||||
case TARGET_MASTER:
|
||||
if(Unit* owner = m_caster->GetCharmerOrOwner())
|
||||
TagUnitMap.push_back(owner);
|
||||
targetUnitMap.push_back(owner);
|
||||
break;
|
||||
case TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
|
||||
// targets the ground, not the units in the area
|
||||
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(targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
break;
|
||||
case TARGET_MINION:
|
||||
if(m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL)
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case TARGET_SINGLE_ENEMY:
|
||||
{
|
||||
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
|
||||
{
|
||||
m_targets.setUnitTarget(pUnitTarget);
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1866,7 +1866,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
|
||||
if(owner)
|
||||
{
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
if(owner->GetTypeId() == TYPEID_PLAYER)
|
||||
pTarget = (Player*)owner;
|
||||
}
|
||||
|
|
@ -1902,39 +1902,39 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
if(Target && Target->GetSubGroup()==subgroup && !m_caster->IsHostileTo(Target))
|
||||
{
|
||||
if( pTarget->IsWithinDistInMap(Target, radius) )
|
||||
TagUnitMap.push_back(Target);
|
||||
targetUnitMap.push_back(Target);
|
||||
|
||||
if(Pet* pet = Target->GetPet())
|
||||
if( pTarget->IsWithinDistInMap(pet, radius) )
|
||||
TagUnitMap.push_back(pet);
|
||||
targetUnitMap.push_back(pet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (owner)
|
||||
{
|
||||
if(m_caster->IsWithinDistInMap(owner, radius))
|
||||
TagUnitMap.push_back(owner);
|
||||
targetUnitMap.push_back(owner);
|
||||
}
|
||||
else if(pTarget)
|
||||
{
|
||||
TagUnitMap.push_back(pTarget);
|
||||
targetUnitMap.push_back(pTarget);
|
||||
|
||||
if(Pet* pet = pTarget->GetPet())
|
||||
if( m_caster->IsWithinDistInMap(pet, radius) )
|
||||
TagUnitMap.push_back(pet);
|
||||
targetUnitMap.push_back(pet);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TARGET_SCRIPT:
|
||||
{
|
||||
if(m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
if(m_targets.getItemTarget())
|
||||
AddItemTarget(m_targets.getItemTarget(), effIndex);
|
||||
break;
|
||||
}
|
||||
case TARGET_SELF_FISHING:
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case TARGET_CHAIN_HEAL:
|
||||
{
|
||||
|
|
@ -1943,33 +1943,33 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
break;
|
||||
|
||||
if (EffectChainTarget <= 1)
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
else
|
||||
{
|
||||
unMaxTargets = EffectChainTarget;
|
||||
float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS;
|
||||
|
||||
UnitList tempUnitMap;
|
||||
UnitList tempTargetUnitMap;
|
||||
|
||||
FillAreaTargets(tempUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
FillAreaTargets(tempTargetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY);
|
||||
|
||||
if(m_caster != pUnitTarget && std::find(tempUnitMap.begin(),tempUnitMap.end(), m_caster) == tempUnitMap.end() )
|
||||
tempUnitMap.push_front(m_caster);
|
||||
if (m_caster != pUnitTarget && std::find(tempTargetUnitMap.begin(), tempTargetUnitMap.end(), m_caster) == tempTargetUnitMap.end())
|
||||
tempTargetUnitMap.push_front(m_caster);
|
||||
|
||||
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(pUnitTarget));
|
||||
|
||||
if(tempUnitMap.empty())
|
||||
if (tempTargetUnitMap.empty())
|
||||
break;
|
||||
|
||||
if(*tempUnitMap.begin() == pUnitTarget)
|
||||
tempUnitMap.erase(tempUnitMap.begin());
|
||||
if (*tempTargetUnitMap.begin() == pUnitTarget)
|
||||
tempTargetUnitMap.erase(tempTargetUnitMap.begin());
|
||||
|
||||
TagUnitMap.push_back(pUnitTarget);
|
||||
targetUnitMap.push_back(pUnitTarget);
|
||||
uint32 t = unMaxTargets - 1;
|
||||
Unit *prev = pUnitTarget;
|
||||
std::list<Unit*>::iterator next = tempUnitMap.begin();
|
||||
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
|
||||
|
||||
while(t && next != tempUnitMap.end() )
|
||||
while(t && next != tempTargetUnitMap.end())
|
||||
{
|
||||
if(!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS))
|
||||
break;
|
||||
|
|
@ -1982,15 +1982,15 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
|
||||
if((*next)->GetHealth() == (*next)->GetMaxHealth())
|
||||
{
|
||||
next = tempUnitMap.erase(next);
|
||||
next = tempTargetUnitMap.erase(next);
|
||||
continue;
|
||||
}
|
||||
|
||||
prev = *next;
|
||||
TagUnitMap.push_back(prev);
|
||||
tempUnitMap.erase(next);
|
||||
tempUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempUnitMap.begin();
|
||||
targetUnitMap.push_back(prev);
|
||||
tempTargetUnitMap.erase(next);
|
||||
tempTargetUnitMap.sort(TargetDistanceOrder(prev));
|
||||
next = tempTargetUnitMap.begin();
|
||||
|
||||
--t;
|
||||
}
|
||||
|
|
@ -2002,10 +2002,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
Unit* currentTarget = m_targets.getUnitTarget();
|
||||
if(currentTarget)
|
||||
{
|
||||
TagUnitMap.push_back(currentTarget);
|
||||
targetUnitMap.push_back(currentTarget);
|
||||
m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ());
|
||||
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(targetUnitMap, currentTarget->GetPositionX(), currentTarget->GetPositionY(), radius, PUSH_TARGET_CENTER, SPELL_TARGETS_AOE_DAMAGE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -2026,12 +2026,12 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
targetPlayer->getClass() == Target->getClass() &&
|
||||
!m_caster->IsHostileTo(Target) )
|
||||
{
|
||||
TagUnitMap.push_back(Target);
|
||||
targetUnitMap.push_back(Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
break;
|
||||
}
|
||||
case TARGET_TABLE_X_Y_Z_COORDINATES:
|
||||
|
|
@ -2084,7 +2084,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
pTarget->GetClosePoint(_target_x, _target_y, _target_z, pTarget->GetObjectSize(), dist, angle);
|
||||
if(pTarget->IsWithinLOS(_target_x, _target_y, _target_z))
|
||||
{
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
m_targets.setDestination(_target_x, _target_y, _target_z);
|
||||
}
|
||||
}
|
||||
|
|
@ -2114,7 +2114,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
m_targets.setDestination(x,y,m_caster->GetPositionZ());
|
||||
}
|
||||
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
|
||||
case TARGET_POINT_AT_NORTH:
|
||||
|
|
@ -2164,7 +2164,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
m_targets.setDestination(_target_x, _target_y, _target_z);
|
||||
}
|
||||
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
}
|
||||
case TARGET_EFFECT_SELECT:
|
||||
|
|
@ -2187,12 +2187,12 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
case TYPEID_UNIT:
|
||||
case TYPEID_PLAYER:
|
||||
TagUnitMap.push_back((Unit*)result);
|
||||
targetUnitMap.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);
|
||||
targetUnitMap.push_back(owner);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2208,7 +2208,7 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
}
|
||||
default:
|
||||
if (m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -2227,22 +2227,22 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
case SPELL_EFFECT_REPUTATION:
|
||||
case SPELL_EFFECT_SEND_TAXI:
|
||||
if (m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.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);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON_PLAYER:
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
|
||||
{
|
||||
Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection());
|
||||
if(target)
|
||||
TagUnitMap.push_back(target);
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
break;
|
||||
case SPELL_EFFECT_RESURRECT_NEW:
|
||||
if (m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
if (m_targets.getCorpseTargetGUID())
|
||||
{
|
||||
Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID());
|
||||
|
|
@ -2250,12 +2250,12 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
|
||||
if(owner)
|
||||
TagUnitMap.push_back(owner);
|
||||
targetUnitMap.push_back(owner);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON:
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
|
||||
case SPELL_EFFECT_TRANS_DOOR:
|
||||
|
|
@ -2265,11 +2265,11 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
case SPELL_EFFECT_FEED_PET:
|
||||
case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
|
||||
case SPELL_EFFECT_SKILL:
|
||||
TagUnitMap.push_back(m_caster);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case SPELL_EFFECT_LEARN_PET_SPELL:
|
||||
if (Pet* pet = m_caster->GetPet())
|
||||
TagUnitMap.push_back(pet);
|
||||
targetUnitMap.push_back(pet);
|
||||
break;
|
||||
case SPELL_EFFECT_ENCHANT_ITEM:
|
||||
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
|
||||
|
|
@ -2285,27 +2285,27 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
{
|
||||
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);
|
||||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
default: // apply to target in other case
|
||||
if (m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.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);
|
||||
SetTargetMap(effIndex, TARGET_AREAEFFECT_PARTY, targetUnitMap);
|
||||
break;
|
||||
case SPELL_EFFECT_SKIN_PLAYER_CORPSE:
|
||||
if (m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
else if (m_targets.getCorpseTargetGUID())
|
||||
{
|
||||
if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGUID()))
|
||||
if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()))
|
||||
TagUnitMap.push_back(owner);
|
||||
targetUnitMap.push_back(owner);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2319,40 +2319,40 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
|
|||
break;
|
||||
}
|
||||
|
||||
if (unMaxTargets && TagUnitMap.size() > unMaxTargets)
|
||||
if (unMaxTargets && targetUnitMap.size() > unMaxTargets)
|
||||
{
|
||||
// make sure one unit is always removed per iteration
|
||||
uint32 removed_utarget = 0;
|
||||
for (UnitList::iterator itr = TagUnitMap.begin(), next; itr != TagUnitMap.end(); itr = next)
|
||||
for (UnitList::iterator itr = targetUnitMap.begin(), next; itr != targetUnitMap.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
if (!*itr) continue;
|
||||
if ((*itr) == m_targets.getUnitTarget())
|
||||
{
|
||||
TagUnitMap.erase(itr);
|
||||
targetUnitMap.erase(itr);
|
||||
removed_utarget = 1;
|
||||
// break;
|
||||
}
|
||||
}
|
||||
// remove random units from the map
|
||||
while (TagUnitMap.size() > unMaxTargets - removed_utarget)
|
||||
while (targetUnitMap.size() > unMaxTargets - removed_utarget)
|
||||
{
|
||||
uint32 poz = urand(0, TagUnitMap.size()-1);
|
||||
for (UnitList::iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end(); ++itr, --poz)
|
||||
uint32 poz = urand(0, targetUnitMap.size()-1);
|
||||
for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr, --poz)
|
||||
{
|
||||
if (!*itr) continue;
|
||||
|
||||
if (!poz)
|
||||
{
|
||||
TagUnitMap.erase(itr);
|
||||
targetUnitMap.erase(itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// the player's target will always be added to the map
|
||||
if (removed_utarget && m_targets.getUnitTarget())
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
targetUnitMap.push_back(m_targets.getUnitTarget());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6142,13 +6142,13 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
|
|||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Spell::FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets )
|
||||
void Spell::FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets)
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, pushType, spellTargets);
|
||||
MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
|
|
@ -6156,7 +6156,7 @@ void Spell::FillAreaTargets( UnitList& TagUnitMap, float x, float y, float radiu
|
|||
cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap(), *m_caster, radius);
|
||||
}
|
||||
|
||||
void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster )
|
||||
void Spell::FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster)
|
||||
{
|
||||
Player *pMember = member->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
Group *pGroup = pMember ? pMember->GetGroup() : NULL;
|
||||
|
|
@ -6175,13 +6175,13 @@ void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* ce
|
|||
{
|
||||
if ((Target==center || center->IsWithinDistInMap(Target, radius)) &&
|
||||
(withcaster || Target != m_caster))
|
||||
TagUnitMap.push_back(Target);
|
||||
targetUnitMap.push_back(Target);
|
||||
|
||||
if (withPets)
|
||||
if (Pet* pet = Target->GetPet())
|
||||
if ((pet==center || center->IsWithinDistInMap(pet, radius)) &&
|
||||
(withcaster || pet != m_caster))
|
||||
TagUnitMap.push_back(pet);
|
||||
targetUnitMap.push_back(pet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6190,46 +6190,46 @@ void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* member, Unit* ce
|
|||
Unit* ownerOrSelf = pMember ? pMember : member->GetCharmerOrOwnerOrSelf();
|
||||
if ((ownerOrSelf==center || center->IsWithinDistInMap(ownerOrSelf, radius)) &&
|
||||
(withcaster || ownerOrSelf != m_caster))
|
||||
TagUnitMap.push_back(ownerOrSelf);
|
||||
targetUnitMap.push_back(ownerOrSelf);
|
||||
|
||||
if (withPets)
|
||||
if (Pet* pet = ownerOrSelf->GetPet())
|
||||
if ((pet==center || center->IsWithinDistInMap(pet, radius)) &&
|
||||
(withcaster || pet != m_caster))
|
||||
TagUnitMap.push_back(pet);
|
||||
targetUnitMap.push_back(pet);
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster )
|
||||
void Spell::FillRaidOrPartyManaPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster)
|
||||
{
|
||||
FillRaidOrPartyTargets(TagUnitMap, member, center, radius, raid, withPets, withCaster);
|
||||
FillRaidOrPartyTargets(targetUnitMap, member, center, radius, raid, withPets, withCaster);
|
||||
|
||||
PrioritizeManaUnitQueue manaUsers;
|
||||
for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && manaUsers.size() < count; ++itr)
|
||||
for(UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end() && manaUsers.size() < count; ++itr)
|
||||
if ((*itr)->getPowerType() == POWER_MANA && !(*itr)->isDead())
|
||||
manaUsers.push(PrioritizeManaUnitWraper(*itr));
|
||||
|
||||
TagUnitMap.clear();
|
||||
targetUnitMap.clear();
|
||||
while(!manaUsers.empty())
|
||||
{
|
||||
TagUnitMap.push_back(manaUsers.top().getUnit());
|
||||
targetUnitMap.push_back(manaUsers.top().getUnit());
|
||||
manaUsers.pop();
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster )
|
||||
void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster)
|
||||
{
|
||||
FillRaidOrPartyTargets(TagUnitMap, member, center, radius, raid, withPets, withCaster);
|
||||
FillRaidOrPartyTargets(targetUnitMap, member, center, radius, raid, withPets, withCaster);
|
||||
|
||||
PrioritizeHealthUnitQueue healthQueue;
|
||||
for(UnitList::const_iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end() && healthQueue.size() < count; ++itr)
|
||||
for(UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end() && healthQueue.size() < count; ++itr)
|
||||
if (!(*itr)->isDead())
|
||||
healthQueue.push(PrioritizeHealthUnitWraper(*itr));
|
||||
|
||||
TagUnitMap.clear();
|
||||
targetUnitMap.clear();
|
||||
while(!healthQueue.empty())
|
||||
{
|
||||
TagUnitMap.push_back(healthQueue.top().getUnit());
|
||||
targetUnitMap.push_back(healthQueue.top().getUnit());
|
||||
healthQueue.pop();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -372,12 +372,12 @@ class Spell
|
|||
|
||||
typedef std::list<Unit*> UnitList;
|
||||
void FillTargetMap();
|
||||
void SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap);
|
||||
void SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList &targetUnitMap);
|
||||
|
||||
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 FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
|
||||
void FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
|
||||
void FillAreaTargets(UnitList &targetUnitMap, float x, float y, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets);
|
||||
void FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster);
|
||||
void FillRaidOrPartyManaPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster);
|
||||
void FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster);
|
||||
|
||||
template<typename T> WorldObject* FindCorpseUsing();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9082"
|
||||
#define REVISION_NR "9083"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue