aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp2
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Unit.cpp20
3 files changed, 19 insertions, 5 deletions
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index 655ab7b4ffd..2c0bcd51918 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -1689,7 +1689,7 @@ struct TRINITY_DLL_DECL npc_mirror_image : SpellAI
{
DoCast(spellId);
uint32 casttime = me->GetCurrentSpellCastTime(spellId);
- events.ScheduleEvent(spellId, casttime ? casttime : 500 + GetAISpellInfo(spellId)->cooldown);
+ events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->cooldown);
}
}
};
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index b4e9940e0b7..0540f8f7dbe 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -321,7 +321,7 @@ enum SpellCategory
#define SPELL_ATTR_EX3_UNK0 0x00000001 // 0
#define SPELL_ATTR_EX3_UNK1 0x00000002 // 1
#define SPELL_ATTR_EX3_UNK2 0x00000004 // 2
-#define SPELL_ATTR_EX3_UNK3 0x00000008 // 3
+#define SPELL_ATTR_EX3_BLOCKABLE_SPELL 0x00000008 // 3 Only dmg class melee in 3.1.3
#define SPELL_ATTR_EX3_UNK4 0x00000010 // 4 Druid Rebirth only this spell have this flag
#define SPELL_ATTR_EX3_UNK5 0x00000020 // 5
#define SPELL_ATTR_EX3_UNK6 0x00000040 // 6
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 26c2728c6e8..359e31c3acc 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2769,6 +2769,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
bool canDodge = true;
bool canParry = true;
+ bool canBlock = spell->AttributesEx3 & SPELL_ATTR_EX3_BLOCKABLE_SPELL;
// Same spells cannot be parry/dodge
if (spell->Attributes & SPELL_ATTR_IMPOSSIBLE_DODGE_PARRY_BLOCK)
@@ -2798,10 +2799,11 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
if (!pVictim->HasInArc(M_PI,this))
{
// Can`t dodge from behind in PvP (but its possible in PvE)
- if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
+ if (pVictim->GetTypeId() == TYPEID_PLAYER)
canDodge = false;
- // Can`t parry
+ // Can`t parry or block
canParry = false;
+ canBlock = false;
}
// Check creatures flags_extra for disable parry
if(pVictim->GetTypeId()==TYPEID_UNIT)
@@ -2809,6 +2811,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
uint32 flagEx = ((Creature*)pVictim)->GetCreatureInfo()->flags_extra;
if( flagEx & CREATURE_FLAG_EXTRA_NO_PARRY )
canParry = false;
+ // Check creatures flags_extra for disable block
+ if( flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK )
+ canBlock = false;
}
// Ignore combat result aura
AuraEffectList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT);
@@ -2819,7 +2824,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
switch((*i)->GetMiscValue())
{
case MELEE_HIT_DODGE: canDodge = false; break;
- case MELEE_HIT_BLOCK: break; // Block check in hit step
+ case MELEE_HIT_BLOCK: canBlock = false; break;
case MELEE_HIT_PARRY: canParry = false; break;
default:
DEBUG_LOG("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT have unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
@@ -2860,6 +2865,15 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
return SPELL_MISS_PARRY;
}
+ if (canBlock)
+ {
+ int32 blockChance = int32(pVictim->GetUnitBlockChance()*100.0f) - skillDiff * 4;
+ tmp += blockChance;
+
+ if (roll < tmp)
+ return SPELL_MISS_BLOCK;
+ }
+
return SPELL_MISS_NONE;
}