mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
*Handle aura SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.
--HG-- branch : trunk
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user