[7954] Added support for spellranges at friendly targets.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
pasdVn 2009-05-29 11:45:51 +02:00 committed by ApoC
parent a3fff9b2cb
commit eaad24d8d5
5 changed files with 20 additions and 8 deletions

View file

@ -1429,7 +1429,9 @@ struct SpellRangeEntry
{ {
uint32 ID; uint32 ID;
float minRange; float minRange;
float minRangeFriendly;
float maxRange; float maxRange;
float maxRangeFriendly;
}; };
struct SpellRuneCostEntry struct SpellRuneCostEntry

View file

@ -87,7 +87,7 @@ const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx";
const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
const char SpellRadiusfmt[]="nfxf"; const char SpellRadiusfmt[]="nfxf";
const char SpellRangefmt[]="nfxfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellRuneCostfmt[]="niiii"; const char SpellRuneCostfmt[]="niiii";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx"; const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx";
const char StableSlotPricesfmt[] = "ni"; const char StableSlotPricesfmt[] = "ni";

View file

@ -4740,14 +4740,14 @@ SpellCastResult Spell::CheckRange(bool strict)
range_mod = 6.25; range_mod = 6.25;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
float max_range = GetSpellMaxRange(srange) + range_mod; Unit *target = m_targets.getUnitTarget();
float min_range = GetSpellMinRange(srange); 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()) if(Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this);
Unit *target = m_targets.getUnitTarget();
if(target && target != m_caster) if(target && target != m_caster)
{ {
// distance from target in checks // distance from target in checks

View file

@ -104,8 +104,18 @@ SpellSpecific GetSpellSpecific(uint32 spellId);
// Different spell properties // Different spell properties
inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); }
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL);
inline float GetSpellMinRange(SpellRangeEntry const *range) { return (range ? range->minRange : 0); } inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false)
inline float GetSpellMaxRange(SpellRangeEntry const *range) { return (range ? range->maxRange : 0); } {
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; } inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; }
int32 GetSpellDuration(SpellEntry const *spellInfo); int32 GetSpellDuration(SpellEntry const *spellInfo);
int32 GetSpellMaxDuration(SpellEntry const *spellInfo); int32 GetSpellMaxDuration(SpellEntry const *spellInfo);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7953" #define REVISION_NR "7954"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__