Jump to content

[patch]SPELL_AURA_316


Auntie Mangos

Recommended Posts

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

allows periodic auras to be affected by haste, also added Shadowform triggering spell with this aura

For which repository revision was the patch created?

9593

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

http://getmangos.eu/community/showthread.php?12995-[bUG]-Glyph-Quick-and-Decay

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

me

diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index fb5a5ee..01855e4 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -358,7 +358,7 @@ enum AuraType
    SPELL_AURA_313 = 313,
    SPELL_AURA_314 = 314,
    SPELL_AURA_315 = 315,
-    SPELL_AURA_316 = 316,
+    SPELL_AURA_MOD_PERIODIC_DURATION_OF_HASTE = 316,
    TOTAL_AURAS = 317
};

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 4a64b7c..d0d0e74 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -366,7 +366,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleNULL,                                      //313 0 spells in 3.3
    &Aura::HandleNULL,                                      //314 1 test spell (reduce duration of silince/magic)
    &Aura::HandleNULL,                                      //315 underwater walking
-    &Aura::HandleNULL                                       //316 makes haste affect HOT/DOT ticks
+    &Aura::HandleNoImmediateEffect                          //316 makes haste affect HOT/DOT ticks, SPELL_AURA_MOD_PERIODIC_DURATION_OF_HASTE, implemented in Unit::CalculateSpellDuration
};

static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
@@ -398,14 +398,12 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false)
    {
        m_caster_guid = target->GetGUID();
        damage = m_currentBasePoints+1;                     // stored value-1
-        m_maxduration = target->CalculateSpellDuration(m_spellProto, m_effIndex, target);
    }
    else
    {
        m_caster_guid = caster->GetGUID();

-        damage        = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
-        m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target);
+        damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);

        if (!damage && castItem && castItem->GetItemSuffixFactor())
        {
@@ -432,11 +430,24 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false)
        }
    }

-    if(m_maxduration == -1 || m_isPassive && m_spellProto->DurationIndex == 0)
-        m_permanent = true;
+
+
+    SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]);

    Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;

+    // Apply periodic time mod
+    if(modOwner && m_modifier.periodictime)
+        modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_modifier.periodictime);
+
+    if (!caster)
+        m_maxduration = target->CalculateSpellDuration(m_spellProto, m_effIndex, target, m_modifier.periodictime);
+    else
+        m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target, m_modifier.periodictime);
+
+    if(m_maxduration == -1 || m_isPassive && m_spellProto->DurationIndex == 0)
+        m_permanent = true;
+
    if(!m_permanent && modOwner)
    {
        modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, m_maxduration);
@@ -449,12 +460,6 @@ m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false)

    sLog.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage);

-    SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage, m_spellProto->EffectAmplitude[eff], m_spellProto->EffectMiscValue[eff]);
-
-    // Apply periodic time mod
-    if(modOwner && m_modifier.periodictime)
-        modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_modifier.periodictime);
-
    // Start periodic on next tick or at aura apply
    if (!(m_spellProto->AttributesEx5 & SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY))
        m_periodicTimer += m_modifier.periodictime;
@@ -5934,7 +5939,7 @@ void Aura::HandleShapeshiftBoosts(bool apply)
            break;
        case FORM_SHADOW:
            spellId1 = 49868;
-
+            spellId2 = 71167;
            if(m_target->GetTypeId() == TYPEID_PLAYER)      // Spell 49868 have same category as main form spell and share cooldown
                ((Player*)m_target)->RemoveSpellCooldown(49868);
            break;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 6608963..9383255 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -11570,7 +11570,7 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, SpellEffectIndex
    return value;
}

-int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectIndex effect_index, Unit const* target)
+int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectIndex effect_index, Unit const* target, uint32 &periodicTime)
{
    Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;

@@ -11588,6 +11588,20 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectInde

    if (duration > 0)
    {
+        if (periodicTime)
+        {
+            Unit::AuraList const& mModByHaste = GetAurasByType(SPELL_AURA_MOD_PERIODIC_DURATION_OF_HASTE);
+            for(Unit::AuraList::const_iterator i = mModByHaste.begin(); i != mModByHaste.end(); ++i)
+            {
+                 if (!(*i)->isAffectedOnSpell(spellProto))
+                     continue;
+                 
+                 int32 ticksNum = duration / periodicTime ;
+                 periodicTime = int32(GetFloatValue(UNIT_MOD_CAST_SPEED) * periodicTime);
+                 duration = periodicTime * ticksNum;
+                 break;
+            }
+        }
        int32 mechanic = GetEffectMechanic(spellProto, effect_index);
        // Find total mod value (negative bonus)
        int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
diff --git a/src/game/Unit.h b/src/game/Unit.h
index b566f0e..8ca7dd1 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1756,7 +1756,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

        uint32 CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo = NULL);
        uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask);
-        int32 CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectIndex effect_index, Unit const* target);
+        int32 CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectIndex effect_index, Unit const* target, uint32 &periodicTime);
        float CalculateLevelPenalty(SpellEntry const* spellProto) const;

        void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }

note: currently existing small problem with Vampiric Touch - it's dummy auras doesn't have periodic timer so they are not affected by haste and not removed at the same time with Vampiric Touch DoT =\\

Link to comment
Share on other sites

I think before implementing haste for periodic spells we should unify durations of auras from single spell by moving related code to aura holders and fix CalculateSpellDuration work for multiple effects. After that implementation won't look so ugly like in old patch.

Also, I was thinking about splitting CalculateSpellDuration into two functions

1. CalculateSpellDuration that would calculate spell duration based on combo points, caster spell mods and haste. It can be also used with SendChannelStart for AoE channeled spells. For auras that don't have caster (e.g. loaded from *_addon) GetSpellDuration can be used.

2. CalculateAuraDuration that would calculate aura duration depending on target unit auras.

Then we'll be able to fix http://getmangos.eu/community/topic/14726/10258-duration-diminishing/

Link to comment
Share on other sites

  • 40 years later...
  • 2 months later...
  • 3 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 1 month later...
  • 1 month later...
Guest
This topic is now closed to further replies.
×
×
  • 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