Jump to content

[Patch] Deterrence


Auntie Mangos

Recommended Posts

  • 41 years later...

What bug does the patch fix?

it fix atacks from behind when hunters use deterrence

For which repository revision was the patch created?

I use the branch of kero99 https://github.com/kero99/Stable

Who has been writing this patch?

me

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b4dc9f9..e9c8455 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2929,11 +2929,23 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack

    bool from_behind = !pVictim->HasInArc(M_PI_F,this);

-    if (from_behind)
+    if (from_behind) {
+        if(pVictim->HasAura(19263)) {
+            int32 tmp2 = int32(parry_chance);
+            if (   (tmp2 > 0)                                   // check if unit _can_ parry
+                && ((tmp2 -= skillBonus) > 0)
+                && (roll < (sum += tmp2)))
+            {
+                DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
+                return MELEE_HIT_PARRY;
+            }
+        }
+        else
        DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: attack came from behind.");
+    }

    // Dodge chance
-
+
    // only players can't dodge if attacker is behind
    if (pVictim->GetTypeId() != TYPEID_PLAYER || !from_behind)
    {
@@ -2976,7 +2988,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
                DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
                return MELEE_HIT_PARRY;
            }
-        }
+        }                             
    }

    // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
@@ -3284,6 +3296,12 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
            if (roll < tmp)
                return SPELL_MISS_DEFLECT;
        }
+        if(pVictim->HasAura(19263)) {
+            int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
+            tmp+=deflect_chance;
+            if (roll < tmp)
+                return SPELL_MISS_DEFLECT;
+        }
        return SPELL_MISS_NONE;
    }

@@ -3294,8 +3312,10 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
        if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
            canDodge = false;
        // Can`t parry
-        canParry = false;
+        if(!pVictim->HasAura(19263))
+            canParry = false;
    }
+
    // Check creatures flags_extra for disable parry
    if(pVictim->GetTypeId()==TYPEID_UNIT)
    {
@@ -3436,7 +3456,12 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
        if (rand < tmp)
            return SPELL_MISS_DEFLECT;
    }
-
+    if(pVictim->HasAura(19263)) {
+        int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
+        tmp+=deflect_chance;
+        if (rand < tmp)
+            return SPELL_MISS_DEFLECT;
+    }
    return SPELL_MISS_NONE;
}

Link to comment
Share on other sites

  • 1 month later...

As described in pre-3.2.0 parry work only for front melee (aura 47)/deflaction for spells (aura 287), and pacify (25)

and exist only spell 19263 for this for players.

But in 3.3.5 (added in 3.2.0) exist spell 67801 that have

aura 288 (unknown), aura 185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE -100

Aura 288 used _only_ in spell 67801 so i think its like: "percent from normal parry for attack in case attack from behind.

[added]In 4.1.0 exist spell "360 Defensive Abilities" with single 288 aura with same 100 value.

I will prepare alt. patch with use this aura

[added]Alt. version in [11510]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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