mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Spells: Check SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK before HasInArc in Unit::isSpellBlocked.
This commit is contained in:
@@ -2250,21 +2250,21 @@ void Unit::SendMeleeAttackStop(Unit* victim)
|
||||
sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
|
||||
}
|
||||
|
||||
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * spellProto, WeaponAttackType attackType)
|
||||
bool Unit::isSpellBlocked(Unit* victim, SpellEntry const * spellProto, WeaponAttackType attackType)
|
||||
{
|
||||
if (pVictim->HasInArc(M_PI, this) || pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
// These spells can't be blocked
|
||||
if (spellProto && spellProto->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK)
|
||||
return false;
|
||||
|
||||
if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
{
|
||||
// Check creatures flags_extra for disable block
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT &&
|
||||
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
||||
if (victim->GetTypeId() == TYPEID_UNIT &&
|
||||
victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
|
||||
return false;
|
||||
|
||||
// These spells shouldn't be blocked
|
||||
if (spellProto && spellProto->Attributes & SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK)
|
||||
return false;
|
||||
|
||||
float blockChance = pVictim->GetUnitBlockChance();
|
||||
blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(pVictim->GetMaxSkillValueForLevel()))*0.04f;
|
||||
float blockChance = victim->GetUnitBlockChance();
|
||||
blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
|
||||
if (roll_chance_f(blockChance))
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user