Core/Spells: Implement SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY and SPELL_ATTR7_NO_ATTACK_MISS
Port From (https://github.com/TrinityCore/TrinityCore/commit/d22d4616339a966ce5e5fe959dca622fc21b7988)
This commit is contained in:
@@ -1841,9 +1841,9 @@ namespace Framework.Constants
|
|||||||
Unk20 = 0x100000, // 20 Blink, Divine Shield, Ice Block
|
Unk20 = 0x100000, // 20 Blink, Divine Shield, Ice Block
|
||||||
Unk21 = 0x200000, // 21 Not Set
|
Unk21 = 0x200000, // 21 Not Set
|
||||||
Unk22 = 0x400000, // 22
|
Unk22 = 0x400000, // 22
|
||||||
Unk23 = 0x800000, // 23 Motivate, Mutilate, Shattering Throw
|
NoAttackDodge = 0x800000, // 23 No Attack Dodge
|
||||||
Unk24 = 0x1000000, // 24 Motivate, Mutilate, Perform Speech, Shattering Throw
|
NoAttackParry = 0x1000000, // 24 No Attack Parry
|
||||||
Unk25 = 0x2000000, // 25
|
NoAttackMiss = 0x2000000, // No Attack Miss
|
||||||
Unk26 = 0x4000000, // 26
|
Unk26 = 0x4000000, // 26
|
||||||
BypassNoResurrectAura = 0x8000000, // 27 Bypass No Resurrect Aura
|
BypassNoResurrectAura = 0x8000000, // 27 Bypass No Resurrect Aura
|
||||||
ConsolidatedRaidBuff = 0x10000000, // 28 Related To Player Positive Buff
|
ConsolidatedRaidBuff = 0x10000000, // 28 Related To Player Positive Buff
|
||||||
|
|||||||
@@ -1920,6 +1920,13 @@ namespace Game.Entities
|
|||||||
if (!victim.IsAlive() && !victim.IsPlayer())
|
if (!victim.IsAlive() && !victim.IsPlayer())
|
||||||
return SpellMissInfo.None;
|
return SpellMissInfo.None;
|
||||||
|
|
||||||
|
float missChance;
|
||||||
|
if (spellInfo.HasAttribute(SpellAttr7.NoAttackMiss))
|
||||||
|
{
|
||||||
|
missChance = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SpellSchoolMask schoolMask = spellInfo.GetSchoolMask();
|
SpellSchoolMask schoolMask = spellInfo.GetSchoolMask();
|
||||||
// PvP - PvE spell misschances per leveldif > 2
|
// PvP - PvE spell misschances per leveldif > 2
|
||||||
int lchance = victim.IsPlayer() ? 7 : 11;
|
int lchance = victim.IsPlayer() ? 7 : 11;
|
||||||
@@ -1961,15 +1968,18 @@ namespace Game.Entities
|
|||||||
modHitChance += victim.GetTotalAuraModifierByMiscMask(AuraType.ModAttackerSpellHitChance, (int)schoolMask);
|
modHitChance += victim.GetTotalAuraModifierByMiscMask(AuraType.ModAttackerSpellHitChance, (int)schoolMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
int HitChance = modHitChance * 100;
|
float HitChance = modHitChance;
|
||||||
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
|
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
|
||||||
Unit unit = ToUnit();
|
Unit unit = ToUnit();
|
||||||
if (unit != null)
|
if (unit != null)
|
||||||
HitChance += (int)(unit.ModSpellHitChance * 100.0f);
|
HitChance += unit.ModSpellHitChance;
|
||||||
|
|
||||||
MathFunctions.RoundToInterval(ref HitChance, 0, 10000);
|
MathFunctions.RoundToInterval(ref HitChance, 0.0f, 100.0f);
|
||||||
|
|
||||||
int tmp = 10000 - HitChance;
|
missChance = 100.0f - HitChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tmp = (int)(missChance * 100.0f);
|
||||||
|
|
||||||
int rand = RandomHelper.IRand(0, 9999);
|
int rand = RandomHelper.IRand(0, 9999);
|
||||||
if (tmp > 0 && rand < tmp)
|
if (tmp > 0 && rand < tmp)
|
||||||
|
|||||||
@@ -794,6 +794,9 @@ namespace Game.Entities
|
|||||||
//Chances
|
//Chances
|
||||||
public override float MeleeSpellMissChance(Unit victim, WeaponAttackType attType, SpellInfo spellInfo)
|
public override float MeleeSpellMissChance(Unit victim, WeaponAttackType attType, SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
|
if (spellInfo != null && spellInfo.HasAttribute(SpellAttr7.NoAttackMiss))
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
//calculate miss chance
|
//calculate miss chance
|
||||||
float missChance = victim.GetUnitMissChance();
|
float missChance = victim.GetUnitMissChance();
|
||||||
|
|
||||||
|
|||||||
@@ -758,8 +758,8 @@ namespace Game.Entities
|
|||||||
if (spellInfo.HasAttribute(SpellAttr0.ImpossibleDodgeParryBlock))
|
if (spellInfo.HasAttribute(SpellAttr0.ImpossibleDodgeParryBlock))
|
||||||
return SpellMissInfo.None;
|
return SpellMissInfo.None;
|
||||||
|
|
||||||
bool canDodge = true;
|
bool canDodge = !spellInfo.HasAttribute(SpellAttr7.NoAttackDodge);
|
||||||
bool canParry = true;
|
bool canParry = !spellInfo.HasAttribute(SpellAttr7.NoAttackParry);
|
||||||
bool canBlock = spellInfo.HasAttribute(SpellAttr3.BlockableSpell);
|
bool canBlock = spellInfo.HasAttribute(SpellAttr3.BlockableSpell);
|
||||||
|
|
||||||
// if victim is casting or cc'd it can't avoid attacks
|
// if victim is casting or cc'd it can't avoid attacks
|
||||||
|
|||||||
Reference in New Issue
Block a user