Skip to content

Commit

Permalink
Combat Rolls Overhaul: Spell hit, resist, deflect, totems
Browse files Browse the repository at this point in the history
Fixes and changes:
* Spell hit/miss calculation reimplemented
* Chance to miss with a spell on players' pets is now calculated the same way as chance to miss players.
* Melee abilities with long range are now subjects to recently implemented deflect mechanics.
* Spell reflection result is now checked before immunities.
* TBC: Taunt, Growl, Righteous Defense, Challenging Shout and Challenging Roar spells now benefit from physical hit rating (implemented attribute).
* Totem's chances to hit and miss with spells now scale with it's owner chances
* Totems now use owners' spell penetration values
* Removed artificial humanoid-only restriction on parry for creatures, therefore moving entire control of creature's dodge and parry chance to database.
- Numerous creatures are now able to parry, this should be adjusted by database from now on.
* Magic resistance changes:
- Magic resistance is now properly penalized when attacking a low level target (< 20).
- Players and pets no longer incorrectly gain bonus level based resistance.
  • Loading branch information
Warlockbugs authored and Fabi committed Jan 3, 2017
1 parent c6a5d70 commit d9efa75
Show file tree
Hide file tree
Showing 4 changed files with 259 additions and 166 deletions.
2 changes: 1 addition & 1 deletion src/game/SharedDefines.h
Expand Up @@ -471,7 +471,7 @@ enum SpellAttributesEx5
SPELL_ATTR_EX5_DONT_SHOW_AURA_IF_NOT_SELF_CAST = 0x10000000,// 28 Auras with this attribute are not visible on units that are not the caster
SPELL_ATTR_EX5_UNK29 = 0x20000000,// 29
SPELL_ATTR_EX5_UNK30 = 0x40000000,// 30
SPELL_ATTR_EX5_UNK31 = 0x80000000,// 31 Forces all nearby enemies to focus attacks caster
SPELL_ATTR_EX5_USE_PHYSICAL_HIT_CHANCE = 0x80000000,// 31 Introduced in patch 2.3: Taunt, Growl, etc spells use ability miss calculation (see implementation for details)
};

enum SpellAttributesEx6
Expand Down
4 changes: 2 additions & 2 deletions src/game/SpellEffects.cpp
Expand Up @@ -6141,8 +6141,7 @@ void Spell::EffectDispel(SpellEffectEntry const* effect)
std::list <std::pair<SpellAuraHolder*, uint32> > dispel_list;

// Create dispel mask by dispel type
uint32 dispel_type = effect->EffectMiscValue;
uint32 dispelMask = GetDispellMask( DispelType(dispel_type) );
uint32 dispelMask = GetDispellMask(DispelType(effect->EffectMiscValue));
Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Expand Down Expand Up @@ -6204,6 +6203,7 @@ void Spell::EffectDispel(SpellEffectEntry const* effect)
{
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance);
miss_chance += caster->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
}
// Try dispel
if (roll_chance_i(miss_chance))
Expand Down

0 comments on commit d9efa75

Please sign in to comment.