Jump to content

Damage from delayed spells @ Spell Reflect


Guest maly32167

Recommended Posts

This fixed reflected delayed spells (not instant) to have effects applied at all and to have damage in its info too.

Maybe its not the way it should be done - Im not actually sure I have been writting it to just fix it and by printf-debugging I found out that at delayed reflect spell's mask is taken out thus effects arent processed at all also due to DelayedSpellLaunch handling, damage is not applied at all if its reflected, would be good to have opinion from devs.

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 36a3d43..d4d6d7d 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1062,7 +1062,18 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
        // mark effects that were already handled in Spell::HandleDelayedSpellLaunch on spell launch as processed
        for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
            if (IsEffectHandledOnDelayedSpellLaunch(m_spellInfo, SpellEffectIndex(i)))
-                mask &= ~(1<<i);
+            {
+                if(missInfo == SPELL_MISS_REFLECT)
+                {
+                    SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
+                    caster->CalculateSpellDamage(&damageInfo, m_damage, m_spellInfo, m_attackType);
+                    unitTarget->CalculateAbsorbResistBlock(caster, &damageInfo, m_spellInfo);
+                    caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
+                     m_damage += damageInfo.damage;
+                }
+                else
+                    mask &= ~(1<<i);
+            }

        // maybe used in effects that are handled on hit
        m_damage += target->damage;

Link to comment
Share on other sites

As for delayed spells no - I also used some other patch from mangos forum to select which spells should be reflected- I have seen You also work on this

I havent this patch on 'live' server so can't get much of feedback yet

This code doesnt change much - there is check so You cant reflect reflected spell thus mask-removal is applied on reflected one - therefore it cant loop so no bugs should be "exposed" in this patch

Link to comment
Share on other sites

Tested and although it works there is nothing preventing reflecting the spell back, such as you suggested.

Reproduce this by .aura 31534 (Reflective Shield 8 seconds) on yourself and enemy, then instant cast a damaging spell (I used Ice Lance .cast 30455) and watch as your screen locks up with "Internal error" spam for a few seconds. Check combat log and see the spell bounces back and forth repeatedly causing both server and client to freeze until one of the reflective shields drops.

This happens with or without your patch (just minus the damage at the end). I'm just reporting that the core isn't preventing multiple reflects as suggested.

Link to comment
Share on other sites

I see, actually I havent tested it I just based my opinion on

if (target.reflectResult == SPELL_MISS_REFLECT)     // Impossible reflect again, so simply deflect spell
           target.reflectResult = SPELL_MISS_PARRY;

Probably it must be checked in different place (or second time at spellhit) not where it is atm.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use