Jump to content

Hex-Newbie's attempt to fix it


Guest Doixdd
 Share

Recommended Posts

Hey guys, my c++ skills recently increased enough to understand enough from mangos code, but i want to learn more. On the server i play people are complaining from getting ganked under the hex effect so i wanna give a try at fixing it.. the problem is i can't find the actual hex code line.. can anyone help me with this? (i know theres a fix for it.. but i wanna try on my own :P )

P.S Sorry if i posted this in the wrong section..

Link to comment
Share on other sites

hacky, but works:

@@ -719,11 +719,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
        // polymorphed and other negative transformed cases
        if(pVictim->getTransForm() && pVictim->hasUnitState(UNIT_STAT_CONFUSED))
            pVictim->RemoveAurasDueToSpell(pVictim->getTransForm());

+        // FG: Hex CAN break on damage (40% chance for now)
+        if(pVictim->HasAura(51514) && urand(0,100) < 40)
+            pVictim->RemoveAurasDueToSpell(51514);
+
        if(damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
        {
            if (!spellProto || !(spellProto->AuraInterruptFlags&AURA_INTERRUPT_FLAG_DIRECT_DAMAGE))

you possibly have to apply this by hand, i copied it from an old commit in my repo.

Link to comment
Share on other sites

thank you very much heres what i manage to do about 1 hours after i posted this

Unit.cpp

Line:  359

/* Original code */
///* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
//void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)
//{
//    if(!HasAuraType(auraType))
//        return;
//
//    // The chance to dispel an aura depends on the damage taken with respect to the casters level.
//    uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;  // with this formula it breaks at every dmg.. bigger than  > 50  (more or less) the cap is so low it doesnt get a change to /roll
//    float chance = float(damage) / max_dmg * 100.0f;
//    if (roll_chance_f(chance))
//        RemoveSpellsCausingAura(auraType);
//}

/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)
{
   if(!HasAuraType(auraType))
       return;

   // The chance to dispel an aura depends on the damage taken with respect to the casters level.
   uint32 max_dmg = getLevel() * 2450 / 80;  // tried to make it break according to what i saw on youtube.. and this cap seems to be the optimum one
   float chance = float(damage) / max_dmg * 100.0f;
   if (roll_chance_f(chance)) 
       RemoveSpellsCausingAura(auraType);
}



Line: 734

/*  Original code */
// polymorphed and other negative transformed cases
// if(pVictim->getTransForm() && pVictim->hasUnitState(UNIT_STAT_CONFUSED))
//    pVictim->RemoveAurasDueToSpell(pVictim->getTransForm());


// polymorphed, hex and other negative transformed cases
if(pVictim->getTransForm() && pVictim->HasAuraType(SPELL_AURA_MOD_CONFUSE))

       pVictim->RemoveAurasDueToSpell(pVictim->getTransForm());

   else if (pVictim->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))

       pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_PACIFY_SILENCE, damage);

Im using it on my server right now... and it works well :) i tested all the spells i could think of that breaks on dmg/should break it works :D this is my first try but hey.. if its good enough maybe it will get implemented in mangos :D

Part 2: Gift of the Naaru

I've noticed its bugged and does not benefit from Spell Power or Attack Power and for the last couple of hours i've been browsing the source code for that spell but i didnt found it -.-' can someone give me a hint(not a fix) where i should look, maybe even the line? Thank You

Link to comment
Share on other sites

 Share

×
×
  • 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