From ef0b29dc8e43ce9f98f1385b907df87587dc38bb Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Thu, 2 Apr 2020 12:03:45 -0400 Subject: [PATCH] Update entity.cpp --- zone/entity.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/zone/entity.cpp b/zone/entity.cpp index b13fb5649..0e93be722 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3294,6 +3294,36 @@ void EntityList::ClearAggro(Mob* targ) } } +//removes "targ" from all hate lists of mobs that are water only. +//water only mobs that are fleed from to another region are healed as per live +void EntityList::ClearWaterAggro(Mob* targ) +{ + Client *c = nullptr; + if (targ->IsClient()) + c = targ->CastToClient(); + auto it = npc_list.begin(); + while (it != npc_list.end()) { + if (it->second->IsUnderwaterOnly()) { + if (it->second->CheckAggro(targ)) { + if (c) + c->RemoveXTarget(it->second, false); + it->second->RemoveFromHateList(targ); + } + if (c && it->second->IsOnFeignMemory(c)) { + it->second->RemoveFromFeignMemory(c); //just in case we feigned + c->RemoveXTarget(it->second, false); + } + if (!it->second->GetHateTop()) { + // target fled the water and no other targets. + // Heal NPC as on live + it->second->Heal(); + } + } + ++it; + } +} + + void EntityList::ClearFeignAggro(Mob *targ) { auto it = npc_list.begin();