Core/Spells: Implemented target 105 TARGET_UNIT_CASTER_AND_PASSENGERS

This commit is contained in:
Shauren
2021-12-29 01:18:17 +01:00
parent 565ef6a2f4
commit bbdb70ed57
3 changed files with 15 additions and 29 deletions
@@ -2603,7 +2603,7 @@ enum Targets
TARGET_UNIT_PASSENGER_6 = 102,
TARGET_UNIT_PASSENGER_7 = 103,
TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY = 104,
TARGET_UNIT_UNK_105 = 105, // 1 spell
TARGET_UNIT_CASTER_AND_PASSENGERS = 105,
TARGET_DEST_CHANNEL_CASTER = 106,
TARGET_UNK_DEST_AREA_UNK_107 = 107, // not enough info - only generic spells avalible
TARGET_GAMEOBJECT_CONE_108 = 108,
+13 -27
View File
@@ -1233,50 +1233,36 @@ void Spell::SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, Sp
return;
}
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue->RadiusMod;
std::list<WorldObject*> targets;
switch (targetType.GetTarget())
{
case TARGET_UNIT_CASTER_AND_PASSENGERS:
targets.push_back(m_caster);
if (Unit* unit = m_caster->ToUnit())
if (Vehicle const* vehicleKit = unit->GetVehicleKit())
for (int8 seat = 0; seat < MAX_VEHICLE_SEATS; ++seat)
if (Unit* passenger = vehicleKit->GetPassenger(seat))
targets.push_back(passenger);
break;
case TARGET_UNIT_TARGET_ALLY_OR_RAID:
if (Unit* targetedUnit = m_targets.GetUnitTarget())
{
if (!m_caster->IsUnit() || !m_caster->ToUnit()->IsInRaidWith(targetedUnit))
{
targets.push_back(m_targets.GetUnitTarget());
CallScriptObjectAreaTargetSelectHandlers(targets, spellEffectInfo.EffectIndex, 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;
else
SearchAreaTargets(targets, radius, targetedUnit, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions);
}
break;
case TARGET_UNIT_CASTER_AND_SUMMONS:
targets.push_back(m_caster);
SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions);
break;
default:
SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions);
break;
}
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue->RadiusMod;
SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions);
CallScriptObjectAreaTargetSelectHandlers(targets, spellEffectInfo.EffectIndex, targetType);
if (!targets.empty())
+1 -1
View File
@@ -323,7 +323,7 @@ SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_T
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 102 TARGET_UNIT_PASSENGER_6
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 103 TARGET_UNIT_PASSENGER_7
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ENEMY, TARGET_DIR_FRONT}, // 104 TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 105 TARGET_UNIT_UNK_105
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 105 TARGET_UNIT_CASTER_AND_PASSENGERS
{TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 106 TARGET_DEST_CHANNEL_CASTER
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 107 TARGET_UNK_DEST_AREA_UNK_107
{TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 108 TARGET_GAMEOBJECT_CONE_108