diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 15 | ||||
-rw-r--r-- | src/game/Spell.h | 3 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 25 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 6 |
4 files changed, 40 insertions, 9 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3cdef148230..253726a48c6 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -273,13 +273,14 @@ void SpellCastTargets::write ( WorldPacket * data ) *data << m_strTarget; } -Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer ) +Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck ) { ASSERT( Caster != NULL && info != NULL ); ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element"); m_spellInfo = info; m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id); + m_skipCheck = skipCheck; m_caster = Caster; m_selfContainer = NULL; m_triggeringContainer = triggeringContainer; @@ -734,7 +735,11 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) // Calculate hit result if(m_originalCaster) + { target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); + if(m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE) + target.missCondition = SPELL_MISS_NONE; + } else target.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; @@ -980,7 +985,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); } - else //TODO: This is a hack. need fix + /*else //TODO: This is a hack. need fix { uint32 tempMask = 0; for(uint32 i = 0; i < 3; ++i) @@ -989,7 +994,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) tempMask |= 1<<i; if(tempMask &= mask) DoSpellHitOnUnit(unit, tempMask); - } + }*/ // All calculated do it! // Do healing and triggers @@ -3299,7 +3304,7 @@ void Spell::TriggerSpell() { for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) { - Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); + Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer, true); spell->prepare(&m_targets); // use original spell original targets } } @@ -3626,7 +3631,7 @@ uint8 Spell::CanCast(bool strict) } }*/ - if(!m_triggeredByAuraSpell) + if(!m_skipCheck && !m_triggeredByAuraSpell) if(uint8 castResult = CheckRange(strict)) return castResult; diff --git a/src/game/Spell.h b/src/game/Spell.h index d7ca8cdd2b6..cc4cfc8f64a 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -320,7 +320,7 @@ class Spell void EffectQuestFail(uint32 i); void EffectRedirectThreat(uint32 i); - Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL ); + Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false ); ~Spell(); void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL); @@ -571,6 +571,7 @@ class Spell SpellEntry const* m_triggeredByAuraSpell; uint32 m_customAttr; + bool m_skipCheck; }; namespace Trinity diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 047637e00f8..62dc2b64864 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -609,6 +609,9 @@ void Spell::EffectDummy(uint32 i) if(!unitTarget && !gameObjTarget && !itemTarget) return; + uint32 spell_id = 0; + int32 bp = 0; + // selection by spell family switch(m_spellInfo->SpellFamilyName) { @@ -1279,8 +1282,8 @@ void Spell::EffectDummy(uint32 i) if(!unitTarget) return; - int32 basePoints0 = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]); - m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0); + spell_id = 20647; + bp = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]); m_caster->SetPower(POWER_RAGE,0); return; } @@ -1682,6 +1685,24 @@ void Spell::EffectDummy(uint32 i) break; } + //spells triggered by dummy effect should not miss + if(spell_id) + { + SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id ); + + if(!spellInfo) + { + sLog.outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); + return; + } + + Spell* spell = new Spell(m_caster, spellInfo, true, m_originalCasterGUID, NULL, true); + if(bp) spell->m_currentBasePoints[0] = bp; + SpellCastTargets targets; + targets.setUnitTarget(unitTarget); + spell->prepare(&targets); + } + // pet auras if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id)) { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 85cfe5c6e96..18549e7dd38 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2150,8 +2150,12 @@ void SpellMgr::LoadSpellCustomAttr() mSpellCustomAttr[i] |= SPELL_ATTR_CU_DIRECT_DAMAGE; break; case SPELL_EFFECT_CHARGE: - spellInfo->speed = SPEED_CHARGE; + if(!spellInfo->speed) + spellInfo->speed = SPEED_CHARGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; + case SPELL_EFFECT_TRIGGER_SPELL: + if(spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION|TARGET_FLAG_DEST_LOCATION)) + spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE; break; } } |