Jump to content

[patch][5890] Parry/block


Guest thenecromancer
 Share

Recommended Posts

Not much to do- these defenses shouldn't be active when casting spell or when stunned

Still, due to wwiki it seems that you can dodge when incapacitated ( eg. Gouge ), and when your attack is Parried you won't loose any rage.

As for first I'm not sure if it is true, and second cannot be done well with current spell system

Index: game/Unit.cpp
===================================================================
--- game/Unit.cpp        (revision 5460)
+++ game/Unit.cpp        (working copy)
@@ -3033,6 +3033,10 @@
float Unit::GetUnitParryChance() const
{
        float chance = 0;
+
+        if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNDED))
+                return 0;
+
        if(GetTypeId() == TYPEID_PLAYER)
        {
                Player const* player = (Player const*)this;
@@ -3061,6 +3065,10 @@

float Unit::GetUnitBlockChance() const
{
+
+        if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNDED))
+                return 0;
+
        if(GetTypeId() == TYPEID_PLAYER)
        {
                Item *tmpitem = ((Player const*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
@@ -3455,7 +3463,7 @@
        }
}

-bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skipAutorepeat)
+bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skipAutorepeat) const
{
        // We don't do loop here to explicitly show that melee spell is excluded.
        // Maybe later some special spells will be excluded too.
Index: game/Unit.h
===================================================================
--- game/Unit.h        (revision 5460)
+++ game/Unit.h        (working copy)
@@ -853,7 +853,7 @@
                // set withDelayed to true to account delayed spells as casted
                // delayed+channeled spells are always accounted as casted
                // we can skip channeled or delayed checks using flags
-                bool IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled = false, bool skipAutorepeat = false);
+                bool IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled = false, bool skipAutorepeat = false) const;

                // set withDelayed to true to interrupt delayed spells too
                // delayed+channeled spells are always interrupted

EDIT: sorry couldn't convert from const ..

Link to comment
Share on other sites

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