mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
fix(Core/Pets): controllable guardians (including pets) should not set the combat with its target when commanded to attack it. (#8877)
This commit is contained in:
@@ -2324,6 +2324,14 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr
|
||||
else
|
||||
LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) %s attacked %s for %u dmg, absorbed %u, blocked %u, resisted %u.",
|
||||
GetGUID().ToString().c_str(), victim->GetGUID().ToString().c_str(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
||||
|
||||
// Let the pet know we've started attacking someting. Handles melee attacks only
|
||||
// Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
|
||||
if (GetTypeId() == TYPEID_PLAYER && !m_Controlled.empty())
|
||||
for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
|
||||
if (Unit* pet = *itr)
|
||||
if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
|
||||
pet->ToCreature()->AI()->OwnerAttacked(victim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9715,7 +9723,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
// set position before any AI calls/assistance
|
||||
//if (GetTypeId() == TYPEID_UNIT)
|
||||
// ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
if (creature && !IsControlledByPlayer())
|
||||
if (creature && !(IsControllableGuardian() && IsControlledByPlayer()))
|
||||
{
|
||||
// should not let player enter combat by right clicking target - doesn't helps
|
||||
SetInCombatWith(victim);
|
||||
@@ -9737,14 +9745,6 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
|
||||
if (meleeAttack)
|
||||
SendMeleeAttackStart(victim);
|
||||
|
||||
// Let the pet know we've started attacking someting. Handles melee attacks only
|
||||
// Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
|
||||
if (GetTypeId() == TYPEID_PLAYER && !m_Controlled.empty())
|
||||
for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
|
||||
if (Unit* pet = *itr)
|
||||
if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
|
||||
pet->ToCreature()->AI()->OwnerAttacked(victim);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user