aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp72
1 files changed, 17 insertions, 55 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 0450fa7fb6c..50e41fe2ff7 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -611,7 +611,6 @@ m_spellValue(new SpellValue(caster->GetMap()->GetDifficultyID(), m_spellInfo))
m_castId = ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, m_caster->GetMapId(), m_spellInfo->Id, m_caster->GetMap()->GenerateLowGuid<HighGuid::Cast>());
memset(m_misc.Raw.Data, 0, sizeof(m_misc.Raw.Data));
m_SpellVisual = caster->GetCastSpellXSpellVisualId(m_spellInfo);
- m_preCastSpell = 0;
m_triggeredByAuraSpell = NULL;
m_spellAura = NULL;
@@ -2785,15 +2784,6 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
void Spell::DoTriggersOnSpellHit(Unit* unit, uint32 effMask)
{
- // Apply additional spell effects to target
- /// @todo move this code to scripts
- if (m_preCastSpell)
- {
- if (sSpellMgr->GetSpellInfo(m_preCastSpell))
- // Blizz seems to just apply aura without bothering to cast
- m_caster->AddAura(m_preCastSpell, unit);
- }
-
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
// this is executed after spell proc spells on target hit
// spells are triggered for each hit spell target
@@ -2805,7 +2795,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint32 effMask)
{
if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance))
{
- m_caster->CastSpell(unit, i->triggeredSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_TARGET_CHECK));
+ m_caster->CastSpell(unit, i->triggeredSpell, TRIGGERED_FULL_MASK);
TC_LOG_DEBUG("spells", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id);
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
@@ -7518,56 +7508,28 @@ bool Spell::CanExecuteTriggersOnHit(uint32 effMask, SpellInfo const* triggeredBy
void Spell::PrepareTriggersExecutedOnHit()
{
- /// @todo move this to scripts
- if (m_spellInfo->SpellFamilyName)
- {
- SpellInfo const* excludeCasterSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeCasterAuraSpell);
- if (excludeCasterSpellInfo && !excludeCasterSpellInfo->IsPositive())
- m_preCastSpell = m_spellInfo->ExcludeCasterAuraSpell;
- SpellInfo const* excludeTargetSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeTargetAuraSpell);
- if (excludeTargetSpellInfo && !excludeTargetSpellInfo->IsPositive())
- m_preCastSpell = m_spellInfo->ExcludeTargetAuraSpell;
- }
-
- /// @todo move this to scripts
- switch (m_spellInfo->SpellFamilyName)
- {
- case SPELLFAMILY_MAGE:
- {
- // Permafrost
- if (m_spellInfo->SpellFamilyFlags[1] & 0x00001000 || m_spellInfo->SpellFamilyFlags[0] & 0x00100220)
- m_preCastSpell = 68391;
- break;
- }
- }
-
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras:
// save auras which were present on spell caster on cast, to prevent triggered auras from affecting caster
// and to correctly calculate proc chance when combopoints are present
Unit::AuraEffectList const& targetTriggers = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_TARGET_TRIGGER);
- for (Unit::AuraEffectList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
+ for (AuraEffect const* aurEff : targetTriggers)
{
- if (!(*i)->IsAffectingSpell(m_spellInfo))
+ if (!aurEff->IsAffectingSpell(m_spellInfo))
continue;
- SpellInfo const* auraSpellInfo = (*i)->GetSpellInfo();
- uint32 auraSpellIdx = (*i)->GetEffIndex();
- // todo 6.x
- if (SpellEffectInfo const* auraEffect = auraSpellInfo->GetEffect(m_caster->GetMap()->GetDifficultyID(), auraSpellIdx))
- {
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(auraEffect->TriggerSpell))
- {
- // calculate the chance using spell base amount, because aura amount is not updated on combo-points change
- // this possibly needs fixing
- int32 auraBaseAmount = (*i)->GetBaseAmount();
- // proc chance is stored in effect amount
- int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount);
- // build trigger and add to the list
- HitTriggerSpell spellTriggerInfo;
- spellTriggerInfo.triggeredSpell = spellInfo;
- spellTriggerInfo.triggeredByAura = auraSpellInfo;
- spellTriggerInfo.chance = chance * (*i)->GetBase()->GetStackAmount();
- m_hitTriggerSpells.push_back(spellTriggerInfo);
- }
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(aurEff->GetSpellEffectInfo()->TriggerSpell))
+ {
+ // calculate the chance using spell base amount, because aura amount is not updated on combo-points change
+ // this possibly needs fixing
+ int32 auraBaseAmount = aurEff->GetBaseAmount();
+ // proc chance is stored in effect amount
+ int32 chance = m_caster->CalculateSpellDamage(nullptr, aurEff->GetSpellInfo(), aurEff->GetEffIndex(), &auraBaseAmount);
+ // 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);
}
}
}