Jump to content

[7566][typo] isSpellBlocked()


pasdVn

Recommended Posts

1st: we should get the victims base block chance, not the one of the caster

2nd: we need a type conversion as GetWeaponSkillValue() is an uint and in general case the subtracted value is bigger (so it will be <0)

From 4d4f92806bbc9be30f232d2759e29fb5881ea51c Mon Sep 17 00:00:00 2001
From: pasdVn <[email protected]>
Date: Fri, 27 Mar 2009 23:58:06 +0100
Subject: [PATCH] fix in block chance calculation

---
src/game/Unit.cpp |    4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 470de75..35ff713 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2287,8 +2287,8 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAtt
           ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK )
                return false;

-        float blockChance = GetUnitBlockChance();
-        blockChance += (GetWeaponSkillValue(attackType) - pVictim->GetMaxSkillValueForLevel() )*0.04;
+        float blockChance = pVictim->GetUnitBlockChance();
+        blockChance += (int32(GetWeaponSkillValue(attackType)) - pVictim->GetMaxSkillValueForLevel() ) * 0.04f;
        if (roll_chance_f(blockChance))
            return true;
    }
-- 
1.6.0.2.1172.ga5ed0

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