fully implement ^pull logic to always return, can still be overidden by ^attack

This commit is contained in:
nytmyr
2024-12-04 20:56:09 -06:00
parent cc5efa4372
commit 6c19f3dbda
2 changed files with 38 additions and 14 deletions
+37 -13
View File
@@ -2119,6 +2119,7 @@ void Bot::AI_Process()
//ALT COMBAT (ACQUIRE HATE) //ALT COMBAT (ACQUIRE HATE)
glm::vec3 Goal(0, 0, 0); glm::vec3 Goal(0, 0, 0);
// We have aggro to choose from // We have aggro to choose from
if (IsEngaged()) { if (IsEngaged()) {
if (rest_timer.Enabled()) { if (rest_timer.Enabled()) {
@@ -2135,16 +2136,18 @@ void Bot::AI_Process()
// RETURNING FLAG // RETURNING FLAG
else if (GetReturningFlag()) { if (GetReturningFlag()) {
if (!ReturningFlagChecks(bot_owner, fm_distance)) { LogTestDebugDetail("#{}: {} has ReturningFlag", __LINE__, GetCleanName()); //deleteme
return; ReturningFlagChecks(bot_owner, leash_owner, fm_distance);
}
return;
} }
// DEFAULT (ACQUIRE TARGET) // DEFAULT (ACQUIRE TARGET)
// VERIFY TARGET AND STANCE // VERIFY TARGET AND STANCE
auto tar = GetBotTarget(bot_owner); auto tar = GetBotTarget(bot_owner);
if (!tar) { if (!tar) {
return; return;
} }
@@ -2204,6 +2207,9 @@ void Bot::AI_Process()
if (GetPullingFlag()) { if (GetPullingFlag()) {
if (!TargetValidation(tar)) { return; } if (!TargetValidation(tar)) { return; }
if (!DoLosChecks(this, tar)) {
return;
}
if (atCombatRange) { if (atCombatRange) {
if (RuleB(Bots, AllowRangedPulling) && IsBotRanged() && ranged_timer.Check(false)) { if (RuleB(Bots, AllowRangedPulling) && IsBotRanged() && ranged_timer.Check(false)) {
StopMoving(CalculateHeadingToTarget(tar->GetX(), tar->GetY())); StopMoving(CalculateHeadingToTarget(tar->GetX(), tar->GetY()));
@@ -2239,7 +2245,9 @@ void Bot::AI_Process()
} }
} }
TryPursueTarget(leash_distance, Goal);
return; return;
//TODO bot rewrite - need pulling checks below to prevent assist
} }
// ENGAGED AT COMBAT RANGE // ENGAGED AT COMBAT RANGE
@@ -2334,7 +2342,6 @@ void Bot::AI_Process()
SetAttackingFlag(false); SetAttackingFlag(false);
if (!bot_owner->GetBotPulling()) { if (!bot_owner->GetBotPulling()) {
SetPullingFlag(false); SetPullingFlag(false);
SetReturningFlag(false); SetReturningFlag(false);
} }
@@ -3013,24 +3020,41 @@ Mob* Bot::GetBotTarget(Client* bot_owner)
return t; return t;
} }
bool Bot::ReturningFlagChecks(Client* bot_owner, float fm_distance) {// Need to make it back to group before clearing return flag bool Bot::ReturningFlagChecks(Client* bot_owner, Mob* leash_owner, float fm_distance) {
if (fm_distance <= GetFollowDistance()) { if (
(NOT_GUARDING && fm_distance <= GetFollowDistance()) ||
// Once we're back, clear blocking flags so everyone else can join in (GUARDING && DistanceSquared(GetPosition(), GetGuardPoint()) <= GetFollowDistance())
) { // Once we're back, clear blocking flags so everyone else can join in
SetReturningFlag(false); SetReturningFlag(false);
bot_owner->SetBotPulling(false); bot_owner->SetBotPulling(false);
if (GetPet()) { if (GetPet()) {
GetPet()->SetPetOrder(m_previous_pet_order); GetPet()->SetPetOrder(m_previous_pet_order);
} }
return false;
} }
// Need to keep puller out of combat until they reach their 'return to' destination // Need to keep puller out of combat until they reach their 'return to' destination
if (HasTargetReflection()) { WipeHateList();
SetTarget(nullptr); if (!IsMoving()) {
WipeHateList(); glm::vec3 Goal(0, 0, 0);
return false;
if (GUARDING) {
Goal = GetGuardPoint();
}
else {
Mob* follow_mob = entity_list.GetMob(GetFollowID());
if (!follow_mob) {
follow_mob = leash_owner;
SetFollowID(leash_owner->GetID());
}
Goal = follow_mob->GetPosition();
}
RunTo(Goal.x, Goal.y, Goal.z);
} }
return true; return true;
+1 -1
View File
@@ -932,7 +932,7 @@ public:
); );
bool PullingFlagChecks(Client* bot_owner); bool PullingFlagChecks(Client* bot_owner);
bool ReturningFlagChecks(Client* bot_owner, float fm_distance); bool ReturningFlagChecks(Client* bot_owner, Mob* leash_owner, float fm_distance);
void BotPullerProcess(Client* bot_owner, Raid* raid); void BotPullerProcess(Client* bot_owner, Raid* raid);