Merge branch 'liyunfan1223:master' into bot_questing

This commit is contained in:
Atidote
2024-08-06 12:09:08 +02:00
committed by GitHub
2 changed files with 16 additions and 13 deletions

View File

@@ -187,8 +187,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
// if (bot->Unit::IsFalling()) {
// bot->Say("I'm falling", LANG_UNIVERSAL);
// }
// !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
bool generatePath = !bot->IsFlying() && !bot->isSwimming();
bool disableMoveSplinePath = sPlayerbotAIConfig->disableMoveSplinePath >= 2 ||
(sPlayerbotAIConfig->disableMoveSplinePath == 1 && bot->InBattleground());
@@ -208,7 +206,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
MotionMaster& mm = *bot->GetMotionMaster();
mm.Clear();
mm.MovePoint(mapId, x, y, z, generatePath);
float delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, 1000.0f * MoveDelay(distance));
float delay = 1000.0f * MoveDelay(distance) - sPlayerbotAIConfig->reactDelay;
delay = std::max(.0f, delay);
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
return true;
}
@@ -238,7 +238,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
mm.Clear();
mm.MoveSplinePath(&path);
// mm.MoveSplinePath(&path);
float delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, 1000.0f * MoveDelay(distance));
float delay = 1000.0f * MoveDelay(distance) - sPlayerbotAIConfig->reactDelay;
delay = std::max(.0f, delay);
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
return true;
}
@@ -792,7 +794,7 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD)) // target is moving forward, predict the position
{
float needToGo = bot->GetExactDist(target) - distance;
float timeToGo = MoveDelay(abs(needToGo)) + sPlayerbotAIConfig->reactDelay;
float timeToGo = MoveDelay(abs(needToGo)) + sPlayerbotAIConfig->reactDelay / 1000.0f;
float targetMoveDist = timeToGo * target->GetSpeed(MOVE_RUN);
targetMoveDist = std::min(5.0f, targetMoveDist);
tx += targetMoveDist * cos(target->GetOrientation());
@@ -806,7 +808,10 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
tz = target->GetPositionZ();
}
}
if (bot->GetExactDist(tx, ty, tz) <= distance)
{
return false;
}
PathGenerator path(bot);
path.CalculatePath(tx, ty, tz, false);
PathType type = path.GetPathType();
@@ -1249,9 +1254,7 @@ float MovementAction::MoveDelay(float distance)
{
speed = bot->GetSpeed(MOVE_RUN);
}
float delay = distance / speed - sPlayerbotAIConfig->reactDistance;
if (delay < 0)
delay = 0;
float delay = distance / speed;
return delay;
}

View File

@@ -97,10 +97,10 @@ void GenericHunterStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(
new TriggerNode("misdirection on main tank",
NextAction::array(0, new NextAction("misdirection on main tank", ACTION_HIGH + 7), NULL)));
triggers.push_back(
new TriggerNode("tranquilizing shot enrage", NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL)));
triggers.push_back(
new TriggerNode("tranquilizing shot magic", NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL)));
triggers.push_back(new TriggerNode("tranquilizing shot enrage",
NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL)));
triggers.push_back(new TriggerNode("tranquilizing shot magic",
NextAction::array(0, new NextAction("tranquilizing shot", 61.0f), NULL)));
}
NextAction** HunterBoostStrategy::getDefaultActions()