📄 skill.cpp.svn-base
字号:
}break;
case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER:
{
CellPair p(VENICE::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
VENICE::SKILLSNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_SELF_CENTER,SKILLS_TARGETS_FRIENDLY);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
}break;
case TARGET_GAMEOBJECT:
{
if(m_targets.getGOTarget())
AddGOTarget(m_targets.getGOTarget(), i);
}break;
case TARGET_IN_FRONT_OF_CASTER:
{
CellPair p(VENICE::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
VENICE::SKILLSNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_IN_FRONT,SKILLS_TARGETS_AOE_DAMAGE);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
}break;
case TARGET_DUELVSPLAYER:
{
Unit *target = m_targets.getUnitTarget();
if(target)
{
if(m_caster->IsFriendlyTo(target))
{
TagUnitMap.push_back(target);
}
else
{
Unit* pUnitTarget = SelectMagnetTarget();
if(pUnitTarget)
TagUnitMap.push_back(pUnitTarget);
}
}
}break;
case TARGET_GAMEOBJECT_ITEM:
{
if(m_targets.getGOTargetGUID())
AddGOTarget(m_targets.getGOTarget(), i);
else if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
break;
}
case TARGET_MASTER:
{
Unit* owner = m_caster->GetCharmerOrOwner();
if(owner)
TagUnitMap.push_back(owner);
break;
}
case TARGET_ALL_ENEMY_IN_AREA_CHANNELED:
{
// targets the AREA, not the units in the area
if (m_SKILLSInfo->Effect[i]!=SKILLS_EFFECT_PERSISTENT_AREA_AURA)
{
CellPair p(VENICE::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
VENICE::SKILLSNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, PUSH_DEST_CENTER,SKILLS_TARGETS_AOE_DAMAGE);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
}
}break;
case TARGET_MINION:
{
if(m_SKILLSInfo->Effect[i] != SKILLS_EFFECT_DUEL)
TagUnitMap.push_back(m_caster);
}break;
case TARGET_SINGLE_ENEMY:
{
Unit* pUnitTarget = SelectMagnetTarget();
if(pUnitTarget)
TagUnitMap.push_back(pUnitTarget);
}break;
case TARGET_AREAEFFECT_PARTY:
{
Unit* owner = m_caster->GetCharmerOrOwner();
Player *pTarget = NULL;
if(owner)
{
TagUnitMap.push_back(m_caster);
if(owner->GetTypeId() == TYPEID_PLAYER)
pTarget = (Player*)owner;
}
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if(Unit* target = m_targets.getUnitTarget())
{
if( target->GetTypeId() != TYPEID_PLAYER)
{
if(((Creature*)target)->isPet())
{
Unit *targetOwner = target->GetOwner();
if(targetOwner->GetTypeId() == TYPEID_PLAYER)
pTarget = (Player*)targetOwner;
}
}
else
pTarget = (Player*)target;
}
}
Group* pGroup = pTarget ? pTarget->GetGroup() : NULL;
if(pGroup)
{
uint8 subgroup = pTarget->GetSubGroup();
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
// IsHostileTo check duel and controlled by enemy
if(Target && Target->GetSubGroup()==subgroup && !m_caster->IsHostileTo(Target))
{
if( pTarget->IsWithinDistInMap(Target, radius) )
TagUnitMap.push_back(Target);
if(Pet* pet = Target->GetPet())
if( pTarget->IsWithinDistInMap(pet, radius) )
TagUnitMap.push_back(pet);
}
}
}
else if (owner)
{
if(m_caster->IsWithinDistInMap(owner, radius))
TagUnitMap.push_back(owner);
}
else if(pTarget)
{
TagUnitMap.push_back(pTarget);
if(Pet* pet = pTarget->GetPet())
if( m_caster->IsWithinDistInMap(pet, radius) )
TagUnitMap.push_back(pet);
}
}break;
case TARGET_SCRIPT:
{
if(m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
if(m_targets.getItemTarget())
AddItemTarget(m_targets.getItemTarget(), i);
}break;
case TARGET_SELF_FISHING:
{
TagUnitMap.push_back(m_caster);
}break;
case TARGET_CHAIN_HEAL:
{
Unit* pUnitTarget = m_targets.getUnitTarget();
if(!pUnitTarget)
break;
if (m_SKILLSInfo->EffectChainTarget[i] <= 1)
TagUnitMap.push_back(pUnitTarget);
else
{
unMaxTargets = m_SKILLSInfo->EffectChainTarget[i];
float max_range = radius + unMaxTargets * CHAIN_SKILLS_JUMP_RADIUS;
std::list<Unit *> tempUnitMap;
{
CellPair p(VENICE::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
VENICE::SKILLSNotifierCreatureAndPlayer notifier(*this, tempUnitMap, max_range, PUSH_SELF_CENTER, SKILLS_TARGETS_FRIENDLY);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, WorldTypeMapContainer > world_object_notifier(notifier);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
}
if(m_caster != pUnitTarget && std::find(tempUnitMap.begin(),tempUnitMap.end(),m_caster) == tempUnitMap.end() )
tempUnitMap.push_front(m_caster);
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
if(tempUnitMap.empty())
break;
if(*tempUnitMap.begin() == pUnitTarget)
tempUnitMap.erase(tempUnitMap.begin());
TagUnitMap.push_back(pUnitTarget);
uint32 t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempUnitMap.begin();
while(t && next != tempUnitMap.end() )
{
if(prev->GetDistanceSq(*next) > CHAIN_SKILLS_JUMP_RADIUS * CHAIN_SKILLS_JUMP_RADIUS)
break;
if(!prev->IsWithinLOSInMap(*next))
{
++next;
continue;
}
if((*next)->GetHealth() == (*next)->GetMaxHealth())
{
next = tempUnitMap.erase(next);
continue;
}
prev = *next;
TagUnitMap.push_back(prev);
tempUnitMap.erase(next);
tempUnitMap.sort(TargetDistanceOrder(prev));
next = tempUnitMap.begin();
--t;
}
}
}break;
case TARGET_CURRENT_SELECTED_ENEMY:
{
Unit* currentTarget = m_targets.getUnitTarget();
if(currentTarget)
{
TagUnitMap.push_back(currentTarget);
if(m_SKILLSInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA_INSTANT)
{
CellPair p(VENICE::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
VENICE::SKILLSNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius,PUSH_TARGET_CENTER, SKILLS_TARGETS_AOE_DAMAGE);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier);
TypeContainerVisitor<VENICE::SKILLSNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_notifier, *MapManager::AREA().GetMap(m_caster->GetMapId(), m_caster));
}
}
}break;
case TARGET_AREAEFFECT_PARTY_AND_CLASS:
{
Player* targetPlayer = m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER
? (Player*)m_targets.getUnitTarget() : NULL;
Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL;
if(pGroup)
{
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->getSource();
// IsHostileTo check duel and controlled by enemy
if( Target && targetPlayer->IsWithinDistInMap(Target, radius) &&
targetPlayer->getClass() == Target->getClass() &&
!m_caster->IsHostileTo(Target) )
{
TagUnitMap.push_back(Target);
}
}
}
else if(m_targets.getUnitTarget())
TagUnitMap.push_back(m_targets.getUnitTarget());
break;
}
default:
break;
}
if (unMaxTargets && TagUnitMap.size() > unMaxTargets)
{
// make sure one unit is always removed per iteration
uint32 removed_utarget = 0;
for (std::list<Unit*>::iterator itr = TagUnitMap.begin(), next; itr != TagUnitMap.end(); itr = next)
{
next = itr;
++next;
if (!*itr) continue;
if ((*itr) == m_targets.getUnitTarget())
{
TagUnitMap.erase(itr);
removed_utarget = 1;
// break;
}
}
// remove random units from the map
while (TagUnitMap.size() > unMaxTargets - removed_utarget)
{
uint32 poz = urand(0, TagUnitMap.size()-1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -