Jump to content

[patch] Deterrence


Auntie Mangos

Recommended Posts

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

removed "behind" check for http://www.wowhead.com/?spell=19263 as it should be on 3.2.2 patch

For which repository revision was the patch created?

9780

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

http://getmangos.eu/community/viewtopic.php?id=10919

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

Me

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index ac17d38..5927b07 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1039,6 +1039,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
        return;
    }

+    // Recheck deflection (only for delayed spells)
+    if (m_spellInfo->speed && unit->HasAura(19263))
+    {
+        if (realCaster)
+            realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_DEFLECT);
+        return;
+    }
+
    if (unit->GetTypeId() == TYPEID_PLAYER)
    {
        ((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id);
@@ -2608,6 +2616,13 @@ void Spell::cast(bool skipCheck)
                AddTriggeredSpell(60089);
            break;
        }
+        case SPELLFAMILY_HUNTER:
+        {
+            // Deterrence
+            if (m_spellInfo->Id == 19263)
+                AddTriggeredSpell(67801);
+            break;
+        }
        case SPELLFAMILY_ROGUE:
            // Fan of Knives (main hand)
            if (m_spellInfo->Id == 51723 && m_caster->GetTypeId() == TYPEID_PLAYER &&
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 697d157..a952f50 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1718,6 +1718,10 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
                    (spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)) )
                    return false;

+                // Deterrence
+                if( spellInfo_1->SpellIconID == 83 && spellInfo_2->SpellIconID == 83 )
+                    return false;
+
                // Bestial Wrath
                if( spellInfo_1->SpellIconID == 1680 && spellInfo_2->SpellIconID == 1680 )
                    return false;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e16a5d2..5903c79 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2579,7 +2579,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
    // parry & block chances

    // check if attack comes from behind, nobody can parry or block if attacker is behind
-    if (!pVictim->HasInArc(M_PI_F,this))
+    if (!pVictim->HasInArc(M_PI_F,this) && !pVictim->HasAura(19263))
    {
        DEBUG_LOG ("RollMeleeOutcomeAgainst: attack came from behind.");
    }
@@ -2870,23 +2870,13 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell,
    bool canDodge = true;
    bool canParry = true;

-    // Same spells cannot be parry/dodge
+    // Some spells cannot be parry/dodge
    if (spell->Attributes & SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK)
        return SPELL_MISS_NONE;

-    // Ranged attack cannot be parry/dodge only deflect
+    // Ranged attack cannot be parry/dodge only miss
    if (attType == RANGED_ATTACK)
-    {
-        // only if in front
-        if (pVictim->HasInArc(M_PI_F,this))
-        {
-            int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
-            tmp+=deflect_chance;
-            if (roll < tmp)
-                return SPELL_MISS_DEFLECT;
-        }
        return SPELL_MISS_NONE;
-    }

    // Check for attack from behind
    if (!pVictim->HasInArc(M_PI_F,this))
@@ -2895,7 +2885,8 @@ 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)
@@ -3029,14 +3020,10 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
    if (rand < tmp)
        return SPELL_MISS_MISS;

-    // cast by caster in front of victim
-    if (pVictim->HasInArc(M_PI_F,this))
-    {
-        int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
-        tmp+=deflect_chance;
-        if (rand < tmp)
-            return SPELL_MISS_DEFLECT;
-    }
+    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

  • 39 years later...

Well, it does not say "gives you a 100% chance to parry" but rather "increases you chance to parry by 100%".

That does not automatically mean that you are invincible in my opinion, if your opponent has more expertise than you have parry (without deterrence, that is), he still should have a chance to hit you...no?

However, that would not be a very likely case it seems...

About "deflected" showing up in combat log, that one seems a bit more complicated. Apart from spells avoided by Deterrence, it seems "deflect" is a special form of "parry", and all classes that can parry will deflect certain spells rather than parry them. I'm just not sure what the exact criteria is.

It seems that typically spells get deflected that:

- are classified melee (dmgClass=2) but don't deal physical damage (e.g. Hammer of the Righteous)

- are classified melee but have a range other than melee range and have certain non-damaging effects like inebriate, knockback, reduce hit chance...

Link to comment
Share on other sites

That does not automatically mean that you are invincible in my opinion, if your opponent has more expertise than you have parry (without deterrence, that is), he still should have a chance to hit you...no?

no no, this tested without any items and talents, only with weapon from game start :) so expertise isn't source of problem, this effect doesn't work at all

Link to comment
Share on other sites

patch updated. Removed "behind" check for parry with this spell and implemented aura 288

I have no idea how to avoid checks like that

if (!pVictim->HasInArc(M_PI,this) && !pVictim->HasAura(19263))

but it works

popovk, you are absolutely right about that. spell aura 287 should deflect only spells, but on clean mangos it deflects both - ranged hits and spells. For ranged hits we should use spell aura 288. I was fixed this.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 1 month later...
  • 3 weeks later...
  • 4 weeks later...

Патч работает кривовато на [10000]-[10060+]. Бывает вообще не чего не отражает, зависимости не нахожу. Доты и некоторые рендж атаки проходят.. Надо доработать

мне кажется 67801 в 3.3.3а кривой сам по себе.

Link to comment
Share on other sites

  • 8 months later...
  • 2 months later...
  • 2 weeks later...
  • 1 month later...
Alt. version in [11510]

It's working almost as it was working in wotlk retail, except for Backstab, Shred and that kind of skills that only can be performed from the opponent's back (They should bypass deterrence). More details: http://www.threadmeters.com/pWsJlL/AmbushBackstab_going_through_deterrence/

https://github.com/mangos/mangos/commit/fe23f25cd84e206a3308c742e24bbc3209ba9713

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