diff options
author | megamage <none@none> | 2009-05-06 10:35:37 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-06 10:35:37 -0500 |
commit | ac3c58a2eb0da881b5eb82ebdc36a99fa53e47f0 (patch) | |
tree | 08a80411af93e04442c2fdc403740da644a15971 /src | |
parent | 2cdea49d81ce2bb4e19df594c019a42fb4ba0c5b (diff) |
*Fix the bug that fishing bobber does not have correct position.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 14 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 912bea7e89b..e459fd161d5 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1654,9 +1654,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); @@ -2647,7 +2657,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); m_effectMask |= (1<<j); diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index d19584514b0..a723e3415e4 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -178,6 +178,12 @@ inline float GetSpellMaxRange(SpellEntry const *spellInfo, bool positive) ? GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)) : GetSpellMaxRangeForHostile(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); } +inline float GetSpellMinRange(SpellEntry const *spellInfo, bool positive) +{ + return positive + ? GetSpellMinRangeForFriend(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)) + : GetSpellMinRangeForHostile(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex)); +} /*struct DispelEntry { |