Core/Spells: Allow removing weapon damage effects by preventing target selection in scripts

Port From (https://github.com/TrinityCore/TrinityCore/commit/ea692f5a248e5e67e3b983767044901cc743309b)
This commit is contained in:
Hondacrx
2025-08-18 10:10:20 -04:00
parent 2bbd77bd94
commit 77a99eb842
+10
View File
@@ -2440,8 +2440,12 @@ namespace Game.Spells
// multiple weapon dmg effect workaround
// execute only the last weapon damage
// and handle all effects at once
uint effectMask = m_UniqueTargetInfo.Find(p => p.TargetGUID == unitTarget.GetGUID()).EffectMask;
for (var j = effectInfo.EffectIndex + 1; j < m_spellInfo.GetEffects().Count; ++j)
{
if ((effectMask & (1 << (int)j)) == 0)
continue;
switch (m_spellInfo.GetEffect(j).Effect)
{
case SpellEffectName.WeaponDamage:
@@ -2474,6 +2478,9 @@ namespace Game.Spells
float weaponDamagePercentMod = 1.0f;
foreach (var spellEffectInfo in m_spellInfo.GetEffects())
{
if ((effectMask & (1 << (int)spellEffectInfo.EffectIndex)) == 0)
continue;
switch (spellEffectInfo.Effect)
{
case SpellEffectName.WeaponDamage:
@@ -2525,6 +2532,9 @@ namespace Game.Spells
// Sequence is important
foreach (var spellEffectInfo in m_spellInfo.GetEffects())
{
if ((effectMask & (1 << (int)spellEffectInfo.EffectIndex)) == 0)
continue;
// We assume that a spell have at most one fixed_bonus
// and at most one weaponDamagePercentMod
switch (spellEffectInfo.Effect)