Core/Spells: ported radius entry indexing from master branch and dropped several now deprecated spell 'fixes' from spellMgr
This commit is contained in:
1 parent
569d66d352
commit
2bcc645cd3
13 files changed
+97
-523
No files matched your search
@@ -825,8 +825,8 @@ void Spell::SelectSpellTargets()
|
||||
if (implicitTargetMask & (TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM))
|
||||
m_targets.SetTargetFlag(TARGET_FLAG_GAMEOBJECT);
|
||||
|
||||
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetA, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetB, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetA, SpellTargetIndex::TargetA, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetB, SpellTargetIndex::TargetB, processedAreaEffectsMask);
|
||||
|
||||
// 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
|
||||
@@ -950,7 +950,7 @@ void Spell::RecalculateDelayMomentForDst()
|
||||
m_caster->m_Events.ModifyEventTime(_spellEvent, GetDelayStart() + m_delayMoment);
|
||||
}
|
||||
|
||||
void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask)
|
||||
void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32& processedEffectMask)
|
||||
{
|
||||
if (!targetType.GetTarget())
|
||||
return;
|
||||
@@ -974,7 +974,8 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
effects[effIndex].TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
|
||||
effects[effIndex].TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
|
||||
effects[effIndex].ImplicitTargetConditions == effects[j].ImplicitTargetConditions &&
|
||||
effects[effIndex].CalcRadius(m_caster) == effects[j].CalcRadius(m_caster) &&
|
||||
effects[effIndex].CalcRadius(m_caster, SpellTargetIndex::TargetA) == effects[j].CalcRadius(m_caster, SpellTargetIndex::TargetA) &&
|
||||
effects[effIndex].CalcRadius(m_caster, SpellTargetIndex::TargetB) == effects[j].CalcRadius(m_caster, SpellTargetIndex::TargetB) &&
|
||||
CheckScriptEffectImplicitTargets(effIndex, j))
|
||||
{
|
||||
effectMask |= 1 << j;
|
||||
@@ -992,13 +993,13 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
SelectImplicitChannelTargets(effIndex, targetType);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_NEARBY:
|
||||
SelectImplicitNearbyTargets(effIndex, targetType, effectMask);
|
||||
SelectImplicitNearbyTargets(effIndex, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_CONE:
|
||||
SelectImplicitConeTargets(effIndex, targetType, effectMask);
|
||||
SelectImplicitConeTargets(effIndex, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_AREA:
|
||||
SelectImplicitAreaTargets(effIndex, targetType, effectMask);
|
||||
SelectImplicitAreaTargets(effIndex, targetType, targetIndex,effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_TRAJ:
|
||||
// just in case there is no dest, explanation in SelectImplicitDestDestTargets
|
||||
@@ -1024,13 +1025,13 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
switch (targetType.GetReferenceType())
|
||||
{
|
||||
case TARGET_REFERENCE_TYPE_CASTER:
|
||||
SelectImplicitCasterDestTargets(effIndex, targetType);
|
||||
SelectImplicitCasterDestTargets(effIndex, targetType, targetIndex);
|
||||
break;
|
||||
case TARGET_REFERENCE_TYPE_TARGET:
|
||||
SelectImplicitTargetDestTargets(effIndex, targetType);
|
||||
SelectImplicitTargetDestTargets(effIndex, targetType, targetIndex);
|
||||
break;
|
||||
case TARGET_REFERENCE_TYPE_DEST:
|
||||
SelectImplicitDestDestTargets(effIndex, targetType);
|
||||
SelectImplicitDestDestTargets(effIndex, targetType, targetIndex);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
||||
@@ -1118,7 +1119,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, [[maybe_unused]] SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER)
|
||||
{
|
||||
@@ -1258,7 +1259,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
SelectImplicitChainTargets(effIndex, targetType, target, effMask);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
Position coneSrc(*m_caster);
|
||||
float coneAngle = m_spellInfo->ConeAngle;
|
||||
@@ -1289,7 +1290,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
|
||||
ConditionContainer* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
|
||||
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster, targetIndex);
|
||||
// Workaround for some spells that don't have RadiusEntry set in dbc (but SpellRange instead)
|
||||
if (G3D::fuzzyEq(radius, 0.f))
|
||||
radius = m_spellInfo->GetMaxRange(m_spellInfo->IsPositiveEffect(effIndex), m_caster, this);
|
||||
@@ -1323,7 +1324,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
WorldObject* referer = nullptr;
|
||||
switch (targetType.GetReferenceType())
|
||||
@@ -1376,7 +1377,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
return;
|
||||
}
|
||||
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster, targetIndex);
|
||||
|
||||
// Workaround for some spells that don't have RadiusEntry set in dbc (but SpellRange instead)
|
||||
if (G3D::fuzzyEq(radius, 0.f))
|
||||
@@ -1433,7 +1434,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex)
|
||||
{
|
||||
SpellDestination dest(*m_caster);
|
||||
|
||||
@@ -1501,7 +1502,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
if (!unitCaster)
|
||||
break;
|
||||
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(unitCaster);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(unitCaster, targetIndex);
|
||||
float angle = targetType.CalcDirectionAngle(m_spellInfo->Effects[effIndex]);
|
||||
|
||||
Position pos = dest._position;
|
||||
@@ -1519,8 +1520,8 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
float dist = [&]()
|
||||
{
|
||||
// Effect specific radius may override default behavior
|
||||
if (m_spellInfo->Effects[effIndex].HasRadius())
|
||||
return m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
if (m_spellInfo->Effects[effIndex].HasRadius(targetIndex))
|
||||
return m_spellInfo->Effects[effIndex].CalcRadius(m_caster, targetIndex);
|
||||
|
||||
// Gameobject summons use range entries
|
||||
if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRANS_DOOR)
|
||||
@@ -1547,7 +1548,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
}
|
||||
default:
|
||||
{
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster, targetIndex);
|
||||
float angle = targetType.CalcDirectionAngle(m_spellInfo->Effects[effIndex]);
|
||||
float objSize = m_caster->GetCombatReach();
|
||||
|
||||
@@ -1563,7 +1564,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
case TARGET_DEST_CASTER_BACK_RIGHT:
|
||||
{
|
||||
static float const DefaultTotemDistance = 3.0f;
|
||||
if (!m_spellInfo->Effects[effIndex].HasRadius())
|
||||
if (!m_spellInfo->Effects[effIndex].HasRadius(targetIndex))
|
||||
dist = DefaultTotemDistance;
|
||||
break;
|
||||
}
|
||||
@@ -1586,7 +1587,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
m_targets.SetDst(dest);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex)
|
||||
{
|
||||
ASSERT(m_targets.GetObjectTarget() && "Spell::SelectImplicitTargetDestTargets - no explicit object target available!");
|
||||
WorldObject* target = m_targets.GetObjectTarget();
|
||||
@@ -1601,7 +1602,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
default:
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle(m_spellInfo->Effects[effIndex]);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(nullptr);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(nullptr, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM)
|
||||
dist *= float(rand_norm());
|
||||
|
||||
@@ -1617,7 +1618,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
m_targets.SetDst(dest);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex)
|
||||
{
|
||||
// set destination to caster if no dest provided
|
||||
// can only happen if previous destination target could not be set for some reason
|
||||
@@ -1637,7 +1638,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT
|
||||
default:
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle(m_spellInfo->Effects[effIndex]);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
|
||||
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM)
|
||||
dist *= float(rand_norm());
|
||||
|
||||
|
||||
Reference in new issue
Block a user