Core/Spells: Implement sqrt based aoe damage diminishing

Port From (https://github.com/TrinityCore/TrinityCore/commit/42a6e0eb1afa431fc1efe7d4c5a62758fed42684)
This commit is contained in:
hondacrx
2023-09-14 04:24:19 -04:00
parent 572bab53e4
commit 6975212812
5 changed files with 129 additions and 12 deletions
+22
View File
@@ -255,11 +255,16 @@ namespace Game.Spells
}
SpellCastTargets targets = new();
int? targetCount = null;
int? targetIndex = null;
if (effectHandleMode == SpellEffectHandleMode.LaunchTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return;
targets.SetUnitTarget(unitTarget);
targetCount = (int)GetUnitTargetCountForEffect(effectInfo.EffectIndex);
targetIndex = GetUnitTargetIndexForEffect(unitTarget.GetGUID(), effectInfo.EffectIndex);
}
else //if (effectHandleMode == SpellEffectHandleMode.Launch)
{
@@ -320,6 +325,12 @@ namespace Game.Spells
for (int i = 0; i < SpellConst.MaxEffects; ++i)
args.AddSpellMod(SpellValueMod.BasePoint0 + i, value);
if (targetCount.HasValue)
args.AddSpellMod(SpellValueMod.ParentSpellTargetCount, targetCount.Value);
if (targetIndex.HasValue)
args.AddSpellMod(SpellValueMod.ParentSpellTargetIndex, targetIndex.Value);
caster.CastSpell(targets, triggerSpell, args);
}, delay);
}
@@ -348,11 +359,16 @@ namespace Game.Spells
}
SpellCastTargets targets = new();
int? targetCount = null;
int? targetIndex = null;
if (effectHandleMode == SpellEffectHandleMode.HitTarget)
{
if (!spellInfo.NeedsToBeTriggeredByCaster(m_spellInfo))
return;
targets.SetUnitTarget(unitTarget);
targetCount = (int)GetUnitTargetCountForEffect(effectInfo.EffectIndex);
targetIndex = GetUnitTargetIndexForEffect(unitTarget.GetGUID(), effectInfo.EffectIndex);
}
else //if (effectHandleMode == SpellEffectHandleMode.Hit)
{
@@ -381,6 +397,12 @@ namespace Game.Spells
for (int i = 0; i < SpellConst.MaxEffects; ++i)
args.AddSpellMod(SpellValueMod.BasePoint0 + i, damage);
if (targetCount.HasValue)
args.AddSpellMod(SpellValueMod.ParentSpellTargetCount, targetCount.Value);
if (targetIndex.HasValue)
args.AddSpellMod(SpellValueMod.ParentSpellTargetIndex, targetIndex.Value);
// original caster guid only for GO cast
m_caster.CastSpell(targets, spellInfo.Id, args);
}