Core/Spells: Rename TARGET_UNIT_CONE_ENEMY_54 to TARGET_UNIT_CONE_180_DEG_ENEMY and add 180 degree fallback for this target type

Port From (https://github.com/TrinityCore/TrinityCore/commit/8921d07201addf661db1642e507034a24fdfa3de)
This commit is contained in:
hondacrx
2022-02-17 09:26:49 -05:00
parent 393cd1e6d0
commit c81497bb36
3 changed files with 14 additions and 3 deletions
@@ -2628,7 +2628,7 @@ namespace Framework.Constants
GameobjectSrcArea = 51,
GameobjectDestArea = 52,
DestTargetEnemy = 53,
UnitConeEnemy54 = 54,
UnitCone180DegEnemy = 54, // Defaults to 180 if ConeDegrees is not set
DestCasterFrontLeap = 55, // For A Leap Spell
UnitCasterAreaRaid = 56,
UnitRaid = 57,
+12 -1
View File
@@ -646,6 +646,7 @@ namespace Game.Spells
void SelectImplicitConeTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
{
Position coneSrc = new(m_caster);
float coneAngle = m_spellInfo.ConeAngle;
switch (targetType.GetReferenceType())
{
case SpellTargetReferenceTypes.Caster:
@@ -658,6 +659,16 @@ namespace Game.Spells
break;
}
switch (targetType.GetTarget())
{
case Targets.UnitCone180DegEnemy:
if (coneAngle == 0.0f)
coneAngle = 180.0f;
break;
default:
break;
}
List<WorldObject> targets = new();
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
@@ -668,7 +679,7 @@ namespace Game.Spells
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
if (containerTypeMask != 0)
{
var spellCone = new WorldObjectSpellConeTargetCheck(coneSrc, MathFunctions.DegToRad(m_spellInfo.ConeAngle), m_spellInfo.Width != 0 ? m_spellInfo.Width : m_caster.GetCombatReach(), radius, m_caster, m_spellInfo, selectionType, condList, objectType);
var spellCone = new WorldObjectSpellConeTargetCheck(coneSrc, MathFunctions.DegToRad(coneAngle), m_spellInfo.Width != 0 ? m_spellInfo.Width : m_caster.GetCombatReach(), radius, m_caster, m_spellInfo, selectionType, condList, objectType);
var searcher = new WorldObjectListSearcher(m_caster, targets, spellCone, containerTypeMask);
SearchTargets(searcher, containerTypeMask, m_caster, m_caster.GetPosition(), radius);
+1 -1
View File
@@ -4977,7 +4977,7 @@ namespace Game.Spells
new StaticData(SpellTargetObjectTypes.Gobj, SpellTargetReferenceTypes.Src, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 51 TARGET_GAMEOBJECT_SRC_AREA
new StaticData(SpellTargetObjectTypes.Gobj, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 52 TARGET_GAMEOBJECT_DEST_AREA
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Target, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.None), // 53 TARGET_DEST_TARGET_ENEMY
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.Front), // 54 TARGET_UNIT_CONE_ENEMY_54
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.Front), // 54 TARGET_UNIT_CONE_180_DEG_ENEMY
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 55 TARGET_DEST_CASTER_FRONT_LEAP
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Raid, SpellTargetDirectionTypes.None), // 56 TARGET_UNIT_CASTER_AREA_RAID
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Target, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Raid, SpellTargetDirectionTypes.None), // 57 TARGET_UNIT_TARGET_RAID