This commit is contained in:
Michael Cook (mackal)
2015-07-16 22:38:32 -04:00
parent 417b034273
commit a52ab7ae48
10 changed files with 169 additions and 203 deletions
+13 -45
View File
@@ -3068,56 +3068,24 @@ bool EntityList::Fighting(Mob *targ)
return false;
}
void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 hate)
{
NPC *cur = nullptr;
uint16 count = 0;
std::list<NPC *> npc_sub_list;
auto it = npc_list.begin();
while (it != npc_list.end()) {
cur = it->second;
if (hate == 0)
return;
if (!cur->CheckAggro(target)) {
++it;
for (auto &e : npc_list) {
auto &npc = e.second;
if (!npc->CheckAggro(target) || npc->IsFeared())
continue;
}
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
npc_sub_list.push_back(cur);
++count;
}
++it;
}
if (zone->random.Roll(15)) // witness check -- place holder
// This is either a level check (con color check?) or a stat roll
continue;
if (thedam > 1) {
if (count > 0)
thedam /= count;
if (thedam < 1)
thedam = 1;
}
cur = nullptr;
auto sit = npc_sub_list.begin();
while (sit != npc_sub_list.end()) {
cur = *sit;
if (cur->IsPet()) {
if (caster) {
if (cur->CheckAggro(caster)) {
cur->AddToHateList(caster, thedam);
}
}
} else {
if (caster) {
if (cur->CheckAggro(caster)) {
cur->AddToHateList(caster, thedam);
} else {
cur->AddToHateList(caster, thedam * 0.33);
}
}
}
++sit;
if ((npc->IsMezzed() || npc->IsStunned()) && hate > 4) // patch notes say stunned/mezzed NPCs get a fraction of the hate
npc->AddToHateList(caster, hate / 4); // made up number
else
npc->AddToHateList(caster, hate);
}
}