Skip to content

Commit

Permalink
fix(Core/Spells): Fixed calculating LoS for dynamic objects. (#13521)
Browse files Browse the repository at this point in the history
Fixes #13255
  • Loading branch information
UltraNix committed Oct 29, 2022
1 parent 41d3df9 commit 0cd6319
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/server/game/Spells/Auras/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2923,15 +2923,18 @@ void DynObjAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* /*caster*/

for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{
// xinef: check z level and los dependence
Unit* target = *itr;
float zLevel = GetDynobjOwner()->GetPositionZ();
if (target->GetPositionZ() + 3.0f < zLevel || target->GetPositionZ() - 5.0f > zLevel)

Optional<float> collisionHeight = { };
if (Unit* dynObjCaster = GetDynobjOwner()->GetCaster())
{
if (!spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) && !target->IsWithinLOSInMap(GetDynobjOwner()))
{
continue;
}
collisionHeight = dynObjCaster->GetCollisionHeight();
}

if (!spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) && !spellInfo->HasAttribute(SPELL_ATTR5_ALWAYS_AOE_LINE_OF_SIGHT) &&
!target->IsWithinLOSInMap(GetDynobjOwner(), VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_ALL_CHECKS, collisionHeight))
{
continue;
}

std::map<Unit*, uint8>::iterator existing = targets.find(*itr);
Expand Down

0 comments on commit 0cd6319

Please sign in to comment.