diff options
author | QAston <none@none> | 2009-02-07 19:57:28 +0100 |
---|---|---|
committer | QAston <none@none> | 2009-02-07 19:57:28 +0100 |
commit | ffd2f71f4bf67833423dfe87f0d3550750ab2011 (patch) | |
tree | 98f4b707f6cb1b169ba67e89e31fbfa0daac3cc6 /src/game/Unit.cpp | |
parent | 52215b43944585e7723807e7fd9e3f46b5f300f0 (diff) |
*Handle aura SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 98f66f09711..f4253d8e97b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1251,6 +1251,9 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama if (blocked) { damageInfo->blocked = uint32(pVictim->GetShieldBlockValue()); + //double blocked amount if block is critical + if (isBlockCritical()) + damageInfo->blocked+=damageInfo->blocked; if (damage < damageInfo->blocked) damageInfo->blocked = damage; damage-=damageInfo->blocked; @@ -1506,6 +1509,9 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da damageInfo->HitInfo |= HITINFO_BLOCK; damageInfo->procEx|=PROC_EX_BLOCK; damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue(); + //double blocked amount if block is critical + if (isBlockCritical()) + damageInfo->blocked_amount+=damageInfo->blocked_amount; if (damageInfo->blocked_amount >= damageInfo->damage) { damageInfo->TargetState = VICTIMSTATE_BLOCKS; @@ -2516,6 +2522,13 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAtt return false; } +bool Unit::isBlockCritical() +{ + if (roll_chance_i(GetTotalAuraModifier(SPELL_AURA_MOD_BLOCK_CRIT_CHANCE))) + return true; + return false; +} + // Melee based spells can be miss, parry or dodge on this step // Crit or block - determined on damage calculation phase! (and can be both in some time) /*float Unit::MeleeSpellMissChance(Unit *pVictim, WeaponAttackType attType, int32 skillDiff, SpellEntry const *spell) |