diff options
Diffstat (limited to 'src/game/SpellEffects.cpp')
| -rw-r--r-- | src/game/SpellEffects.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d4e131ae37e..a700595a8ac 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -208,7 +208,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectNULL, //141 SPELL_EFFECT_141 damage and reduce speed? &Spell::EffectTriggerSpellWithValue, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE &Spell::EffectApplyAreaAura, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER - &Spell::EffectNULL, //144 SPELL_EFFECT_144 Spectral Blast + &Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_2 Spectral Blast &Spell::EffectNULL, //145 SPELL_EFFECT_145 Black Hole Effect &Spell::EffectActivateRune, //146 SPELL_EFFECT_ACTIVATE_RUNE &Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail @@ -6190,17 +6190,33 @@ void Spell::EffectSummonCritter(uint32 i) void Spell::EffectKnockBack(uint32 i) { - if(!unitTarget || !m_caster) + if(!unitTarget) return; // Effect only works on players if(unitTarget->GetTypeId()!=TYPEID_PLAYER) return; - float vsin = sin(m_caster->GetAngle(unitTarget)); - float vcos = cos(m_caster->GetAngle(unitTarget)); + float x, y; + if(m_targets.HasDest()) + { + x = m_targets.m_destX; + y = m_targets.m_destY; + } + else + { + x = m_caster->GetPositionX(); + y = m_caster->GetPositionX(); + } + + float dx = unitTarget->GetPositionX() - x; + float dy = unitTarget->GetPositionY() - y; + float dist = sqrt((dx*dx) + (dy*dy)); + + float vsin = dx / dist; + float vcos = dy / dist; float speedxy = float(m_spellInfo->EffectMiscValue[i])/10; - float speedz = float(damage/-10); + float speedz = float(damage/-10); WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); data.append(unitTarget->GetPackGUID()); |
