diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/Spell.cpp | 46 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 17 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 9 |
4 files changed, 31 insertions, 43 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 61c266854ff..e93c82b7314 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -345,7 +345,7 @@ enum SpellCategory #define SPELL_ATTR_EX3_UNK23 0x00800000 // 23 #define SPELL_ATTR_EX3_REQ_OFFHAND 0x01000000 // 24 Req offhand weapon #define SPELL_ATTR_EX3_UNK25 0x02000000 // 25 no cause spell pushback ? -#define SPELL_ATTR_EX3_UNK26 0x04000000 // 26 +#define SPELL_ATTR_EX3_CAN_PROC_TRIGGERED 0x04000000 // 26 #define SPELL_ATTR_EX3_UNK27 0x08000000 // 27 #define SPELL_ATTR_EX3_UNK28 0x10000000 // 28 #define SPELL_ATTR_EX3_UNK29 0x20000000 // 29 diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f5758a22b15..8d6ae5ba67a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -663,47 +663,13 @@ void Spell::FillTargetMap() void Spell::prepareDataForTriggerSystem() { //========================================================================================== - // Now fill data for trigger system, need know: - // Ņan spell trigger another or not ( m_canTrigger ) // Create base triggers flags for Attacker and Victim ( m_procAttacker and m_procVictim) //========================================================================================== - // Fill flag can spell trigger or not - // TODO: possible exist spell attribute for this - m_canTrigger = false; - if (m_CastItem) - m_canTrigger = false; // Do not trigger from item cast spell - else if (!m_IsTriggeredSpell) - m_canTrigger = true; // Normal cast - can trigger - else if (!m_triggeredByAuraSpell) - m_canTrigger = true; // Triggered from SPELL_EFFECT_TRIGGER_SPELL - can trigger + m_canTrigger = true; - if (!m_canTrigger) // Exceptions (some periodic triggers) - { - switch (m_spellInfo->SpellFamilyName) - { - case SPELLFAMILY_MAGE: // Arcane Missles / Blizzard triggers need do it - if (m_spellInfo->SpellFamilyFlags[0] & 0x200080) m_canTrigger = true; - break; - case SPELLFAMILY_WARLOCK: // For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it - if (m_spellInfo->SpellFamilyFlags[1] & 0x00008000 || m_spellInfo->SpellFamilyFlags[0] & 0x00000060) m_canTrigger = true; - break; - case SPELLFAMILY_PRIEST: // For Penance heal/damage triggers need do it - if (m_spellInfo->SpellFamilyFlags[1] & 0x00018000) m_canTrigger = true; - break; - case SPELLFAMILY_ROGUE: // For poisons need do it - if (m_spellInfo->SpellFamilyFlags[1] & 0x00000010 || m_spellInfo->SpellFamilyFlags[0] & 0x1001E000) m_canTrigger = true; - break; - case SPELLFAMILY_HUNTER: // Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot/Freezing Trap Effect - if (m_spellInfo->SpellFamilyFlags[1] & 0x01002000 - || m_spellInfo->SpellFamilyFlags[0] & 0x0000021C || - m_spellInfo->SpellFamilyFlags[2] & 0x200) m_canTrigger = true; - break; - case SPELLFAMILY_PALADIN: // For Judgements (all) / Holy Shock triggers need do it - if (m_spellInfo->SpellFamilyFlags[1] & 0x00010009 || m_spellInfo->SpellFamilyFlags[0] & 0x00B80400) m_canTrigger = true; - break; - } - } + if (m_CastItem && m_spellInfo->SpellFamilyName != SPELLFAMILY_POTION) + m_canTrigger = false; // Do not trigger from item cast spell(except potions) // Get data for type of attack and fill base info for trigger switch (m_spellInfo->DmgClass) @@ -944,7 +910,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // Fill base trigger info uint32 procAttacker = m_procAttacker; uint32 procVictim = m_procVictim; - uint32 procEx = PROC_EX_NONE; + uint32 procEx = m_triggeredByAuraSpell || m_CastItem ? PROC_EX_INTERNAL_TRIGGERED : PROC_EX_NONE; m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target @@ -1011,7 +977,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // Send log damage message to client caster->SendSpellNonMeleeDamageLog(&damageInfo); - procEx = createProcExtendMask(&damageInfo, missInfo); + procEx |= createProcExtendMask(&damageInfo, missInfo); procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE; // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) @@ -1035,7 +1001,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { // Fill base damage struct (unitTarget - is real spell target) SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); - procEx = createProcExtendMask(&damageInfo, missInfo); + procEx |= createProcExtendMask(&damageInfo, missInfo); // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) if (m_canTrigger && missInfo != SPELL_MISS_REFLECT) caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 9b6e785ab52..7f9e05e1591 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1176,6 +1176,13 @@ void SpellMgr::LoadSpellBonusess() bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active) { + // Additional checks for triggered spells + if (procExtra & PROC_EX_INTERNAL_TRIGGERED) + { + if (!(procSpell->AttributesEx3 & SPELL_ATTR_EX3_CAN_PROC_TRIGGERED)) + return false; + } + // No extra req need uint32 procEvent_procEx = PROC_EX_NONE; @@ -1200,6 +1207,10 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr } else // For spells need check school/spell family/family mask { + // Potions can trigger only if spellfamily given + if (procSpell->SpellFamilyName == SPELLFAMILY_POTION && !spellProcEvent->spellFamilyName) + return false; + // Check (if set) for school if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0) return false; @@ -1217,6 +1228,10 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr } } } + // potions can trigger only if have spell_proc entry + else if (procSpell && procSpell->SpellFamilyName==SPELLFAMILY_POTION) + return false; + // Check for extra req (if none) and hit/crit if (procEvent_procEx == PROC_EX_NONE) { @@ -1227,7 +1242,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr else // Passive spells hits here only if resist/reflect/immune/evade { // Exist req for PROC_EX_EX_TRIGGER_ALWAYS - if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS) + if ((procExtra & AURA_SPELL_PROC_EX_MASK) && (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS)) return true; // Passive spells can`t trigger if need hit if ((procEvent_procEx & PROC_EX_NORMAL_HIT) && !active) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 41a6cf41cf3..976a147dbd1 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -435,11 +435,18 @@ enum ProcFlagsEx PROC_EX_AURA_REMOVE_DESTROY = 0x0002000, // aura absorb destroy or dispel PROC_EX_AURA_REMOVE_EXPIRE = 0x0004000, // aura remove by default and by cancel PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges - PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000 // If set trigger always but only one time (not used) + PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not used) + PROC_EX_INTERNAL_TRIGGERED = 0x4000000 // Only for internal use }; #define AURA_REMOVE_PROC_EX_MASK \ (PROC_EX_AURA_REMOVE_DESTROY | PROC_EX_AURA_REMOVE_EXPIRE) +#define AURA_SPELL_PROC_EX_MASK \ + (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT | PROC_EX_MISS | \ + PROC_EX_RESIST | PROC_EX_DODGE | PROC_EX_PARRY | PROC_EX_BLOCK | \ + PROC_EX_EVADE | PROC_EX_IMMUNE | PROC_EX_DEFLECT | \ + PROC_EX_ABSORB | PROC_EX_REFLECT | PROC_EX_INTERRUPT) + struct SpellProcEventEntry { uint32 schoolMask; // if nonzero - bit mask for matching proc condition based on spell candidate's school: Fire=2, Mask=1<<(2-1)=2 |