aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts
diff options
context:
space:
mode:
authorQAston <none@none>2009-02-14 15:56:04 +0100
committerQAston <none@none>2009-02-14 15:56:04 +0100
commit14d85a183e2bf1fef602e6377510e9fc05ac9107 (patch)
tree0aa17b9f8fa292f8396f227308799e8188531a97 /src/bindings/scripts
parentf506fde01e84d2a1aeb7fbabe051673479a5afb6 (diff)
*Make range check dependent from target.
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp12
-rw-r--r--src/bindings/scripts/include/sc_creature.h2
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp2
4 files changed, 9 insertions, 9 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 8764f612557..9ed263398dc 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -508,13 +508,13 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* Target, int32 School, int32 Mech
continue;
//Check if the spell meets our range requirements
- if (RangeMin && TempRange->maxRange < RangeMin)
+ if (RangeMin && m_creature->GetSpellMinRangeForTarget(Target, TempRange) < RangeMin)
continue;
- if (RangeMax && TempRange->maxRange > RangeMax)
+ if (RangeMax && m_creature->GetSpellMaxRangeForTarget(Target, TempRange) > RangeMax)
continue;
//Check if our target is in range
- if (m_creature->IsWithinDistInMap(Target, TempRange->minRange) || !m_creature->IsWithinDistInMap(Target, TempRange->maxRange))
+ if (m_creature->IsWithinDistInMap(Target, m_creature->GetSpellMinRangeForTarget(Target, TempRange)) || !m_creature->IsWithinDistInMap(Target, m_creature->GetSpellMaxRangeForTarget(Target, TempRange)))
continue;
//All good so lets add it to the spell list
@@ -552,20 +552,20 @@ bool ScriptedAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
return false;
//Unit is out of range of this spell
- if (m_creature->GetDistance(Target) > TempRange->maxRange || m_creature->GetDistance(Target) < TempRange->minRange)
+ if (m_creature->GetDistance(Target) > m_creature->GetSpellMaxRangeForTarget(Target, TempRange) || m_creature->GetDistance(Target) < m_creature->GetSpellMinRangeForTarget(Target, TempRange))
return false;
return true;
}
-float GetSpellMaxRange(uint32 id)
+float GetSpellMaxRangeForHostile(uint32 id)
{
SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id);
if(!spellInfo) return 0;
SpellRangeEntry const *range = GetSpellRangeStore()->LookupEntry(spellInfo->rangeIndex);
if(!range) return 0;
- return range->maxRange;
+ return range->maxRangeHostile;
}
void FillSpellSummary()
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 866007cc52a..f72278595c8 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -11,7 +11,7 @@
#include "CreatureAI.h"
#include "Creature.h"
-float GetSpellMaxRange(uint32 id);
+float GetSpellMaxRangeForHostile(uint32 id);
class SummonList : std::list<uint64>
{
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
index fed536832bf..9bf7fe0a437 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
@@ -333,7 +333,7 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
if(Charge_Timer < diff)
{
- Unit *target= SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRange(SPELL_CHARGE), true);
+ Unit *target= SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRangeForHostile(SPELL_CHARGE), true);
DoCast(target, SPELL_CHARGE);
Charge_Timer = 30000;
}else Charge_Timer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
index 0220523a1e2..b047ebd04d6 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
@@ -407,7 +407,7 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
{
DoYell(YELL_SURGE, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_YELL_SURGE);
- Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRange(SPELL_SURGE), true);
+ Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1, GetSpellMaxRangeForHostile(SPELL_SURGE), true);
DoCast(target, SPELL_SURGE);
Surge_Timer = 15000 + rand()%5000;
}else Surge_Timer -= diff;