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:
@@ -2440,8 +2440,12 @@ namespace Game.Spells
|
|||||||
// multiple weapon dmg effect workaround
|
// multiple weapon dmg effect workaround
|
||||||
// execute only the last weapon damage
|
// execute only the last weapon damage
|
||||||
// and handle all effects at once
|
// 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)
|
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)
|
switch (m_spellInfo.GetEffect(j).Effect)
|
||||||
{
|
{
|
||||||
case SpellEffectName.WeaponDamage:
|
case SpellEffectName.WeaponDamage:
|
||||||
@@ -2474,6 +2478,9 @@ namespace Game.Spells
|
|||||||
float weaponDamagePercentMod = 1.0f;
|
float weaponDamagePercentMod = 1.0f;
|
||||||
foreach (var spellEffectInfo in m_spellInfo.GetEffects())
|
foreach (var spellEffectInfo in m_spellInfo.GetEffects())
|
||||||
{
|
{
|
||||||
|
if ((effectMask & (1 << (int)spellEffectInfo.EffectIndex)) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (spellEffectInfo.Effect)
|
switch (spellEffectInfo.Effect)
|
||||||
{
|
{
|
||||||
case SpellEffectName.WeaponDamage:
|
case SpellEffectName.WeaponDamage:
|
||||||
@@ -2525,6 +2532,9 @@ namespace Game.Spells
|
|||||||
// Sequence is important
|
// Sequence is important
|
||||||
foreach (var spellEffectInfo in m_spellInfo.GetEffects())
|
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
|
// We assume that a spell have at most one fixed_bonus
|
||||||
// and at most one weaponDamagePercentMod
|
// and at most one weaponDamagePercentMod
|
||||||
switch (spellEffectInfo.Effect)
|
switch (spellEffectInfo.Effect)
|
||||||
|
|||||||
Reference in New Issue
Block a user