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

@@ -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)