From 6762744452766a5772ac66ac483262351a5ec0b0 Mon Sep 17 00:00:00 2001 From: DasMy Date: Sat, 28 Mar 2009 16:11:21 +0100 Subject: [PATCH] [7570] respect UNIT_FIELD_COMBATREACH for spell range check Signed-off-by: arrai --- src/game/Creature.cpp | 14 ++++++++++++-- src/game/Spell.cpp | 7 +++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 08225da43..380dc2ddb 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1586,7 +1586,12 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); - float dist = GetDistance(pVictim); + + // DasMy: respect victims dimensions + float dist = GetDistance(pVictim) - pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH) - GetFloatValue(UNIT_FIELD_COMBATREACH); + if (dist < 0.0f) + dist = 0.0f; + //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if( dist > range || dist < minrange ) @@ -1632,7 +1637,12 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRange(srange); float minrange = GetSpellMinRange(srange); - float dist = GetDistance(pVictim); + + // DasMy: respect victims dimensions + float dist = GetDistance(pVictim) - pVictim->GetFloatValue(UNIT_FIELD_COMBATREACH) - GetFloatValue(UNIT_FIELD_COMBATREACH); + if (dist < 0.0f) + dist = 0.0f; + //if(!isInFront( pVictim, range ) && spellInfo->AttributesEx ) // continue; if( dist > range || dist < minrange ) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index cad5706e6..67b0f6790 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4749,8 +4749,11 @@ SpellCastResult Spell::CheckRange(bool strict) if(target && target != m_caster) { - // distance from target center in checks - float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ()); + // distance from target in checks + float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ()) - target->GetFloatValue(UNIT_FIELD_COMBATREACH) - m_caster->GetFloatValue(UNIT_FIELD_COMBATREACH); // DasMy: respect victims dimension + if (dist < 0.0f) + dist = 0.0f; + if(dist > max_range) return SPELL_FAILED_OUT_OF_RANGE; //0x5A; if(dist < min_range) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index edcde8e7a..fce93d4b3 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 "7569" + #define REVISION_NR "7570" #endif // __REVISION_NR_H__