mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
PvP: ignore Spirit of Redemption and pets
This commit is contained in:
@@ -46,7 +46,7 @@ bool TellAttackersAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
ThreatMgr* threatMgr = ref->GetSource();
|
ThreatMgr* threatMgr = ref->GetSource();
|
||||||
Unit* unit = threatMgr->GetOwner();
|
Unit* unit = threatMgr->GetOwner();
|
||||||
float threat = ref->getThreat();
|
float threat = ref->GetThreat();
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << unit->GetName() << " (" << threat << ")";
|
out << unit->GetName() << " (" << threat << ")";
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void AttackersValue::AddAttackersOf(Player* player, std::set<Unit*>& targets)
|
|||||||
{
|
{
|
||||||
if (!player->GetGroup())
|
if (!player->GetGroup())
|
||||||
{
|
{
|
||||||
if (!unit->GetThreatMgr().getThreat(player) && (!unit->GetThreatMgr().getCurrentVictim() || unit->GetThreatMgr().getCurrentVictim()->getTarget() != player))
|
if (!unit->GetThreatMgr().GetThreat(player) && (!unit->GetThreatMgr().getCurrentVictim() || unit->GetThreatMgr().getCurrentVictim()->getTarget() != player))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
|
|
||||||
bool leaderHasThreat = false;
|
bool leaderHasThreat = false;
|
||||||
if (attacker && bot->GetGroup() && botAI->GetMaster())
|
if (attacker && bot->GetGroup() && botAI->GetMaster())
|
||||||
leaderHasThreat = attacker->GetThreatMgr().getThreat(botAI->GetMaster());
|
leaderHasThreat = attacker->GetThreatMgr().GetThreat(botAI->GetMaster());
|
||||||
|
|
||||||
bool isMemberBotGroup = false;
|
bool isMemberBotGroup = false;
|
||||||
if (bot->GetGroup() && botAI->GetMaster())
|
if (bot->GetGroup() && botAI->GetMaster())
|
||||||
@@ -119,10 +119,14 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
|
|
||||||
bool inCannon = botAI->IsInVehicle(false, true);
|
bool inCannon = botAI->IsInVehicle(false, true);
|
||||||
|
|
||||||
|
bool enemy = botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target")->Get();
|
||||||
|
|
||||||
return attacker && attacker->IsInWorld() && attacker->GetMapId() == bot->GetMapId() && !attacker->isDead() && !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) &&
|
return attacker && attacker->IsInWorld() && attacker->GetMapId() == bot->GetMapId() && !attacker->isDead() && !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE_2) &&
|
||||||
(inCannon || !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) && attacker->CanSeeOrDetect(bot) &&
|
(inCannon || !attacker->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) && attacker->CanSeeOrDetect(bot) &&
|
||||||
!(attacker->HasUnitState(UNIT_STATE_STUNNED) && botAI->HasAura("shackle undead", attacker)) && !((attacker->IsPolymorphed() || botAI->HasAura("sap", attacker) || /*attacker->IsCharmed() ||*/ attacker->isFeared()) && !rti) &&
|
!(attacker->HasUnitState(UNIT_STATE_STUNNED) && botAI->HasAura("shackle undead", attacker)) && !((attacker->IsPolymorphed() || botAI->HasAura("sap", attacker) || /*attacker->IsCharmed() ||*/ attacker->isFeared()) && !rti) &&
|
||||||
/*!sServerFacade->IsInRoots(attacker) &&*/!attacker->IsFriendlyTo(bot) && bot->IsWithinDistInMap(attacker, range) &&
|
/*!sServerFacade->IsInRoots(attacker) &&*/!attacker->IsFriendlyTo(bot) && bot->IsWithinDistInMap(attacker, range) &&
|
||||||
|
!attacker->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) &&
|
||||||
|
!(attacker->GetGUID().IsPet() && enemy) &&
|
||||||
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) && !(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) &&
|
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) && !(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) &&
|
||||||
(attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
(attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
||||||
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class FindTargetForTankStrategy : public FindNonCcTargetStrategy
|
|||||||
if (IsCcTarget(creature))
|
if (IsCcTarget(creature))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float threat = threatMgr->getThreat(bot);
|
float threat = threatMgr->GetThreat(bot);
|
||||||
if (!result || (minThreat - threat) > 0.1f)
|
if (!result || (minThreat - threat) > 0.1f)
|
||||||
{
|
{
|
||||||
minThreat = threat;
|
minThreat = threat;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ uint8 ThreatValue::Calculate(Unit* target)
|
|||||||
if (!group)
|
if (!group)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float botThreat = target->GetThreatMgr().getThreat(bot);
|
float botThreat = target->GetThreatMgr().GetThreat(bot);
|
||||||
float maxThreat = -1.0f;
|
float maxThreat = -1.0f;
|
||||||
bool hasTank = false;
|
bool hasTank = false;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ uint8 ThreatValue::Calculate(Unit* target)
|
|||||||
if (botAI->IsTank(player))
|
if (botAI->IsTank(player))
|
||||||
{
|
{
|
||||||
hasTank = true;
|
hasTank = true;
|
||||||
float threat = target->GetThreatMgr().getThreat(player);
|
float threat = target->GetThreatMgr().GetThreat(player);
|
||||||
if (maxThreat < threat)
|
if (maxThreat < threat)
|
||||||
maxThreat = threat;
|
maxThreat = threat;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user