Core/Spells: Fixed target radius logic in spell effects for TargetB
Port From (https://github.com/TrinityCore/TrinityCore/commit/889e88ab8033a78db837e0bb8619d8ce9d64967f)
This commit is contained in:
@@ -2962,4 +2962,10 @@ namespace Framework.Constants
|
|||||||
ForcedDismount = 9,
|
ForcedDismount = 9,
|
||||||
Ok = 10 // never sent
|
Ok = 10 // never sent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum SpellTargetIndex
|
||||||
|
{
|
||||||
|
TargetA = 0,
|
||||||
|
TargetB = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-29
@@ -243,8 +243,8 @@ namespace Game.Spells
|
|||||||
if (Convert.ToBoolean(implicitTargetMask & (SpellCastTargetFlags.Gameobject | SpellCastTargetFlags.GameobjectItem)))
|
if (Convert.ToBoolean(implicitTargetMask & (SpellCastTargetFlags.Gameobject | SpellCastTargetFlags.GameobjectItem)))
|
||||||
m_targets.SetTargetFlag(SpellCastTargetFlags.Gameobject);
|
m_targets.SetTargetFlag(SpellCastTargetFlags.Gameobject);
|
||||||
|
|
||||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetA, ref processedAreaEffectsMask);
|
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetA, SpellTargetIndex.TargetA, ref processedAreaEffectsMask);
|
||||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetB, ref processedAreaEffectsMask);
|
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetB, SpellTargetIndex.TargetB, ref processedAreaEffectsMask);
|
||||||
|
|
||||||
// Select targets of effect based on effect type
|
// Select targets of effect based on effect type
|
||||||
// those are used when no valid target could be added for spell effect based on spell target type
|
// those are used when no valid target could be added for spell effect based on spell target type
|
||||||
@@ -370,7 +370,7 @@ namespace Game.Spells
|
|||||||
m_caster.m_Events.ModifyEventTime(_spellEvent, TimeSpan.FromMilliseconds(GetDelayStart() + m_delayMoment));
|
m_caster.m_Events.ModifyEventTime(_spellEvent, TimeSpan.FromMilliseconds(GetDelayStart() + m_delayMoment));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectEffectImplicitTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, ref uint processedEffectMask)
|
void SelectEffectImplicitTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex, ref uint processedEffectMask)
|
||||||
{
|
{
|
||||||
if (targetType.GetTarget() == 0)
|
if (targetType.GetTarget() == 0)
|
||||||
return;
|
return;
|
||||||
@@ -397,7 +397,8 @@ namespace Game.Spells
|
|||||||
spellEffectInfo.TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
|
spellEffectInfo.TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
|
||||||
spellEffectInfo.TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
|
spellEffectInfo.TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
|
||||||
spellEffectInfo.ImplicitTargetConditions == effects[j].ImplicitTargetConditions &&
|
spellEffectInfo.ImplicitTargetConditions == effects[j].ImplicitTargetConditions &&
|
||||||
spellEffectInfo.CalcRadius(m_caster) == effects[j].CalcRadius(m_caster) &&
|
spellEffectInfo.CalcRadius(m_caster, SpellTargetIndex.TargetA) == effects[j].CalcRadius(m_caster, SpellTargetIndex.TargetA) &&
|
||||||
|
spellEffectInfo.CalcRadius(m_caster, SpellTargetIndex.TargetB) == effects[j].CalcRadius(m_caster, SpellTargetIndex.TargetB) &&
|
||||||
CheckScriptEffectImplicitTargets(spellEffectInfo.EffectIndex, (uint)j))
|
CheckScriptEffectImplicitTargets(spellEffectInfo.EffectIndex, (uint)j))
|
||||||
{
|
{
|
||||||
effectMask |= 1u << j;
|
effectMask |= 1u << j;
|
||||||
@@ -416,13 +417,13 @@ namespace Game.Spells
|
|||||||
SelectImplicitChannelTargets(spellEffectInfo, targetType);
|
SelectImplicitChannelTargets(spellEffectInfo, targetType);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Nearby:
|
case SpellTargetSelectionCategories.Nearby:
|
||||||
SelectImplicitNearbyTargets(spellEffectInfo, targetType, effectMask);
|
SelectImplicitNearbyTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Cone:
|
case SpellTargetSelectionCategories.Cone:
|
||||||
SelectImplicitConeTargets(spellEffectInfo, targetType, effectMask);
|
SelectImplicitConeTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Area:
|
case SpellTargetSelectionCategories.Area:
|
||||||
SelectImplicitAreaTargets(spellEffectInfo, targetType, effectMask);
|
SelectImplicitAreaTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Traj:
|
case SpellTargetSelectionCategories.Traj:
|
||||||
// just in case there is no dest, explanation in SelectImplicitDestDestTargets
|
// just in case there is no dest, explanation in SelectImplicitDestDestTargets
|
||||||
@@ -431,7 +432,7 @@ namespace Game.Spells
|
|||||||
SelectImplicitTrajTargets(spellEffectInfo, targetType);
|
SelectImplicitTrajTargets(spellEffectInfo, targetType);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Line:
|
case SpellTargetSelectionCategories.Line:
|
||||||
SelectImplicitLineTargets(spellEffectInfo, targetType, effectMask);
|
SelectImplicitLineTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||||
break;
|
break;
|
||||||
case SpellTargetSelectionCategories.Default:
|
case SpellTargetSelectionCategories.Default:
|
||||||
switch (targetType.GetObjectType())
|
switch (targetType.GetObjectType())
|
||||||
@@ -451,13 +452,13 @@ namespace Game.Spells
|
|||||||
switch (targetType.GetReferenceType())
|
switch (targetType.GetReferenceType())
|
||||||
{
|
{
|
||||||
case SpellTargetReferenceTypes.Caster:
|
case SpellTargetReferenceTypes.Caster:
|
||||||
SelectImplicitCasterDestTargets(spellEffectInfo, targetType);
|
SelectImplicitCasterDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||||
break;
|
break;
|
||||||
case SpellTargetReferenceTypes.Target:
|
case SpellTargetReferenceTypes.Target:
|
||||||
SelectImplicitTargetDestTargets(spellEffectInfo, targetType);
|
SelectImplicitTargetDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||||
break;
|
break;
|
||||||
case SpellTargetReferenceTypes.Dest:
|
case SpellTargetReferenceTypes.Dest:
|
||||||
SelectImplicitDestDestTargets(spellEffectInfo, targetType);
|
SelectImplicitDestDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
||||||
@@ -563,7 +564,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitNearbyTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
|
void SelectImplicitNearbyTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex, uint effMask)
|
||||||
{
|
{
|
||||||
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
|
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
|
||||||
{
|
{
|
||||||
@@ -642,7 +643,7 @@ namespace Game.Spells
|
|||||||
dest = new SpellDestination(st.target_X, st.target_Y, st.target_Z, st.target_Orientation);
|
dest = new SpellDestination(st.target_X, st.target_Y, st.target_Z, st.target_Orientation);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float randomRadius1 = spellEffectInfo.CalcRadius(m_caster);
|
float randomRadius1 = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||||
if (randomRadius1 > 0.0f)
|
if (randomRadius1 > 0.0f)
|
||||||
m_caster.MovePositionToFirstCollision(dest.Position, randomRadius1, targetType.CalcDirectionAngle());
|
m_caster.MovePositionToFirstCollision(dest.Position, randomRadius1, targetType.CalcDirectionAngle());
|
||||||
}
|
}
|
||||||
@@ -668,7 +669,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
target = m_caster;
|
target = m_caster;
|
||||||
// radius is only meant to be randomized when using caster fallback
|
// radius is only meant to be randomized when using caster fallback
|
||||||
randomRadius = spellEffectInfo.CalcRadius(m_caster);
|
randomRadius = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -749,7 +750,7 @@ namespace Game.Spells
|
|||||||
SelectImplicitChainTargets(spellEffectInfo, targetType, target, effMask);
|
SelectImplicitChainTargets(spellEffectInfo, targetType, target, effMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitConeTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
|
void SelectImplicitConeTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex, uint effMask)
|
||||||
{
|
{
|
||||||
Position coneSrc = new(m_caster);
|
Position coneSrc = new(m_caster);
|
||||||
float coneAngle = m_spellInfo.ConeAngle;
|
float coneAngle = m_spellInfo.ConeAngle;
|
||||||
@@ -780,7 +781,7 @@ namespace Game.Spells
|
|||||||
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
|
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
|
||||||
|
|
||||||
var condList = spellEffectInfo.ImplicitTargetConditions;
|
var condList = spellEffectInfo.ImplicitTargetConditions;
|
||||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue.RadiusMod;
|
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue.RadiusMod;
|
||||||
|
|
||||||
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
|
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
|
||||||
if (containerTypeMask != 0)
|
if (containerTypeMask != 0)
|
||||||
@@ -812,7 +813,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitAreaTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
|
void SelectImplicitAreaTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex, uint effMask)
|
||||||
{
|
{
|
||||||
WorldObject referer;
|
WorldObject referer;
|
||||||
switch (targetType.GetReferenceType())
|
switch (targetType.GetReferenceType())
|
||||||
@@ -866,7 +867,7 @@ namespace Game.Spells
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue.RadiusMod;
|
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue.RadiusMod;
|
||||||
List<WorldObject> targets = new();
|
List<WorldObject> targets = new();
|
||||||
switch (targetType.GetTarget())
|
switch (targetType.GetTarget())
|
||||||
{
|
{
|
||||||
@@ -944,7 +945,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitCasterDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType)
|
void SelectImplicitCasterDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex)
|
||||||
{
|
{
|
||||||
SpellDestination dest = new(m_caster);
|
SpellDestination dest = new(m_caster);
|
||||||
|
|
||||||
@@ -1016,7 +1017,7 @@ namespace Game.Spells
|
|||||||
if (unitCaster == null)
|
if (unitCaster == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
float dist = spellEffectInfo.CalcRadius(unitCaster);
|
float dist = spellEffectInfo.CalcRadius(unitCaster, targetIndex);
|
||||||
float angle = targetType.CalcDirectionAngle();
|
float angle = targetType.CalcDirectionAngle();
|
||||||
if (targetType.GetTarget() == Targets.DestCasterMovementDirection)
|
if (targetType.GetTarget() == Targets.DestCasterMovementDirection)
|
||||||
{
|
{
|
||||||
@@ -1087,7 +1088,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||||
float angl = targetType.CalcDirectionAngle();
|
float angl = targetType.CalcDirectionAngle();
|
||||||
float objSize = m_caster.GetCombatReach();
|
float objSize = m_caster.GetCombatReach();
|
||||||
|
|
||||||
@@ -1106,7 +1107,7 @@ namespace Game.Spells
|
|||||||
case Targets.DestCasterBackRight:
|
case Targets.DestCasterBackRight:
|
||||||
{
|
{
|
||||||
float DefaultTotemDistance = 3.0f;
|
float DefaultTotemDistance = 3.0f;
|
||||||
if (!spellEffectInfo.HasRadius() && !spellEffectInfo.HasMaxRadius())
|
if (!spellEffectInfo.HasRadius(targetIndex))
|
||||||
dist = DefaultTotemDistance;
|
dist = DefaultTotemDistance;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1132,7 +1133,7 @@ namespace Game.Spells
|
|||||||
m_targets.SetDst(dest);
|
m_targets.SetDst(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitTargetDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType)
|
void SelectImplicitTargetDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex)
|
||||||
{
|
{
|
||||||
WorldObject target = m_targets.GetObjectTarget();
|
WorldObject target = m_targets.GetObjectTarget();
|
||||||
|
|
||||||
@@ -1147,7 +1148,7 @@ namespace Game.Spells
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
float angle = targetType.CalcDirectionAngle();
|
float angle = targetType.CalcDirectionAngle();
|
||||||
float dist = spellEffectInfo.CalcRadius(null);
|
float dist = spellEffectInfo.CalcRadius(null, targetIndex);
|
||||||
if (targetType.GetTarget() == Targets.DestRandom)
|
if (targetType.GetTarget() == Targets.DestRandom)
|
||||||
dist *= (float)RandomHelper.NextDouble();
|
dist *= (float)RandomHelper.NextDouble();
|
||||||
|
|
||||||
@@ -1166,7 +1167,7 @@ namespace Game.Spells
|
|||||||
m_targets.SetDst(dest);
|
m_targets.SetDst(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitDestDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType)
|
void SelectImplicitDestDestTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex)
|
||||||
{
|
{
|
||||||
// set destination to caster if no dest provided
|
// set destination to caster if no dest provided
|
||||||
// can only happen if previous destination target could not be set for some reason
|
// can only happen if previous destination target could not be set for some reason
|
||||||
@@ -1188,7 +1189,7 @@ namespace Game.Spells
|
|||||||
break;
|
break;
|
||||||
case Targets.DestDestTargetTowardsCaster:
|
case Targets.DestDestTargetTowardsCaster:
|
||||||
{
|
{
|
||||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||||
Position pos = dest.Position;
|
Position pos = dest.Position;
|
||||||
float angle = pos.GetAbsoluteAngle(m_caster) - m_caster.GetOrientation();
|
float angle = pos.GetAbsoluteAngle(m_caster) - m_caster.GetOrientation();
|
||||||
|
|
||||||
@@ -1201,7 +1202,7 @@ namespace Game.Spells
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
float angle = targetType.CalcDirectionAngle();
|
float angle = targetType.CalcDirectionAngle();
|
||||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||||
if (targetType.GetTarget() == Targets.DestRandom)
|
if (targetType.GetTarget() == Targets.DestRandom)
|
||||||
dist *= (float)RandomHelper.NextDouble();
|
dist *= (float)RandomHelper.NextDouble();
|
||||||
|
|
||||||
@@ -1455,7 +1456,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectImplicitLineTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, uint effMask)
|
void SelectImplicitLineTargets(SpellEffectInfo spellEffectInfo, SpellImplicitTargetInfo targetType, SpellTargetIndex targetIndex, uint effMask)
|
||||||
{
|
{
|
||||||
List<WorldObject> targets = new();
|
List<WorldObject> targets = new();
|
||||||
SpellTargetObjectTypes objectType = targetType.GetObjectType();
|
SpellTargetObjectTypes objectType = targetType.GetObjectType();
|
||||||
@@ -1482,7 +1483,7 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
|
|
||||||
var condList = spellEffectInfo.ImplicitTargetConditions;
|
var condList = spellEffectInfo.ImplicitTargetConditions;
|
||||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue.RadiusMod;
|
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue.RadiusMod;
|
||||||
|
|
||||||
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
|
GridMapTypeMask containerTypeMask = GetSearcherTypeMask(objectType, condList);
|
||||||
if (containerTypeMask != 0)
|
if (containerTypeMask != 0)
|
||||||
|
|||||||
@@ -2701,7 +2701,7 @@ namespace Game.Spells
|
|||||||
case 45151:
|
case 45151:
|
||||||
{
|
{
|
||||||
//Workaround for Range ... should be global for every ScriptEffect
|
//Workaround for Range ... should be global for every ScriptEffect
|
||||||
float radius = effectInfo.CalcRadius();
|
float radius = effectInfo.CalcRadius(null, SpellTargetIndex.TargetB);
|
||||||
if (unitTarget != null && unitTarget.IsTypeId(TypeId.Player) && unitTarget.GetDistance(m_caster) >= radius && !unitTarget.HasAura(46394) && unitTarget != m_caster)
|
if (unitTarget != null && unitTarget.IsTypeId(TypeId.Player) && unitTarget.GetDistance(m_caster) >= radius && !unitTarget.HasAura(46394) && unitTarget != m_caster)
|
||||||
unitTarget.CastSpell(unitTarget, 46394, new CastSpellExtraArgs(this));
|
unitTarget.CastSpell(unitTarget, 46394, new CastSpellExtraArgs(this));
|
||||||
|
|
||||||
@@ -4078,7 +4078,7 @@ namespace Game.Spells
|
|||||||
if (m_targets.HasDst())
|
if (m_targets.HasDst())
|
||||||
destTarget.GetPosition(out fx, out fy, out fz, out fo);
|
destTarget.GetPosition(out fx, out fy, out fz, out fo);
|
||||||
//FIXME: this can be better check for most objects but still hack
|
//FIXME: this can be better check for most objects but still hack
|
||||||
else if (effectInfo.HasRadius() && m_spellInfo.Speed == 0)
|
else if (effectInfo.HasRadius(SpellTargetIndex.TargetA) && m_spellInfo.Speed == 0)
|
||||||
{
|
{
|
||||||
float dis = effectInfo.CalcRadius(unitCaster);
|
float dis = effectInfo.CalcRadius(unitCaster);
|
||||||
unitCaster.GetClosePoint(out fx, out fy, out fz, SharedConst.DefaultPlayerBoundingRadius, dis);
|
unitCaster.GetClosePoint(out fx, out fy, out fz, SharedConst.DefaultPlayerBoundingRadius, dis);
|
||||||
|
|||||||
@@ -4088,8 +4088,8 @@ namespace Game.Spells
|
|||||||
PositionFacing = effect.EffectPosFacing;
|
PositionFacing = effect.EffectPosFacing;
|
||||||
TargetA = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[0]);
|
TargetA = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[0]);
|
||||||
TargetB = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[1]);
|
TargetB = new SpellImplicitTargetInfo((Targets)effect.ImplicitTarget[1]);
|
||||||
RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[0]);
|
TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[0]);
|
||||||
MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[1]);
|
TargetBRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(effect.EffectRadiusIndex[1]);
|
||||||
ChainTargets = effect.EffectChainTargets;
|
ChainTargets = effect.EffectChainTargets;
|
||||||
ItemType = effect.EffectItemType;
|
ItemType = effect.EffectItemType;
|
||||||
TriggerSpell = effect.EffectTriggerSpell;
|
TriggerSpell = effect.EffectTriggerSpell;
|
||||||
@@ -4332,21 +4332,27 @@ namespace Game.Spells
|
|||||||
return multiplierPercent / 100.0f;
|
return multiplierPercent / 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasRadius()
|
public bool HasRadius(SpellTargetIndex targetIndex)
|
||||||
{
|
{
|
||||||
return RadiusEntry != null;
|
switch (targetIndex)
|
||||||
|
{
|
||||||
|
case SpellTargetIndex.TargetA:
|
||||||
|
return TargetARadiusEntry != null;
|
||||||
|
case SpellTargetIndex.TargetB:
|
||||||
|
return TargetBRadiusEntry != null;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasMaxRadius()
|
public float CalcRadius(WorldObject caster = null, SpellTargetIndex targetIndex = SpellTargetIndex.TargetA, Spell spell = null)
|
||||||
{
|
{
|
||||||
return MaxRadiusEntry != null;
|
// TargetA -> TargetARadiusEntry
|
||||||
}
|
// TargetB -> TargetBRadiusEntry
|
||||||
|
// Aura effects have TargetARadiusEntry == TargetBRadiusEntry (mostly)
|
||||||
public float CalcRadius(WorldObject caster = null, Spell spell = null)
|
var entry = TargetARadiusEntry;
|
||||||
{
|
if (targetIndex == SpellTargetIndex.TargetB && HasRadius(targetIndex))
|
||||||
SpellRadiusRecord entry = RadiusEntry;
|
entry = TargetBRadiusEntry;
|
||||||
if (!HasRadius() && HasMaxRadius())
|
|
||||||
entry = MaxRadiusEntry;
|
|
||||||
|
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@@ -4854,8 +4860,8 @@ namespace Game.Spells
|
|||||||
public float PositionFacing;
|
public float PositionFacing;
|
||||||
public SpellImplicitTargetInfo TargetA = new();
|
public SpellImplicitTargetInfo TargetA = new();
|
||||||
public SpellImplicitTargetInfo TargetB = new();
|
public SpellImplicitTargetInfo TargetB = new();
|
||||||
public SpellRadiusRecord RadiusEntry;
|
public SpellRadiusRecord TargetARadiusEntry;
|
||||||
public SpellRadiusRecord MaxRadiusEntry;
|
public SpellRadiusRecord TargetBRadiusEntry;
|
||||||
public int ChainTargets;
|
public int ChainTargets;
|
||||||
public uint ItemType;
|
public uint ItemType;
|
||||||
public uint TriggerSpell;
|
public uint TriggerSpell;
|
||||||
|
|||||||
@@ -3207,7 +3207,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards100); // 100yards instead of 50000?!
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards100); // 100yards instead of 50000?!
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3403,7 +3403,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10);
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3514,7 +3514,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200);
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200);
|
||||||
spellEffectInfo.TargetA = new SpellImplicitTargetInfo(Targets.UnitSrcAreaEntry);
|
spellEffectInfo.TargetA = new SpellImplicitTargetInfo(Targets.UnitSrcAreaEntry);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -3588,7 +3588,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10);
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3676,7 +3676,7 @@ namespace Game.Entities
|
|||||||
// use max radius from 4.3.4
|
// use max radius from 4.3.4
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards25);
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards25);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// ENDOF VIOLET HOLD
|
// ENDOF VIOLET HOLD
|
||||||
@@ -3689,7 +3689,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards50000); // 50000yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards50000); // 50000yd
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4008,11 +4008,11 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200); // 200yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200); // 200yd
|
||||||
});
|
});
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200); // 200yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards200); // 200yd
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4057,7 +4057,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards25); // 25yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards25); // 25yd
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4073,20 +4073,10 @@ namespace Game.Entities
|
|||||||
spellInfo.RangeEntry = CliDB.SpellRangeStorage.LookupByKey(5); // 40yd
|
spellInfo.RangeEntry = CliDB.SpellRangeStorage.LookupByKey(5); // 40yd
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10); // 10yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10); // 10yd
|
||||||
spellEffectInfo.MiscValue = 190;
|
spellEffectInfo.MiscValue = 190;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Broken Frostmourne
|
|
||||||
ApplySpellFix(new[] { 72405 }, spellInfo =>
|
|
||||||
{
|
|
||||||
spellInfo.AttributesEx |= SpellAttr1.NoThreat;
|
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
|
||||||
{
|
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards20); // 20yd
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// ENDOF ICECROWN CITADEL SPELLS
|
// ENDOF ICECROWN CITADEL SPELLS
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4097,7 +4087,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.RadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards12);
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards12);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4177,7 +4167,7 @@ namespace Game.Entities
|
|||||||
// Little hack, Increase the radius so it can hit the Cave In Stalkers in the platform.
|
// Little hack, Increase the radius so it can hit the Cave In Stalkers in the platform.
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards45);
|
spellEffectInfo.TargetBRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards45);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4282,7 +4272,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards15);
|
spellEffectInfo.TargetBRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards15);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1122,7 +1122,7 @@ namespace Scripts.Spells.Mage
|
|||||||
void FilterTargets(List<WorldObject> targets)
|
void FilterTargets(List<WorldObject> targets)
|
||||||
{
|
{
|
||||||
WorldLocation dest = GetExplTargetDest();
|
WorldLocation dest = GetExplTargetDest();
|
||||||
float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).CalcRadius();
|
float outRadius = Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).CalcRadius(null, SpellTargetIndex.TargetB);
|
||||||
float inRadius = 6.5f;
|
float inRadius = 6.5f;
|
||||||
|
|
||||||
targets.RemoveAll(target =>
|
targets.RemoveAll(target =>
|
||||||
|
|||||||
Reference in New Issue
Block a user