Jump to content

[Mangos/one][Fix] MeleeSpellMissChance & MeleeMissChanceCalc


Guest Hundekuchen

Recommended Posts

Rev: s0773 Mangos/One

On the current way the melees can not get their hitcap. I have changed the code with the calculation of wowwikki (http://www.wowwiki.com/index.php?title=Hit&oldid=1130455)

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 4ce0ade..927c5d2 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2520,11 +2520,10 @@ float Unit::MeleeSpellMissChance(Unit *pVictim, WeaponAttackType attType, int32

    // PvP - PvE melee chances
    int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
-    int32 leveldif = pVictim->GetLevelForTarget(this) - GetLevelForTarget(pVictim);
-    if(leveldif < 3)
-        HitChance = 95 - leveldif;
-    else
-        HitChance = 93 - (leveldif - 2) * lchance;
+    if(skillDiff <= 10)
+        HitChance = 95 - skillDiff * 0.1f;
+     else
+        HitChance = 100 - (lchance + (skillDiff - 10)*0.4f);

    // Hit chance depends from victim auras
    if(attType == RANGED_ATTACK)
@@ -2545,9 +2544,6 @@ float Unit::MeleeSpellMissChance(Unit *pVictim, WeaponAttackType attType, int32
    else
        miss_chance -= m_modMeleeHitChance;

-    // bonus from skills is 0.04%
-    miss_chance -= skillDiff * 0.04f;
-
    // Limit miss chance from 0 to 60%
    if (miss_chance < 0.0f)
        return 0.0f;
@@ -2567,7 +2563,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
    // bonus from skills is 0.04% per skill Diff
    int32 attackerWeaponSkill = int32(GetWeaponSkillValue(attType,pVictim));
    int32 skillDiff = attackerWeaponSkill - int32(pVictim->GetMaxSkillValueForLevel(this));
-    int32 fullSkillDiff = attackerWeaponSkill - int32(pVictim->GetDefenseSkillValue(this));
+    int32 fullSkillDiff = int32(pVictim->GetDefenseSkillValue(this)) - attackerWeaponSkill;

    uint32 roll = urand (0, 10000);

@@ -2828,12 +2824,11 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c
            misschance = 24.0f;
    }

-    // PvP : PvE melee misschances per leveldif > 2
-    int32 chance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7;
-
-    int32 leveldif = int32(pVictim->GetLevelForTarget(this)) - int32(GetLevelForTarget(pVictim));
-    if(leveldif < 0)
-        leveldif = 0;
+    // PvP : PvE melee misschances per skillDiff > 10
+    int32 lchance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : (misschance+2);
+ 
+    // Modify miss chance from skill difference
+    int32 skillDiff = int32(pVictim->GetDefenseSkillValue(this)) - int32(GetWeaponSkillValue(attType,pVictim));

    // Hit chance from attacker based on ratings and auras
    float m_modHitChance;
@@ -2842,10 +2837,12 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c
    else
        m_modHitChance = m_modMeleeHitChance;

-    if(leveldif < 3)
-        misschance += (leveldif - m_modHitChance);
-    else
-        misschance += ((leveldif - 2) * chance - m_modHitChance);
+    if(skillDiff <= 10)
+        misschance += (skillDiff)*0.1f;
+     else
+        misschance = lchance + (skillDiff - 10)*0.4f;
+
+    misschance -= m_modHitChance;

    // Hit chance for victim based on ratings
    if (pVictim->GetTypeId()==TYPEID_PLAYER)
@@ -2862,10 +2859,6 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c
    else
        misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE);

-    // Modify miss chance from skill difference ( bonus from skills is 0.04% )
-    int32 skillBonus = int32(GetWeaponSkillValue(attType,pVictim)) - int32(pVictim->GetDefenseSkillValue(this));
-    misschance -= skillBonus * 0.04f;
-
    // Limit miss chance from 0 to 60%
    if ( misschance < 0.0f)
        return 0.0f;

The patch have some mistakes, new patch is in work

best regards

Hundekuchen

Link to comment
Share on other sites

base dodge/parry chance calculated in other place for same level attacker with max weapon skill for level

So this part skill dependence value preincluded in chances.

that why in function used reversed attackerWeaponSkill - int32(pVictim->GetMaxSkillValueForLevel(this));

and in fact negative always value have for fix value to real weapon skill value.

You change make this broken.

Link to comment
Share on other sites

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