*Implement attribute flag SPELL_ATTR_EX3_BLOCKABLE_SPELL - now spells: Gouge, Kick, Wing Clip, Rake, Hamstring are blocable - by thenecromancer.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-28 23:27:45 +02:00
parent 09637795de
commit 6bb0ff8948
3 changed files with 19 additions and 5 deletions
@@ -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);
}
}
};
+1 -1
View File
@@ -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
+17 -3
View File
@@ -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;
}