Jump to content

[patch] Crushing blows and criticals from creatures


Guest Tassader2

Recommended Posts

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

It

1) prevents attacks dealing elemental damage from crushing (crushing blows are restricted to physical autoattack on official realm),

2) prevents melee spells from crushing (crushing blows are restricted to physical autoattack on official realm),

3) prevents "normal" spells from critically hitting unless caster is a player (critical hits from creatures are restricted to autoattack and (maybe) melee spells on official realm).

See comments in code for hint which change corresponds to 1), 2) and 3)

* For which repository revision was the patch created?

6918

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

http://mangos.lighthouseapp.com/projects/18208/tickets/34-spells-from-creatures-can-crit#ticket-34-8

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

Me, Tassader

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5925b21..d67bae6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1334,7 +1334,7 @@ void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *da
            // Calculate damage bonus
            *damage = SpellDamageBonus(pVictim, spellInfo, *damage, SPELL_DIRECT_DAMAGE);

-            *crit = isSpellCrit(pVictim, spellInfo, GetSpellSchoolMask(spellInfo), BASE_ATTACK);
+            *crit = isSpellCrit(pVictim, spellInfo, GetSpellSchoolMask(spellInfo), BASE_ATTACK) && GetTypeId()==TYPEID_PLAYER /* Only players can crit with spells */;
            if (*crit)
            {
                *damage = SpellCriticalBonus(spellInfo, *damage, pVictim);
@@ -2083,11 +2083,14 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama
        }
        case MELEE_HIT_CRUSHING:
        {
-            // 150% normal damage
-            *damage += (*damage / 2);
-            cleanDamage->damage = *damage;
-            *hitInfo |= HITINFO_CRUSHING;
-            // TODO: victimState, victim animation?
+            if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL) //Only physical attack can be crushing blow
+            {
+                // 150% normal damage
+                *damage += (*damage / 2);
+                cleanDamage->damage = *damage;
+                *hitInfo |= HITINFO_CRUSHING;
+                // TODO: victimState, victim animation?
+            }
            break;
        }
        default:
@@ -2486,7 +2489,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
        }
    }

-    if(GetTypeId()!=TYPEID_PLAYER && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) && !((Creature*)this)->isPet() )
+    if(GetTypeId()!=TYPEID_PLAYER && !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) && !((Creature*)this)->isPet() && !SpellCasted /*Only autoattack can be crushing blow*/)
    {
        // mobs can score crushing blows if they're 3 or more levels above victim
        // or when their weapon skill is 15 or more above victim's defense skill

Link to comment
Share on other sites

  • 1 year 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