aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormknjc <none@none>2009-05-07 18:20:55 +0200
committermknjc <none@none>2009-05-07 18:20:55 +0200
commit3703f4891def906b405d37787b7b993e2a652491 (patch)
tree92ca8f3b82efa9f9ff2c4df80512c8ad2fb92591 /src
parent54c514eee570d97756ac300938c968291d89e0f0 (diff)
Backported TC2 commit 3157 (megamage: *Fix the bug that fishing bobber does not have correct position.)
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp14
-rw-r--r--src/game/SpellMgr.h6
2 files changed, 18 insertions, 2 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 91d6622425e..664e52b26c0 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1593,9 +1593,19 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_UNIT_CASTER:
- case TARGET_UNIT_CASTER_FISHING:
AddUnitTarget(m_caster, i);
break;
+ case TARGET_UNIT_CASTER_FISHING:
+ {
+ AddUnitTarget(m_caster, i);
+ float min_dis = GetSpellMinRange(m_spellInfo, true);
+ float max_dis = GetSpellMaxRange(m_spellInfo, true);
+ float dis = rand_norm() * (max_dis - min_dis) + min_dis;
+ float x, y, z;
+ m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis);
+ m_targets.setDestination(x, y, z);
+ break;
+ }
case TARGET_UNIT_MASTER:
if(Unit* owner = m_caster->GetCharmerOrOwner())
AddUnitTarget(owner, i);
@@ -2471,7 +2481,7 @@ void Spell::_handle_immediate_phase()
{
if(spellmgr.EffectTargetType[m_spellInfo->Effect[j]] == SPELL_REQUIRE_DEST)
{
- if(!m_targets.HasDst())
+ if(!m_targets.HasDst()) // FIXME: this will ignore dest set in effect
m_targets.setDestination(m_caster);
HandleEffects(m_originalCaster, NULL, NULL, j);
}
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 70b81403a52..7c5a0874e41 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -326,6 +326,12 @@ inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
return true;
return false;
}
+inline float GetSpellMinRange(SpellEntry const *spellInfo, bool positive)
+{
+ return positive
+ ? GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex))
+ : GetSpellMinRangeForHostile(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
+}
//bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);