Merge branch 'master' into raycast

This commit is contained in:
KimLS
2014-04-27 14:36:05 -07:00
96 changed files with 3391 additions and 745 deletions
+26 -24
View File
@@ -3016,6 +3016,7 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
{
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;
@@ -3025,11 +3026,13 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
continue;
}
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
npc_sub_list.push_back(cur);
++count;
}
++it;
}
if (thedam > 1) {
if (count > 0)
thedam /= count;
@@ -3039,32 +3042,26 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
}
cur = nullptr;
it = npc_list.begin();
while (it != npc_list.end()) {
cur = it->second;
if (!cur->CheckAggro(target)) {
++it;
continue;
}
auto sit = npc_sub_list.begin();
while (sit != npc_sub_list.end()) {
cur = *sit;
if (!cur->IsMezzed() && !cur->IsStunned() && !cur->IsFeared()) {
if (cur->IsPet()) {
if (caster) {
if (cur->CheckAggro(caster)) {
cur->AddToHateList(caster, thedam);
}
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);
}
}
} else {
if (caster) {
if (cur->CheckAggro(caster)) {
cur->AddToHateList(caster, thedam);
} else {
cur->AddToHateList(caster, thedam * 0.33);
}
}
}
++it;
++sit;
}
}
@@ -3418,9 +3415,14 @@ void EntityList::ReloadAllClientsTaskState(int TaskID)
bool EntityList::IsMobInZone(Mob *who)
{
auto it = mob_list.find(who->GetID());
if (it != mob_list.end())
return who == it->second;
//We don't use mob_list.find(who) because this code needs to be able to handle dangling pointers for the quest code.
auto it = mob_list.begin();
while(it != mob_list.end()) {
if(it->second == who) {
return true;
}
++it;
}
return false;
}