From c60425c6bd0d75458288a34d385a9e871cd12ebe Mon Sep 17 00:00:00 2001 From: Laise Date: Thu, 4 Aug 2011 19:33:43 +0300 Subject: [PATCH] [11766] fix spell redirection and totem destruction on hit by redirected spell --- sql/mangos.sql | 10 +++++++- .../11766_01_mangos_spell_proc_event.sql | 13 +++++++++++ src/game/Spell.cpp | 23 +++++++++++++++---- src/game/Spell.h | 10 +++++++- src/game/SpellAuras.cpp | 4 ++-- src/game/SpellAuras.h | 2 +- src/game/Unit.cpp | 16 ++----------- src/game/Unit.h | 1 + src/game/UnitAuraProcHandler.cpp | 16 ++++++++++++- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 11 files changed, 73 insertions(+), 26 deletions(-) create mode 100644 sql/updates/11766_01_mangos_spell_proc_event.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 79a0132e6..c68964d86 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_11764_01_mangos_spell_proc_event` bit(1) default NULL + `required_11766_01_mangos_spell_proc_event` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17069,6 +17069,7 @@ INSERT INTO `spell_proc_event` VALUES ( 324, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), ( 974, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), ( 3232, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +( 3411, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), ( 5952, 0x00, 8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), ( 6346, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), ( 7383, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), @@ -17175,6 +17176,7 @@ INSERT INTO `spell_proc_event` VALUES (23689, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4.000000, 0.000000, 0), (23721, 0x00, 9, 0x00000800, 0x00000800, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (23920, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(23921, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (24353, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (24389, 0x00, 3, 0x00C00017, 0x00C00017, 0x00C00017, 0x00000040, 0x00000040, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (24658, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00014110, 0x00000000, 0.000000, 0.000000, 0), @@ -17295,6 +17297,7 @@ INSERT INTO `spell_proc_event` VALUES (34754, 0x00, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00080000, 0.000000, 0.000000, 0), (34774, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.500000, 0.000000, 20), (34783, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0.000000, 0.000000, 0), +(34784, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (34827, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (34914, 0x00, 6, 0x00002000, 0x00002000, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (34935, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 8), @@ -17372,6 +17375,7 @@ INSERT INTO `spell_proc_event` VALUES (40899, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (40971, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (41034, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0.000000, 0.000000, 0), +(41198, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (41260, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (41262, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 10), (41381, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0.000000, 0.000000, 0), @@ -17454,6 +17458,7 @@ INSERT INTO `spell_proc_event` VALUES (49208, 0x00, 15, 0x00440000, 0x00440000, 0x00440000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (49222, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 3), (49622, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 60), +(50253, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (50781, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 6), (50880, 0x10, 15, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0x00000800, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0), (51123, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), @@ -17498,6 +17503,7 @@ INSERT INTO `spell_proc_event` VALUES (53290, 0x00, 9, 0x00000800, 0x00000800, 0x00000800, 0x00000001, 0x00000001, 0x00000001, 0x00000200, 0x00000200, 0x00000200, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53380, 0x00, 10, 0x00800000, 0x00800000, 0x00800000, 0x00028000, 0x00028000, 0x00028000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53397, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(53476, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (53486, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53501, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (53551, 0x00, 10, 0x00001000, 0x00001000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), @@ -17508,6 +17514,8 @@ INSERT INTO `spell_proc_event` VALUES (53695, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (53709, 0x00, 10, 0x00004000, 0x00004000, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0.000000, 0.000000, 0), (53817, 0x00, 11, 0x00000000, 0x000001C3, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(54061, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(54062, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), (54149, 0x00, 10, 0x00200000, 0x00200000, 0x00200000, 0x00010000, 0x00010000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (54278, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), (54646, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), diff --git a/sql/updates/11766_01_mangos_spell_proc_event.sql b/sql/updates/11766_01_mangos_spell_proc_event.sql new file mode 100644 index 000000000..334a73239 --- /dev/null +++ b/sql/updates/11766_01_mangos_spell_proc_event.sql @@ -0,0 +1,13 @@ +ALTER TABLE db_version CHANGE COLUMN required_11764_01_mangos_spell_proc_event required_11766_01_mangos_spell_proc_event bit; + +DELETE FROM spell_proc_event WHERE entry IN (3411, 8178, 23921, 34784, 38857, 41198, 50253, 53476, 54061, 54062); +INSERT INTO spell_proc_event VALUES (3411, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(8178, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(23921, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(34784, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(38857, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(41198, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(50253, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(53476, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(54061, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0), +(54062, 0x7F, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 0); \ No newline at end of file diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index c67cf76a5..adfbd9755 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -392,6 +392,8 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o // determine reflection m_canReflect = false; + m_spellFlags = SPELL_FLAG_NORMAL; + if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)) { for(int j = 0; j < MAX_EFFECT_INDEX; ++j) @@ -804,6 +806,9 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) // Check for effect immune skip if immuned bool immuned = pVictim->IsImmuneToSpellEffect(m_spellInfo, effIndex); + if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsTotem() && (m_spellFlags & SPELL_FLAG_REDIRECTED)) + immuned = false; + ObjectGuid targetGUID = pVictim->GetObjectGuid(); // Lookup target in already in list @@ -858,6 +863,8 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) // Increase time interval for reflected spells by 1.5 target.timeDelay += target.timeDelay >> 1; + + m_spellFlags |= SPELL_FLAG_REFLECTED; } else target.reflectResult = SPELL_MISS_NONE; @@ -1004,7 +1011,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him { - DoSpellHitOnUnit(m_caster, mask, true); + DoSpellHitOnUnit(m_caster, mask); unitTarget = m_caster; } } @@ -1147,7 +1154,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); } -void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool isReflected) +void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) { if (!unit || !effectMask) return; @@ -1298,7 +1305,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool isReflected) if (duration > 0) { int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, m_spellInfo); - unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel, limitduration, isReflected); + unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel, limitduration, m_spellFlags & SPELL_FLAG_REFLECTED); // Fully diminished if (duration == 0) @@ -1819,6 +1826,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); + m_spellFlags |= SPELL_FLAG_REDIRECTED; targetUnitMap.push_back(pUnitTarget); } } @@ -2257,6 +2265,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); + m_spellFlags |= SPELL_FLAG_REDIRECTED; targetUnitMap.push_back(pUnitTarget); } } @@ -2287,6 +2296,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); + m_spellFlags |= SPELL_FLAG_REDIRECTED; targetUnitMap.push_back(pUnitTarget); } break; @@ -2902,13 +2912,18 @@ void Spell::cancel() case SPELL_STATE_CASTING: { - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition == SPELL_MISS_NONE) { Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); + + // prevent other effects applying if spell is already interrupted + // i.e. if effects have different targets and it was interrupted on one of them when + // haven't yet applied to another + ihit->processed = true; } } diff --git a/src/game/Spell.h b/src/game/Spell.h index 6fff7e224..5585c1f0b 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -64,6 +64,13 @@ enum SpellCastFlags CAST_FLAG_IMMUNITY = 0x04000000 // spell cast school imminity info }; +enum SpellFlags +{ + SPELL_FLAG_NORMAL = 0x00, + SPELL_FLAG_REFLECTED = 0x01, // reflected spell + SPELL_FLAG_REDIRECTED = 0x02 // redirected spell +}; + enum SpellNotifyPushType { PUSH_IN_FRONT, @@ -514,6 +521,7 @@ class Spell int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare int32 m_duration; bool m_canReflect; // can reflect this spell? + uint8 m_spellFlags; // for spells whose target was changed in cast i.e. due to reflect bool m_autoRepeat; uint8 m_runesState; @@ -615,7 +623,7 @@ class Spell void HandleDelayedSpellLaunch(TargetInfo *target); void InitializeDamageMultipliers(); void ResetEffectDamageAndHeal(); - void DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool isReflected = false); + void DoSpellHitOnUnit(Unit *unit, uint32 effectMask); void DoAllEffectOnTarget(GOTargetInfo *target); void DoAllEffectOnTarget(ItemTargetInfo *target); bool IsAliveUnitPresentInTargetList(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6b3900431..7ee78f763 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -8383,9 +8383,9 @@ void Aura::HandleAuraModAllCritChance(bool apply, bool Real) ((Player*)target)->UpdateAllSpellCritChances(); } -void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool real) +void Aura::HandleAuraStopNaturalManaRegen(bool apply, bool Real) { - if (!real) + if (!Real) return; GetTarget()->ApplyModFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER, !apply && !GetTarget()->IsUnderLastManaUseEffect()); diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index e7bc4cab3..5dff7ad70 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -373,7 +373,7 @@ class MANGOS_DLL_SPEC Aura void HandleAuraModAllCritChance(bool Apply, bool Real); void HandleAuraOpenStable(bool apply, bool Real); void HandleAuraAddMechanicAbilities(bool apply, bool Real); - void HandleAuraStopNaturalManaRegen(bool apply, bool real); + void HandleAuraStopNaturalManaRegen(bool apply, bool Real); virtual ~Aura(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6da2665b2..85815d12e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -6042,7 +6042,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff) return NULL; // Magic case - if (spell && (spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)) + if (spell && spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) { Unit::AuraList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET); for(Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) @@ -6050,12 +6050,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff) if (Unit* magnet = (*itr)->GetCaster()) { if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff)) - { - if (SpellAuraHolder *holder = (*itr)->GetHolder()) - if (holder->DropAuraCharge()) - victim->RemoveSpellAuraHolder(holder); return magnet; - } } } } @@ -6070,12 +6065,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff) if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && (!spell || spell->CheckTarget(magnet, eff))) { if (roll_chance_i((*i)->GetModifier()->m_amount)) - { - if (SpellAuraHolder *holder = (*i)->GetHolder()) - if (holder->DropAuraCharge()) - victim->RemoveSpellAuraHolder(holder); return magnet; - } } } } @@ -9739,8 +9729,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if (!triggeredByAura) continue; - Modifier *auraModifier = triggeredByAura->GetModifier(); - if (procSpell) { if (spellProcEvent) @@ -9769,7 +9757,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag continue; } - SpellAuraProcResult procResult = (*this.*AuraProcHandler[auraModifier->m_auraname])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown); + SpellAuraProcResult procResult = (*this.*AuraProcHandler[triggeredByHolder->GetSpellProto()->EffectApplyAuraName[i]])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown); switch (procResult) { case SPELL_AURA_PROC_CANT_TRIGGER: diff --git a/src/game/Unit.h b/src/game/Unit.h index 09a5f0bbc..197e08a46 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1849,6 +1849,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject SpellAuraProcResult HandleAddPctModifierAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModDamagePercentDoneAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModRating(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + SpellAuraProcResult HandleSpellMagnetAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleModResistanceAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); SpellAuraProcResult HandleNULLProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index c1ff8a7f2..47a9ffc4b 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -128,7 +128,7 @@ pAuraProcHandler AuraProcHandler[TOTAL_AURAS]= &Unit::HandleNULLProc, // 93 SPELL_AURA_MOD_UNATTACKABLE &Unit::HandleNULLProc, // 94 SPELL_AURA_INTERRUPT_REGEN &Unit::HandleNULLProc, // 95 SPELL_AURA_GHOST - &Unit::HandleNULLProc, // 96 SPELL_AURA_SPELL_MAGNET + &Unit::HandleSpellMagnetAuraProc, // 96 SPELL_AURA_SPELL_MAGNET &Unit::HandleManaShieldAuraProc, // 97 SPELL_AURA_MANA_SHIELD &Unit::HandleNULLProc, // 98 SPELL_AURA_MOD_SKILL_TALENT &Unit::HandleNULLProc, // 99 SPELL_AURA_MOD_ATTACK_POWER @@ -3974,6 +3974,20 @@ SpellAuraProcResult Unit::HandleModRating(Unit* /*pVictim*/, uint32 /*damage*/, return SPELL_AURA_PROC_OK; } +SpellAuraProcResult Unit::HandleSpellMagnetAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) +{ + if (triggeredByAura->GetId() == 8178) // Grounding Totem Effect + { + // for spells that doesn't do damage but need to destroy totem anyway + if ((!damage || damage < GetHealth()) && GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsTotem()) + { + DealDamage(this, GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return SPELL_AURA_PROC_OK; + } + } + return SPELL_AURA_PROC_OK; +} + SpellAuraProcResult Unit::HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 82cbdaead..1fbe98f2a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11765" + #define REVISION_NR "11766" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 994b24d3f..3b948f42f 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_11716_10_characters_mail" - #define REVISION_DB_MANGOS "required_11764_01_mangos_spell_proc_event" + #define REVISION_DB_MANGOS "required_11766_01_mangos_spell_proc_event" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__