Core/Spells: Implemented new target types
* TARGET_UNIT_TARGET_ALLY_OR_RAID * TARGET_UNIT_CASTER_AND_SUMMONS * TARGET_UNIT_AREA_THREAT_LIST * TARGET_UNIT_AREA_TAP_LIST
This commit is contained in:
1 parent
6622a94384
commit
9fe40967b1
4 files changed
+60
-8
No files matched your search
@@ -1277,6 +1277,46 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
}
|
||||
|
||||
std::list<WorldObject*> targets;
|
||||
|
||||
switch (targetType.GetTarget())
|
||||
{
|
||||
case TARGET_UNIT_TARGET_ALLY_OR_RAID:
|
||||
if (Unit* targetedUnit = m_targets.GetUnitTarget())
|
||||
{
|
||||
if (!m_caster->IsInRaidWith(targetedUnit))
|
||||
{
|
||||
targets.push_back(m_targets.GetUnitTarget());
|
||||
|
||||
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType);
|
||||
|
||||
if (!targets.empty())
|
||||
{
|
||||
// Other special target selection goes here
|
||||
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
|
||||
Trinity::Containers::RandomResize(targets, maxTargets);
|
||||
|
||||
for (WorldObject* target : targets)
|
||||
{
|
||||
if (Unit* unit = target->ToUnit())
|
||||
AddUnitTarget(unit, effMask, false, true, center);
|
||||
else if (GameObject* gObjTarget = target->ToGameObject())
|
||||
AddGOTarget(gObjTarget, effMask);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
center = targetedUnit;
|
||||
}
|
||||
break;
|
||||
case TARGET_UNIT_CASTER_AND_SUMMONS:
|
||||
targets.push_back(m_caster);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
// Workaround for some spells that don't have RadiusEntry set in dbc (but SpellRange instead)
|
||||
if (G3D::fuzzyEq(radius, 0.f))
|
||||
@@ -8224,6 +8264,16 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
|
||||
if (!_referer->IsInRaidWith(unitTarget))
|
||||
return false;
|
||||
break;
|
||||
case TARGET_CHECK_THREAT:
|
||||
if (_referer->getThreatManager().getThreat(unitTarget, true) <= 0.0f)
|
||||
return false;
|
||||
break;
|
||||
case TARGET_CHECK_TAP:
|
||||
if (_referer->GetTypeId() != TYPEID_UNIT || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
if (!_referer->ToCreature()->isTappedBy(unitTarget->ToPlayer()))
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user