Jump to content

[11552] Aura 294 + Aura of Despair


Guest breakwater

Recommended Posts

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

Implement the Aura 294 and the unique spell Spell 62692 with triggerspell 64848

* For which repository revision was the patch created?

11469

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

i don't know

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

me

i writed no codeline

target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);

in Aurahandling 294, when aura is remove, because the player update function set this flag in player::update

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 256ba23..bd9d560 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1438,7 +1438,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
    if (isAlive())
    {
        // if no longer casting, set regen power as soon as it is up.
-        if (!IsUnderLastManaUseEffect())
+        if (!IsUnderLastManaUseEffect() && !HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN))
            SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);

        if (!m_regenTimer)
@@ -2178,6 +2178,8 @@ void Player::Regenerate(Powers power, uint32 diff)
    {
        case POWER_MANA:
        {
+            if (HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN))
+                break;
            bool recentCast = IsUnderLastManaUseEffect();
            float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
            if (recentCast)
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 5c6b3e5..0aaa715 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -329,7 +329,7 @@ enum AuraType
    SPELL_AURA_MOD_QUEST_XP_PCT = 291,
    SPELL_AURA_OPEN_STABLE = 292,
    SPELL_AURA_ADD_MECHANIC_ABILITIES = 293,
-    SPELL_AURA_294 = 294,
+    SPELL_AURA_STOP_NATURAL_MANA_REGEN = 294,
    SPELL_AURA_295 = 295,
    SPELL_AURA_296 = 296,
    SPELL_AURA_297 = 297,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 55cad1c..3adc8da 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -345,7 +345,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleNoImmediateEffect,                         //291 SPELL_AURA_MOD_QUEST_XP_PCT           implemented in Player::GiveXP
    &Aura::HandleAuraOpenStable,                            //292 call stabled pet
    &Aura::HandleAuraAddMechanicAbilities,                  //293 SPELL_AURA_ADD_MECHANIC_ABILITIES  replaces target's action bars with a predefined spellset
-    &Aura::HandleNULL,                                      //294 2 spells, possible prevent mana regen
+    &Aura::HandleAuraStopNaturalManaRegen,                  //294 No natural mana regen                 implemented in Player:Regenerate
    &Aura::HandleUnused,                                    //295 unused (3.2.2a)
    &Aura::HandleAuraSetVehicle,                            //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
    &Aura::HandleNULL,                                      //297 1 spell (counter spell school?)
@@ -10775,3 +10775,34 @@ void Aura::HandleAuraFactionChange(bool apply, bool real)
        target->setFaction(newFaction);

}
+
+void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool real)
+{
+    if (!real)
+        return;
+    
+    Unit* target = GetTarget();
+
+    if (!target)
+        return;
+
+    Unit* caster = GetCaster();
+
+    if (!caster)
+        return;
+
+    switch (GetId())
+    {
+        case 62692:                                                     // Aura of Despair
+            if (apply)
+            {
+                target->CastSpell(target, 64848 , true, 0, 0, caster->GetObjectGuid());
+            }
+            else
+            {
+                target->RemoveAurasDueToSpell(64848);
+            }
+            break;
+    }
+    target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
+}
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 9fd9461..84545ed 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -374,6 +374,7 @@ class MANGOS_DLL_SPEC Aura
        void HandleAuraAddMechanicAbilities(bool apply, bool Real);
        void HandleAuraSetVehicle(bool apply, bool Real);
        void HandleAuraFactionChange(bool apply, bool real);
+        void HandleAuraStopNaturalManaRegen(bool apply, bool real);

        virtual ~Aura();

Link to comment
Share on other sites

I think proper way to implement this aura will be Spell Effect/State Immune implementation...

Those spells apply following auras:

Apply Aura: Aura of Despair (1)

Apply Aura: Mod Melee Attack Speed - %

Apply Aura: Effect Immunity (30) - SPELL_EFFECT_ENERGIZE

Apply Aura: Effect Immunity (137) - SPELL_EFFECT_ENERGIZE_PCT

Apply Aura: State Immunity (24) - SPELL_AURA_PERIODIC_ENERGIZE

Apply Aura: State Immunity (21) - SPELL_AURA_OBS_MOD_MANA

We have somewhere in Unit.cpp:

bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
{
   if (!spellInfo)
       return false;

   //TODO add spellEffect immunity checks!, player with flag in bg is immune to immunity buffs from other friendly players!
   //SpellImmuneList const& dispelList = m_spellImmune[iMMUNITY_EFFECT];

Link to comment
Share on other sites

i don't think so, because the two spells (Spell 62692 with triggerspell 64848) handel all the immun effects sameself. So I need no explicit implementation in Unit::IsImmuneToSpell. Maybe an exclusion for the energize spell 63337in bossfight.

Of course we can use the handling for spell aura 294 for other spells, maybe in Cata. Therefor I have write this handling.

Link to comment
Share on other sites

Ok Vladimir, I have write an apply and unapply(!apply), and the trigger spell write in SpellAuraHolder::HandleSpellSpecificBoosts

The Code part

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 256ba23..bd9d560 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1438,7 +1438,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
    if (isAlive())
    {
        // if no longer casting, set regen power as soon as it is up.
-        if (!IsUnderLastManaUseEffect())
+        if (!IsUnderLastManaUseEffect() && !HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN))
            SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);

        if (!m_regenTimer)
@@ -2178,6 +2178,8 @@ void Player::Regenerate(Powers power, uint32 diff)
    {
        case POWER_MANA:
        {
+            if (HasAuraType(SPELL_AURA_STOP_NATURAL_MANA_REGEN))
+                break;
            bool recentCast = IsUnderLastManaUseEffect();
            float ManaIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_MANA);
            if (recentCast)
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 5c6b3e5..0aaa715 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -329,7 +329,7 @@ enum AuraType
    SPELL_AURA_MOD_QUEST_XP_PCT = 291,
    SPELL_AURA_OPEN_STABLE = 292,
    SPELL_AURA_ADD_MECHANIC_ABILITIES = 293,
-    SPELL_AURA_294 = 294,
+    SPELL_AURA_STOP_NATURAL_MANA_REGEN = 294,
    SPELL_AURA_295 = 295,
    SPELL_AURA_296 = 296,
    SPELL_AURA_297 = 297,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 99048e4..29a63b2 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -345,7 +345,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleNoImmediateEffect,                         //291 SPELL_AURA_MOD_QUEST_XP_PCT           implemented in Player::GiveXP
    &Aura::HandleAuraOpenStable,                            //292 call stabled pet
    &Aura::HandleAuraAddMechanicAbilities,                  //293 SPELL_AURA_ADD_MECHANIC_ABILITIES  replaces target's action bars with a predefined spellset
-    &Aura::HandleNULL,                                      //294 2 spells, possible prevent mana regen
+    &Aura::HandleAuraStopNaturalManaRegen,                  //294 No natural mana regen                 implemented in Player:Regenerate
    &Aura::HandleUnused,                                    //295 unused (3.2.2a)
    &Aura::HandleAuraSetVehicle,                            //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
    &Aura::HandleNULL,                                      //297 1 spell (counter spell school?)
@@ -9707,6 +9707,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
                            caster->RemoveAurasDueToSpell(34027);
                    return;
                }
+                case 62692:                                 // Aura of Despair
+                {
+                    spellId1 = 64848;
+                    break;
+                }
                case 70867:                                 // Soul of Blood Qween
                case 71473:
                case 71532:
@@ -10778,3 +10783,19 @@ void Aura::HandleAuraFactionChange(bool apply, bool real)
        target->setFaction(newFaction);

}
+
+void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool real)
+{
+    if (!real)
+        return;
+    
+    Unit* target = GetTarget();
+
+    if (!target)
+        return;
+
+    if (apply)
+        target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
+    else
+        target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
+}
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 9fd9461..84545ed 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -374,6 +374,7 @@ class MANGOS_DLL_SPEC Aura
        void HandleAuraAddMechanicAbilities(bool apply, bool Real);
        void HandleAuraSetVehicle(bool apply, bool Real);
        void HandleAuraFactionChange(bool apply, bool real);
+        void HandleAuraStopNaturalManaRegen(bool apply, bool real);

        virtual ~Aura();

Link to comment
Share on other sites

I think proper way to implement this aura will be Spell Effect/State Immune implementation...

In fact for normal regeneration prevent it will anyway require checks in same lines, so i not sure that immunity will better.

At least i not see clean way, and current patch look like good in current state.

[added]I understand problem in part mana potions prevent use. So immunity really need implement as point TOM

Special confirm for immunity way:

It will proc, same as the meta gem does, but just says "immune" and gives no mana.

[added2]After small additional fix i not see what really need immuned additionally.

managems immunted, potion used but not real mana restored. Attempt use potion must also report error instead ignore?

This is tested version: https://gist.github.com/994536

Link to comment
Share on other sites

I think that the ignore is right, because the spell tooltip say something like this. "Prevents mana regeneration from nearly all natural sources." In my opinion the potion drinking is allowed, only the effect will be ignore. The Tooltip doesn't say "Prevent takes potions"

The two auras make you immun to all mana restore thinks: SpellEffects and Aura State. problem are spells, which should have a function which this aura, like 63337 (or some abilities from pala, hunter, shaman)

the tested version looks good

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