Fix for bots ceasing combat when their 'follow me' mob dies

This commit is contained in:
Uleat 2019-02-04 14:56:00 -05:00
parent 594ec4faee
commit ee970acc2e
2 changed files with 14 additions and 4 deletions

View File

@ -20,6 +20,10 @@ Uleat: Added command 'profanity' (aliased 'prof')
-- Quest failures and limited social interactions may alienate players if they become inhibiting -- Quest failures and limited social interactions may alienate players if they become inhibiting
-- System commands are allowed to be processed before redaction occurs in the 'say' channel -- System commands are allowed to be processed before redaction occurs in the 'say' channel
- A longer list requires more clock cycles to process - so, try to keep them to the most offensible occurrences - A longer list requires more clock cycles to process - so, try to keep them to the most offensible occurrences
Uleat: Fix for bots ceasing combat when their 'follow me' mob dies
- Bots will revert to their client leash owner (bot owner or client group leader) when their FollowID() mob is no longer valid
- Combat will no longer be interrupted in these cases
- Does not apply to bot owner death...
== 1/26/2019 == == 1/26/2019 ==
Uleat: Fix for class Bot not honoring NPCType data reference Uleat: Fix for class Bot not honoring NPCType data reference

View File

@ -2248,10 +2248,9 @@ void Bot::AI_Process() {
Client* bot_owner = (GetBotOwner() && GetBotOwner()->IsClient() ? GetBotOwner()->CastToClient() : nullptr); Client* bot_owner = (GetBotOwner() && GetBotOwner()->IsClient() ? GetBotOwner()->CastToClient() : nullptr);
Group* bot_group = GetGroup(); Group* bot_group = GetGroup();
Mob* follow_mob = entity_list.GetMob(GetFollowID());
// Primary reasons for not processing AI // Primary reasons for not processing AI
if (!bot_owner || !bot_group || !follow_mob || !IsAIControlled()) if (!bot_owner || !bot_group || !IsAIControlled())
return; return;
if (bot_owner->IsDead()) { if (bot_owner->IsDead()) {
@ -2261,11 +2260,18 @@ void Bot::AI_Process() {
return; return;
} }
// We also need a leash owner (subset of primary AI criteria) // We also need a leash owner and follow mob (subset of primary AI criteria)
Client* leash_owner = (bot_group->GetLeader() && bot_group->GetLeader()->IsClient() ? bot_group->GetLeader()->CastToClient() : bot_owner); Client* leash_owner = (bot_group->GetLeader() && bot_group->GetLeader()->IsClient() ? bot_group->GetLeader()->CastToClient() : bot_owner);
if (!leash_owner) if (!leash_owner)
return; return;
Mob* follow_mob = entity_list.GetMob(GetFollowID());
if (!follow_mob) {
follow_mob = leash_owner;
SetFollowID(leash_owner->GetID());
}
// Berserk updates should occur if primary AI criteria are met // Berserk updates should occur if primary AI criteria are met
if (GetClass() == WARRIOR || GetClass() == BERSERKER) { if (GetClass() == WARRIOR || GetClass() == BERSERKER) {
if (!berserk && GetHP() > 0 && GetHPRatio() < 30.0f) { if (!berserk && GetHP() > 0 && GetHPRatio() < 30.0f) {