From e81175ec11124e885d349b1dca257d0cf97bdd85 Mon Sep 17 00:00:00 2001 From: QAston Date: Mon, 15 Jun 2009 01:10:09 +0200 Subject: *Fix Hungering Cold. --HG-- branch : trunk rename : sql/updates/3997_world_spell_proc_event.sql => sql/updates/4000_world_spell_proc_event.sql --- src/game/Spell.cpp | 70 +++++++++++++++++++++++++++++---------------------- src/game/SpellMgr.cpp | 4 +-- src/game/Unit.cpp | 36 +++++++++++++++++++++++++- src/game/Unit.h | 1 + 4 files changed, 77 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 2f641c43c35..87be2d381c2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2280,46 +2280,56 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) } else { - if(m_spellInfo->Id == 27285) // Seed of Corruption proc spell - unitList.remove(m_targets.getUnitTarget()); - else if (m_spellInfo->Id==57699) //Replenishment (special target selection) 10 targets with lowest mana + switch (m_spellInfo->Id) { - typedef std::priority_queue, PrioritizeMana> TopMana; - TopMana manaUsers; - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();++itr) + case 27285: // Seed of Corruption proc spell + unitList.remove(m_targets.getUnitTarget()); + break; + case 55789: // Improved Icy Talons + case 59725: // Improved Spell Reflection - aoe aura + unitList.remove(m_caster); + break; + case 57699: //Replenishment (special target selection) 10 targets with lowest mana { - if ((*itr)->getPowerType() == POWER_MANA) + typedef std::priority_queue, PrioritizeMana> TopMana; + TopMana manaUsers; + for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();++itr) { - PrioritizeManaWraper WTarget(*itr); - manaUsers.push(WTarget); + if ((*itr)->getPowerType() == POWER_MANA) + { + PrioritizeManaWraper WTarget(*itr); + manaUsers.push(WTarget); + } } - } - unitList.clear(); - while(!manaUsers.empty() && unitList.size()<10) - { - unitList.push_back(manaUsers.top().getUnit()); - manaUsers.pop(); + unitList.clear(); + while(!manaUsers.empty() && unitList.size()<10) + { + unitList.push_back(manaUsers.top().getUnit()); + manaUsers.pop(); + } + break; } - } - else if (m_spellInfo->Id==52759)// Ancestral Awakening - { - typedef std::priority_queue, PrioritizeHealth> TopHealth; - TopHealth healedMembers; - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();++itr) + case 52759: // Ancestral Awakening { - PrioritizeHealthWraper WTarget(*itr); - healedMembers.push(WTarget); - } + typedef std::priority_queue, PrioritizeHealth> TopHealth; + TopHealth healedMembers; + for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();++itr) + { + PrioritizeHealthWraper WTarget(*itr); + healedMembers.push(WTarget); + } - unitList.clear(); - while(!healedMembers.empty() && unitList.size()<1) - { - unitList.push_back(healedMembers.top().getUnit()); - healedMembers.pop(); + unitList.clear(); + while(!healedMembers.empty() && unitList.size()<1) + { + unitList.push_back(healedMembers.top().getUnit()); + healedMembers.pop(); + } + break; } } - else if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_TARGET_ANY + if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_TARGET_ANY && m_spellInfo->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ALLY_DST)// Wild Growth, Circle of Healing, Glyph of holy light target special selection { typedef std::priority_queue, PrioritizeHealth> TopHealth; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 14f7033cfc6..cc9dcfb14e4 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -3351,10 +3351,8 @@ void SpellMgr::LoadSpellCustomAttr() // Target entry seems to be wrong for this spell :/ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_PARTY_CASTER; spellInfo->EffectRadiusIndex[0] = 45; - //mSpellCustomAttr[i] |= SPELL_ATTR_CU_EXCLUDE_SELF; - //break; + break; case 27820: // Mana Detonation - case 55789: // Improved Icy Talons //case 28062: case 39090: // Positive/Negative Charge //case 28085: case 39093: mSpellCustomAttr[i] |= SPELL_ATTR_CU_EXCLUDE_SELF; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 944a92ae755..3b1889d03f2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7035,6 +7035,32 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff return true; } +// Used in case when access to whole aura is needed +// All procs should be handled like this... +bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled) +{ + SpellEntry const *dummySpell = triggeredByAura->GetSpellProto(); + + switch(dummySpell->SpellFamilyName) + { + case SPELLFAMILY_DEATHKNIGHT: + { + switch(dummySpell->Id) + { + // Hungering Cold aura drop + case 51209: + *handled = true; + // Drop only in disease case + if (procSpell && procSpell->Dispel == DISPEL_DISEASE) + return false; + return true; + } + break; + } + } + return false; +} + bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown) { // Get triggered aura spell info @@ -12498,8 +12524,16 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if (GetTypeId() == TYPEID_PLAYER && i->spellProcEvent && i->spellProcEvent->cooldown) cooldown = i->spellProcEvent->cooldown; - uint32 procDebug = 0; + // This bool is needed till separate aura effect procs are still here + bool handled = false; + if (HandleAuraProc(pTarget, damage, i->aura, procSpell, procFlag, procExtra, cooldown, &handled)) + { + sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), Id); + takeCharges = true; + } + uint32 procDebug = 0; + if (!handled) for (uint8 effIndex = 0; effIndexeffMask & (1<