Core/Spells Implement targets 133, 134, 135 : TARGET_UNIT_LINE_CASTER_TO_DEST_***
Port From (https://github.com/TrinityCore/TrinityCore/commit/fb6761c273d518eae6bab72fc9c2a2b6f93eec83)
This commit is contained in:
@@ -2661,9 +2661,9 @@ namespace Framework.Constants
|
|||||||
Unk130 = 130,
|
Unk130 = 130,
|
||||||
DestSummoner = 131,
|
DestSummoner = 131,
|
||||||
DestTargetAlly = 132,
|
DestTargetAlly = 132,
|
||||||
Unk133 = 133,
|
UnitLineCasterToDestAlly = 133,
|
||||||
Unk134 = 134,
|
UnitLineCasterToDestEnemy = 134,
|
||||||
Unk135 = 135,
|
UnitLineCasterToDest = 135,
|
||||||
Unk136 = 136,
|
Unk136 = 136,
|
||||||
Unk137 = 137,
|
Unk137 = 137,
|
||||||
Unk138 = 138,
|
Unk138 = 138,
|
||||||
@@ -2690,7 +2690,8 @@ namespace Framework.Constants
|
|||||||
Nearby,
|
Nearby,
|
||||||
Cone,
|
Cone,
|
||||||
Area,
|
Area,
|
||||||
Traj
|
Traj,
|
||||||
|
Line
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SpellTargetReferenceTypes
|
public enum SpellTargetReferenceTypes
|
||||||
|
|||||||
@@ -960,6 +960,7 @@ namespace Game
|
|||||||
case SpellTargetSelectionCategories.Cone:
|
case SpellTargetSelectionCategories.Cone:
|
||||||
case SpellTargetSelectionCategories.Area:
|
case SpellTargetSelectionCategories.Area:
|
||||||
case SpellTargetSelectionCategories.Traj:
|
case SpellTargetSelectionCategories.Traj:
|
||||||
|
case SpellTargetSelectionCategories.Line:
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -971,6 +972,7 @@ namespace Game
|
|||||||
case SpellTargetSelectionCategories.Cone:
|
case SpellTargetSelectionCategories.Cone:
|
||||||
case SpellTargetSelectionCategories.Area:
|
case SpellTargetSelectionCategories.Area:
|
||||||
case SpellTargetSelectionCategories.Traj:
|
case SpellTargetSelectionCategories.Traj:
|
||||||
|
case SpellTargetSelectionCategories.Line:
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ namespace Game.Entities
|
|||||||
return IsInDist2d(center, radius) && Math.Abs(verticalDelta) <= height;
|
return IsInDist2d(center, radius) && Math.Abs(verticalDelta) <= height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasInArc(float arc, Position obj, float border = 2.0f)
|
public bool HasInArc(float arc, Position obj, float border = 2.0f, float? orientation = null)
|
||||||
{
|
{
|
||||||
// always have self in arc
|
// always have self in arc
|
||||||
if (obj == this)
|
if (obj == this)
|
||||||
@@ -296,7 +296,7 @@ namespace Game.Entities
|
|||||||
arc = NormalizeOrientation(arc);
|
arc = NormalizeOrientation(arc);
|
||||||
|
|
||||||
float angle = GetAngle(obj);
|
float angle = GetAngle(obj);
|
||||||
angle -= GetOrientation();
|
angle -= orientation.HasValue ? orientation.Value : GetOrientation();
|
||||||
|
|
||||||
// move angle to range -pi ... +pi
|
// move angle to range -pi ... +pi
|
||||||
angle = NormalizeOrientation(angle);
|
angle = NormalizeOrientation(angle);
|
||||||
@@ -308,13 +308,13 @@ namespace Game.Entities
|
|||||||
return ((angle >= lborder) && (angle <= rborder));
|
return ((angle >= lborder) && (angle <= rborder));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasInLine(Position pos, float objSize, float width)
|
public bool HasInLine(Position pos, float objSize, float width, float? orientation = null)
|
||||||
{
|
{
|
||||||
if (!HasInArc(MathFunctions.PI, pos))
|
if (!HasInArc(MathFunctions.PI, pos, 2.0f, orientation))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
width += objSize;
|
width += objSize;
|
||||||
float angle = GetRelativeAngle(pos);
|
float angle = GetAngle(pos) - (orientation.HasValue ? orientation.Value : GetOrientation());
|
||||||
return Math.Abs(Math.Sin(angle)) * GetExactDist2d(pos.GetPositionX(), pos.GetPositionY()) < width;
|
return Math.Abs(Math.Sin(angle)) * GetExactDist2d(pos.GetPositionX(), pos.GetPositionY()) < width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ namespace Game.Scripting
|
|||||||
return true;
|
return true;
|
||||||
case SpellTargetSelectionCategories.Cone: // AREA
|
case SpellTargetSelectionCategories.Cone: // AREA
|
||||||
case SpellTargetSelectionCategories.Area: // AREA
|
case SpellTargetSelectionCategories.Area: // AREA
|
||||||
|
case SpellTargetSelectionCategories.Line: // AREA
|
||||||
return _area;
|
return _area;
|
||||||
case SpellTargetSelectionCategories.Default:
|
case SpellTargetSelectionCategories.Default:
|
||||||
switch (targetInfo.GetObjectType())
|
switch (targetInfo.GetObjectType())
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ namespace Game.Spells
|
|||||||
case SpellTargetSelectionCategories.Nearby:
|
case SpellTargetSelectionCategories.Nearby:
|
||||||
case SpellTargetSelectionCategories.Cone:
|
case SpellTargetSelectionCategories.Cone:
|
||||||
case SpellTargetSelectionCategories.Area:
|
case SpellTargetSelectionCategories.Area:
|
||||||
|
case SpellTargetSelectionCategories.Line:
|
||||||
// targets for effect already selected
|
// targets for effect already selected
|
||||||
if (Convert.ToBoolean(effectMask & processedEffectMask))
|
if (Convert.ToBoolean(effectMask & processedEffectMask))
|
||||||
return;
|
return;
|
||||||
@@ -386,6 +387,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
SelectImplicitTrajTargets(effIndex, targetType);
|
SelectImplicitTrajTargets(effIndex, targetType);
|
||||||
break;
|
break;
|
||||||
|
case SpellTargetSelectionCategories.Line:
|
||||||
|
SelectImplicitLineTargets(effIndex, targetType, effectMask);
|
||||||
|
break;
|
||||||
case SpellTargetSelectionCategories.Default:
|
case SpellTargetSelectionCategories.Default:
|
||||||
switch (targetType.GetObjectType())
|
switch (targetType.GetObjectType())
|
||||||
{
|
{
|
||||||
@@ -1238,6 +1242,76 @@ namespace Game.Spells
|
|||||||
veh.SetLastShootPos(m_targets.GetDstPos());
|
veh.SetLastShootPos(m_targets.GetDstPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectImplicitLineTargets(uint effIndex, SpellImplicitTargetInfo targetType, uint effMask)
|
||||||
|
{
|
||||||
|
List<WorldObject> targets = new();
|
||||||
|
SpellTargetObjectTypes objectType = targetType.GetObjectType();
|
||||||
|
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
|
||||||
|
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
|
||||||
|
if (effect == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Position dst;
|
||||||
|
switch (targetType.GetReferenceType())
|
||||||
|
{
|
||||||
|
case SpellTargetReferenceTypes.Src:
|
||||||
|
dst = m_targets.GetSrcPos();
|
||||||
|
break;
|
||||||
|
case SpellTargetReferenceTypes.Dest:
|
||||||
|
dst = m_targets.GetDstPos();
|
||||||
|
break;
|
||||||
|
case SpellTargetReferenceTypes.Caster:
|
||||||
|
dst = m_caster;
|
||||||
|
break;
|
||||||
|
case SpellTargetReferenceTypes.Target:
|
||||||
|
dst = m_targets.GetUnitTarget();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Cypher.Assert(false, "Spell.SelectImplicitLineTargets: received not implemented target reference type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var condList = effect.ImplicitTargetConditions;
|
||||||
|
float radius = effect.CalcRadius(m_caster) * m_spellValue.RadiusMod;
|
||||||
|
|
||||||
|
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
|
||||||
|
if (containerTypeMask != 0)
|
||||||
|
{
|
||||||
|
WorldObjectSpellLineTargetCheck check = new(m_caster, dst, m_spellInfo.Width != 0 ? m_spellInfo.Width : m_caster.GetCombatReach(), radius, m_caster, m_spellInfo, selectionType, condList, objectType);
|
||||||
|
WorldObjectListSearcher searcher = new(m_caster, targets, check, containerTypeMask);
|
||||||
|
SearchTargets(searcher, containerTypeMask, m_caster, m_caster, radius);
|
||||||
|
|
||||||
|
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType);
|
||||||
|
|
||||||
|
if (!targets.Empty())
|
||||||
|
{
|
||||||
|
// Other special target selection goes here
|
||||||
|
uint maxTargets = m_spellValue.MaxAffectedTargets;
|
||||||
|
if (maxTargets != 0)
|
||||||
|
{
|
||||||
|
if (maxTargets < targets.Count)
|
||||||
|
{
|
||||||
|
targets.Sort(new ObjectDistanceOrderPred(m_caster));
|
||||||
|
targets.Resize(maxTargets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var obj in targets)
|
||||||
|
{
|
||||||
|
Unit unit = obj.ToUnit();
|
||||||
|
if (unit != null)
|
||||||
|
AddUnitTarget(unit, effMask, false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameObject gObjTarget = obj.ToGameObject();
|
||||||
|
if (gObjTarget != null)
|
||||||
|
AddGOTarget(gObjTarget, effMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SelectEffectTypeImplicitTargets(uint effIndex)
|
void SelectEffectTypeImplicitTargets(uint effIndex)
|
||||||
{
|
{
|
||||||
// special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER
|
// special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER
|
||||||
@@ -7956,6 +8030,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
float _range;
|
float _range;
|
||||||
Position _position;
|
Position _position;
|
||||||
|
|
||||||
public WorldObjectSpellNearbyTargetCheck(float range, Unit caster, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
|
public WorldObjectSpellNearbyTargetCheck(float range, Unit caster, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
|
||||||
: base(caster, caster, spellInfo, selectionType, condList, objectType)
|
: base(caster, caster, spellInfo, selectionType, condList, objectType)
|
||||||
{
|
{
|
||||||
@@ -7979,6 +8054,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
float _range;
|
float _range;
|
||||||
Position _position;
|
Position _position;
|
||||||
|
|
||||||
public WorldObjectSpellAreaTargetCheck(float range, Position position, Unit caster, Unit referer, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
|
public WorldObjectSpellAreaTargetCheck(float range, Position position, Unit caster, Unit referer, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
|
||||||
: base(caster, referer, spellInfo, selectionType, condList, objectType)
|
: base(caster, referer, spellInfo, selectionType, condList, objectType)
|
||||||
{
|
{
|
||||||
@@ -8068,6 +8144,33 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class WorldObjectSpellLineTargetCheck : WorldObjectSpellAreaTargetCheck
|
||||||
|
{
|
||||||
|
Position _srcPosition;
|
||||||
|
Position _dstPosition;
|
||||||
|
float _lineWidth;
|
||||||
|
|
||||||
|
public WorldObjectSpellLineTargetCheck(Position srcPosition, Position dstPosition, float lineWidth, float range, Unit caster, SpellInfo spellInfo, SpellTargetCheckTypes selectionType, List<Condition> condList, SpellTargetObjectTypes objectType)
|
||||||
|
: base(range, caster, caster, caster, spellInfo, selectionType, condList, objectType)
|
||||||
|
{
|
||||||
|
_srcPosition = srcPosition;
|
||||||
|
_dstPosition = dstPosition;
|
||||||
|
_lineWidth = lineWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Invoke(WorldObject target)
|
||||||
|
{
|
||||||
|
float angle = _caster.GetOrientation();
|
||||||
|
if (_srcPosition != _dstPosition)
|
||||||
|
angle = _srcPosition.GetAngle(_dstPosition);
|
||||||
|
|
||||||
|
if (!_caster.HasInLine(target, target.GetCombatReach(), _lineWidth, angle))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.Invoke(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class SpellEvent : BasicEvent
|
public class SpellEvent : BasicEvent
|
||||||
{
|
{
|
||||||
public SpellEvent(Spell spell)
|
public SpellEvent(Spell spell)
|
||||||
|
|||||||
@@ -4856,9 +4856,9 @@ namespace Game.Spells
|
|||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 130
|
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 130
|
||||||
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 131 TARGET_DEST_SUMMONER
|
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 131 TARGET_DEST_SUMMONER
|
||||||
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Target, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Ally, SpellTargetDirectionTypes.None), // 132 TARGET_DEST_TARGET_ALLY
|
new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Target, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Ally, SpellTargetDirectionTypes.None), // 132 TARGET_DEST_TARGET_ALLY
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 133
|
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Line, SpellTargetCheckTypes.Ally, SpellTargetDirectionTypes.None), // 133 TARGET_UNIT_LINE_CASTER_TO_DEST_ALLY
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 134
|
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Line, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.None), // 134 TARGET_UNIT_LINE_CASTER_TO_DEST_ENEMY
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 135
|
new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Line, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 135 TARGET_UNIT_LINE_CASTER_TO_DEST
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 136
|
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 136
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 137
|
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 137
|
||||||
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 138
|
new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 138
|
||||||
|
|||||||
@@ -3630,6 +3630,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (spellInfo.ActiveIconFileDataId == 135754) // flight
|
if (spellInfo.ActiveIconFileDataId == 135754) // flight
|
||||||
spellInfo.Attributes |= SpellAttr0.Passive;
|
spellInfo.Attributes |= SpellAttr0.Passive;
|
||||||
|
|
||||||
|
if (spellInfo.IsSingleTarget())
|
||||||
|
spellInfo.MaxAffectedTargets = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SummonPropertiesRecord properties = CliDB.SummonPropertiesStorage.LookupByKey(121);
|
SummonPropertiesRecord properties = CliDB.SummonPropertiesStorage.LookupByKey(121);
|
||||||
|
|||||||
Reference in New Issue
Block a user