diff options
19 files changed, 118 insertions, 100 deletions
diff --git a/sql/updates/world/master/2018_01_13_00_world_2016_11_19_00_world_335.sql b/sql/updates/world/master/2018_01_13_00_world_2016_11_19_00_world_335.sql new file mode 100644 index 00000000000..ae32a91d4d1 --- /dev/null +++ b/sql/updates/world/master/2018_01_13_00_world_2016_11_19_00_world_335.sql @@ -0,0 +1 @@ +UPDATE `spell_proc` SET `AttributesMask`=`AttributesMask`|0x2 WHERE `SpellId` IN (71406,71545); -- Anger Capacitor diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b4429fb02fc..e263f7e8295 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5048,10 +5048,10 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const* log) void Unit::ProcSkillsAndAuras(Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) { WeaponAttackType attType = damageInfo ? damageInfo->GetAttackType() : BASE_ATTACK; - if (typeMaskActor && CanProc()) + if (typeMaskActor) ProcSkillsAndReactives(false, actionTarget, typeMaskActor, hitMask, attType); - if (typeMaskActionTarget && actionTarget && actionTarget->CanProc()) + if (typeMaskActionTarget && actionTarget) actionTarget->ProcSkillsAndReactives(true, this, typeMaskActionTarget, hitMask, attType); TriggerAurasProcOnEvent(nullptr, nullptr, actionTarget, typeMaskActor, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); @@ -10156,7 +10156,7 @@ void Unit::TriggerAurasProcOnEvent(AuraApplicationList* myProcAuras, AuraApplica // prepare data for self trigger ProcEventInfo myProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); AuraApplicationProcContainer myAurasTriggeringProc; - if (typeMaskActor && CanProc()) + if (typeMaskActor) { GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo); @@ -10179,7 +10179,7 @@ void Unit::TriggerAurasProcOnEvent(AuraApplicationList* myProcAuras, AuraApplica // prepare data for target trigger ProcEventInfo targetProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); AuraApplicationProcContainer targetAurasTriggeringProc; - if (typeMaskActionTarget && actionTarget && actionTarget->CanProc()) + if (typeMaskActionTarget && actionTarget) actionTarget->GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo); TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 2a6b9ac227d..58873b89232 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1669,6 +1669,27 @@ uint32 Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& even if (!procEntry) return 0; + // check spell triggering us + if (Spell const* spell = eventInfo.GetProcSpell()) + { + // Do not allow auras to proc from effect triggered from itself + if (spell->IsTriggeredByAura(m_spellInfo)) + return 0; + + // check if aura can proc when spell is triggered (exception for hunter auto shot & wands) + if (spell->IsTriggered() && !(procEntry->AttributesMask & PROC_ATTR_TRIGGERED_CAN_PROC) && !(eventInfo.GetTypeMask() & AUTO_ATTACK_PROC_FLAG_MASK)) + if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED)) + return 0; + } + + // check don't break stealth attr present + if (m_spellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_MOD_STEALTH)) + { + if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) + if (spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH)) + return 0; + } + // check if we have charges to proc with if (IsUsingCharges()) { @@ -1686,24 +1707,9 @@ uint32 Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& even return 0; // do checks against db data - if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo)) + if (!SpellMgr::CanSpellTriggerProcOnEvent(*procEntry, eventInfo)) return 0; - // check don't break stealth attr present - if (m_spellInfo->HasAura(DIFFICULTY_NONE, SPELL_AURA_MOD_STEALTH)) - { - if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) - if (spellInfo->HasAttribute(SPELL_ATTR0_CU_DONT_BREAK_STEALTH)) - return 0; - } - - // check if aura can proc when spell is triggered (exception for hunter auto shot & wands) - if (!(procEntry->AttributesMask & PROC_ATTR_TRIGGERED_CAN_PROC) && !(eventInfo.GetTypeMask() & AUTO_ATTACK_PROC_FLAG_MASK)) - if (Spell const* spell = eventInfo.GetProcSpell()) - if (spell->IsTriggered()) - if (!GetSpellInfo()->HasAttribute(SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED)) - return 0; - // do checks using conditions table if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId(), eventInfo.GetActor(), eventInfo.GetActionTarget())) return 0; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6fbe7e5dadc..d132fa50d07 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2389,7 +2389,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) m_spellAura = nullptr; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied // Spells with this flag cannot trigger if effect is cast on self - bool canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_PROC) && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE || missInfo == SPELL_MISS_IMMUNE2); + bool const canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE || missInfo == SPELL_MISS_IMMUNE2); Unit* spellHitTarget = nullptr; if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target @@ -2801,8 +2801,8 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint32 effMask) // info confirmed with retail sniffs of permafrost and shadow weaving if (!m_hitTriggerSpells.empty()) { - int _duration = 0; - for (HitTriggerSpellList::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) + int32 _duration = 0; + for (auto i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) { if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) { @@ -7601,12 +7601,10 @@ void Spell::PrepareTriggersExecutedOnHit() int32 auraBaseAmount = aurEff->GetBaseAmount(); // proc chance is stored in effect amount int32 chance = m_caster->CalculateSpellDamage(nullptr, aurEff->GetSpellInfo(), aurEff->GetEffIndex(), &auraBaseAmount); + chance *= aurEff->GetBase()->GetStackAmount(); + // build trigger and add to the list - HitTriggerSpell spellTriggerInfo; - spellTriggerInfo.triggeredSpell = spellInfo; - spellTriggerInfo.triggeredByAura = aurEff->GetSpellInfo(); - spellTriggerInfo.chance = chance * aurEff->GetBase()->GetStackAmount(); - m_hitTriggerSpells.push_back(spellTriggerInfo); + m_hitTriggerSpells.emplace_back(spellInfo, aurEff->GetSpellInfo(), chance); } } } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index be622ba20fd..2a58d0306fd 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -651,6 +651,8 @@ class TC_GAME_API Spell bool IsChannelActive() const; bool IsAutoActionResetSpell() const; + bool IsTriggeredByAura(SpellInfo const* auraSpellInfo) const { return (auraSpellInfo == m_triggeredByAuraSpell); } + bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; } void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; } bool IsInterruptable() const { return !m_executedCurrently; } @@ -845,6 +847,9 @@ class TC_GAME_API Spell struct HitTriggerSpell { + HitTriggerSpell(SpellInfo const* spellInfo, SpellInfo const* auraSpellInfo, int32 procChance) : + triggeredSpell(spellInfo), triggeredByAura(auraSpellInfo), chance(procChance) { } + SpellInfo const* triggeredSpell; SpellInfo const* triggeredByAura; // uint8 triggeredByEffIdx This might be needed at a later stage - No need known for now @@ -853,7 +858,7 @@ class TC_GAME_API Spell bool CanExecuteTriggersOnHit(uint32 effMask, SpellInfo const* triggeredByAura = nullptr) const; void PrepareTriggersExecutedOnHit(); - typedef std::list<HitTriggerSpell> HitTriggerSpellList; + typedef std::vector<HitTriggerSpell> HitTriggerSpellList; HitTriggerSpellList m_hitTriggerSpells; // effect helpers diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 52af3bb8a63..52f3630b815 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -429,7 +429,7 @@ SpellProcEntry const* SpellMgr::GetSpellProcEntry(uint32 spellId) const return NULL; } -bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const +bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) { // proc type doesn't match if (!(eventInfo.GetTypeMask() & procEntry.ProcFlags)) diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 97b61d5cebf..c1462dc1e4d 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -640,7 +640,7 @@ class TC_GAME_API SpellMgr // Spell proc table SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const; - bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const; + static bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo); // Spell threat table SpellThreatEntry const* GetSpellThreatEntry(uint32 spellID) const; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 0c3344fdf8e..a138aec1de4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -278,7 +278,7 @@ class spell_anetheron_vampiric_aura : public SpellScriptLoader return ValidateSpellInfo({ SPELL_VAMPIRIC_AURA_HEAL }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); DamageInfo* damageInfo = eventInfo.GetDamageInfo(); @@ -286,7 +286,7 @@ class spell_anetheron_vampiric_aura : public SpellScriptLoader return; int32 bp = damageInfo->GetDamage() * 3; - eventInfo.GetActor()->CastCustomSpell(SPELL_VAMPIRIC_AURA_HEAL, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetActor(), true); + eventInfo.GetActor()->CastCustomSpell(SPELL_VAMPIRIC_AURA_HEAL, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetActor(), true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 41cbebf48f2..1a9225f0a3d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -1118,7 +1118,7 @@ class spell_putricide_ooze_tank_protection : public SpellScriptLoader PreventDefaultAction(); Unit* actionTarget = eventInfo.GetActionTarget(); - actionTarget->CastSpell((Unit*)nullptr, aurEff->GetSpellEffectInfo()->TriggerSpell, true); + actionTarget->CastSpell((Unit*)nullptr, aurEff->GetSpellEffectInfo()->TriggerSpell, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index da338c976df..0074fed9706 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -219,11 +219,11 @@ class spell_uk_second_wind : public SpellScriptLoader return (spellInfo->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN))) != 0; } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActionTarget(); - caster->CastSpell(caster, SPELL_SECOND_WIND_TRIGGER, true); + caster->CastSpell(caster, SPELL_SECOND_WIND_TRIGGER, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp index bb793113cdd..37a24fd8d3b 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp @@ -38,14 +38,14 @@ class spell_mark_of_malice : public SpellScriptLoader return ValidateSpellInfo({ SPELL_MARK_OF_MALICE_TRIGGERED }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); // just drop charges if (GetCharges() > 1) return; - GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, true); + GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 999a0d23f61..f2c5b3206d8 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -234,14 +234,14 @@ class spell_twisted_reflection : public SpellScriptLoader return ValidateSpellInfo({ SPELL_TWISTED_REFLECTION_HEAL }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); DamageInfo* damageInfo = eventInfo.GetDamageInfo(); if (!damageInfo || !damageInfo->GetDamage()) return; - eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, true); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_TWISTED_REFLECTION_HEAL, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index a018da538c3..c7822d8acc5 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -873,10 +873,10 @@ class spell_dru_t3_6p_bonus : public SpellScriptLoader return ValidateSpellInfo({ SPELL_DRUID_BLESSING_OF_THE_CLAW }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, true); + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, true, nullptr, aurEff); } void Register() override @@ -920,7 +920,7 @@ class spell_dru_t3_8p_bonus : public SpellScriptLoader return; int32 amount = CalculatePct(m->Amount, aurEff->GetAmount()); - caster->CastCustomSpell(SPELL_DRUID_EXHILARATE, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true); + caster->CastCustomSpell(SPELL_DRUID_EXHILARATE, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff); } void Register() override @@ -951,10 +951,10 @@ class spell_dru_t4_2p_bonus : public SpellScriptLoader return ValidateSpellInfo({ SPELL_DRUID_INFUSION }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_DRUID_INFUSION, true); + eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_DRUID_INFUSION, true, nullptr, aurEff); } void Register() override @@ -988,7 +988,7 @@ class spell_dru_item_t6_trinket : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); @@ -1020,7 +1020,7 @@ class spell_dru_item_t6_trinket : public SpellScriptLoader return; if (roll_chance_i(chance)) - eventInfo.GetActor()->CastSpell((Unit*)nullptr, spellId, true); + eventInfo.GetActor()->CastSpell((Unit*)nullptr, spellId, true, nullptr, aurEff); } void Register() override @@ -1067,7 +1067,7 @@ class spell_dru_t10_balance_4p_bonus : public SpellScriptLoader // Add remaining ticks to damage done amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_DRUID_LANGUISH, SPELL_AURA_PERIODIC_DAMAGE); - caster->CastCustomSpell(SPELL_DRUID_LANGUISH, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_DRUID_LANGUISH, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override @@ -1169,12 +1169,12 @@ class spell_dru_t10_restoration_4p_bonus_dummy : public SpellScriptLoader return caster->GetGroup() || caster != eventInfo.GetProcTarget(); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); int32 amount = static_cast<int32>(eventInfo.GetHealInfo()->GetHeal()); - eventInfo.GetActor()->CastCustomSpell(SPELL_DRUID_REJUVENATION_T10_PROC, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true); + eventInfo.GetActor()->CastCustomSpell(SPELL_DRUID_REJUVENATION_T10_PROC, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index c0b4d56bf40..9aae5a665fb 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3612,7 +3612,7 @@ class spell_gen_vampiric_touch : public SpellScriptLoader return ValidateSpellInfo({ SPELL_VAMPIRIC_TOUCH_HEAL }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); DamageInfo* damageInfo = eventInfo.GetDamageInfo(); @@ -3621,7 +3621,7 @@ class spell_gen_vampiric_touch : public SpellScriptLoader Unit* caster = eventInfo.GetActor(); int32 bp = damageInfo->GetDamage() / 2; - caster->CastCustomSpell(SPELL_VAMPIRIC_TOUCH_HEAL, SPELLVALUE_BASE_POINT0, bp, caster, true); + caster->CastCustomSpell(SPELL_VAMPIRIC_TOUCH_HEAL, SPELLVALUE_BASE_POINT0, bp, caster, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index fc9eeacc6bc..90f1eb65f54 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -217,7 +217,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); @@ -234,7 +234,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1)) spellId = SPELL_MANIFEST_ANGER_OFF_HAND; - caster->CastSpell(target, spellId, true); + caster->CastSpell(target, spellId, true, nullptr, aurEff); } void Register() override @@ -323,7 +323,7 @@ class spell_item_aura_of_madness : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { static std::vector<uint32> const triggeredSpells[MAX_CLASSES] = { @@ -356,7 +356,7 @@ class spell_item_aura_of_madness : public SpellScriptLoader PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); uint32 spellId = Trinity::Containers::SelectRandomContainerElement(triggeredSpells[caster->getClass()]); - caster->CastSpell(caster, spellId, true); + caster->CastSpell(caster, spellId, true, nullptr, aurEff); if (roll_chance_i(10)) caster->Unit::Say(SAY_MADNESS); @@ -389,10 +389,10 @@ class spell_item_dementia : public SpellScriptLoader return ValidateSpellInfo({ SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG }); } - void HandlePeriodicDummy(AuraEffect const* /*aurEff*/) + void HandlePeriodicDummy(AuraEffect const* aurEff) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true); + GetTarget()->CastSpell(GetTarget(), RAND(SPELL_DEMENTIA_POS, SPELL_DEMENTIA_NEG), true, nullptr, aurEff); } void Register() override @@ -450,7 +450,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader protEff->GetBase()->RefreshDuration(); } else - GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, NULL, aurEff); + GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, nullptr, aurEff); } void Register() override @@ -575,7 +575,7 @@ class spell_item_deathbringers_will : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { static std::vector<uint32> const triggeredSpells[MAX_CLASSES] = { @@ -607,12 +607,12 @@ class spell_item_deathbringers_will : public SpellScriptLoader PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - auto const& randomSpells = triggeredSpells[caster->getClass()]; + std::vector<uint32> const& randomSpells = triggeredSpells[caster->getClass()]; if (randomSpells.empty()) return; uint32 spellId = Trinity::Containers::SelectRandomContainerElement(randomSpells); - caster->CastSpell(caster, spellId, true); + caster->CastSpell(caster, spellId, true, nullptr, aurEff); } void Register() override @@ -1038,7 +1038,7 @@ class spell_item_frozen_shadoweave : public SpellScriptLoader int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); Unit* caster = eventInfo.GetActor(); - caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true); + caster->CastCustomSpell(SPELL_SHADOWMEND, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff); } void Register() override @@ -1081,9 +1081,9 @@ class spell_item_gnomish_death_ray : public SpellScriptLoader if (Unit* target = GetHitUnit()) { if (urand(0, 99) < 15) - caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure + caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true); // failure else - caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL); + caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true); } } @@ -1139,7 +1139,7 @@ class spell_item_heartpierce : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); @@ -1156,6 +1156,7 @@ class spell_item_heartpierce : public SpellScriptLoader case POWER_RAGE: spellId = Rage; break; + // Death Knights can't use daggers, but oh well case POWER_RUNIC_POWER: spellId = RunicPower; break; @@ -1163,7 +1164,7 @@ class spell_item_heartpierce : public SpellScriptLoader return; } - caster->CastSpell((Unit*)nullptr, spellId, true); + caster->CastSpell((Unit*)nullptr, spellId, true, nullptr, aurEff); } void Register() override @@ -1301,14 +1302,14 @@ class spell_item_mark_of_conquest : public SpellScriptLoader return ValidateSpellInfo({ SPELL_MARK_OF_CONQUEST_ENERGIZE }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { if (eventInfo.GetTypeMask() & (PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS)) { // in that case, do not cast heal spell PreventDefaultAction(); // but mana instead - eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true); + eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_MARK_OF_CONQUEST_ENERGIZE, true, nullptr, aurEff); } } @@ -1468,7 +1469,7 @@ class spell_item_net_o_matic : public SpellScriptLoader else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) spellId = SPELL_NET_O_MATIC_TRIGGERED2; - GetCaster()->CastSpell(target, spellId, true, NULL); + GetCaster()->CastSpell(target, spellId, true, nullptr); } } @@ -1527,7 +1528,7 @@ class spell_item_noggenfogger_elixir : public SpellScriptLoader case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; } - caster->CastSpell(caster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, nullptr); } void Register() override @@ -1660,7 +1661,7 @@ class spell_item_pet_healing : public SpellScriptLoader int32 bp = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); Unit* caster = eventInfo.GetActor(); - caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, (Unit*)nullptr, true); + caster->CastCustomSpell(SPELL_HEALTH_LINK, SPELLVALUE_BASE_POINT0, bp, (Unit*)nullptr, true, nullptr, aurEff); } void Register() override @@ -2135,7 +2136,7 @@ class spell_item_swift_hand_justice_dummy : public SpellScriptLoader Unit* caster = eventInfo.GetActor(); int32 amount = caster->CountPctFromMaxHealth(aurEff->GetAmount()); - caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true); + caster->CastCustomSpell(SPELL_SWIFT_HAND_OF_JUSTICE_HEAL, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true, nullptr, aurEff); } void Register() override @@ -3617,17 +3618,17 @@ class spell_item_shard_of_the_scale : public SpellScriptLoader return ValidateSpellInfo({ HealProc, DamageProc }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) - caster->CastSpell(target, HealProc, true); + caster->CastSpell(target, HealProc, true, nullptr, aurEff); if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG) - caster->CastSpell(target, DamageProc, true); + caster->CastSpell(target, DamageProc, true, nullptr, aurEff); } void Register() override @@ -3766,7 +3767,7 @@ class spell_item_sunwell_neck : public SpellScriptLoader return true; } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Player* player = eventInfo.GetActor()->ToPlayer(); @@ -3774,10 +3775,10 @@ class spell_item_sunwell_neck : public SpellScriptLoader // Aggression checks are in the spell system... just cast and forget if (player->GetReputationRank(FACTION_ALDOR) == REP_EXALTED) - player->CastSpell(target, Aldors, true); + player->CastSpell(target, Aldors, true, nullptr, aurEff); if (player->GetReputationRank(FACTION_SCRYERS) == REP_EXALTED) - player->CastSpell(target, Scryers, true); + player->CastSpell(target, Scryers, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 41e14e5ebc8..056ab79de33 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -101,9 +101,16 @@ class spell_pal_ardent_defender : public SpellScriptLoader enum Spell { - PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235, + PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235 }; + bool Validate(SpellInfo const* spellInfo) override + { + if (!sSpellMgr->GetSpellInfo(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + return false; + return true; + } + bool Load() override { healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); @@ -866,7 +873,7 @@ class spell_pal_item_t6_trinket : public SpellScriptLoader return ValidateSpellInfo({ SPELL_PALADIN_ENDURING_LIGHT, SPELL_PALADIN_ENDURING_JUDGEMENT }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); @@ -892,7 +899,7 @@ class spell_pal_item_t6_trinket : public SpellScriptLoader return; if (roll_chance_i(chance)) - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, true); + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, true, nullptr, aurEff); } void Register() override @@ -1333,7 +1340,7 @@ class spell_pal_t3_6p_bonus : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); @@ -1364,7 +1371,7 @@ class spell_pal_t3_6p_bonus : public SpellScriptLoader return; } - caster->CastSpell(target, spellId, true); + caster->CastSpell(target, spellId, true, nullptr, aurEff); } void Register() override @@ -1411,7 +1418,7 @@ class spell_pal_t8_2p_bonus : public SpellScriptLoader // Add remaining ticks to damage done amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_HOLY_MENDING, SPELL_AURA_PERIODIC_HEAL); - caster->CastCustomSpell(SPELL_PALADIN_HOLY_MENDING, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_PALADIN_HOLY_MENDING, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 821937ae60c..c074198b99c 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -142,7 +142,7 @@ class spell_pri_aq_3p_bonus : public SpellScriptLoader return ValidateSpellInfo({ SPELL_PRIEST_ORACULAR_HEAL }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); @@ -154,7 +154,7 @@ class spell_pri_aq_3p_bonus : public SpellScriptLoader return; int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), 10); - caster->CastCustomSpell(SPELL_PRIEST_ORACULAR_HEAL, SPELLVALUE_BASE_POINT0, amount, caster, true); + caster->CastCustomSpell(SPELL_PRIEST_ORACULAR_HEAL, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff); } void Register() override @@ -1254,10 +1254,10 @@ class spell_pri_t3_4p_bonus : public SpellScriptLoader return ValidateSpellInfo({ SPELL_PRIEST_ARMOR_OF_FAITH }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, true); + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, true, nullptr, aurEff); } void Register() override @@ -1349,7 +1349,7 @@ class spell_pri_t10_heal_2p_bonus : public SpellScriptLoader Unit* target = eventInfo.GetProcTarget(); amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PRIEST_BLESSED_HEALING, SPELL_AURA_PERIODIC_HEAL); - caster->CastCustomSpell(SPELL_PRIEST_BLESSED_HEALING, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_PRIEST_BLESSED_HEALING, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 1ea8ca2d4a3..58977ed5dc0 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -1018,7 +1018,7 @@ class spell_sha_t3_6p_bonus : public SpellScriptLoader }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); @@ -1049,7 +1049,7 @@ class spell_sha_t3_6p_bonus : public SpellScriptLoader return; } - caster->CastSpell(target, spellId, true); + caster->CastSpell(target, spellId, true, nullptr, aurEff); } void Register() override @@ -1091,12 +1091,12 @@ class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); amount /= spellInfo->GetMaxTicks(DIFFICULTY_NONE); - // Add remaining ticks to healing done + // Add remaining ticks to damage done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_ELECTRIFIED, SPELL_AURA_PERIODIC_DAMAGE); - caster->CastCustomSpell(SPELL_SHAMAN_ELECTRIFIED, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_SHAMAN_ELECTRIFIED, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override @@ -1138,12 +1138,12 @@ class spell_sha_t9_elemental_4p_bonus : public SpellScriptLoader int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); amount /= spellInfo->GetMaxTicks(DIFFICULTY_NONE); - // Add remaining ticks to healing done + // Add remaining ticks to damage done Unit* caster = eventInfo.GetActor(); Unit* target = eventInfo.GetProcTarget(); amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE); - caster->CastCustomSpell(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override @@ -1235,7 +1235,7 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader Unit* target = eventInfo.GetProcTarget(); amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_CHAINED_HEAL, SPELL_AURA_PERIODIC_HEAL); - caster->CastCustomSpell(SPELL_SHAMAN_CHAINED_HEAL, SPELLVALUE_BASE_POINT0, amount, target, true); + caster->CastCustomSpell(SPELL_SHAMAN_CHAINED_HEAL, SPELLVALUE_BASE_POINT0, amount, target, true, nullptr, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index cead7bf93a0..a8502c9e6d9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -1046,7 +1046,7 @@ class spell_warl_seed_of_corruption_generic : public SpellScriptLoader if (!caster) return; - caster->CastSpell(eventInfo.GetActionTarget(), SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC, true); + caster->CastSpell(eventInfo.GetActionTarget(), SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC, true, nullptr, aurEff); } void Register() override @@ -1383,11 +1383,11 @@ class spell_warl_t4_2p_bonus : public SpellScriptLoader return ValidateSpellInfo({ Trigger }); } - void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - caster->CastSpell(caster, Trigger, true); + caster->CastSpell(caster, Trigger, true, nullptr, aurEff); } void Register() override |