Skip to content

Commit

Permalink
-Aggression change: Bots will now ignore hard targets when traveling …
Browse files Browse the repository at this point in the history
…far or heading to a master that is far away.
  • Loading branch information
mostlikely4r committed Jun 13, 2024
1 parent f55cc08 commit 94efc0e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion playerbot/strategy/values/AttackersValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,30 @@ bool AttackersValue::IsValid(Unit* target, Player* player, Player* owner, bool c
}
}

if (WorldPosition(player).isOverworld() && target->AI() && target->AI()->IsPreventingDeath())
if (WorldPosition(player).isOverworld() && target->AI() && target->AI()->IsPreventingDeath())
{
return false;
}
}

if (playerToCheckAgainst->GetPlayerbotAI())
{
PlayerbotAI* ai = playerToCheckAgainst->GetPlayerbotAI();
AiObjectContext* context = ai->GetAiObjectContext();

//Ignore Hard hostiles while not already fighting.
if (target->GetLevel() > (playerToCheckAgainst->GetLevel() + 5) && ai->GetState() == BotState::BOT_STATE_NON_COMBAT)
{
//When traveling a long distance.
if (AI_VALUE(TravelTarget*, "travel target")->isTraveling() && AI_VALUE2(float, "distance", "travel target") > sPlayerbotAIConfig.reactDistance)
return false;

//When moving to master far away.
if (ai->HasStrategy("follow", BotState::BOT_STATE_NON_COMBAT) && AI_VALUE2(bool, "trigger active", "out of react range"))
return false;
}
}

return true;
}

Expand Down

0 comments on commit 94efc0e

Please sign in to comment.