mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-29 00:18:18 +00:00
Renamed function, need to fix bots, some combat bug fixes.
This commit is contained in:
+26
-34
@@ -801,13 +801,11 @@ void Client::AI_Process()
|
||||
speed *= 2;
|
||||
SetCurrentSpeed(speed);
|
||||
// Check if we have reached the last fear point
|
||||
if ((std::abs(GetX() - m_FearWalkTarget.x) < 0.1) &&
|
||||
(std::abs(GetY() - m_FearWalkTarget.y) < 0.1)) {
|
||||
// Calculate a new point to run to
|
||||
if(IsPositionEqual(GetX(), GetY(), GetZ(), m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z)) {
|
||||
CalculateNewFearpoint();
|
||||
}
|
||||
|
||||
CalculateNewPosition(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed, true);
|
||||
NavigateTo(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -841,6 +839,8 @@ void Client::AI_Process()
|
||||
bool is_combat_range = CombatRange(GetTarget());
|
||||
|
||||
if (is_combat_range) {
|
||||
StopNavigation();
|
||||
|
||||
if (charm_class_attacks_timer.Check()) {
|
||||
DoClassAttacks(GetTarget());
|
||||
}
|
||||
@@ -877,7 +877,7 @@ void Client::AI_Process()
|
||||
animation = newspeed;
|
||||
newspeed *= 2;
|
||||
SetCurrentSpeed(newspeed);
|
||||
CalculateNewPosition(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), newspeed);
|
||||
NavigateTo(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), newspeed);
|
||||
}
|
||||
}
|
||||
else if(IsMoving())
|
||||
@@ -925,13 +925,10 @@ void Client::AI_Process()
|
||||
nspeed *= 2;
|
||||
SetCurrentSpeed(nspeed);
|
||||
|
||||
CalculateNewPosition(owner->GetX(), owner->GetY(), owner->GetZ(), nspeed);
|
||||
NavigateTo(owner->GetX(), owner->GetY(), owner->GetZ(), nspeed);
|
||||
}
|
||||
} else {
|
||||
if (moved) {
|
||||
SetCurrentSpeed(0);
|
||||
moved = false;
|
||||
}
|
||||
StopNavigation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,17 +1089,15 @@ void Mob::AI_Process() {
|
||||
else {
|
||||
if (AI_movement_timer->Check()) {
|
||||
// Check if we have reached the last fear point
|
||||
if ((std::abs(GetX() - m_FearWalkTarget.x) < 0.1) &&
|
||||
(std::abs(GetY() - m_FearWalkTarget.y) < 0.1)) {
|
||||
if (IsPositionEqual(GetX(), GetY(), GetZ(), m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z)) {
|
||||
// Calculate a new point to run to
|
||||
CalculateNewFearpoint();
|
||||
}
|
||||
CalculateNewPosition(
|
||||
NavigateTo(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
GetFearSpeed(),
|
||||
true
|
||||
GetFearSpeed()
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -1218,6 +1213,8 @@ void Mob::AI_Process() {
|
||||
bool is_combat_range = CombatRange(target);
|
||||
|
||||
if (is_combat_range) {
|
||||
StopNavigation();
|
||||
|
||||
if (AI_movement_timer->Check()) {
|
||||
if (CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()) != m_Position.w) {
|
||||
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
||||
@@ -1422,13 +1419,12 @@ void Mob::AI_Process() {
|
||||
else if (AI_movement_timer->Check() && target) {
|
||||
if (!IsRooted()) {
|
||||
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName());
|
||||
CalculateNewPosition(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed());
|
||||
NavigateTo(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed());
|
||||
|
||||
}
|
||||
else if (IsMoving()) {
|
||||
SetHeading(CalculateHeadingToTarget(target->GetX(), target->GetY()));
|
||||
SetCurrentSpeed(0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1522,15 +1518,11 @@ void Mob::AI_Process() {
|
||||
|
||||
auto &Goal = owner->GetPosition();
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, pet_speed, true);
|
||||
NavigateTo(Goal.x, Goal.y, Goal.z, pet_speed);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (moved) {
|
||||
this->FixZ();
|
||||
SetCurrentSpeed(0);
|
||||
moved = false;
|
||||
}
|
||||
StopNavigation();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1576,7 +1568,7 @@ void Mob::AI_Process() {
|
||||
|
||||
auto &Goal = follow->GetPosition();
|
||||
|
||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed, true);
|
||||
NavigateTo(Goal.x, Goal.y, Goal.z, speed);
|
||||
}
|
||||
else {
|
||||
moved = false;
|
||||
@@ -1702,7 +1694,7 @@ void NPC::AI_DoMovement() {
|
||||
roambox_destination_y);
|
||||
}
|
||||
|
||||
CalculateNewPosition(roambox_destination_x, roambox_destination_y, roambox_destination_z, move_speed, true);
|
||||
NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z, move_speed);
|
||||
|
||||
if (m_Position.x == roambox_destination_x && m_Position.y == roambox_destination_y) {
|
||||
time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay);
|
||||
@@ -1766,12 +1758,11 @@ void NPC::AI_DoMovement() {
|
||||
ClearFeignMemory();
|
||||
}
|
||||
if (doMove) { // not at waypoint yet or at 0 pause WP, so keep moving
|
||||
CalculateNewPosition(
|
||||
NavigateTo(
|
||||
m_CurrentWayPoint.x,
|
||||
m_CurrentWayPoint.y,
|
||||
m_CurrentWayPoint.z,
|
||||
move_speed,
|
||||
true
|
||||
move_speed
|
||||
);
|
||||
|
||||
}
|
||||
@@ -1790,14 +1781,12 @@ void NPC::AI_DoMovement() {
|
||||
}
|
||||
|
||||
}
|
||||
else if (IsGuarding()) {
|
||||
CalculateNewPosition(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, move_speed);
|
||||
|
||||
//if(Distance(m_GuardPoint, m_Position))
|
||||
|
||||
bool at_gp = CalculateDistance(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z) < 0.1f;
|
||||
else if (IsGuarding()) {
|
||||
bool at_gp = IsPositionEqual(GetX(), GetY(), GetZ(), m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
|
||||
|
||||
if (at_gp) {
|
||||
StopNavigation();
|
||||
|
||||
if (moved) {
|
||||
Log(Logs::Detail,
|
||||
Logs::AI,
|
||||
@@ -1818,6 +1807,9 @@ void NPC::AI_DoMovement() {
|
||||
SetAppearance(GetGuardPointAnim());
|
||||
}
|
||||
}
|
||||
else {
|
||||
NavigateTo(m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z, move_speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user