mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/Object): Permanently invisible creatures should be able to e… (#15498)
This commit is contained in:
@@ -1863,7 +1863,9 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
return false;
|
||||
|
||||
if (!CanDetect(obj, ignoreStealth, !distanceCheck, checkAlert))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1890,7 +1892,9 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool che
|
||||
if (!ignoreStealth)
|
||||
{
|
||||
if (!seer->CanDetectInvisibilityOf(obj)) // xinef: added ignoreStealth, allow AoE spells to hit invisible targets!
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!seer->CanDetectStealthOf(obj, checkAlert))
|
||||
{
|
||||
@@ -1923,11 +1927,32 @@ bool WorldObject::CanDetectInvisibilityOf(WorldObject const* obj) const
|
||||
// It seems like that only Units are affected by this check (couldn't see arena doors with preparation invisibility)
|
||||
if (obj->ToUnit())
|
||||
{
|
||||
uint32 objMask = m_invisibility.GetFlags() & obj->m_invisibilityDetect.GetFlags();
|
||||
// xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother
|
||||
objMask |= m_invisibility.GetFlags() & obj->m_invisibility.GetFlags();
|
||||
if (objMask != m_invisibility.GetFlags())
|
||||
return false;
|
||||
// Permanently invisible creatures should be able to engage non-invisible targets.
|
||||
// ex. Skulking Witch (20882) / Greater Invisibility (16380)
|
||||
bool isPermInvisibleCreature = false;
|
||||
if (Creature const* baseObj = ToCreature())
|
||||
{
|
||||
auto auraEffects = baseObj->GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
for (auto const effect : auraEffects)
|
||||
{
|
||||
if (SpellInfo const* spell = effect->GetSpellInfo())
|
||||
{
|
||||
if (spell->GetMaxDuration() == -1)
|
||||
{
|
||||
isPermInvisibleCreature = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPermInvisibleCreature)
|
||||
{
|
||||
uint32 objMask = m_invisibility.GetFlags() & obj->m_invisibilityDetect.GetFlags();
|
||||
// xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother
|
||||
objMask |= m_invisibility.GetFlags() & obj->m_invisibility.GetFlags();
|
||||
if (objMask != m_invisibility.GetFlags())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < TOTAL_INVISIBILITY_TYPES; ++i)
|
||||
|
||||
Reference in New Issue
Block a user