diff options
author | xinef1 <w.szyszko2@gmail.com> | 2017-02-04 23:50:32 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-07-21 21:06:54 +0200 |
commit | ca26c33145cb40ae7fd2c84fc7577fc6f11bdbbf (patch) | |
tree | 6df7aab9ce9c322fa74c8a50354dae8af04cdd75 /src/server/game/Spells/SpellMgr.cpp | |
parent | ad008c43b75080ec59aa973f1e2e4424332c34a4 (diff) |
Implemented binary resistances and some more (#18933)
- Fixed possible exploit with tamed pets having template immunities
- Implemented binary resistances
- Corrected resistances calculations
- Pets properly inherit players spell penetration
- Fixed doubled block calculation for damaging melee spells
- Auras removing snare effects will only remove the snaring component
- Shapeshifting will properly remove movement impairing auras only and not crowd control (dragon's breath)
- Immunities are properly checked versus all schools appearing in spell, unit is immune only if immune to all schools
- Spells with melee and magic school mask should compare armor reduction with resistances and select smaller reduction
- Demonic Circle: Teleport no longer removes root effects
(cherrypicked from 93746e8c4a79c8256cd4896533315683f143508c)
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 4a42fa64b62..3dccae606f4 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2402,6 +2402,14 @@ void SpellMgr::LoadSpellInfoCustomAttributes() switch (effect->ApplyAuraName) { + case SPELL_AURA_MOD_POSSESS: + case SPELL_AURA_MOD_CONFUSE: + case SPELL_AURA_MOD_CHARM: + case SPELL_AURA_AOE_CHARM: + case SPELL_AURA_MOD_FEAR: + case SPELL_AURA_MOD_STUN: + spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; + break; case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: @@ -2482,6 +2490,87 @@ void SpellMgr::LoadSpellInfoCustomAttributes() } } + // spells ignoring hit result should not be binary + if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) + { + bool setFlag = false; + for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(DIFFICULTY_NONE)) + { + if (!effect) + continue; + + if (effect->IsEffect()) + { + switch (effect->Effect) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: + case SPELL_EFFECT_TRIGGER_SPELL: + case SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE: + break; + case SPELL_EFFECT_PERSISTENT_AREA_AURA: + case SPELL_EFFECT_APPLY_AURA: + case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: + case SPELL_EFFECT_APPLY_AREA_AURA_RAID: + case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: + case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: + case SPELL_EFFECT_APPLY_AREA_AURA_PET: + case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: + { + if (effect->ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || + effect->ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT || + effect->ApplyAuraName == SPELL_AURA_DUMMY || + effect->ApplyAuraName == SPELL_AURA_PERIODIC_LEECH || + effect->ApplyAuraName == SPELL_AURA_PERIODIC_HEALTH_FUNNEL || + effect->ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY) + break; + } + default: + { + // No value and not interrupt cast or crowd control without SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY flag + if (!effect->CalcValue() && !((effect->Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))) + break; + + // Sindragosa Frost Breath + if (spellInfo->Id == 69649 || spellInfo->Id == 71056 || spellInfo->Id == 71057 || spellInfo->Id == 71058 || spellInfo->Id == 73061 || spellInfo->Id == 73062 || spellInfo->Id == 73063 || spellInfo->Id == 73064) + break; + + // Frostbolt + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->SpellFamilyFlags[0] & 0x20)) + break; + + // Frost Fever + if (spellInfo->Id == 55095) + break; + + // Haunt + if (spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellInfo->SpellFamilyFlags[1] & 0x40000)) + break; + + setFlag = true; + break; + } + } + + if (setFlag) + { + spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL; + break; + } + } + } + } + + // Remove normal school mask to properly calculate damage + if ((spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) && (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_MAGIC)) + { + spellInfo->SchoolMask &= ~SPELL_SCHOOL_MASK_NORMAL; + spellInfo->AttributesCu |= SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC; + } + if (!spellInfo->_IsPositiveEffect(EFFECT_0, false)) spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0; @@ -2494,10 +2583,70 @@ void SpellMgr::LoadSpellInfoCustomAttributes() if (talentSpells.count(spellInfo->Id)) spellInfo->AttributesCu |= SPELL_ATTR0_CU_IS_TALENT; + switch (spellInfo->SpellFamilyName) + { + case SPELLFAMILY_WARRIOR: + // Shout / Piercing Howl + if (spellInfo->SpellFamilyFlags[0] & 0x20000/* || spellInfo->SpellFamilyFlags[1] & 0x20*/) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; + break; + case SPELLFAMILY_DRUID: + // Roar + if (spellInfo->SpellFamilyFlags[0] & 0x8) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; + break; + case SPELLFAMILY_GENERIC: + // Stoneclaw Totem effect + if (spellInfo->Id == 5729) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; + break; + default: + break; + } spellInfo->_InitializeExplicitTargetMask(); } + // addition for binary spells, ommit spells triggering other spells + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) + { + spellInfo = mSpellInfoMap[i]; + if (!spellInfo) + continue; + + if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL)) + continue; + + bool allNonBinary = true; + bool overrideAttr = false; + for (SpellEffectInfo const* effect : spellInfo->GetEffectsForDifficulty(DIFFICULTY_NONE)) + { + if (!effect) + continue; + + if (effect->IsAura() && effect->TriggerSpell) + { + switch (effect->ApplyAuraName) + { + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: + if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(effect->TriggerSpell)) + { + overrideAttr = true; + if (triggerSpell->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL)) + allNonBinary = false; + } + break; + default: + break; + } + } + } + + if (overrideAttr && allNonBinary) + spellInfo->AttributesCu &= ~SPELL_ATTR0_CU_BINARY_SPELL; + } + TC_LOG_INFO("server.loading", ">> Loaded SpellInfo custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } |