General improvement

This commit is contained in:
Yunfan Li 2025-07-21 11:39:22 +08:00
parent c9d341cb36
commit eff9873272
3 changed files with 12 additions and 12 deletions

View File

@ -78,7 +78,7 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
float rx, ry, rz; float rx, ry, rz;
bool found = false; bool found = false;
int attempt = 3; int attempt = 3;
while (--attempt) while (attempt--)
{ {
float angle = bot->GetAngle(&dest); float angle = bot->GetAngle(&dest);
float delta = urand(1, 100) <= 75 ? (rand_norm() - 0.5) * M_PI * 0.5 : (rand_norm() - 0.5) * M_PI * 2; float delta = urand(1, 100) <= 75 ? (rand_norm() - 0.5) * M_PI * 0.5 : (rand_norm() - 0.5) * M_PI * 2;
@ -157,8 +157,8 @@ bool NewRpgBaseAction::MoveRandomNear(float moveStep, MovementPriority priority)
const float x = bot->GetPositionX(); const float x = bot->GetPositionX();
const float y = bot->GetPositionY(); const float y = bot->GetPositionY();
const float z = bot->GetPositionZ(); const float z = bot->GetPositionZ();
int attempts = 5; int attempts = 1;
while (--attempts) while (attempts--)
{ {
float angle = (float)rand_norm() * 2 * static_cast<float>(M_PI); float angle = (float)rand_norm() * 2 * static_cast<float>(M_PI);
float dx = x + distance * cos(angle); float dx = x + distance * cos(angle);

View File

@ -195,16 +195,16 @@ bool GrindTargetValue::needForQuest(Unit* target)
return true; return true;
} }
} }
}
}
if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry())) if (CreatureTemplate const* data = sObjectMgr->GetCreatureTemplate(target->GetEntry()))
{
if (uint32 lootId = data->lootid)
{
if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot))
{ {
if (uint32 lootId = data->lootid) return true;
{
if (LootTemplates_Creature.HaveQuestLootForPlayer(lootId, bot))
{
return true;
}
}
} }
} }
} }

View File

@ -15,7 +15,7 @@ class NearestCorpsesValue : public NearestUnitsValue
{ {
public: public:
NearestCorpsesValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance) NearestCorpsesValue(PlayerbotAI* botAI, float range = sPlayerbotAIConfig->sightDistance)
: NearestUnitsValue(botAI, "nearest corpses", range) : NearestUnitsValue(botAI, "nearest corpses", range, true)
{ {
} }