mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-25 06:26:24 +00:00
Fix: Allow bots to duel in PVP prohibited areas (#1906)
Noticed that if you ask a bot to duel in a PVP prohibited area, it will accept, and do nothing. I thought about making the bot reject the request, but if you (the real player) want to duel with it, the duel should happen. This is just a minor fix to allow bots to duel if you ask them to in such areas. Tested with bots in party, random bots of the same faction, and random bots of the opposite faction. All behaved the same before and after fix. An example place to test is Zim'Torga in Zul'Drak which is by default is a PVP prohibited area. - Before fix, you challenge a bot, they accept and turn red, then they either just stay where they are or wander off. - After fix, bot attacks you within the PVP prohibited area when the duel starts.
This commit is contained in:
@@ -33,18 +33,14 @@ GuidVector AttackersValue::Calculate()
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(target);
|
||||
if (unit && IsValidTarget(unit, bot))
|
||||
{
|
||||
targets.insert(unit);
|
||||
}
|
||||
}
|
||||
if (Group* group = bot->GetGroup())
|
||||
{
|
||||
ObjectGuid skullGuid = group->GetTargetIcon(7);
|
||||
Unit* skullTarget = botAI->GetUnit(skullGuid);
|
||||
if (skullTarget && IsValidTarget(skullTarget, bot))
|
||||
{
|
||||
targets.insert(skullTarget);
|
||||
}
|
||||
}
|
||||
|
||||
for (Unit* unit : targets)
|
||||
@@ -61,9 +57,7 @@ GuidVector AttackersValue::Calculate()
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(guid);
|
||||
if (unit && unit->IsPlayer() && IsValidTarget(unit, bot))
|
||||
{
|
||||
result.push_back(unit->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,9 +104,8 @@ void AttackersValue::AddAttackersOf(Player* player, std::unordered_set<Unit*>& t
|
||||
|
||||
if (player->IsValidAttackTarget(attacker) &&
|
||||
player->GetDistance2d(attacker) < sPlayerbotAIConfig->sightDistance)
|
||||
{
|
||||
targets.insert(attacker);
|
||||
}
|
||||
|
||||
ref = ref->next();
|
||||
}
|
||||
}
|
||||
@@ -180,8 +173,9 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float /*range
|
||||
if (!bot->CanSeeOrDetect(attacker))
|
||||
return false;
|
||||
|
||||
// PvP prohibition checks
|
||||
// PvP prohibition checks (skip for duels)
|
||||
if ((attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet()) &&
|
||||
(!bot->duel || bot->duel->Opponent != attacker) &&
|
||||
(sPlayerbotAIConfig->IsPvpProhibited(attacker->GetZoneId(), attacker->GetAreaId()) ||
|
||||
sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId())))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user