mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-15 08:06:11 +00:00
fix: bot stuck after drink or food && initialization customized
This commit is contained in:
@@ -135,9 +135,10 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
||||
|
||||
bool AttackersValue::IsValidTarget(Unit *attacker, Player *bot)
|
||||
{
|
||||
return IsPossibleTarget(attacker, bot) && (attacker->GetThreatMgr().getCurrentVictim() || attacker->GetGuidValue(UNIT_FIELD_TARGET) ||
|
||||
return IsPossibleTarget(attacker, bot) && (attacker->GetThreatMgr().getCurrentVictim() || attacker->GetGuidValue(UNIT_FIELD_TARGET) ||
|
||||
attacker->GetGUID().IsPlayer() || attacker->GetGUID() == GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<ObjectGuid>("pull target")->Get());
|
||||
}
|
||||
|
||||
bool PossibleAddsValue::Calculate()
|
||||
{
|
||||
GuidVector possible = botAI->GetAiObjectContext()->GetValue<GuidVector >("possible targets no los")->Get();
|
||||
|
||||
@@ -16,7 +16,7 @@ class Unit;
|
||||
class AttackersValue : public ObjectGuidListCalculatedValue
|
||||
{
|
||||
public:
|
||||
AttackersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "attackers", 2) { }
|
||||
AttackersValue(PlayerbotAI* botAI) : ObjectGuidListCalculatedValue(botAI, "attackers", 1) { }
|
||||
|
||||
GuidVector Calculate();
|
||||
static bool IsPossibleTarget(Unit* attacker, Player* bot, float range = sPlayerbotAIConfig->sightDistance);
|
||||
|
||||
@@ -15,7 +15,15 @@ bool InvalidTargetValue::Calculate()
|
||||
|
||||
if (target && qualifier == "current target")
|
||||
{
|
||||
return !AttackersValue::IsValidTarget(target, bot);
|
||||
return target->GetMapId() != bot->GetMapId() ||
|
||||
!target->IsAlive() ||
|
||||
target->IsPolymorphed() ||
|
||||
target->IsCharmed() ||
|
||||
target->isFeared() ||
|
||||
target->HasUnitState(UNIT_STATE_ISOLATED) ||
|
||||
target->IsFriendlyTo(bot) ||
|
||||
!bot->IsWithinDistInMap(target, sPlayerbotAIConfig->sightDistance) ||
|
||||
!bot->IsWithinLOSInMap(target);
|
||||
}
|
||||
|
||||
return !target;
|
||||
|
||||
Reference in New Issue
Block a user