Core/Spells: Implemented SPELL_ATTR3_IGNORE_HIT_RESULT. Spells with this attribute will only be subject to own spell modifiers, ignoring enemy avoidance auras such as Cloak of Shadows or Deterrence
This commit is contained in:
@@ -2304,6 +2304,11 @@ int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
|
|||||||
// Melee based spells hit result calculations
|
// Melee based spells hit result calculations
|
||||||
SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||||
{
|
{
|
||||||
|
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore
|
||||||
|
// resist and deflect chances
|
||||||
|
if (spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT)
|
||||||
|
return SPELL_MISS_NONE;
|
||||||
|
|
||||||
WeaponAttackType attType = BASE_ATTACK;
|
WeaponAttackType attType = BASE_ATTACK;
|
||||||
|
|
||||||
// Check damage class instead of attack type to correctly handle judgements
|
// Check damage class instead of attack type to correctly handle judgements
|
||||||
@@ -2488,22 +2493,28 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
|||||||
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
|
// Spellmod from SPELLMOD_RESIST_MISS_CHANCE
|
||||||
if (Player *modOwner = GetSpellModOwner())
|
if (Player *modOwner = GetSpellModOwner())
|
||||||
modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
|
modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
|
||||||
|
|
||||||
// Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
|
// Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
|
||||||
modHitChance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, schoolMask);
|
modHitChance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, schoolMask);
|
||||||
// Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
|
|
||||||
modHitChance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
|
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects
|
||||||
// Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
|
if (!(spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT))
|
||||||
if (IsAreaOfEffectSpell(spell))
|
{
|
||||||
modHitChance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
|
// Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
|
||||||
|
modHitChance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
|
||||||
|
// Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
|
||||||
|
if (IsAreaOfEffectSpell(spell))
|
||||||
|
modHitChance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
|
||||||
|
|
||||||
|
// Decrease hit chance from victim rating bonus
|
||||||
|
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
modHitChance -= int32(pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
|
||||||
|
}
|
||||||
|
|
||||||
int32 HitChance = modHitChance * 100;
|
int32 HitChance = modHitChance * 100;
|
||||||
// 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
|
||||||
HitChance += int32(m_modSpellHitChance * 100.0f);
|
HitChance += int32(m_modSpellHitChance * 100.0f);
|
||||||
|
|
||||||
// Decrease hit chance from victim rating bonus
|
|
||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
HitChance -= int32(pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL) * 100.0f);
|
|
||||||
|
|
||||||
if (HitChance < 100)
|
if (HitChance < 100)
|
||||||
HitChance = 100;
|
HitChance = 100;
|
||||||
else if (HitChance > 10000)
|
else if (HitChance > 10000)
|
||||||
@@ -2516,6 +2527,11 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
|||||||
if (rand < tmp)
|
if (rand < tmp)
|
||||||
return SPELL_MISS_MISS;
|
return SPELL_MISS_MISS;
|
||||||
|
|
||||||
|
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore
|
||||||
|
// resist and deflect chances
|
||||||
|
if (spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT)
|
||||||
|
return SPELL_MISS_NONE;
|
||||||
|
|
||||||
// Chance resist mechanic (select max value from every mechanic spell effect)
|
// Chance resist mechanic (select max value from every mechanic spell effect)
|
||||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell) * 100;
|
int32 resist_chance = pVictim->GetMechanicResistChance(spell) * 100;
|
||||||
tmp += resist_chance;
|
tmp += resist_chance;
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ enum SpellAttr3
|
|||||||
SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag
|
SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag
|
||||||
SPELL_ATTR3_UNK16 = 0x00010000, // 16 no triggers effects that trigger on casting a spell?? (15290 - 2.2ptr change)
|
SPELL_ATTR3_UNK16 = 0x00010000, // 16 no triggers effects that trigger on casting a spell?? (15290 - 2.2ptr change)
|
||||||
SPELL_ATTR3_NO_INITIAL_AGGRO = 0x00020000, // 17 Soothe Animal, 39758, Mind Soothe
|
SPELL_ATTR3_NO_INITIAL_AGGRO = 0x00020000, // 17 Soothe Animal, 39758, Mind Soothe
|
||||||
SPELL_ATTR3_UNK18 = 0x00040000, // 18 added to Explosive Trap Effect 3.3.0, removed from Mutilate 3.3.0
|
SPELL_ATTR3_IGNORE_HIT_RESULT = 0x00040000, // 18 Spell should always hit its target
|
||||||
SPELL_ATTR3_DISABLE_PROC = 0x00080000, // 19 during aura proc no spells can trigger (20178, 20375)
|
SPELL_ATTR3_DISABLE_PROC = 0x00080000, // 19 during aura proc no spells can trigger (20178, 20375)
|
||||||
SPELL_ATTR3_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells
|
SPELL_ATTR3_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells
|
||||||
SPELL_ATTR3_UNK21 = 0x00200000, // 21
|
SPELL_ATTR3_UNK21 = 0x00200000, // 21
|
||||||
|
|||||||
Reference in New Issue
Block a user