Core/Spells: Rename TARGET_UNIT_CONE_ENEMY_104 to TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY

Port From (https://github.com/TrinityCore/TrinityCore/commit/70f1eaac4867cac94fb1a19f5bbf5096366f6281)
This commit is contained in:
hondacrx
2022-02-16 13:09:48 -05:00
parent 8d7ba1061c
commit c0795c5849
4 changed files with 21 additions and 11 deletions
@@ -2678,7 +2678,7 @@ namespace Framework.Constants
UnitPassenger5 = 101,
UnitPassenger6 = 102,
UnitPassenger7 = 103,
UnitConeEnemy104 = 104,
UnitConeCasterToDestEnemy = 104,
UnitUnk105 = 105, // 1 Spell
DestChannelCaster = 106,
UnkDestAreaUnk107 = 107, // Not Enough Info - Only Generic Spells Avalible
+18 -8
View File
@@ -645,11 +645,19 @@ namespace Game.Spells
void SelectImplicitConeTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
{
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
Position coneSrc = new(m_caster);
switch (targetType.GetReferenceType())
{
Cypher.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
return;
case SpellTargetReferenceTypes.Caster:
break;
case SpellTargetReferenceTypes.Dest:
if (m_caster.GetExactDist2d(m_targets.GetDstPos()) > 0.1f)
coneSrc.SetOrientation(m_caster.GetAbsoluteAngle(m_targets.GetDstPos()));
break;
default:
break;
}
List<WorldObject> targets = new();
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
@@ -660,7 +668,7 @@ namespace Game.Spells
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
if (containerTypeMask != 0)
{
var spellCone = new WorldObjectSpellConeTargetCheck(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(m_spellInfo.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);
@@ -8515,12 +8523,14 @@ namespace Game.Spells
public class WorldObjectSpellConeTargetCheck : WorldObjectSpellAreaTargetCheck
{
Position _coneSrc;
float _coneAngle;
float _lineWidth;
public WorldObjectSpellConeTargetCheck(float coneAngle, float lineWidth, float range, WorldObject caster, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
public WorldObjectSpellConeTargetCheck(Position coneSrc, float coneAngle, float lineWidth, float range, WorldObject caster, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
: base(range, caster.GetPosition(), caster, caster, spellInfo, selectionType, condList, objectType)
{
_coneSrc = coneSrc;
_coneAngle = coneAngle;
_lineWidth = lineWidth;
}
@@ -8529,12 +8539,12 @@ namespace Game.Spells
{
if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeBack))
{
if (!_caster.IsInBack(target, _coneAngle))
if (_coneSrc.HasInArc(-Math.Abs(_coneAngle), target))
return false;
}
else if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeLine))
{
if (!_caster.HasInLine(target, target.GetCombatReach(), _lineWidth))
if (!_coneSrc.HasInLine(target, target.GetCombatReach(), _lineWidth))
return false;
}
else
@@ -8542,7 +8552,7 @@ namespace Game.Spells
if (!_caster.IsUnit() || !_caster.ToUnit().IsWithinBoundaryRadius(target.ToUnit()))
// ConeAngle > 0 . select targets in front
// ConeAngle < 0 . select targets in back
if (_caster.HasInArc(_coneAngle, target) != MathFunctions.fuzzyGe(_coneAngle, 0.0f))
if (_coneSrc.HasInArc(_coneAngle, target) != MathFunctions.fuzzyGe(_coneAngle, 0.0f))
return false;
}
return base.Invoke(target);
+1 -1
View File
@@ -5027,7 +5027,7 @@ namespace Game.Spells
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 101 TARGET_UNIT_PASSENGER_5
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 102 TARGET_UNIT_PASSENGER_6
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 103 TARGET_UNIT_PASSENGER_7
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.Front), // 104 TARGET_UNIT_CONE_ENEMY_104
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.Front), // 104 TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 105 TARGET_UNIT_UNK_105
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Channel, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 106 TARGET_DEST_CHANNEL_CASTER
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 107 TARGET_UNK_DEST_AREA_UNK_107
+1 -1
View File
@@ -286,7 +286,7 @@ namespace Scripts.Spells.Shaman
public override void Register()
{
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitConeEnemy104));
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(CountTargets, 0, Targets.UnitConeCasterToDestEnemy));
AfterCast.Add(new CastHandler(TriggerCleaveBuff));
}