Core/Spelld: fix target selection for ground based aoe spells. use the center of the cast (dynamic object) instead of the caster for checking los
This commit is contained in:
@@ -12254,7 +12254,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// function based on function Unit::CanAttack from 13850 client
|
// function based on function Unit::CanAttack from 13850 client
|
||||||
bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const
|
bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj) const
|
||||||
{
|
{
|
||||||
ASSERT(target);
|
ASSERT(target);
|
||||||
|
|
||||||
@@ -12272,8 +12272,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
|||||||
if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
|
if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// can't attack invisible (ignore stealth for aoe spells)
|
// can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
|
||||||
if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
|
if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !canSeeOrDetect(target, bySpell && bySpell->IsAffectingArea())))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// can't attack dead
|
// can't attack dead
|
||||||
|
|||||||
@@ -1573,7 +1573,7 @@ class Unit : public WorldObject
|
|||||||
bool isTargetableForAttack(bool checkFakeDeath = true) const;
|
bool isTargetableForAttack(bool checkFakeDeath = true) const;
|
||||||
|
|
||||||
bool IsValidAttackTarget(Unit const* target) const;
|
bool IsValidAttackTarget(Unit const* target) const;
|
||||||
bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const;
|
bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, WorldObject const* obj = NULL) const;
|
||||||
|
|
||||||
bool IsValidAssistTarget(Unit const* target) const;
|
bool IsValidAssistTarget(Unit const* target) const;
|
||||||
bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const;
|
bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const;
|
||||||
|
|||||||
@@ -943,7 +943,7 @@ namespace Trinity
|
|||||||
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
|
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range))
|
if (i_funit->_IsValidAttackTarget(u, _spellInfo,i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user