Fixed a few bot issues...

This commit is contained in:
Uleat
2018-10-06 23:23:29 -04:00
parent d8c6c62809
commit 94c17f941c
5 changed files with 89 additions and 4 deletions
+15 -4
View File
@@ -2261,10 +2261,15 @@ void Bot::AI_Process() {
}
if (find_target) {
if (IsRooted())
if (IsRooted()) {
SetTarget(hate_list.GetClosestEntOnHateList(this));
else
SetTarget(hate_list.GetEntWithMostHateOnList(this));
}
else {
// This will keep bots on target for now..but, future updates will allow for rooting/stunning
SetTarget(hate_list.GetEscapingEntOnHateList(leash_owner, BOT_LEASH_DISTANCE));
if (!GetTarget())
SetTarget(hate_list.GetEntWithMostHateOnList(this));
}
}
TEST_TARGET();
@@ -2471,6 +2476,8 @@ void Bot::AI_Process() {
ChangeBotArcherWeapons(IsBotArcher());
}
// all of this needs review...
if (IsBotArcher() && atArcheryRange)
atCombatRange = true;
else if (caster_distance_max && tar_distance <= caster_distance_max)
@@ -2567,6 +2574,10 @@ void Bot::AI_Process() {
}
}
if (!IsBotNonSpellFighter() && AI_EngagedCastCheck()) {
return;
}
// Up to this point, GetTarget() has been safe to dereference since the initial
// TEST_TARGET() call. Due to the chance of the target dying and our pointer
// being nullified, we need to test it before dereferencing to avoid crashes
@@ -2576,7 +2587,7 @@ void Bot::AI_Process() {
if (GetTarget()->GetHPRatio() <= 99.0f)
BotRangedAttack(tar);
}
else if (!IsBotArcher() && (!(IsBotCaster() && GetLevel() >= RuleI(Bots, CasterStopMeleeLevel)))) {
else if (!IsBotArcher() && (IsBotNonSpellFighter() || GetLevel() < GetStopMeleeLevel())) {
// we can't fight if we don't have a target, are stun/mezzed or dead..
// Stop attacking if the target is enraged
TEST_TARGET();