mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
*Handle aura SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.
--HG-- branch : trunk
This commit is contained in:
@@ -307,7 +307,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
||||
&Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
|
||||
&Aura::HandleNULL, //251 SPELL_AURA_MOD_ENEMY_DODGE
|
||||
&Aura::HandleNULL, //252 haste all?
|
||||
&Aura::HandleNULL, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
|
||||
&Aura::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
|
||||
&Aura::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
|
||||
&Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
|
||||
&Aura::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1415,6 +1415,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
|
||||
uint32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
|
||||
bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
|
||||
bool isBlockCritical();
|
||||
bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK);
|
||||
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
|
||||
uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
|
||||
|
||||
Reference in New Issue
Block a user