Jump to content

[BUG] Cheat Death not available after dieing


Guest Forusim

Recommended Posts

Mangos Version: 10072

Custom Patches: Broadcaster

SD2 Version: 1714

Database Name and Version : UDB 391

How it SHOULD work: Once a minute Cheat Death gives you a chance to survive a deadly hit and will reduce all dmg taken for 3 seconds.

How it DOES work: If you die after a Procc of Cheat Death, this will not proccing again, until you relog. If you survive after Procc of Cheat Death everything is fine.

Here is the code, i cant find the source of the bug:

Unit.ccp

case SPELLFAMILY_ROGUE:
           {
               // Cheat Death (make less prio with Guardian Spirit case)
               if (!preventDeathSpell && spellProto->SpellIconID == 2109 &&
                   GetTypeId()==TYPEID_PLAYER &&           // Only players
                   !((Player*)this)->HasSpellCooldown(31231) &&
                                                           // Only if no cooldown
                   roll_chance_i((*i)->GetModifier()->m_amount))
                                                           // Only if roll
               {
                   preventDeathSpell = (*i)->GetSpellProto();
                   continue;
               }
               break;

Unit.ccp

           // Cheat Death
           case SPELLFAMILY_ROGUE:
           {
               // Cheat Death
               if (preventDeathSpell->SpellIconID == 2109)
               {
                   CastSpell(this,31231,true);
                   ((Player*)this)->AddSpellCooldown(31231,0,time(NULL)+60);
                   // with health > 10% lost health until health==10%, in other case no losses
                   uint32 health10 = GetMaxHealth()/10;
                   RemainingDamage = GetHealth() > health10 ? GetHealth() - health10 : 0;
               }
               break;
           }

Maybe you have an idea. Thanks!

Link to comment
Share on other sites

  • 3 weeks later...

I added the aura of "Cheat Death", because it is no longer activated after death.

Maybe one of you sees a possibility to activate "Cheat Death" after death.

My Revision: 10154

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f2d4b5e..1232216 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1917,10 +1917,40 @@ void Unit::CalculateAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolMask, D
    bool existExpired = false;

    // Incanter's Absorption, for converting to spell power
    int32 incanterAbsorption = 0;

+    if(GetTypeId() == TYPEID_PLAYER )
+    {
+        Player* temp_player = ((Player*)this);
+        
+        if (temp_player->getClass() == CLASS_ROGUE && !(temp_player->HasAura(31228) || temp_player->HasAura (31229) || temp_player->HasAura(31230)))
+        {
+            SpellEntry const *spellInfo = temp_player->GetKnownTalentRankById(1722);
+            if(spellInfo)
+            {
+                for(uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
+                {
+                    uint8 eff = spellInfo->Effect[i];
+                    if (eff>=TOTAL_SPELL_EFFECTS)
+                        continue;
+                    if( IsAreaAuraEffect(eff)           ||
+                        eff == SPELL_EFFECT_APPLY_AURA  ||
+                        eff == SPELL_EFFECT_PERSISTENT_AREA_AURA )
+                    {
+                        Aura *Aur = CreateAura(spellInfo, SpellEffectIndex(i), NULL, this);
+                        temp_player->AddAura(Aur);
+                    }
+                    
+                }
+            }else{
+                temp_player->RemoveAurasDueToSpell(31228);
+                temp_player->RemoveAurasDueToSpell(31229);
+                temp_player->RemoveAurasDueToSpell(31230);
+            }
+        }        
+    }
    // absorb without mana cost
    AuraList const& vSchoolAbsorb = GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
    for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end() && RemainingDamage > 0; ++i)
    {
        Modifier* mod = (*i)->GetModifier();

Link to comment
Share on other sites

  • 1 month later...
×
×
  • 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