mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-22 14:42:24 +00:00
Few tweaks to bot ai
This commit is contained in:
parent
ed67b461ea
commit
bd6e06aadb
22
zone/bot.cpp
22
zone/bot.cpp
@ -83,6 +83,7 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
|
||||
SetPauseAI(false);
|
||||
|
||||
m_alt_combat_hate_timer.Start(250);
|
||||
m_auto_defend_timer.Disable();
|
||||
//m_combat_jitter_timer.Disable();
|
||||
//SetCombatJitterFlag(false);
|
||||
SetGuardFlag(false);
|
||||
@ -180,6 +181,7 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
|
||||
SetPauseAI(false);
|
||||
|
||||
m_alt_combat_hate_timer.Start(250);
|
||||
m_auto_defend_timer.Disable();
|
||||
//m_combat_jitter_timer.Disable();
|
||||
//SetCombatJitterFlag(false);
|
||||
SetGuardFlag(false);
|
||||
@ -2462,7 +2464,7 @@ constexpr float MAX_CASTER_DISTANCE[PLAYER_CLASS_COUNT] = {
|
||||
// W C P R S D M B R S N W M E B B
|
||||
// A L A N H R N R O H E I A N S E
|
||||
// R R L G D U K D G M C Z G C T R
|
||||
};
|
||||
};
|
||||
|
||||
void Bot::AI_Process()
|
||||
{
|
||||
@ -2861,14 +2863,14 @@ void Bot::AI_Process()
|
||||
if (find_target) {
|
||||
|
||||
if (IsRooted()) {
|
||||
SetTarget(hate_list.GetClosestEntOnHateList(this));
|
||||
SetTarget(hate_list.GetClosestEntOnHateList(this, true));
|
||||
}
|
||||
else {
|
||||
|
||||
// This will keep bots on target for now..but, future updates will allow for rooting/stunning
|
||||
SetTarget(hate_list.GetEscapingEntOnHateList(leash_owner, leash_distance));
|
||||
if (!GetTarget()) {
|
||||
SetTarget(hate_list.GetEntWithMostHateOnList(this));
|
||||
SetTarget(hate_list.GetEntWithMostHateOnList(this, nullptr, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3550,9 +3552,15 @@ void Bot::AI_Process()
|
||||
|
||||
// This is as close as I could get without modifying the aggro mechanics and making it an expensive process...
|
||||
// 'class Client' doesn't make use of hate_list...
|
||||
if (bot_owner->GetAggroCount() && bot_owner->GetBotOption(Client::booAutoDefend)) {
|
||||
if (RuleB(Bots, AllowOwnerOptionAutoDefend) && bot_owner->GetBotOption(Client::booAutoDefend)) {
|
||||
|
||||
if (RuleB(Bots, AllowOwnerOptionAutoDefend)) {
|
||||
if (!m_auto_defend_timer.Enabled()) {
|
||||
|
||||
m_auto_defend_timer.Start(zone->random.Int(250, 1250)); // random timer to simulate 'awareness' (cuts down on scanning overhead)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_auto_defend_timer.Check() && bot_owner->GetAggroCount()) {
|
||||
|
||||
if (NOT_HOLDING && NOT_PASSIVE) {
|
||||
|
||||
@ -3570,7 +3578,7 @@ void Bot::AI_Process()
|
||||
}
|
||||
|
||||
auto hater = entity_list.GetMob(hater_iter.spawn_id);
|
||||
if (hater && DistanceSquared(hater->GetPosition(), bot_owner->GetPosition()) <= leash_distance) {
|
||||
if (hater && !hater->IsMezzed() && DistanceSquared(hater->GetPosition(), bot_owner->GetPosition()) <= leash_distance) {
|
||||
|
||||
// This is roughly equivilent to npc attacking a client pet owner
|
||||
AddToHateList(hater, 1);
|
||||
@ -3582,6 +3590,8 @@ void Bot::AI_Process()
|
||||
GetPet()->SetTarget(hater);
|
||||
}
|
||||
|
||||
m_auto_defend_timer.Disable();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,6 +693,7 @@ private:
|
||||
|
||||
Timer m_evade_timer; // can be moved to pTimers at some point
|
||||
Timer m_alt_combat_hate_timer;
|
||||
Timer m_auto_defend_timer;
|
||||
//Timer m_combat_jitter_timer;
|
||||
//bool m_combat_jitter_flag;
|
||||
bool m_guard_flag;
|
||||
|
||||
@ -5758,7 +5758,7 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
|
||||
}
|
||||
Bot * botCheckNotOnline = entity_list.GetBotByBotName(bots_iter.Name);
|
||||
std::string botspawn_saylink = StringFormat("^botspawn %s", bots_iter.Name);
|
||||
c->Message(Chat::White, "%s is a level %u %s %s %s who is owned by %s",
|
||||
c->Message(Chat::White, "[%s] is a level %u %s %s %s who is owned by %s",
|
||||
((c->CharacterID() == bots_iter.Owner_ID) && (!botCheckNotOnline) ? (EQEmu::SayLinkEngine::GenerateQuestSaylink(botspawn_saylink, false, bots_iter.Name).c_str()) : (bots_iter.Name)),
|
||||
bots_iter.Level,
|
||||
Bot::RaceIdToString(bots_iter.Race).c_str(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user