Enable new rpg strategy by default (#1192)

* Add RandomBotMinLevelChance

* Save mana only for healer

* Disable addclass dk for low level player

* Target selection and debuff cast with less players in group

* Change default rpg strategy and bots count in config

* Logs clean up

* Improve init=auto

* Remove login logs after initialization

* Rndbots stats for quest

* Prediction chase in reach combat

* Poor & Normal items ensurence for init=auto
This commit is contained in:
Yunfan Li
2025-04-11 20:31:38 +08:00
committed by GitHub
parent 0d19f298da
commit 19447c3914
18 changed files with 175 additions and 73 deletions

View File

@@ -8,6 +8,17 @@
#include "CreatureAI.h"
#include "Playerbots.h"
enum PetSpells
{
PET_PROWL_1 = 24450,
PET_PROWL_2 = 24452,
PET_PROWL_3 = 24453,
PET_COWER = 1742,
PET_LEAP = 47482
};
static std::vector<uint32> disabledPetSpells = {PET_PROWL_1, PET_PROWL_2, PET_PROWL_3, PET_COWER, PET_LEAP};
bool MeleeAction::isUseful()
{
// do not allow if can't attack from vehicle
@@ -44,18 +55,20 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
{
if (itr->second.state == PETSPELL_REMOVED)
continue;
uint32 spellId = itr->first;
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo->IsAutocastable())
continue;
bool shouldApply = true;
if (spellId == 1742 /*cower*/ || spellId == 24450 /*Prowl*/ ||
spellId == 47482 /*Leap*/ /* || spellId == 47481 Gnaw*/)
for (uint32 disabledSpell : disabledPetSpells)
{
shouldApply = false;
if (spellId == disabledSpell)
{
shouldApply = false;
break;
}
}
bool isAutoCast = false;
for (unsigned int& m_autospell : pet->m_autospells)

View File

@@ -847,6 +847,26 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
float tx = target->GetPositionX();
float ty = target->GetPositionY();
float tz = target->GetPositionZ();
float targetOrientation = target->GetOrientation();
float deltaAngle = Position::NormalizeOrientation(targetOrientation - target->GetAngle(bot));
if (deltaAngle > M_PI)
deltaAngle -= 2.0f * M_PI; // -PI..PI
// if target is moving forward and moving far away, predict the position
bool behind = fabs(deltaAngle) > M_PI_2;
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind) {
float predictDis = std::min(3.0f, target->GetObjectSize() * 2);
tx += cos(target->GetOrientation()) * predictDis;
ty += sin(target->GetOrientation()) * predictDis;
if (!target->GetMap()->CheckCollisionAndGetValidCoords(target, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),
tx, ty, tz))
{
tx = target->GetPositionX();
ty = target->GetPositionY();
tz = target->GetPositionZ();
}
}
float combatDistance = bot->GetCombatReach() + target->GetCombatReach();
distance += combatDistance;
@@ -863,7 +883,7 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
// Avoid walking too far when moving towards each other
float disToGo = bot->GetExactDist(tx, ty, tz) - distance;
if (disToGo >= 10.0f)
if (disToGo >= 6.0f)
shortenTo = disToGo / 2 + distance;
// if (bot->GetExactDist(tx, ty, tz) <= shortenTo)