Core/Spells: ported radius entry indexing from master branch and dropped several now deprecated spell 'fixes' from spellMgr

This commit is contained in:
Ovahlord committed 2023-08-06 12:54:05 +02:00
1 parent 569d66d352
commit 2bcc645cd3
13 files changed
+97 -523

No files matched your search

+19 -13
View File
@@ -380,8 +380,8 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* /*spellEntry*/, SpellInfo con
Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0);
TargetA = SpellImplicitTargetInfo(_effect ? _effect->EffectImplicitTargetA : 0);
TargetB = SpellImplicitTargetInfo(_effect ? _effect->EffectImplicitTargetB : 0);
RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : nullptr;
MaxRadiusEntry = _effect && _effect->EffectRadiusMaxIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusMaxIndex) : nullptr;
TargetARadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : nullptr;
TargetBRadiusEntry = _effect && _effect->EffectRadiusMaxIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusMaxIndex) : nullptr;
ChainTarget = _effect ? _effect->EffectChainTargets : 0;
ItemType = _effect ? _effect->EffectItemType : 0;
TriggerSpell = _effect ? _effect->EffectTriggerSpell : 0;
@@ -616,21 +616,27 @@ float SpellEffectInfo::CalcDamageMultiplier(WorldObject* caster, Spell* spell) c
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, Spell* spell) 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;