diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 089d2c189..f3c3b0714 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1429,7 +1429,9 @@ struct SpellRangeEntry { uint32 ID; float minRange; + float minRangeFriendly; float maxRange; + float maxRangeFriendly; }; struct SpellRuneCostEntry diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index a6c99b838..148b90bec 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -87,7 +87,7 @@ const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; const char SpellRadiusfmt[]="nfxf"; -const char SpellRangefmt[]="nfxfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellRuneCostfmt[]="niiii"; const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx"; const char StableSlotPricesfmt[] = "ni"; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 51eb5685c..6786248c2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4740,14 +4740,14 @@ SpellCastResult Spell::CheckRange(bool strict) range_mod = 6.25; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); - float max_range = GetSpellMaxRange(srange) + range_mod; - float min_range = GetSpellMinRange(srange); + Unit *target = m_targets.getUnitTarget(); + bool friendly = target ? target->IsFriendlyTo(m_caster) : false; + float max_range = GetSpellMaxRange(srange, friendly) + range_mod; + float min_range = GetSpellMinRange(srange, friendly); if(Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this); - Unit *target = m_targets.getUnitTarget(); - if(target && target != m_caster) { // distance from target in checks diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a6d238e0f..81393d980 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -104,8 +104,18 @@ SpellSpecific GetSpellSpecific(uint32 spellId); // Different spell properties inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); -inline float GetSpellMinRange(SpellRangeEntry const *range) { return (range ? range->minRange : 0); } -inline float GetSpellMaxRange(SpellRangeEntry const *range) { return (range ? range->maxRange : 0); } +inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false) +{ + if(!range) + return 0; + return (friendly ? range->minRangeFriendly : range->minRange); +} +inline float GetSpellMaxRange(SpellRangeEntry const *range, bool friendly = false) +{ + if(!range) + return 0; + return (friendly ? range->maxRangeFriendly : range->maxRange); +} inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; } int32 GetSpellDuration(SpellEntry const *spellInfo); int32 GetSpellMaxDuration(SpellEntry const *spellInfo); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d6285af33..fe29e1a63 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7953" + #define REVISION_NR "7954" #endif // __REVISION_NR_H__