diff options
author | ariel- <ariel-@users.noreply.github.com> | 2016-12-30 01:57:14 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2016-12-30 02:29:34 -0300 |
commit | 81f16b201b120f4a26c05ce4c3943d825c89cc97 (patch) | |
tree | 15a9a6775bf89aec7622d42cf73c8a0475fec665 | |
parent | 342cd18c3cf0bae7496616b1b08b9a59ec9247ed (diff) |
Core/Spell: Fixed Arcane Potency
- Removed old workaround in SpellAuras.cpp
Closes #18417
-rw-r--r-- | sql/updates/world/3.3.5/2016_12_30_02_world_335.sql | 5 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 27 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 18 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 15 |
4 files changed, 46 insertions, 19 deletions
diff --git a/sql/updates/world/3.3.5/2016_12_30_02_world_335.sql b/sql/updates/world/3.3.5/2016_12_30_02_world_335.sql new file mode 100644 index 00000000000..23954b3bee3 --- /dev/null +++ b/sql/updates/world/3.3.5/2016_12_30_02_world_335.sql @@ -0,0 +1,5 @@ +UPDATE `spell_proc` SET `SpellFamilyMask2`=0, `AttributesMask`=`AttributesMask`|0x2 WHERE `SpellId`=-31571; +DELETE FROM `spell_proc` WHERE `SpellId` IN (57529, 57531); +INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES +(57529, 0, 3, 0x61400035, 0x00001000, 0x00000000, 0, 0x0, 0x1, 0x0, 0x8, 0, 0, 0, 0), +(57531, 0, 3, 0x61400035, 0x00001000, 0x00000000, 0, 0x0, 0x1, 0x0, 0x8, 0, 0, 0, 0); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 16d29f0bc61..a1cadcff3a3 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7216,7 +7216,34 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto crit_chance = 0.0f; // For other schools else if (GetTypeId() == TYPEID_PLAYER) + { crit_chance = GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask)); + + // register aura mod, this is needed for Arcane Potency + if (Spell* spell = ToPlayer()->m_spellModTakingSpell) + { + std::vector<Aura*> affectingAuras; + (void)GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE, [&affectingAuras](AuraEffect const* aurEff) -> bool + { + affectingAuras.push_back(aurEff->GetBase()); + return true; + }); + + (void)GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, [&affectingAuras, schoolMask](AuraEffect const* aurEff) -> bool + { + if ((aurEff->GetMiscValue() & schoolMask) != 0) + { + affectingAuras.push_back(aurEff->GetBase()); + return true; + } + + return false; + }); + + for (Aura* aura : affectingAuras) + spell->m_appliedMods.insert(aura); + } + } else { crit_chance = (float)m_baseSpellCritChance; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 67ca679e249..8973a3efd50 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1266,24 +1266,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b } switch (GetId()) { - case 12536: // Clearcasting - case 12043: // Presence of Mind - // Arcane Potency - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, 2120, 0)) - { - uint32 spellId = 0; - - switch (aurEff->GetId()) - { - case 31571: spellId = 57529; break; - case 31572: spellId = 57531; break; - default: - TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); - } - if (spellId) - caster->CastSpell(caster, spellId, true); - } - break; case 44544: // Fingers of Frost // Refresh or add visual aura target->CastCustomSpell(74396, SPELLVALUE_AURA_STACK, sSpellMgr->AssertSpellInfo(74396)->StackAmount, (Unit*)nullptr, true); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 5c496024599..88eb2663520 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -68,7 +68,9 @@ enum MageSpells enum MageSpellIcons { - SPELL_ICON_MAGE_SHATTERED_BARRIER = 2945 + SPELL_ICON_MAGE_SHATTERED_BARRIER = 2945, + SPELL_ICON_MAGE_PRESENCE_OF_MIND = 139, + SPELL_ICON_MAGE_CLEARCASTING = 212 }; // Incanter's Absorbtion @@ -114,6 +116,16 @@ class spell_mage_arcane_potency : public SpellScriptLoader return true; } + bool CheckProc(ProcEventInfo& eventInfo) + { + // due to family mask sharing with brain freeze/missile barrage proc, we need to filter out by icon id + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo || (spellInfo->SpellIconID != SPELL_ICON_MAGE_CLEARCASTING && spellInfo->SpellIconID != SPELL_ICON_MAGE_PRESENCE_OF_MIND)) + return false; + + return true; + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { static uint32 const triggerSpell[2] = { SPELL_MAGE_ARCANE_POTENCY_RANK_1, SPELL_MAGE_ARCANE_POTENCY_RANK_2 }; @@ -126,6 +138,7 @@ class spell_mage_arcane_potency : public SpellScriptLoader void Register() override { + DoCheckProc += AuraCheckProcFn(spell_mage_arcane_potency_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_mage_arcane_potency_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; |