Jump to content

[patch][7183] Updated Spell Delaying


Sarjuuk

Recommended Posts

What bug does the patch fix? What features does the patch add?

SpellPushback changed with 3.0. Its now delaying by a fixed ammount for normal spells (500ms) and a percentage for channeled spells (25%)

SpellPushback may only occur twice per spell.

Any Talents, previously giving a %chance to resist pushback are now giving a reduction to the fixed value. Renamed SpellAura:149, to reflect this new behaviour.

For which repository revision was the patch created?

master @ 08b475203194da030de1f4c0c57bdf6215c0170e

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

none

Who has been writing this patch? Please include either forum user names or email addresses.

Sarjuuk

Reference:

WellKnownWiki => Interrupt

Diff:

=>DelaySpell.diff

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 53a2327..7ef2f44 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -5189,18 +5189,20 @@ void Spell::Delayed()
    if (m_spellState == SPELL_STATE_DELAYED)
        return;                                             // spell is active and can't be time-backed

+    if(isDelayableNoMore())                                 // Spells may only be delayed twice
+        return;
+
    // spells not loosing casting time ( slam, dynamites, bombs.. )
    if(!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE))
        return;

-    //check resist chance
-    int32 resistChance = 100;                               //must be initialized to 100 for percent modifiers
-    ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this);
-    resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100;
-    if (roll_chance_i(resistChance))
-        return;
+    //check pushback reduce
+    int32 delaytime = 500;                                     // spellcasting delay is normally 500ms
+    int32 delayReduce = 100;                               // must be initialized to 100 for percent modifiers
+    ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
+    delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;

-    int32 delaytime = GetNextDelayAtDamageMsTime();
+    delaytime -= delaytime * delayReduce / 100;

    if(int32(m_timer) + delaytime > m_casttime)
    {
@@ -5224,14 +5226,16 @@ void Spell::DelayedChannel()
    if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING)
        return;

-    //check resist chance
-    int32 resistChance = 100;                               //must be initialized to 100 for percent modifiers
-    ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,resistChance, this);
-    resistChance += m_caster->GetTotalAuraModifier(SPELL_AURA_RESIST_PUSHBACK) - 100;
-    if (roll_chance_i(resistChance))
+    if(isDelayableNoMore())                                 // Spells may only be delayed twice
        return;

-    int32 delaytime = GetNextDelayAtDamageMsTime();
+    //check pushback reduce
+    int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit
+    int32 delayReduce = 100;                               // must be initialized to 100 for percent modifiers
+    ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this);
+    delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
+
+    delaytime -= delaytime * delayReduce / 100;

    if(int32(m_timer) < delaytime)
    {
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 5befc67..4749433 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -453,7 +453,14 @@ class Spell
        uint8 m_runesState;

        uint8 m_delayAtDamageCount;
-        int32 GetNextDelayAtDamageMsTime() { return m_delayAtDamageCount < 5 ? 1000 - (m_delayAtDamageCount++)* 200 : 200; }
+        bool isDelayableNoMore() 
+        { 
+            if(m_delayAtDamageCount >= 2)
+                return true;
+
+            m_delayAtDamageCount++;
+            return false; 
+        }

        // Delayed spells system
        uint64 m_delayStart;                                // time of spell delay start, filled by event handler, zero = just started
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 5d401b2..55eeab8 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -191,7 +191,7 @@ enum AuraType
    SPELL_AURA_PERSUADED = 146,
    SPELL_AURA_ADD_CREATURE_IMMUNITY = 147,
    SPELL_AURA_RETAIN_COMBO_POINTS = 148,
-    SPELL_AURA_RESIST_PUSHBACK  = 149,                      //    Resist Pushback
+    SPELL_AURA_REDUCE_PUSHBACK  = 149,                      //    Reduce Pushback
    SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
    SPELL_AURA_TRACK_STEALTHED  = 151,                      //    Track Stealthed
    SPELL_AURA_MOD_DETECTED_RANGE = 152,                    //    Mod Detected Range
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 08fef1f..a3b6e8b 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -199,7 +199,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleUnused,                                    //146 SPELL_AURA_PERSUADED obsolete?
    &Aura::HandleNULL,                                      //147 SPELL_AURA_ADD_CREATURE_IMMUNITY
    &Aura::HandleAuraRetainComboPoints,                     //148 SPELL_AURA_RETAIN_COMBO_POINTS
-    &Aura::HandleNoImmediateEffect,                         //149 SPELL_AURA_RESIST_PUSHBACK
+    &Aura::HandleNoImmediateEffect,                         //149 SPELL_AURA_REDUCE_PUSHBACK
    &Aura::HandleShieldBlockValue,                          //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
    &Aura::HandleAuraTrackStealthed,                        //151 SPELL_AURA_TRACK_STEALTHED
    &Aura::HandleNoImmediateEffect,                         //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index abbe272..fa47cd6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10207,7 +10207,7 @@ bool InitTriggerAuraData()
    isTriggerAura[sPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE] = true;

    isNonTriggerAura[sPELL_AURA_MOD_POWER_REGEN]=true;
-    isNonTriggerAura[sPELL_AURA_RESIST_PUSHBACK]=true;
+    isNonTriggerAura[sPELL_AURA_REDUCE_PUSHBACK]=true;

    return true;
}

pleas bear with me and my nonexistent git-account ;o

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