Core/Spells: defined and implemented SPELL_ATTR5_DONT_TARGET_PLAYERS
This commit is contained in:
1 parent
1706b9688f
commit
e93a66d287
4 files changed
+14
-4
No files matched your search
@@ -945,10 +945,14 @@ namespace Trinity
|
||||
class AnyFriendlyUnitInObjectRangeCheck
|
||||
{
|
||||
public:
|
||||
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly) { }
|
||||
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool playerOnly = false, bool noPlayerTarget = false) : i_obj(obj), i_funit(funit), i_range(range), i_playerOnly(playerOnly), i_noPlayerTarget(noPlayerTarget) { }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_funit->IsFriendlyTo(u) && (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER))
|
||||
if (u->IsAlive()
|
||||
&& i_obj->IsWithinDistInMap(u, i_range)
|
||||
&& i_funit->IsFriendlyTo(u)
|
||||
&& (!i_playerOnly || u->GetTypeId() == TYPEID_PLAYER)
|
||||
&& (!i_noPlayerTarget || u->GetTypeId() != TYPEID_PLAYER))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -958,6 +962,7 @@ namespace Trinity
|
||||
Unit const* i_funit;
|
||||
float i_range;
|
||||
bool i_playerOnly;
|
||||
bool i_noPlayerTarget;
|
||||
};
|
||||
|
||||
class AnyGroupedUnitInObjectRangeCheck
|
||||
@@ -1054,6 +1059,9 @@ namespace Trinity
|
||||
if (_spellInfo && _spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS) && u->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if (_spellInfo && _spellInfo->HasAttribute(SPELL_ATTR5_DONT_TARGET_PLAYERS) && u->GetTypeId() == TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
return i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range);
|
||||
}
|
||||
private:
|
||||
|
||||
@@ -540,7 +540,7 @@ enum SpellAttr5
|
||||
SPELL_ATTR5_UNK4 = 0x00000010, // 4
|
||||
SPELL_ATTR5_SINGLE_TARGET_SPELL = 0x00000020, // 5 Only one target can be apply at a time
|
||||
SPELL_ATTR5_UNK6 = 0x00000040, // 6
|
||||
SPELL_ATTR5_UNK7 = 0x00000080, // 7
|
||||
SPELL_ATTR5_DONT_TARGET_PLAYERS = 0x00000080, // 7 Not On Player
|
||||
SPELL_ATTR5_DONT_ALLOW_PET_TARGET = 0x00000100, // 8 do not allow the following spell to affect or target pets
|
||||
SPELL_ATTR5_START_PERIODIC_AT_APPLY = 0x00000200, // 9 begin periodic tick at aura apply
|
||||
SPELL_ATTR5_HIDE_DURATION = 0x00000400, // 10 do not send duration to client
|
||||
|
||||
@@ -2427,7 +2427,7 @@ void DynObjAura::FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit*
|
||||
if (GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_ALLY
|
||||
|| GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_UNIT_DEST_AREA_ALLY)
|
||||
{
|
||||
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius, m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS));
|
||||
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius, m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS), m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TARGET_PLAYERS));
|
||||
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(GetDynobjOwner(), units, u_check);
|
||||
Cell::VisitAllObjects(GetDynobjOwner(), searcher, radius);
|
||||
}
|
||||
|
||||
@@ -1916,6 +1916,8 @@ uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionConta
|
||||
retMask &= GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER;
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_GHOSTS))
|
||||
retMask &= GRID_MAP_TYPE_MASK_PLAYER;
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TARGET_PLAYERS))
|
||||
retMask &= ~(GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER);
|
||||
|
||||
if (condList)
|
||||
retMask &= sConditionMgr->GetSearcherTypeMaskForConditionList(*condList);
|
||||
|
||||
Reference in new issue
Block a user