mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Attack target] Fix
This commit is contained in:
@@ -23,24 +23,25 @@ GuidVector AttackersValue::Calculate()
|
|||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
AddAttackersOf(group, targets);
|
AddAttackersOf(group, targets);
|
||||||
|
|
||||||
|
|
||||||
|
RemoveNonThreating(targets);
|
||||||
|
|
||||||
// prioritized target
|
// prioritized target
|
||||||
GuidVector prioritizedTargets = AI_VALUE(GuidVector, "prioritized targets");
|
GuidVector prioritizedTargets = AI_VALUE(GuidVector, "prioritized targets");
|
||||||
for (ObjectGuid target : prioritizedTargets) {
|
for (ObjectGuid target : prioritizedTargets) {
|
||||||
Unit* unit = botAI->GetUnit(target);
|
Unit* unit = botAI->GetUnit(target);
|
||||||
if (unit) {
|
if (unit && IsValidTarget(unit, bot)) {
|
||||||
targets.insert(unit);
|
targets.insert(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Group* group = bot->GetGroup()) {
|
if (Group* group = bot->GetGroup()) {
|
||||||
ObjectGuid skullGuid = group->GetTargetIcon(4);
|
ObjectGuid skullGuid = group->GetTargetIcon(4);
|
||||||
Unit* skullTarget = botAI->GetUnit(skullGuid);
|
Unit* skullTarget = botAI->GetUnit(skullGuid);
|
||||||
if (skullTarget) {
|
if (skullTarget && IsValidTarget(skullTarget, bot)) {
|
||||||
targets.insert(skullTarget);
|
targets.insert(skullTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveNonThreating(targets);
|
|
||||||
|
|
||||||
for (Unit* unit : targets)
|
for (Unit* unit : targets)
|
||||||
result.push_back(unit->GetGUID());
|
result.push_back(unit->GetGUID());
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ bool AttackersValue::hasRealThreat(Unit *attacker)
|
|||||||
attacker->IsAlive() &&
|
attacker->IsAlive() &&
|
||||||
!attacker->IsPolymorphed() &&
|
!attacker->IsPolymorphed() &&
|
||||||
// !attacker->isInRoots() &&
|
// !attacker->isInRoots() &&
|
||||||
!attacker->IsFriendlyTo(bot) &&
|
!attacker->IsFriendlyTo(bot);
|
||||||
(attacker->GetThreatMgr().getCurrentVictim() || dynamic_cast<Player*>(attacker));
|
(attacker->GetThreatMgr().getCurrentVictim() || dynamic_cast<Player*>(attacker));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user