Core/Spells: Fixed target radius logic in spell effects for TargetB (#29158)
This commit is contained in:
@@ -60,6 +60,12 @@ enum SpellEffIndex : uint8
|
||||
EFFECT_31 = 31
|
||||
};
|
||||
|
||||
enum class SpellTargetIndex : uint8
|
||||
{
|
||||
TargetA = 0,
|
||||
TargetB = 1
|
||||
};
|
||||
|
||||
// used in script definitions
|
||||
#define EFFECT_FIRST_FOUND 254
|
||||
#define EFFECT_ALL 255
|
||||
|
||||
@@ -755,8 +755,8 @@ void Spell::SelectSpellTargets()
|
||||
if (implicitTargetMask & (TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM))
|
||||
m_targets.SetTargetFlag(TARGET_FLAG_GAMEOBJECT);
|
||||
|
||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetA, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetB, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.TargetA, SpellTargetIndex::TargetA, processedAreaEffectsMask);
|
||||
SelectEffectImplicitTargets(spellEffectInfo, spellEffectInfo.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
|
||||
@@ -894,7 +894,7 @@ void Spell::UpdateDelayMomentForUnitTarget(Unit* unit, uint64 hitDelay)
|
||||
m_caster->m_Events.ModifyEventTime(_spellEvent, Milliseconds(GetDelayStart() + m_delayMoment));
|
||||
}
|
||||
|
||||
void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask)
|
||||
void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32& processedEffectMask)
|
||||
{
|
||||
if (!targetType.GetTarget())
|
||||
return;
|
||||
@@ -920,7 +920,8 @@ void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
spellEffectInfo.TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
|
||||
spellEffectInfo.TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
|
||||
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, j))
|
||||
{
|
||||
effectMask |= 1 << j;
|
||||
@@ -939,13 +940,13 @@ void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
SelectImplicitChannelTargets(spellEffectInfo, targetType);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_NEARBY:
|
||||
SelectImplicitNearbyTargets(spellEffectInfo, targetType, effectMask);
|
||||
SelectImplicitNearbyTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_CONE:
|
||||
SelectImplicitConeTargets(spellEffectInfo, targetType, effectMask);
|
||||
SelectImplicitConeTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_AREA:
|
||||
SelectImplicitAreaTargets(spellEffectInfo, targetType, effectMask);
|
||||
SelectImplicitAreaTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_TRAJ:
|
||||
// just in case there is no dest, explanation in SelectImplicitDestDestTargets
|
||||
@@ -954,7 +955,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
SelectImplicitTrajTargets(spellEffectInfo, targetType);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_LINE:
|
||||
SelectImplicitLineTargets(spellEffectInfo, targetType, effectMask);
|
||||
SelectImplicitLineTargets(spellEffectInfo, targetType, targetIndex, effectMask);
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_DEFAULT:
|
||||
switch (targetType.GetObjectType())
|
||||
@@ -974,13 +975,13 @@ void Spell::SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
switch (targetType.GetReferenceType())
|
||||
{
|
||||
case TARGET_REFERENCE_TYPE_CASTER:
|
||||
SelectImplicitCasterDestTargets(spellEffectInfo, targetType);
|
||||
SelectImplicitCasterDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||
break;
|
||||
case TARGET_REFERENCE_TYPE_TARGET:
|
||||
SelectImplicitTargetDestTargets(spellEffectInfo, targetType);
|
||||
SelectImplicitTargetDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||
break;
|
||||
case TARGET_REFERENCE_TYPE_DEST:
|
||||
SelectImplicitDestDestTargets(spellEffectInfo, targetType);
|
||||
SelectImplicitDestDestTargets(spellEffectInfo, targetType, targetIndex);
|
||||
break;
|
||||
default:
|
||||
ABORT_MSG("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
||||
@@ -1083,7 +1084,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER)
|
||||
{
|
||||
@@ -1161,7 +1162,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
dest = SpellDestination(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
|
||||
else
|
||||
{
|
||||
float randomRadius = spellEffectInfo.CalcRadius(m_caster);
|
||||
float randomRadius = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
if (randomRadius > 0.0f)
|
||||
m_caster->MovePositionToFirstCollision(dest._position, randomRadius, targetType.CalcDirectionAngle());
|
||||
}
|
||||
@@ -1187,7 +1188,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
{
|
||||
target = m_caster;
|
||||
// radius is only meant to be randomized when using caster fallback
|
||||
randomRadius = spellEffectInfo.CalcRadius(m_caster);
|
||||
randomRadius = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1267,7 +1268,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo,
|
||||
SelectImplicitChainTargets(spellEffectInfo, targetType, target, effMask);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
Position coneSrc(*m_caster);
|
||||
float coneAngle = m_spellInfo->ConeAngle;
|
||||
@@ -1297,7 +1298,7 @@ void Spell::SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
SpellTargetObjectTypes objectType = targetType.GetObjectType();
|
||||
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
|
||||
ConditionContainer* condList = spellEffectInfo.ImplicitTargetConditions;
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue->RadiusMod;
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue->RadiusMod;
|
||||
|
||||
if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList))
|
||||
{
|
||||
@@ -1327,7 +1328,7 @@ void Spell::SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
WorldObject* referer = nullptr;
|
||||
switch (targetType.GetReferenceType())
|
||||
@@ -1382,7 +1383,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
return;
|
||||
}
|
||||
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue->RadiusMod;
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue->RadiusMod;
|
||||
std::list<WorldObject*> targets;
|
||||
switch (targetType.GetTarget())
|
||||
{
|
||||
@@ -1451,7 +1452,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex)
|
||||
{
|
||||
SpellDestination dest(*m_caster);
|
||||
|
||||
@@ -1520,7 +1521,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
if (!unitCaster)
|
||||
break;
|
||||
|
||||
float dist = spellEffectInfo.CalcRadius(unitCaster);
|
||||
float dist = spellEffectInfo.CalcRadius(unitCaster, targetIndex);
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
if (targetType.GetTarget() == TARGET_DEST_CASTER_MOVEMENT_DIRECTION)
|
||||
{
|
||||
@@ -1576,7 +1577,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
break;
|
||||
default:
|
||||
{
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float objSize = m_caster->GetCombatReach();
|
||||
|
||||
@@ -1595,7 +1596,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
case TARGET_DEST_CASTER_BACK_RIGHT:
|
||||
{
|
||||
static float const DefaultTotemDistance = 3.0f;
|
||||
if (!spellEffectInfo.HasRadius() && !spellEffectInfo.HasMaxRadius())
|
||||
if (!spellEffectInfo.HasRadius(targetIndex))
|
||||
dist = DefaultTotemDistance;
|
||||
break;
|
||||
}
|
||||
@@ -1621,7 +1622,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
m_targets.SetDst(dest);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex)
|
||||
{
|
||||
ASSERT(m_targets.GetObjectTarget() && "Spell::SelectImplicitTargetDestTargets - no explicit object target available!");
|
||||
WorldObject* target = m_targets.GetObjectTarget();
|
||||
@@ -1637,7 +1638,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
default:
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(nullptr);
|
||||
float dist = spellEffectInfo.CalcRadius(nullptr, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM)
|
||||
dist *= float(rand_norm());
|
||||
|
||||
@@ -1656,7 +1657,7 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
m_targets.SetDst(dest);
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType)
|
||||
void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo, 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
|
||||
@@ -1678,7 +1679,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo
|
||||
break;
|
||||
case TARGET_DEST_DEST_TARGET_TOWARDS_CASTER:
|
||||
{
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
Position pos = dest._position;
|
||||
float angle = pos.GetAbsoluteAngle(m_caster) - m_caster->GetOrientation();
|
||||
|
||||
@@ -1691,7 +1692,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo
|
||||
default:
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster);
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM)
|
||||
dist *= float(rand_norm());
|
||||
|
||||
@@ -1931,7 +1932,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask)
|
||||
void Spell::SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask)
|
||||
{
|
||||
std::list<WorldObject*> targets;
|
||||
SpellTargetObjectTypes objectType = targetType.GetObjectType();
|
||||
@@ -1957,7 +1958,7 @@ void Spell::SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, Sp
|
||||
}
|
||||
|
||||
ConditionContainer* condList = spellEffectInfo.ImplicitTargetConditions;
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue->RadiusMod;
|
||||
float radius = spellEffectInfo.CalcRadius(m_caster, targetIndex) * m_spellValue->RadiusMod;
|
||||
|
||||
if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList))
|
||||
{
|
||||
|
||||
@@ -427,19 +427,19 @@ class TC_GAME_API Spell
|
||||
void SelectExplicitTargets();
|
||||
|
||||
void SelectSpellTargets();
|
||||
void SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask);
|
||||
void SelectEffectImplicitTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32& processedEffectMask);
|
||||
void SelectImplicitChannelTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitNearbyTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
|
||||
void SelectImplicitConeTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
|
||||
void SelectImplicitAreaTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
|
||||
void SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
|
||||
void SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
|
||||
void SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex);
|
||||
void SelectImplicitCasterObjectTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitTargetObjectTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitChainTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask);
|
||||
void SelectImplicitTrajTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitLineTargets(SpellEffectInfo const& spellEffectInfo, SpellImplicitTargetInfo const& targetType, SpellTargetIndex targetIndex, uint32 effMask);
|
||||
|
||||
void SelectEffectTypeImplicitTargets(SpellEffectInfo const& spellEffectInfo);
|
||||
|
||||
|
||||
@@ -3038,7 +3038,7 @@ void Spell::EffectScriptEffect()
|
||||
case 45151:
|
||||
{
|
||||
//Workaround for Range ... should be global for every ScriptEffect
|
||||
float radius = effectInfo->CalcRadius();
|
||||
float radius = effectInfo->CalcRadius(nullptr, SpellTargetIndex::TargetB);
|
||||
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER && unitTarget->GetDistance(m_caster) >= radius && !unitTarget->HasAura(46394) && unitTarget != m_caster)
|
||||
unitTarget->CastSpell(unitTarget, 46394, this);
|
||||
|
||||
@@ -4347,7 +4347,7 @@ void Spell::EffectTransmitted()
|
||||
if (m_targets.HasDst())
|
||||
destTarget->GetPosition(fx, fy, fz, fo);
|
||||
//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);
|
||||
unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis);
|
||||
|
||||
@@ -398,7 +398,7 @@ std::array<SpellImplicitTargetInfo::StaticData, TOTAL_SPELL_TARGETS> SpellImplic
|
||||
SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo): _spellInfo(spellInfo), EffectIndex(EFFECT_0), Effect(SPELL_EFFECT_NONE), ApplyAuraName(AuraType(0)), ApplyAuraPeriod(0),
|
||||
BasePoints(0), RealPointsPerLevel(0), PointsPerResource(0), Amplitude(0), ChainAmplitude(0),
|
||||
BonusCoefficient(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), PositionFacing(0),
|
||||
RadiusEntry(nullptr), MaxRadiusEntry(nullptr), ChainTargets(0), ItemType(0), TriggerSpell(0),
|
||||
TargetARadiusEntry(nullptr), TargetBRadiusEntry(nullptr), ChainTargets(0), ItemType(0), TriggerSpell(0),
|
||||
BonusCoefficientFromAP(0.0f), ImplicitTargetConditions(nullptr),
|
||||
EffectAttributes(SpellEffectAttributes::None), Scaling(), _immunityInfo(nullptr)
|
||||
{
|
||||
@@ -426,8 +426,8 @@ SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo, SpellEffectEntry co
|
||||
PositionFacing = _effect.EffectPosFacing;
|
||||
TargetA = SpellImplicitTargetInfo(_effect.ImplicitTarget[0]);
|
||||
TargetB = SpellImplicitTargetInfo(_effect.ImplicitTarget[1]);
|
||||
RadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[0]);
|
||||
MaxRadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[1]);
|
||||
TargetARadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[0]);
|
||||
TargetBRadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[1]);
|
||||
ChainTargets = _effect.EffectChainTargets;
|
||||
ItemType = _effect.EffectItemType;
|
||||
TriggerSpell = _effect.EffectTriggerSpell;
|
||||
@@ -656,21 +656,27 @@ float SpellEffectInfo::CalcDamageMultiplier(WorldObject* caster, Spell* spell /*
|
||||
return multiplierPercent / 100.0f;
|
||||
}
|
||||
|
||||
bool SpellEffectInfo::HasRadius() const
|
||||
bool SpellEffectInfo::HasRadius(SpellTargetIndex targetIndex) const
|
||||
{
|
||||
return RadiusEntry != nullptr;
|
||||
switch (targetIndex)
|
||||
{
|
||||
case SpellTargetIndex::TargetA:
|
||||
return TargetARadiusEntry != nullptr;
|
||||
case SpellTargetIndex::TargetB:
|
||||
return TargetBRadiusEntry != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SpellEffectInfo::HasMaxRadius() const
|
||||
float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTargetIndex targetIndex /*=SpellTargetIndex::TargetA*/, Spell* spell /*= nullptr*/) const
|
||||
{
|
||||
return MaxRadiusEntry != nullptr;
|
||||
}
|
||||
|
||||
float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, Spell* spell /*= nullptr*/) const
|
||||
{
|
||||
const SpellRadiusEntry* entry = RadiusEntry;
|
||||
if (!HasRadius() && HasMaxRadius())
|
||||
entry = MaxRadiusEntry;
|
||||
// TargetA -> TargetARadiusEntry
|
||||
// TargetB -> TargetBRadiusEntry
|
||||
// Aura effects have TargetARadiusEntry == TargetBRadiusEntry (mostly)
|
||||
SpellRadiusEntry const* entry = TargetARadiusEntry;
|
||||
if (targetIndex == SpellTargetIndex::TargetB && HasRadius(targetIndex))
|
||||
entry = TargetBRadiusEntry;
|
||||
|
||||
if (!entry)
|
||||
return 0.0f;
|
||||
|
||||
@@ -230,8 +230,8 @@ public:
|
||||
float PositionFacing;
|
||||
SpellImplicitTargetInfo TargetA;
|
||||
SpellImplicitTargetInfo TargetB;
|
||||
SpellRadiusEntry const* RadiusEntry;
|
||||
SpellRadiusEntry const* MaxRadiusEntry;
|
||||
SpellRadiusEntry const* TargetARadiusEntry;
|
||||
SpellRadiusEntry const* TargetBRadiusEntry;
|
||||
int32 ChainTargets;
|
||||
uint32 ItemType;
|
||||
uint32 TriggerSpell;
|
||||
@@ -269,9 +269,8 @@ public:
|
||||
float CalcValueMultiplier(WorldObject* caster, Spell* spell = nullptr) const;
|
||||
float CalcDamageMultiplier(WorldObject* caster, Spell* spell = nullptr) const;
|
||||
|
||||
bool HasRadius() const;
|
||||
bool HasMaxRadius() const;
|
||||
float CalcRadius(WorldObject* caster = nullptr, Spell* = nullptr) const;
|
||||
bool HasRadius(SpellTargetIndex targetIndex) const;
|
||||
float CalcRadius(WorldObject* caster = nullptr, SpellTargetIndex targetIndex = SpellTargetIndex::TargetA, Spell* = nullptr) const;
|
||||
|
||||
uint32 GetProvidedTargetMask() const;
|
||||
uint32 GetMissingTargetMask(bool srcSet = false, bool destSet = false, uint32 mask = 0) const;
|
||||
|
||||
@@ -3533,7 +3533,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yards instead of 50000?!
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_100_YARDS); // 100yards instead of 50000?!
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3729,7 +3729,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3840,7 +3840,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS);
|
||||
spellEffectInfo->TargetA = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ENTRY);
|
||||
});
|
||||
});
|
||||
@@ -3914,7 +3914,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4000,7 +4000,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
// use max radius from 4.3.4
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS);
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS);
|
||||
});
|
||||
});
|
||||
// ENDOF VIOLET HOLD
|
||||
@@ -4013,7 +4013,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_50000_YARDS); // 50000yd
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4332,11 +4332,11 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
|
||||
});
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_1, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_200_YARDS); // 200yd
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4381,7 +4381,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS); // 25yd
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_25_YARDS); // 25yd
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4397,20 +4397,10 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
spellInfo->RangeEntry = sSpellRangeStore.LookupEntry(5); // 40yd
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_10_YARDS); // 10yd
|
||||
spellEffectInfo->MiscValue = 190;
|
||||
});
|
||||
});
|
||||
|
||||
// Broken Frostmourne
|
||||
ApplySpellFix({ 72405 }, [](SpellInfo* spellInfo)
|
||||
{
|
||||
spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT;
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_1, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_20_YARDS); // 20yd
|
||||
});
|
||||
});
|
||||
// ENDOF ICECROWN CITADEL SPELLS
|
||||
|
||||
//
|
||||
@@ -4421,7 +4411,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_1, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_12_YARDS);
|
||||
spellEffectInfo->TargetARadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_12_YARDS);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4501,7 +4491,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
// Little hack, Increase the radius so it can hit the Cave In Stalkers in the platform.
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->MaxRadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_45_YARDS);
|
||||
spellEffectInfo->TargetBRadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_45_YARDS);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4606,7 +4596,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
{
|
||||
ApplySpellEffectFix(spellInfo, EFFECT_0, [](SpellEffectInfo* spellEffectInfo)
|
||||
{
|
||||
spellEffectInfo->MaxRadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_15_YARDS);
|
||||
spellEffectInfo->TargetBRadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_15_YARDS);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -545,7 +545,7 @@ public:
|
||||
/// TODO: Remove this once we find a general rule for WorldObject::MovePosition (this spell shouldn't take the Z change into consideration)
|
||||
Unit* caster = GetCaster();
|
||||
float angle = float(rand_norm()) * static_cast<float>(2 * M_PI);
|
||||
uint32 dist = caster->GetCombatReach() + GetSpellInfo()->GetEffect(EFFECT_0).CalcRadius(caster) * (float)rand_norm();
|
||||
uint32 dist = caster->GetCombatReach() + GetSpellInfo()->GetEffect(EFFECT_0).CalcRadius(caster, SpellTargetIndex::TargetB) * (float)rand_norm();
|
||||
|
||||
float x = caster->GetPositionX() + dist * std::cos(angle);
|
||||
float y = caster->GetPositionY() + dist * std::sin(angle);
|
||||
|
||||
@@ -166,7 +166,7 @@ class spell_krystallus_shatter_effect : public SpellScript
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
|
||||
float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster());
|
||||
float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster(), SpellTargetIndex::TargetB);
|
||||
if (!radius)
|
||||
return;
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ class spell_gruul_shatter_effect : public SpellScriptLoader
|
||||
if (!GetHitUnit())
|
||||
return;
|
||||
|
||||
float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster());
|
||||
float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster(), SpellTargetIndex::TargetB);
|
||||
if (!radius)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1406,7 +1406,7 @@ class spell_mage_ring_of_frost_freeze : public SpellScript
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
WorldLocation const* dest = GetExplTargetDest();
|
||||
float outRadius = sSpellMgr->AssertSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON, GetCastDifficulty())->GetEffect(EFFECT_0).CalcRadius();
|
||||
float outRadius = sSpellMgr->AssertSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON, GetCastDifficulty())->GetEffect(EFFECT_0).CalcRadius(nullptr, SpellTargetIndex::TargetB);
|
||||
float inRadius = 6.5f;
|
||||
|
||||
targets.remove_if([dest, outRadius, inRadius](WorldObject* target)
|
||||
|
||||
Reference in New Issue
Block a user