Jump to content

[Fix]Sudden Death


Guest Gommes

Recommended Posts

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

Fix Sudden Death

For which repository revision was the patch created?

Any compatible with 3.0.8 version.

Who has been writing this patch?

kozelo, I made patch files.

In Spell.cpp

@@ -3615,10 +3615,30 @@ void Spell::TriggerSpell()
    }
}

uint8 Spell::CanCast(bool strict)
{
+      // Sudden death
+      bool ex=false;
+      switch(m_spellInfo->Id)
+      {
+      case 5308:
+      case 20658:
+      case 20660:
+      case 20661:
+      case 20662:
+      case 25234:
+      case 25236:
+      case 47470:
+      case 20647:
+      case 47471: ex= true;
+      }
+      
+      
+      if(ex && m_caster->HasAura(52437)) return 0; // Allow execute
+      
+
    // check cooldowns to prevent cheating
    if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id))
    {
        if(m_triggeredByAuraSpell)
            return SPELL_FAILED_DONT_REPORT;

SpellEffects.cpp

@@ -1187,24 +1187,46 @@ void Spell::EffectDummy(uint32 i)
                return;
            }
            // Execute
            if(m_spellInfo->SpellFamilyFlags & 0x20000000)
            {
-                if(!unitTarget)
-                    return;
-
-                uint32 rage = m_caster->GetPower(POWER_RAGE);
-                // Glyph of Execution bonus
-                if (Aura *aura = m_caster->GetDummyAura(58367))
-                    rage+=aura->GetModifier()->m_amount;
-
-                int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
-                                                 m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
-                m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
-                m_caster->SetPower(POWER_RAGE,0);
-                return;
-            }
+                 if(!unitTarget)
+                     return;
+        int lastrage=0;
+        uint32 rage2 = 30;
+        uint32 rage = m_caster->GetPower(POWER_RAGE);
+
+        if(m_targets.getUnitTarget()->GetHealth() < m_targets.getUnitTarget()->GetMaxHealth()*0.2) rage2=rage; //Clean execute, ignore Sudden death
+        else if(m_caster->HasAura(29723)) lastrage=3;
+        else if (m_caster->HasAura(29725)) lastrage=7;
+        else if (m_caster->HasAura(29724)) lastrage=10;
+        
+                 // Glyph of Execution bonus
+                 if (Aura *aura = m_caster->GetDummyAura(58367)
+                 rage2+=aura->GetModifier()->m_amount;
+        
+ 
+                int32 basePoints0 = damage+int32(rage2 * m_spellInfo->DmgMultiplier[i] +
+                                                  m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
+                 m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
+
+        if(m_caster->HasAura(52437)) m_caster->RemoveSingleSpellAurasFromStack(52437);
+        if(lastrage !=0  ) 
+        {
+        if(rage-30 < lastrage)
+            m_caster->SetPower(POWER_RAGE,lastrage);
+        else
+            m_caster->SetPower(POWER_RAGE,rage-30);
+
+        }
+        else
+        {
+                       m_caster->SetPower(POWER_RAGE,0);
+        }
+        
+                 return;
+             }
            // Slam
            if(m_spellInfo->SpellFamilyFlags & 0x0000000000200000LL)
            {
                if(!unitTarget)
                    return;

Unit.cpp, void Unit::CalculateMeleeDamage

@@ -1274,10 +1274,28 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
            if (pVictim->GetTypeId()==TYPEID_PLAYER)
            {
                uint32 resilienceReduction = ((Player*)pVictim)->GetMeleeCritDamageReduction(damageInfo->damage);
                damageInfo->damage      -= resilienceReduction;
                damageInfo->cleanDamage += resilienceReduction;
+                
+                if(GetTypeId()==TYPEID_PLAYER)
+                {
+                        //sudden death
+                          int chance = rand()%100;
+                            if(HasAura(29723) && chance<4)
+                              {
+                                CastSpell(this, 52437, true);
+                              }
+                          if(HasAura(29725) && chance<7)
+                            {
+                                CastSpell(this, 52437, true);
+                              }
+                        if(HasAura(29724) && chance<10)
+                            {
+                                 CastSpell(this, 52437, true);
+                               }
+                   }
            }
            break;
        }
        case MELEE_HIT_PARRY:
            damageInfo->TargetState  = VICTIMSTATE_PARRY;
@@ -11346,6 +11364,6 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
    WorldObject::SetPhaseMask(newPhaseMask,update);

    if(IsInWorld())
        if(Pet* pet = GetPet())
            pet->SetPhaseMask(newPhaseMask,true);
-}
\\ No newline at end of file
+}

well hell I need to download Mangos again xD

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
  • 2 weeks later...

This is my try at implementing Sudden Death. Implemented for [7681].

I'm not sure it is "unhacky" enough. I couldn't really find any useful way to move code into an aura 262 implementation.

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index d8f6259..03c3bbd 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3694,8 +3694,12 @@ SpellCastResult Spell::CheckCast(bool strict)

        if(target != m_caster)
        {
+            // Execute: check override of target aura states by caster aura 262 (52437: Sudden Death)
+            uint32 TargetAuraState = m_spellInfo->TargetAuraState;
+            if (m_spellInfo->SpellIconID == 1648 && m_caster->HasAura(52437))
+                TargetAuraState = 0;
            // target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
-            if(m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
+            if(TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
                return SPELL_FAILED_TARGET_AURASTATE;

            // Not allow casting on flying player
@@ -4005,12 +4009,13 @@ SpellCastResult Spell::CheckCast(bool strict)
        {
            case SPELL_EFFECT_DUMMY:
            {
-                if(m_spellInfo->SpellIconID == 1648)        // Execute
+                /* if(m_spellInfo->SpellIconID == 1648)        // Execute
                {
                    if(!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2)
                        return SPELL_FAILED_BAD_TARGETS;
                }
-                else if (m_spellInfo->Id == 51582)          // Rocket Boots Engaged
+                else */
+                if (m_spellInfo->Id == 51582)          // Rocket Boots Engaged
                {
                    if(m_caster->IsInWater())
                        return SPELL_FAILED_ONLY_ABOVEWATER;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 13d1f03..c602259 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -1216,7 +1216,23 @@ void Spell::EffectDummy(uint32 i)
                if(!unitTarget)
                    return;

-                uint32 rage = m_caster->GetPower(POWER_RAGE);
+                int32 rageLasting = 0;
+                int32 rage = m_caster->GetPower(POWER_RAGE);
+                int32 currentRage = rage;
+                
+                // effect of Sudden Death ranks, independant of proc
+                if (m_caster->HasAura(29723)) rageLasting = 30;
+                else if (m_caster->HasAura(29725)) rageLasting = 70;
+                else if (m_caster->HasAura(29724)) rageLasting = 100;
+                // Sudden Death proc aura
+                bool hasAuraSD = m_caster->HasAura(52437);
+                if (hasAuraSD)
+                {
+                    // max of 30 rage consumed, even if target is below 20% health (to the dismay of PvP players)
+                    // spell rage cost already substracted (?)
+                    rage = std::min(300 - m_powerCost, rage);
+                    rageLasting = std::max(rageLasting, currentRage - rage);
+                }
                // Glyph of Execution bonus
                if (Aura *aura = m_caster->GetDummyAura(58367))
                    rage+=aura->GetModifier()->m_amount;
@@ -1224,7 +1240,8 @@ void Spell::EffectDummy(uint32 i)
                int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
                                                 m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
                m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
-                m_caster->SetPower(POWER_RAGE,0);
+                m_caster->SetPower(POWER_RAGE,rageLasting);
+                if (hasAuraSD) m_caster->RemoveAurasDueToSpell(52437);
                return;
            }
            // Slam

Notes:

In Spell::CheckCast() i commented the original check for Execute out because i think it is redundant.

All Execute spells require AuraState to be AURA_STATE_HEALTHLESS_20_PERCENT and in my tests (PvE only) it does abort the casting if the target has above 20% health, so why manually calculate percentage again?

Instead, you need to override the targets AuraState requirement when Sudden Death buff is active.

I'm not sure if a may use m_powerCost in Spell::EffectDummy() but it is needed to calculate the proper damage due to the 30 rage consume limitation.

I tried to research as good as i can, but it would be nice of someone could confirm these assumptions:

  • * The minimum rage remaining after execute is independent of the Sudden Death proc aura, it is a passive bonus to Execute.
    * If you would have less rage left than Sudden Death [rank] guarantees, you regain it, i.e. it does not affect damage dealt.
    * Sudden Death limitation of 30 rage consumed in total always applies when proc buff active, even if target is below 20% health which would allow normal Execute.
    Judging from the exensive whining about this i'm somewhat sure it is like this.
    * Sudden Death buff is consumed when Execute is used.
    The tooltip is not clear about this, but in youtube videos the buff never seemed to last the full 10s (hard to tell because of crappy quality) and i read at official forum it is consumed, but that poster was not sure either.
Link to comment
Share on other sites

I think the casting part could be solved this way (didn't test it yet, based on dbc data) but the other things could only be implemented in other functions :/

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b8c0f80..013f3b0 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3667,6 +3667,27 @@ SpellCastResult Spell::CheckCast(bool strict)
            if(bg->GetStatus() == STATUS_WAIT_LEAVE)
                return SPELL_FAILED_DONT_REPORT;

+    // SpellAura 262 & 263
+    Unit::AuraList const& prohibitAuras = m_caster->GetAurasByType(SPELL_AURA_ALLOW_ONLY_ABILITY);
+    for(Unit::AuraList::const_iterator itr = prohibitAuras.begin(); itr != prohibitAuras.end(); ++itr)
+    {
+        for (int i=0; i<3 ; ++i) 
+        { 
+            if (!(*itr)->isAffectedOnSpell(m_spellInfo))
+                return SPELL_FAILED_CASTER_AURASTATE; // Don't allow cast 
+        } 
+    } 
+
+    Unit::AuraList const& allowAuras = m_caster->GetAurasByType(SPELL_AURA_262);
+    for(Unit::AuraList::const_iterator itr = allowAuras.begin(); itr != allowAuras.end(); ++itr)
+    {
+        for (int i=0; i<3 ; ++i)
+        {
+            if ((*itr)->isAffectedOnSpell(m_spellInfo))
+                return SPELL_CAST_OK; // Allow cast
+        }
+    }
+
    // only check at first call, Stealth auras are already removed at second call
    // for now, ignore triggered spells
    if( strict && !m_IsTriggeredSpell)
@@ -5839,4 +5860,4 @@ void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* me
        TagUnitMap.push_back(healthQueue.top().getUnit());
        healthQueue.pop();
    }
-}
\\ No newline at end of file
+}

Link to comment
Share on other sites

This aura is used by 3 warrior talents ( 4 talents in 3.1 ) and i believe that other skills too, i have tested this aura implementation but the talents http://www.wowhead.com/?spell=29723 and ranks, http://www.wowhead.com/?spell=57499 doesn't works ( or must be added other functions? )

But http://www.wowhead.com/?spell=56636 works fine and this uses aura 262 as the other talents

I have tested the others patch and works ( but you say that is "hacky" ) but not stack with effect of taste for blood http://www.wowhead.com/?spell=56636

Link to comment
Share on other sites

Well i fixed the missing Unit:: tags, and tested it myself on 7692

http://www.wowhead.com/?spell=29723 - Sudden Death worked

http://www.wowhead.com/?spell=56636 - Taste for Blood worked

http://www.wowhead.com/?spell=57499 - Warbringer not worked but needs aura 275 (NYI)

ofc the side effects have to be implemented somewhere else. (Probably a new function.??)

Link to comment
Share on other sites

Great! you are right, this aura implementation works, but is needed some function because when Execute is used the effect of Sudden death not disappears.

I'm already testing the branch 310, but http://www.wowhead.com/?spell=64976 doesn't work, maybe charge ability need a new function or maybe need it be modify? but that is 310 branch, for now ( in master branch) this work.

Thanks you xD

Link to comment
Share on other sites

This is my try at implementing Sudden Death. Implemented for [7681].

I tried to research as good as i can, but it would be nice of someone could confirm these assumptions:

  • * The minimum rage remaining after execute is independent of the Sudden Death proc aura, it is a passive bonus to Execute.
    * If you would have less rage left than Sudden Death [rank] guarantees, you regain it, i.e. it does not affect damage dealt.
    * Sudden Death limitation of 30 rage consumed in total always applies when proc buff active, even if target is below 20% health which would allow normal Execute.
    Judging from the exensive whining about this i'm somewhat sure it is like this.
    * Sudden Death buff is consumed when Execute is used.
    The tooltip is not clear about this, but in youtube videos the buff never seemed to last the full 10s (hard to tell because of crappy quality) and i read at official forum it is consumed, but that poster was not sure either.

1 - I think it's a buff to all executes or else it would be specified in the tooltip..

2 - No, because you need at least 15 rage to execute.

3 - Yes, sudden death has priority.

4 - Not sure.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

http://www.wowhead.com/?spell=57499 - Warbringer not worked but needs aura 275 (NYI)

ofc the side effects have to be implemented somewhere else. (Probably a new function.??)

I have wracked my head with this one for a very long time and I finally realize why Warbringer doesn't allow the client to use Charge in combat. It's because, as a passive, invisible aura, it is never sent to the client. So the client never does anything to enable spells affected by Warbringer, Juggernaut, etc. outside their bypassed restraints.

I think one logical way to solve this problem would be to, in the handler of 262, custom send this packet to the client. You can confirm this works by .debug send opcode with the following parameters in opcode.txt:

1174             uint 16  xxxxx             uint8 255             uint32 57499    uint8 19        uint8 80   uint8 1 uint8 0
SMSG_AURA_UPDATE whatever GetPackGUID() is  max allowed auraslot  Warbringer ID   see AFLAG enum  AuraLevel  Charges

What this opcode does is send the client the invisible Warbringer aura (you can also try this with Juggernaut), and allows the client to use charge in combat / use intercept and intervene in combat.

Edit: Also, in the patch you wrote, you could have just used (*i)->IsAffectedOn(m_spellInfo) ;)

Link to comment
Share on other sites

Ah, yes you're definetly right, and this sniff you've got is interesting. We could takea deeper look into it...

This may also be the solution for spells that would require targetaurastate eg. Fingers of Frost, but implementing it in a way that we pretend the aurastate for the next target would be terribly hacky.

Link to comment
Share on other sites

Actually, it's not a sniff, it was trial + error, so it probably will not be 100% correct.

I'm only working with the client-side problem of implementing this aura in Juggernaut and Warbringer. With Juggernaut and Warbringer, the spells affected remain greyed out in combat / with the wrong stances.

The other spells work fine on the client side since they are visible auras (Taste for Blood and Sudden Death).

Unfortunately, I think the way to implement Fingers of Frost will still be through a hack in Shatter/Ice Lance's custom script code.

Edit: @Pelle: patience, please... Sudden Death works with Lightguard's patch, I already stated Juggernaut is the same issue as Warbringer, Shadow Dance doesn't even use 262.

Link to comment
Share on other sites

I'm only working with the client-side problem of implementing this aura in Juggernaut and Warbringer. With Juggernaut and Warbringer, the spells affected remain greyed out in combat / with the wrong stances.

but won't a "let cast it in combat if they have talent" patch work?

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