|
@@ -68,6 +68,12 @@ void Brain::Think() {
|
|
|
if (target) {
|
|
|
LogWrite(NPC_AI__DEBUG, 7, "NPC_AI", "%s has %s targeted.", m_body->GetName(), target->GetName());
|
|
|
// NPC has an entity that it hates
|
|
|
+ // Set the NPC's target to the most hated entity if it is not already.
|
|
|
+ if (m_body->GetTarget() != target) {
|
|
|
+ m_body->SetTarget(target);
|
|
|
+ }
|
|
|
+ m_body->FaceTarget(target);
|
|
|
+ // target needs to be set before in combat is engaged
|
|
|
|
|
|
// If the NPC is not in combat then put them in combat
|
|
|
if (!m_body->EngagedInCombat()) {
|
|
@@ -76,12 +82,6 @@ void Brain::Think() {
|
|
|
m_body->GetZone()->CallSpawnScript(m_body, SPAWN_SCRIPT_AGGRO, target);
|
|
|
}
|
|
|
|
|
|
- // Set the NPC's target to the most hated entity if it is not already.
|
|
|
- if (m_body->GetTarget() != target) {
|
|
|
- m_body->SetTarget(target);
|
|
|
- }
|
|
|
- m_body->FaceTarget(target);
|
|
|
-
|
|
|
bool breakWaterPursuit = false;
|
|
|
if (m_body->IsWaterCreature() && !m_body->IsFlyingCreature() && !target->InWater())
|
|
|
breakWaterPursuit = true;
|
|
@@ -667,6 +667,13 @@ void DumbFirePetBrain::Think() {
|
|
|
|
|
|
if (target) {
|
|
|
if (!GetBody()->IsMezzedOrStunned()) {
|
|
|
+ // Set the NPC's target to the most hated entity if it is not already.
|
|
|
+ if (GetBody()->GetTarget() != target) {
|
|
|
+ GetBody()->SetTarget(target);
|
|
|
+ GetBody()->FaceTarget(target);
|
|
|
+ }
|
|
|
+ // target needs to be identified before combat setting
|
|
|
+
|
|
|
// If the NPC is not in combat then put them in combat
|
|
|
if (!GetBody()->EngagedInCombat()) {
|
|
|
//GetBody()->ClearRunningLocations();
|
|
@@ -674,12 +681,6 @@ void DumbFirePetBrain::Think() {
|
|
|
GetBody()->InCombat(true);
|
|
|
}
|
|
|
|
|
|
- // Set the NPC's target to the most hated entity if it is not already.
|
|
|
- if (GetBody()->GetTarget() != target) {
|
|
|
- GetBody()->SetTarget(target);
|
|
|
- GetBody()->FaceTarget(target);
|
|
|
- }
|
|
|
-
|
|
|
float distance = GetBody()->GetDistance(target);
|
|
|
|
|
|
if(GetBody()->CheckLoS(target) && !GetBody()->IsCasting() && (!HasRecovered() || !ProcessSpell(target, distance))) {
|