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
|
||||
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;
|
||||
|
||||
// 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
|
||||
if (Player *modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
|
||||
|
||||
// Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
|
||||
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);
|
||||
// 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);
|
||||
|
||||
// Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects
|
||||
if (!(spell->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT))
|
||||
{
|
||||
// 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;
|
||||
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
|
||||
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)
|
||||
HitChance = 100;
|
||||
else if (HitChance > 10000)
|
||||
@@ -2516,6 +2527,11 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
if (rand < tmp)
|
||||
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)
|
||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell) * 100;
|
||||
tmp += resist_chance;
|
||||
@@ -3277,7 +3293,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
|
||||
ASSERT(aurApp);
|
||||
ASSERT(!aurApp->GetRemoveMode());
|
||||
ASSERT(aurApp->GetTarget() == this);
|
||||
|
||||
|
||||
aurApp->SetRemoveMode(removeMode);
|
||||
Aura * aura = aurApp->GetBase();
|
||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura %u now is remove mode %d", aura->GetId(), removeMode);
|
||||
@@ -3576,7 +3592,7 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
|
||||
{
|
||||
// we've special situation here, RemoveAura called while during aura removal
|
||||
// this kind of call is needed only when aura effect removal handler
|
||||
// or event triggered by it expects to remove
|
||||
// or event triggered by it expects to remove
|
||||
// not yet removed effects of an aura
|
||||
if (aurApp->GetRemoveMode())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user