mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -14056,7 +14056,7 @@ void Unit::TauntFadeOut(Unit* taunter)
|
||||
if (m_ThreatMgr.isThreatListEmpty())
|
||||
{
|
||||
if (creature->IsAIEnabled)
|
||||
creature->AI()->EnterEvadeMode();
|
||||
creature->AI()->EnterEvadeMode(CreatureAI::EVADE_REASON_NO_HOSTILES);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14094,7 +14094,7 @@ Unit* Creature::SelectVictim()
|
||||
if (CanHaveThreatList())
|
||||
{
|
||||
if (!target && !m_ThreatMgr.isThreatListEmpty())
|
||||
target = m_ThreatMgr.getHostilTarget();
|
||||
target = m_ThreatMgr.getHostileTarget();
|
||||
}
|
||||
else if (!HasReactState(REACT_PASSIVE))
|
||||
{
|
||||
@@ -14142,7 +14142,7 @@ Unit* Creature::SelectVictim()
|
||||
for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
|
||||
if ((*itr)->GetBase()->IsPermanent())
|
||||
{
|
||||
AI()->EnterEvadeMode();
|
||||
AI()->EnterEvadeMode(CreatureAI::EVADE_REASON_NO_HOSTILES);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -17916,6 +17916,8 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
||||
// Set charmed
|
||||
charmer->SetCharm(this, true);
|
||||
|
||||
StopAttackingInvalidTarget();
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
|
||||
@@ -18080,6 +18082,8 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||
|
||||
charmer->SetCharm(this, false);
|
||||
|
||||
StopAttackingInvalidTarget();
|
||||
|
||||
Player* playerCharmer = charmer->ToPlayer();
|
||||
if (playerCharmer)
|
||||
{
|
||||
@@ -19623,6 +19627,37 @@ void Unit::StopAttackFaction(uint32 faction_id)
|
||||
(*itr)->StopAttackFaction(faction_id);
|
||||
}
|
||||
|
||||
void Unit::StopAttackingInvalidTarget()
|
||||
{
|
||||
AttackerSet const& attackers = getAttackers();
|
||||
for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
|
||||
{
|
||||
Unit* attacker = (*itr);
|
||||
if (!attacker->IsValidAttackTarget(this))
|
||||
{
|
||||
attacker->AttackStop();
|
||||
if (attacker->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
attacker->ToPlayer()->SendAttackSwingCancelAttack();
|
||||
}
|
||||
|
||||
for (Unit* controled : attacker->m_Controlled)
|
||||
{
|
||||
if (controled->GetVictim() == this && !controled->IsValidAttackTarget(this))
|
||||
{
|
||||
controled->AttackStop();
|
||||
}
|
||||
}
|
||||
|
||||
itr = attackers.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::OutDebugInfo() const
|
||||
{
|
||||
LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
|
||||
|
||||
@@ -1360,6 +1360,7 @@ public:
|
||||
void CombatStop(bool includingCast = false);
|
||||
void CombatStopWithPets(bool includingCast = false);
|
||||
void StopAttackFaction(uint32 faction_id);
|
||||
void StopAttackingInvalidTarget();
|
||||
Unit* SelectNearbyTarget(Unit* exclude = nullptr, float dist = NOMINAL_MELEE_RANGE) const;
|
||||
Unit* SelectNearbyNoTotemTarget(Unit* exclude = nullptr, float dist = NOMINAL_MELEE_RANGE) const;
|
||||
void SendMeleeAttackStop(Unit* victim = nullptr);
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Unit.h"
|
||||
#include "Define.h"
|
||||
#include "SmartEnum.h"
|
||||
#include "Unit.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Acore::Impl::EnumUtilsImpl
|
||||
|
||||
Reference in New Issue
Block a user