mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
refactor(Core): Clean-up after FD (#8586)
This commit is contained in:
@@ -2351,13 +2351,6 @@ bool Creature::_IsTargetAcceptable(const Unit* target) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Creature::_CanDetectFeignDeathOf(const Unit* target) const
|
||||
{
|
||||
if (target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH))
|
||||
return IsGuard();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Creature::UpdateMoveInLineOfSightState()
|
||||
{
|
||||
// xinef: pets, guardians and units with scripts / smartAI should be skipped
|
||||
@@ -2423,6 +2416,12 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// if victim is in FD and we can't see that
|
||||
if (victim->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetCharmerOrOwnerGUID().IsPlayer())
|
||||
{
|
||||
if (GetMap()->IsDungeon())
|
||||
|
||||
@@ -255,7 +255,6 @@ public:
|
||||
bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const;
|
||||
bool _IsTargetAcceptable(const Unit* target) const;
|
||||
bool CanIgnoreFeignDeath() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0; }
|
||||
bool _CanDetectFeignDeathOf(const Unit* target) const; // pussywizard
|
||||
|
||||
// pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone
|
||||
void UpdateMoveInLineOfSightState();
|
||||
|
||||
@@ -13917,7 +13917,7 @@ Unit* Creature::SelectVictim()
|
||||
if (!tauntAuras.empty())
|
||||
for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
|
||||
if (Unit* caster = (*itr)->GetCaster())
|
||||
if (_CanDetectFeignDeathOf(caster) && CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID()))
|
||||
if (CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID()))
|
||||
{
|
||||
target = caster;
|
||||
break;
|
||||
@@ -13950,7 +13950,7 @@ Unit* Creature::SelectVictim()
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
if (target && _CanDetectFeignDeathOf(target) && CanCreatureAttack(target))
|
||||
if (target && CanCreatureAttack(target))
|
||||
{
|
||||
SetInFront(target);
|
||||
return target;
|
||||
|
||||
Reference in New Issue
Block a user