Re-Push Refactoring changes before without broken functionality

This commit is contained in:
Akkadius 2014-12-27 23:44:15 -06:00
parent 4f65066274
commit 18f9a06f06
6 changed files with 127 additions and 146 deletions

View File

@ -3424,7 +3424,7 @@ void Bot::AI_Process() {
if(IsRooted()) if(IsRooted())
SetTarget(hate_list.GetClosestEntOnHateList(this)); SetTarget(hate_list.GetClosestEntOnHateList(this));
else else
SetTarget(hate_list.GetEntWithMostHateInRange(this)); SetTarget(hate_list.GetEntWithMostHateOnList(this));
if(!GetTarget()) if(!GetTarget())
return; return;
@ -3793,7 +3793,7 @@ void Bot::PetAIProcess() {
if (botPet->IsRooted()) if (botPet->IsRooted())
botPet->SetTarget(hate_list.GetClosestEntOnHateList(botPet)); botPet->SetTarget(hate_list.GetClosestEntOnHateList(botPet));
else else
botPet->SetTarget(hate_list.GetEntWithMostHateInRange(botPet)); botPet->SetTarget(hate_list.GetEntWithMostHateOnList(botPet));
// Let's check if we have a los with our target. // Let's check if we have a los with our target.
// If we don't, our hate_list is wiped. // If we don't, our hate_list is wiped.

View File

@ -36,7 +36,7 @@ extern Zone *zone;
HateList::HateList() HateList::HateList()
{ {
owner = nullptr; hate_owner = nullptr;
} }
HateList::~HateList() HateList::~HateList()
@ -65,7 +65,7 @@ void HateList::WipeHateList()
Mob* m = (*iterator)->entity_on_hatelist; Mob* m = (*iterator)->entity_on_hatelist;
if (m) if (m)
{ {
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), m, "0", 0);
if (m->IsClient()) if (m->IsClient())
m->CastToClient()->DecrementAggroCount(); m->CastToClient()->DecrementAggroCount();
@ -83,27 +83,27 @@ bool HateList::IsEntOnHateList(Mob *mob)
return false; return false;
} }
struct_HateList *HateList::Find(Mob *ent) struct_HateList *HateList::Find(Mob *in_entity)
{ {
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) while (iterator != list.end())
{ {
if ((*iterator)->entity_on_hatelist == ent) if ((*iterator)->entity_on_hatelist == in_entity)
return (*iterator); return (*iterator);
++iterator; ++iterator;
} }
return nullptr; return nullptr;
} }
void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_dam) void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_damage)
{ {
struct_HateList *p = Find(other); struct_HateList *entity = Find(other);
if (p) if (entity)
{ {
if (in_dam > 0) if (in_damage > 0)
p->hatelist_damage = in_dam; entity->hatelist_damage = in_damage;
if (in_hate > 0) if (in_hate > 0)
p->stored_hate_amount = in_hate; entity->stored_hate_amount = in_hate;
} }
} }
@ -153,14 +153,14 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater)
Mob* HateList::GetClosestEntOnHateList(Mob *hater) { Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
Mob* close = nullptr; Mob* close = nullptr;
float closedist = 99999.9f; float close_distance = 99999.9f;
float thisdist; float this_distance;
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) { while (iterator != list.end()) {
thisdist = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater);
if ((*iterator)->entity_on_hatelist != nullptr && thisdist <= closedist) { if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) {
closedist = thisdist; close_distance = this_distance;
close = (*iterator)->entity_on_hatelist; close = (*iterator)->entity_on_hatelist;
} }
++iterator; ++iterator;
@ -172,62 +172,60 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) {
return close; return close;
} }
void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzied, bool iAddIfNotExist)
// a few comments added, rearranged code for readability
void HateList::AddEntToHateList(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist)
{ {
if (!ent) if (!in_entity)
return; return;
if (ent->IsCorpse()) if (in_entity->IsCorpse())
return; return;
if (ent->IsClient() && ent->CastToClient()->IsDead()) if (in_entity->IsClient() && in_entity->CastToClient()->IsDead())
return; return;
struct_HateList *p = Find(ent); struct_HateList *entity = Find(in_entity);
if (p) if (entity)
{ {
p->hatelist_damage += (in_dam >= 0) ? in_dam : 0; entity->hatelist_damage += (in_damage >= 0) ? in_damage : 0;
p->stored_hate_amount += in_hate; entity->stored_hate_amount += in_hate;
p->is_entity_frenzy = bFrenzy; entity->is_entity_frenzy = in_is_entity_frenzied;
} }
else if (iAddIfNotExist) { else if (iAddIfNotExist) {
p = new struct_HateList; entity = new struct_HateList;
p->entity_on_hatelist = ent; entity->entity_on_hatelist = in_entity;
p->hatelist_damage = (in_dam >= 0) ? in_dam : 0; entity->hatelist_damage = (in_damage >= 0) ? in_damage : 0;
p->stored_hate_amount = in_hate; entity->stored_hate_amount = in_hate;
p->is_entity_frenzy = bFrenzy; entity->is_entity_frenzy = in_is_entity_frenzied;
list.push_back(p); list.push_back(entity);
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "1", 0);
if (ent->IsClient()) { if (in_entity->IsClient()) {
if (owner->CastToNPC()->IsRaidTarget()) if (hate_owner->CastToNPC()->IsRaidTarget())
ent->CastToClient()->SetEngagedRaidTarget(true); in_entity->CastToClient()->SetEngagedRaidTarget(true);
ent->CastToClient()->IncrementAggroCount(); in_entity->CastToClient()->IncrementAggroCount();
} }
} }
} }
bool HateList::RemoveEntFromHateList(Mob *ent) bool HateList::RemoveEntFromHateList(Mob *in_entity)
{ {
if (!ent) if (!in_entity)
return false; return false;
bool found = false; bool is_found = false;
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) while (iterator != list.end())
{ {
if ((*iterator)->entity_on_hatelist == ent) if ((*iterator)->entity_on_hatelist == in_entity)
{ {
if (ent) if (in_entity)
parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "0", 0);
found = true; is_found = true;
if (ent && ent->IsClient()) if (in_entity && in_entity->IsClient())
ent->CastToClient()->DecrementAggroCount(); in_entity->CastToClient()->DecrementAggroCount();
delete (*iterator); delete (*iterator);
iterator = list.erase(iterator); iterator = list.erase(iterator);
@ -236,24 +234,24 @@ bool HateList::RemoveEntFromHateList(Mob *ent)
else else
++iterator; ++iterator;
} }
return found; return is_found;
} }
void HateList::DoFactionHits(int32 nfl_id) { void HateList::DoFactionHits(int32 npc_faction_level_id) {
if (nfl_id <= 0) if (npc_faction_level_id <= 0)
return; return;
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) while (iterator != list.end())
{ {
Client *p; Client *client;
if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient())
p = (*iterator)->entity_on_hatelist->CastToClient(); client = (*iterator)->entity_on_hatelist->CastToClient();
else else
p = nullptr; client = nullptr;
if (p) if (client)
p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity()); client->SetFactionLevel(client->CharacterID(), npc_faction_level_id, client->GetBaseClass(), client->GetBaseRace(), client->GetDeity());
++iterator; ++iterator;
} }
} }
@ -262,43 +260,43 @@ int HateList::GetSummonedPetCountOnHateList(Mob *hater) {
//Function to get number of 'Summoned' pets on a targets hate list to allow calculations for certian spell effects. //Function to get number of 'Summoned' pets on a targets hate list to allow calculations for certian spell effects.
//Unclear from description that pets are required to be 'summoned body type'. Will not require at this time. //Unclear from description that pets are required to be 'summoned body type'. Will not require at this time.
int petcount = 0; int pet_count = 0;
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) { while (iterator != list.end()) {
if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0))) if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0)))
{ {
++petcount; ++pet_count;
} }
++iterator; ++iterator;
} }
return petcount; return pet_count;
} }
Mob *HateList::GetEntWithMostHateInRange(Mob *center) Mob *HateList::GetEntWithMostHateOnList(Mob *center)
{ {
// hack fix for zone shutdown crashes on some servers // hack fix for zone shutdown crashes on some servers
if (!zone->IsLoaded()) if (!zone->IsLoaded())
return nullptr; return nullptr;
Mob* top = nullptr; Mob* top_hate = nullptr;
int32 hate = -1; int32 hate = -1;
if (center == nullptr) if (center == nullptr)
return nullptr; return nullptr;
if (RuleB(Aggro, SmartAggroList)){ if (RuleB(Aggro, SmartAggroList)){
Mob* topClientTypeInRange = nullptr; Mob* top_client_type_in_range = nullptr;
int32 hateClientTypeInRange = -1; int32 hate_client_type_in_range = -1;
int skipped_count = 0; int skipped_count = 0;
auto iterator = list.begin(); auto iterator = list.begin();
while (iterator != list.end()) while (iterator != list.end())
{ {
struct_HateList *cur = (*iterator); struct_HateList *cur = (*iterator);
int16 aggroMod = 0; int16 aggro_mod = 0;
if (!cur){ if (!cur){
++iterator; ++iterator;
@ -321,7 +319,7 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center)
if (cur->entity_on_hatelist->Sanctuary()) { if (cur->entity_on_hatelist->Sanctuary()) {
if (hate == -1) if (hate == -1)
{ {
top = cur->entity_on_hatelist; top_hate = cur->entity_on_hatelist;
hate = 1; hate = 1;
} }
++iterator; ++iterator;
@ -331,32 +329,32 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center)
if (cur->entity_on_hatelist->DivineAura() || cur->entity_on_hatelist->IsMezzed() || cur->entity_on_hatelist->IsFeared()){ if (cur->entity_on_hatelist->DivineAura() || cur->entity_on_hatelist->IsMezzed() || cur->entity_on_hatelist->IsFeared()){
if (hate == -1) if (hate == -1)
{ {
top = cur->entity_on_hatelist; top_hate = cur->entity_on_hatelist;
hate = 0; hate = 0;
} }
++iterator; ++iterator;
continue; continue;
} }
int32 currentHate = cur->stored_hate_amount; int32 current_hate = cur->stored_hate_amount;
if (cur->entity_on_hatelist->IsClient()){ if (cur->entity_on_hatelist->IsClient()){
if (cur->entity_on_hatelist->CastToClient()->IsSitting()){ if (cur->entity_on_hatelist->CastToClient()->IsSitting()){
aggroMod += RuleI(Aggro, SittingAggroMod); aggro_mod += RuleI(Aggro, SittingAggroMod);
} }
if (center){ if (center){
if (center->GetTarget() == cur->entity_on_hatelist) if (center->GetTarget() == cur->entity_on_hatelist)
aggroMod += RuleI(Aggro, CurrentTargetAggroMod); aggro_mod += RuleI(Aggro, CurrentTargetAggroMod);
if (RuleI(Aggro, MeleeRangeAggroMod) != 0) if (RuleI(Aggro, MeleeRangeAggroMod) != 0)
{ {
if (center->CombatRange(cur->entity_on_hatelist)){ if (center->CombatRange(cur->entity_on_hatelist)){
aggroMod += RuleI(Aggro, MeleeRangeAggroMod); aggro_mod += RuleI(Aggro, MeleeRangeAggroMod);
if (currentHate > hateClientTypeInRange || cur->is_entity_frenzy){ if (current_hate > hate_client_type_in_range || cur->is_entity_frenzy){
hateClientTypeInRange = currentHate; hate_client_type_in_range = current_hate;
topClientTypeInRange = cur->entity_on_hatelist; top_client_type_in_range = cur->entity_on_hatelist;
} }
} }
} }
@ -366,67 +364,67 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center)
else{ else{
if (center){ if (center){
if (center->GetTarget() == cur->entity_on_hatelist) if (center->GetTarget() == cur->entity_on_hatelist)
aggroMod += RuleI(Aggro, CurrentTargetAggroMod); aggro_mod += RuleI(Aggro, CurrentTargetAggroMod);
if (RuleI(Aggro, MeleeRangeAggroMod) != 0) if (RuleI(Aggro, MeleeRangeAggroMod) != 0)
{ {
if (center->CombatRange(cur->entity_on_hatelist)){ if (center->CombatRange(cur->entity_on_hatelist)){
aggroMod += RuleI(Aggro, MeleeRangeAggroMod); aggro_mod += RuleI(Aggro, MeleeRangeAggroMod);
} }
} }
} }
} }
if (cur->entity_on_hatelist->GetMaxHP() != 0 && ((cur->entity_on_hatelist->GetHP() * 100 / cur->entity_on_hatelist->GetMaxHP()) < 20)){ if (cur->entity_on_hatelist->GetMaxHP() != 0 && ((cur->entity_on_hatelist->GetHP() * 100 / cur->entity_on_hatelist->GetMaxHP()) < 20)){
aggroMod += RuleI(Aggro, CriticallyWoundedAggroMod); aggro_mod += RuleI(Aggro, CriticallyWoundedAggroMod);
} }
if (aggroMod){ if (aggro_mod){
currentHate += (currentHate * aggroMod / 100); current_hate += (current_hate * aggro_mod / 100);
} }
if (currentHate > hate || cur->is_entity_frenzy){ if (current_hate > hate || cur->is_entity_frenzy){
hate = currentHate; hate = current_hate;
top = cur->entity_on_hatelist; top_hate = cur->entity_on_hatelist;
} }
++iterator; ++iterator;
} }
if (topClientTypeInRange != nullptr && top != nullptr) { if (top_client_type_in_range != nullptr && top_hate != nullptr) {
bool isTopClientType = top->IsClient(); bool isTopClientType = top_hate->IsClient();
#ifdef BOTS #ifdef BOTS
if (!isTopClientType) { if (!isTopClientType) {
if (top->IsBot()) { if (top_hate->IsBot()) {
isTopClientType = true; isTopClientType = true;
topClientTypeInRange = top; top_client_type_in_range = top_hate;
} }
} }
#endif //BOTS #endif //BOTS
if (!isTopClientType) { if (!isTopClientType) {
if (top->IsMerc()) { if (top_hate->IsMerc()) {
isTopClientType = true; isTopClientType = true;
topClientTypeInRange = top; top_client_type_in_range = top_hate;
} }
} }
if (!isTopClientType) { if (!isTopClientType) {
if (top->GetSpecialAbility(ALLOW_TO_TANK)){ if (top_hate->GetSpecialAbility(ALLOW_TO_TANK)){
isTopClientType = true; isTopClientType = true;
topClientTypeInRange = top; top_client_type_in_range = top_hate;
} }
} }
if (!isTopClientType) if (!isTopClientType)
return topClientTypeInRange ? topClientTypeInRange : nullptr; return top_client_type_in_range ? top_client_type_in_range : nullptr;
return top ? top : nullptr; return top_hate ? top_hate : nullptr;
} }
else { else {
if (top == nullptr && skipped_count > 0) { if (top_hate == nullptr && skipped_count > 0) {
return center->GetTarget() ? center->GetTarget() : nullptr; return center->GetTarget() ? center->GetTarget() : nullptr;
} }
return top ? top : nullptr; return top_hate ? top_hate : nullptr;
} }
} }
else{ else{
@ -445,20 +443,20 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center)
if (cur->entity_on_hatelist != nullptr && ((cur->stored_hate_amount > hate) || cur->is_entity_frenzy)) if (cur->entity_on_hatelist != nullptr && ((cur->stored_hate_amount > hate) || cur->is_entity_frenzy))
{ {
top = cur->entity_on_hatelist; top_hate = cur->entity_on_hatelist;
hate = cur->stored_hate_amount; hate = cur->stored_hate_amount;
} }
++iterator; ++iterator;
} }
if (top == nullptr && skipped_count > 0) { if (top_hate == nullptr && skipped_count > 0) {
return center->GetTarget() ? center->GetTarget() : nullptr; return center->GetTarget() ? center->GetTarget() : nullptr;
} }
return top ? top : nullptr; return top_hate ? top_hate : nullptr;
} }
return nullptr; return nullptr;
} }
Mob *HateList::GetEntWithMostHateInRange(){ Mob *HateList::GetEntWithMostHateOnList(){
Mob* top = nullptr; Mob* top = nullptr;
int32 hate = -1; int32 hate = -1;
@ -499,26 +497,24 @@ Mob *HateList::GetRandomEntOnHateList()
return (*iterator)->entity_on_hatelist; return (*iterator)->entity_on_hatelist;
} }
int32 HateList::GetEntHateAmount(Mob *ent, bool damage) int32 HateList::GetEntHateAmount(Mob *in_entity, bool damage)
{ {
struct_HateList *p; struct_HateList *entity;
p = Find(ent); entity = Find(in_entity);
if (p && damage) if (entity && damage)
return p->hatelist_damage; return entity->hatelist_damage;
else if (p) else if (entity)
return p->stored_hate_amount; return entity->stored_hate_amount;
else else
return 0; return 0;
} }
//looking for any mob with hate > -1
bool HateList::IsHateListEmpty() { bool HateList::IsHateListEmpty() {
return(list.size() == 0); return(list.size() == 0);
} }
// Prints hate list to a client
void HateList::PrintHateListToClient(Client *c) void HateList::PrintHateListToClient(Client *c)
{ {
auto iterator = list.begin(); auto iterator = list.begin();

View File

@ -38,53 +38,38 @@ public:
HateList(); HateList();
~HateList(); ~HateList();
// adds a mob to the hatelist
void AddEntToHateList(Mob *ent, int32 in_hate = 0, int32 in_dam = 0, bool bFrenzy = false, bool iAddIfNotExist = true);
// sets existing hate
void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam);
// removes mobs from hatelist
bool RemoveEntFromHateList(Mob *ent);
// Remove all
void WipeHateList();
// ???
void DoFactionHits(int32 nfl_id);
// Gets Hate amount for mob
int32 GetEntHateAmount(Mob *ent, bool damage = false);
// gets top hated mob
Mob *GetEntWithMostHateInRange(Mob *center);
// gets any on the list
Mob *GetRandomEntOnHateList();
// get closest mob or nullptr if list empty
Mob *GetClosestEntOnHateList(Mob *hater); Mob *GetClosestEntOnHateList(Mob *hater);
// gets top mob or nullptr if hate list empty
Mob *GetDamageTopOnHateList(Mob *hater); Mob *GetDamageTopOnHateList(Mob *hater);
// used to check if mob is on hatelist Mob *GetEntWithMostHateOnList(Mob *center);
Mob *GetRandomEntOnHateList();
Mob* GetEntWithMostHateOnList();
bool IsEntOnHateList(Mob *); bool IsEntOnHateList(Mob *);
// used to remove or add frenzy hate bool IsHateListEmpty();
void IsEntityInFrenzyMode(); bool RemoveEntFromHateList(Mob *ent);
//Gets the target with the most hate regardless of things like frenzy etc.
Mob* GetEntWithMostHateInRange();
// Count 'Summoned' pets on hatelist
int GetSummonedPetCountOnHateList(Mob *hater);
int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts);
int GetSummonedPetCountOnHateList(Mob *hater);
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); int32 GetEntHateAmount(Mob *ent, bool in_damage = false);
bool IsHateListEmpty();
void PrintHateListToClient(Client *c);
//For accessing the hate list via perl; don't use for anything else
std::list<struct_HateList*>& GetHateList() { return list; } std::list<struct_HateList*>& GetHateList() { return list; }
//setting owner void AddEntToHateList(Mob *ent, int32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true);
void SetOwner(Mob *newOwner) { owner = newOwner; } void DoFactionHits(int32 npc_faction_level_id);
void IsEntityInFrenzyMode();
void PrintHateListToClient(Client *c);
void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_damage);
void SetOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; }
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr);
void WipeHateList();
protected: protected:
struct_HateList* Find(Mob *ent); struct_HateList* Find(Mob *ent);
private: private:
std::list<struct_HateList*> list; std::list<struct_HateList*> list;
Mob *owner; Mob *hate_owner;
}; };
#endif #endif

View File

@ -2565,7 +2565,7 @@ bool Mob::RemoveFromHateList(Mob* mob)
} }
if(GetTarget() == mob) if(GetTarget() == mob)
{ {
SetTarget(hate_list.GetEntWithMostHateInRange(this)); SetTarget(hate_list.GetEntWithMostHateOnList(this));
} }
return bFound; return bFound;

View File

@ -460,10 +460,10 @@ public:
void DoubleAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHateAmountOnEnt(other, (in_hate ? in_hate * 2 : 1)); } void DoubleAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHateAmountOnEnt(other, (in_hate ? in_hate * 2 : 1)); }
uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHateAmount(tmob,is_dam);} uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHateAmount(tmob,is_dam);}
uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHateAmount(tmob, true);} uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHateAmount(tmob, true);}
Mob* GetHateTop() { return hate_list.GetEntWithMostHateInRange(this);} Mob* GetHateTop() { return hate_list.GetEntWithMostHateOnList(this);}
Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTopOnHateList(other);} Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTopOnHateList(other);}
Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();} Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();}
Mob* GetHateMost() { return hate_list.GetEntWithMostHateInRange();} Mob* GetHateMost() { return hate_list.GetEntWithMostHateOnList();}
bool IsEngaged() { return(!hate_list.IsHateListEmpty()); } bool IsEngaged() { return(!hate_list.IsHateListEmpty()); }
bool HateSummon(); bool HateSummon();
void FaceTarget(Mob* MobToFace = 0); void FaceTarget(Mob* MobToFace = 0);

View File

@ -819,7 +819,7 @@ void Client::AI_Process()
{ {
if(AItarget_check_timer->Check()) if(AItarget_check_timer->Check())
{ {
SetTarget(hate_list.GetEntWithMostHateInRange(this)); SetTarget(hate_list.GetEntWithMostHateOnList(this));
} }
} }
@ -1096,11 +1096,11 @@ void Mob::AI_Process() {
{ {
if (IsFocused()) { if (IsFocused()) {
if (!target) { if (!target) {
SetTarget(hate_list.GetEntWithMostHateInRange(this)); SetTarget(hate_list.GetEntWithMostHateOnList(this));
} }
} else { } else {
if (!ImprovedTaunt()) if (!ImprovedTaunt())
SetTarget(hate_list.GetEntWithMostHateInRange(this)); SetTarget(hate_list.GetEntWithMostHateOnList(this));
} }
} }
@ -1374,7 +1374,7 @@ void Mob::AI_Process() {
//underwater stuff only works with water maps in the zone! //underwater stuff only works with water maps in the zone!
if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) {
if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) {
Mob *tar = hate_list.GetEntWithMostHateInRange(this); Mob *tar = hate_list.GetEntWithMostHateOnList(this);
if(tar == target) { if(tar == target) {
WipeHateList(); WipeHateList();
Heal(); Heal();