mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 16:31:29 +00:00
Added swarm pet checks to viral spreading function.
This commit is contained in:
parent
adb8175654
commit
3247137ef2
@ -4614,7 +4614,7 @@ Client *EntityList::FindCorpseDragger(uint16 CorpseID)
|
|||||||
|
|
||||||
Mob *EntityList::GetTargetForVirus(Mob *spreader, int range)
|
Mob *EntityList::GetTargetForVirus(Mob *spreader, int range)
|
||||||
{
|
{
|
||||||
int max_spread_range = RuleI(Spells, VirusSpreadDistance);
|
int max_spread_range = RuleI(Spells, VirusSpreadDistance);
|
||||||
|
|
||||||
if (range)
|
if (range)
|
||||||
max_spread_range = range;
|
max_spread_range = range;
|
||||||
@ -4623,34 +4623,38 @@ Mob *EntityList::GetTargetForVirus(Mob *spreader, int range)
|
|||||||
|
|
||||||
auto it = mob_list.begin();
|
auto it = mob_list.begin();
|
||||||
while (it != mob_list.end()) {
|
while (it != mob_list.end()) {
|
||||||
|
Mob *cur = it->second;
|
||||||
// Make sure the target is in range, has los and is not the mob doing the spreading
|
// Make sure the target is in range, has los and is not the mob doing the spreading
|
||||||
if ((it->second->GetID() != spreader->GetID()) &&
|
if ((cur->GetID() != spreader->GetID()) &&
|
||||||
(it->second->CalculateDistance(spreader->GetX(), spreader->GetY(),
|
(cur->CalculateDistance(spreader->GetX(), spreader->GetY(),
|
||||||
spreader->GetZ()) <= max_spread_range) &&
|
spreader->GetZ()) <= max_spread_range) &&
|
||||||
(spreader->CheckLosFN(it->second))) {
|
(spreader->CheckLosFN(cur))) {
|
||||||
// If the spreader is an npc it can only spread to other npc controlled mobs
|
// If the spreader is an npc it can only spread to other npc controlled mobs
|
||||||
if (spreader->IsNPC() && !spreader->IsPet() && it->second->IsNPC()) {
|
if (spreader->IsNPC() && !spreader->IsPet() && !spreader->CastToNPC()->GetSwarmOwner() && cur->IsNPC()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
}
|
}
|
||||||
// If the spreader is an npc controlled pet it can spread to any other npc or an npc controlled pet
|
// If the spreader is an npc controlled pet it can spread to any other npc or an npc controlled pet
|
||||||
else if (spreader->IsNPC() && spreader->IsPet() && spreader->GetOwner()->IsNPC()) {
|
else if (spreader->IsNPC() && spreader->IsPet() && spreader->GetOwner()->IsNPC()) {
|
||||||
if (it->second->IsNPC() && !it->second->IsPet()) {
|
if (cur->IsNPC() && !cur->IsPet()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
} else if (it->second->IsNPC() && it->second->IsPet() && it->second->GetOwner()->IsNPC()) {
|
} else if (cur->IsNPC() && cur->IsPet() && cur->GetOwner()->IsNPC()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
|
}
|
||||||
|
else if (cur->IsNPC() && cur->CastToNPC()->GetSwarmOwner() && cur->GetOwner()->IsNPC()) {
|
||||||
|
TargetsInRange.push_back(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the spreader is anything else(bot, pet, etc) then it should spread to everything but non client controlled npcs
|
// if the spreader is anything else(bot, pet, etc) then it should spread to everything but non client controlled npcs
|
||||||
else if (!spreader->IsNPC() && !it->second->IsNPC()) {
|
else if (!spreader->IsNPC() && !cur->IsNPC()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
}
|
}
|
||||||
// if its a pet we need to determine appropriate targets(pet to client, pet to pet, pet to bot, etc)
|
// if its a pet we need to determine appropriate targets(pet to client, pet to pet, pet to bot, etc)
|
||||||
else if (spreader->IsNPC() && spreader->IsPet() && !spreader->GetOwner()->IsNPC()) {
|
else if (spreader->IsNPC() && (spreader->IsPet() || spreader->CastToNPC()->GetSwarmOwner()) && !spreader->GetOwner()->IsNPC()) {
|
||||||
if (!it->second->IsNPC()) {
|
if (!cur->IsNPC()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
}
|
}
|
||||||
else if (it->second->IsNPC() && it->second->IsPet() && !it->second->GetOwner()->IsNPC()) {
|
else if (cur->IsNPC() && (cur->IsPet() || cur->CastToNPC()->GetSwarmOwner()) && !cur->GetOwner()->IsNPC()) {
|
||||||
TargetsInRange.push_back(it->second);
|
TargetsInRange.push_back(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user