mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Pull target overlap fix (#2335)
<!-- Thank you for contributing to mod-playerbots, please make sure that you... 1. Submit your PR to the test-staging branch, not master. 2. Read the guidelines below before submitting. 3. Don't delete parts of this template. DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND PREDICTABILITY over behavioral realism. Every action and decision executes PER BOT AND PER TRIGGER. Small increases in logic complexity scale poorly across thousands of bots and negatively affect all. We prioritize a stable system over a smarter one. Bots don't need to behave perfectly; believable behavior is the goal, not human simulation. Default behavior must be cheap in processing; expensive behavior must be opt-in. Before submitting, make sure your changes aligns with these principles. --> ## Pull Request Description <!-- Describe what this change does and why it is needed --> Fixed "pull target" value which was overlap with new pull strategy. Related with #2334 ## How to Test the Changes <!-- - Step-by-step instructions to test the change. - Any required setup (e.g. multiple players, number of bots, specific configuration). - Expected behavior and how to verify it. --> 1. Invite tank bot to party 2. Use `nc +debug` 3. Use command `do attack my target` 4. In debug shouldnt be `reach pull` or similar ## Impact Assessment <!-- As a generic test, before and after measure of pmon (playerbot pmon tick) can help you here. --> - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance <!-- AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. We expect contributors to be honest about what they do and do not understand. --> Was AI assistance used while working on this change? - - [ ] No - - [x] Yes (**explain below**) <!-- If yes, please specify: - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation). - Which parts of the change were influenced or generated, and whether it was thoroughly reviewed. --> To analyze problem with value <!-- TRANSLATIONS: Anything new that the bots say in chat must be in a translatable format. This is done using GetBotTextOrDefault, which you can search for in the codebase to find examples. Your code needs to have English as the default fallback, while the full translations need to be in an SQL update file. The languages in the file are the nine language options supported by AzerothCore: English, Korean, French, German, Chinese, Taiwanese, Spanish, Spanish Mexico, and Russian. See data/sql/playerbots/updates/2025_12_27_ai_playerbot_fishing_text.sql as an example of a translation SQL update, whose content are called within the codebase at src/strategy/actions/FishingAction.cpp --> ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers <!-- Anything else that's helpful to review or test your pull request. -->
This commit is contained in:
parent
605f1d7aaa
commit
ed5791eabf
@ -49,7 +49,7 @@ PullStrategy* PullStrategy::Get(PlayerbotAI* botAI)
|
||||
|
||||
Unit* PullStrategy::GetTarget() const
|
||||
{
|
||||
ObjectGuid const guid = botAI->GetAiObjectContext()->GetValue<ObjectGuid>("pull target")->Get();
|
||||
ObjectGuid const guid = botAI->GetAiObjectContext()->GetValue<ObjectGuid>("pull strategy target")->Get();
|
||||
if (guid.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
@ -66,7 +66,7 @@ bool PullStrategy::HasTarget() const { return GetTarget() != nullptr; }
|
||||
|
||||
void PullStrategy::SetTarget(Unit* target)
|
||||
{
|
||||
botAI->GetAiObjectContext()->GetValue<ObjectGuid>("pull target")->Set(target ? target->GetGUID() : ObjectGuid::Empty);
|
||||
botAI->GetAiObjectContext()->GetValue<ObjectGuid>("pull strategy target")->Set(target ? target->GetGUID() : ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
std::string PullStrategy::GetPullActionName() const
|
||||
|
||||
@ -116,6 +116,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class PullStrategyTargetValue : public ManualSetValue<ObjectGuid>
|
||||
{
|
||||
public:
|
||||
PullStrategyTargetValue(PlayerbotAI* botAI, std::string const name = "pull strategy target")
|
||||
: ManualSetValue<ObjectGuid>(botAI, ObjectGuid::Empty, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class FindTargetValue : public UnitCalculatedValue, public Qualified
|
||||
{
|
||||
public:
|
||||
|
||||
@ -241,6 +241,7 @@ public:
|
||||
creators["travel target"] = &ValueContext::travel_target;
|
||||
creators["talk target"] = &ValueContext::talk_target;
|
||||
creators["pull target"] = &ValueContext::pull_target;
|
||||
creators["pull strategy target"] = &ValueContext::pull_strategy_target;
|
||||
creators["focus heal targets"] = &ValueContext::focus_heal_targets;
|
||||
creators["group"] = &ValueContext::group;
|
||||
creators["range"] = &ValueContext::range;
|
||||
@ -498,6 +499,7 @@ private:
|
||||
static UntypedValue* next_rpg_action(PlayerbotAI* botAI) { return new NextRpgActionValue(botAI); }
|
||||
static UntypedValue* travel_target(PlayerbotAI* botAI) { return new TravelTargetValue(botAI); }
|
||||
static UntypedValue* pull_target(PlayerbotAI* botAI) { return new PullTargetValue(botAI); }
|
||||
static UntypedValue* pull_strategy_target(PlayerbotAI* botAI) { return new PullStrategyTargetValue(botAI); }
|
||||
static UntypedValue* focus_heal_targets(PlayerbotAI* botAI) { return new FocusHealTargetValue(botAI); }
|
||||
|
||||
static UntypedValue* bg_master(PlayerbotAI* botAI) { return new BgMasterValue(botAI); }
|
||||
|
||||
@ -867,6 +867,7 @@ void PlayerbotAI::Reset(bool full)
|
||||
aiObjectContext->GetValue<Unit*>("current target")->Set(nullptr);
|
||||
aiObjectContext->GetValue<GuidVector>("prioritized targets")->Reset();
|
||||
aiObjectContext->GetValue<ObjectGuid>("pull target")->Set(ObjectGuid::Empty);
|
||||
aiObjectContext->GetValue<ObjectGuid>("pull strategy target")->Set(ObjectGuid::Empty);
|
||||
aiObjectContext->GetValue<GuidPosition>("rpg target")->Set(GuidPosition());
|
||||
aiObjectContext->GetValue<LootObject>("loot target")->Set(LootObject());
|
||||
aiObjectContext->GetValue<uint32>("lfg proposal")->Set(0);
|
||||
@ -1476,6 +1477,7 @@ void PlayerbotAI::DoNextAction(bool min)
|
||||
aiObjectContext->GetValue<Unit*>("current target")->Set(nullptr);
|
||||
aiObjectContext->GetValue<Unit*>("enemy player target")->Set(nullptr);
|
||||
aiObjectContext->GetValue<ObjectGuid>("pull target")->Set(ObjectGuid::Empty);
|
||||
aiObjectContext->GetValue<ObjectGuid>("pull strategy target")->Set(ObjectGuid::Empty);
|
||||
aiObjectContext->GetValue<LootObject>("loot target")->Set(LootObject());
|
||||
|
||||
ChangeEngine(BOT_STATE_DEAD);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user