*Handle aura SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-02-07 19:57:28 +01:00
parent 52215b4394
commit ffd2f71f4b
3 changed files with 15 additions and 1 deletions

View File

@@ -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)