aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts/include
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-29 00:15:18 -0500
committermegamage <none@none>2009-04-29 00:15:18 -0500
commitce68fc9c646e5a7b6ac7f33b12fa4296586b53e8 (patch)
tree933749fff97c6c8a15084ef6ec204896a054b39d /src/bindings/scripts/include
parent207c3f7afff6ee2b462bd6855487fbcbfdbd63a8 (diff)
*Update some naxx boss scripts.
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts/include')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp5
-rw-r--r--src/bindings/scripts/include/sc_creature.h8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index fde0f92f1c9..fed04c5303c 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -61,6 +61,11 @@ void SummonList::DespawnAll()
}
}
+ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false)
+{
+ HeroicMode = m_creature->GetMap()->IsHeroic();
+}
+
void ScriptedAI::AttackStart(Unit* who, bool melee)
{
if (!who)
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 880cdffc504..dfdb23eeb14 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -11,6 +11,8 @@
#include "CreatureAI.h"
#include "Creature.h"
+#define HEROIC(n,h) (HeroicMode ? h : n)
+
float GetSpellMaxRangeForHostile(uint32 id);
class SummonList : private std::list<uint64>
@@ -44,7 +46,7 @@ struct PointMovement
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
{
- ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false) {}
+ explicit ScriptedAI(Creature* creature);
~ScriptedAI() {}
//*************
@@ -101,6 +103,8 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
//For fleeing
bool IsFleeing;
+ bool HeroicMode;
+
//*************
//Pure virtual functions
//*************
@@ -177,6 +181,8 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
Unit* SelectUnit(SelectAggroTarget target, uint32 position, float dist, bool playerOnly);
void SelectUnitList(std::list<Unit*> &targetList, uint32 num, SelectAggroTarget target, float dist, bool playerOnly);
+ bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < m_creature->GetMaxHealth() * pct; }
+
//Returns spells that meet the specified criteria from the creatures spell list
SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTarget Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect);