diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index ad97f4bbf..a7ed33414 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2789,33 +2789,41 @@ void Unit::SendMeleeAttackStop(Unit* victim) ((Creature*)victim)->AI().EnterEvadeMode(this);*/ } -bool Unit::IsSpellBlocked(Unit *pCaster, SpellEntry const * /*spellProto*/, WeaponAttackType attackType) +bool Unit::IsSpellBlocked(Unit *pCaster, SpellEntry const *spellEntry, WeaponAttackType attackType) { - if (HasInArc(M_PI_F,pCaster)) + if (!HasInArc(M_PI_F, pCaster)) + return false; + + if (spellEntry) { - /* Currently not exist spells with ignore block - // Ignore combat result aura (parry/dodge check on prepare) - AuraList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT); - for(AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i) - { - if (!(*i)->isAffectedOnSpell(spellProto)) - continue; - if ((*i)->GetModifier()->m_miscvalue == ) - return false; - } - */ - - // Check creatures flags_extra for disable block - if(GetTypeId()==TYPEID_UNIT && - ((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK ) - return false; - - float blockChance = GetUnitBlockChance(); - blockChance += (int32(pCaster->GetWeaponSkillValue(attackType)) - int32(GetMaxSkillValueForLevel()))*0.04f; - if (roll_chance_f(blockChance)) - return true; + // Some spells cannot be blocked + if (spellEntry->Attributes & SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK) + return false; } - return false; + + /* + // Ignore combat result aura (parry/dodge check on prepare) + AuraList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT); + for(AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i) + { + if (!(*i)->isAffectedOnSpell(spellProto)) + continue; + if ((*i)->GetModifier()->m_miscvalue == ) + return false; + } + */ + + // Check creatures flags_extra for disable block + if (GetTypeId() == TYPEID_UNIT) + { + if (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) + return false; + } + + float blockChance = GetUnitBlockChance(); + blockChance += (int32(pCaster->GetWeaponSkillValue(attackType)) - int32(GetMaxSkillValueForLevel()))*0.04f; + + return roll_chance_f(blockChance); } // Melee based spells can be miss, parry or dodge on this step diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e41ba6e0c..9d74850e0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10702" + #define REVISION_NR "10703" #endif // __REVISION_NR_H__