diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 38 | ||||
-rwxr-xr-x | src/server/game/Miscellaneous/SharedDefines.h | 2 |
2 files changed, 28 insertions, 12 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 41312ed19d1..492e7af8b18 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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()) { diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index f1b71383cd3..7b016ee5ce8 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -389,7 +389,7 @@ enum SpellAttr3 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_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_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells SPELL_ATTR3_UNK21 = 0x00200000, // 21 |