aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 7ecb08e3100..2d92b671ba3 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -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;
-}
-
-bool SpellEffectInfo::HasMaxRadius() const
-{
- return MaxRadiusEntry != nullptr;
+ switch (targetIndex)
+ {
+ case SpellTargetIndex::TargetA:
+ return TargetARadiusEntry != nullptr;
+ case SpellTargetIndex::TargetB:
+ return TargetBRadiusEntry != nullptr;
+ default:
+ return false;
+ }
}
-float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, Spell* spell /*= nullptr*/) const
+float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTargetIndex targetIndex /*=SpellTargetIndex::TargetA*/, 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;