aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp183
1 files changed, 95 insertions, 88 deletions
diff --git a/src/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp b/src/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp
index 67f090da32a..17c6765cddf 100644
--- a/src/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp
+++ b/src/scripts/northrend/ulduar/halls_of_lightning/boss_ionar.cpp
@@ -1,4 +1,5 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * Copyright (C) 2008 - 2010 TrinityCore <http://www.trinitycore.org/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -14,44 +15,50 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* ScriptData
-SDName: Boss Ionar
-SD%Complete: 90%
-SDComment: Timer check
-SDCategory: Halls of Lightning
-EndScriptData */
+/*
+ * Comment: Timer check pending
+ */
#include "ScriptedPch.h"
#include "halls_of_lightning.h"
-enum eEnums
+enum Spells
{
- SAY_AGGRO = -1602011,
- SAY_SLAY_1 = -1602012,
- SAY_SLAY_2 = -1602013,
- SAY_SLAY_3 = -1602014,
- SAY_DEATH = -1602015,
- SAY_SPLIT_1 = -1602016,
- SAY_SPLIT_2 = -1602017,
-
- SPELL_BALL_LIGHTNING_N = 52780,
- SPELL_BALL_LIGHTNING_H = 59800,
- SPELL_STATIC_OVERLOAD_N = 52658,
- SPELL_STATIC_OVERLOAD_H = 59795,
-
- SPELL_DISPERSE = 52770,
- SPELL_SUMMON_SPARK = 52746,
- SPELL_SPARK_DESPAWN = 52776,
-
+ SPELL_BALL_LIGHTNING = 52780,
+ H_SPELL_BALL_LIGHTNING = 59800,
+ SPELL_STATIC_OVERLOAD = 52658,
+ H_SPELL_STATIC_OVERLOAD = 59795,
+
+ SPELL_DISPERSE = 52770,
+ SPELL_SUMMON_SPARK = 52746,
+ SPELL_SPARK_DESPAWN = 52776,
+
//Spark of Ionar
- SPELL_SPARK_VISUAL_TRIGGER_N = 52667,
- SPELL_SPARK_VISUAL_TRIGGER_H = 59833,
+ SPELL_SPARK_VISUAL_TRIGGER = 52667,
+ H_SPELL_SPARK_VISUAL_TRIGGER = 59833
+};
- NPC_SPARK_OF_IONAR = 28926,
+enum Yells
+{
+ SAY_AGGRO = -1602011,
+ SAY_SLAY_1 = -1602012,
+ SAY_SLAY_2 = -1602013,
+ SAY_SLAY_3 = -1602014,
+ SAY_DEATH = -1602015,
+ SAY_SPLIT_1 = -1602016,
+ SAY_SPLIT_2 = -1602017
+};
- MAX_SPARKS = 5,
- MAX_SPARK_DISTANCE = 90, // Distance to boss - prevent runs through the whole instance
- POINT_CALLBACK = 0
+enum Creatures
+{
+ NPC_SPARK_OF_IONAR = 28926
+};
+
+enum Misc
+{
+ DATA_MAX_SPARKS = 5,
+ DATA_MAX_SPARK_DISTANCE = 90, // Distance to boss - prevent runs through the whole instance
+ DATA_POINT_CALLBACK = 0
};
/*######
@@ -60,60 +67,60 @@ enum eEnums
struct boss_ionarAI : public ScriptedAI
{
- boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), m_sparkList(pCreature)
+ boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), lSparkList(pCreature)
{
- m_pInstance = pCreature->GetInstanceData();
+ pInstance = pCreature->GetInstanceData();
}
- ScriptedInstance* m_pInstance;
+ ScriptedInstance* pInstance;
- SummonList m_sparkList;
+ SummonList lSparkList;
- bool m_bIsSplitPhase;
- uint32 m_uiSplitTimer;
+ bool bIsSplitPhase;
+ uint32 uiSplitTimer;
- uint32 m_uiStaticOverloadTimer;
- uint32 m_uiBallLightningTimer;
+ uint32 uiStaticOverloadTimer;
+ uint32 uiBallLightningTimer;
- uint32 m_uiHealthAmountModifier;
+ uint32 uiHealthAmountModifier;
void Reset()
{
- m_sparkList.DespawnAll();
+ lSparkList.DespawnAll();
- m_bIsSplitPhase = true;
- m_uiSplitTimer = 25000;
+ bIsSplitPhase = true;
+ uiSplitTimer = 25*IN_MILISECONDS;
- m_uiStaticOverloadTimer = urand(5000, 6000);
- m_uiBallLightningTimer = urand(10000, 11000);
+ uiStaticOverloadTimer = urand(5*IN_MILISECONDS, 6*IN_MILISECONDS);
+ uiBallLightningTimer = urand(10*IN_MILISECONDS, 11*IN_MILISECONDS);
- m_uiHealthAmountModifier = 1;
+ uiHealthAmountModifier = 1;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE);
if (m_creature->GetVisibility() == VISIBILITY_OFF)
m_creature->SetVisibility(VISIBILITY_ON);
- if (m_pInstance)
- m_pInstance->SetData(TYPE_IONAR, NOT_STARTED);
+ if (pInstance)
+ pInstance->SetData(TYPE_IONAR, NOT_STARTED);
}
void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
- if (m_pInstance)
- m_pInstance->SetData(TYPE_IONAR, IN_PROGRESS);
+ if (pInstance)
+ pInstance->SetData(TYPE_IONAR, IN_PROGRESS);
}
void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, m_creature);
- m_sparkList.DespawnAll();
+ lSparkList.DespawnAll();
- if (m_pInstance)
- m_pInstance->SetData(TYPE_IONAR, DONE);
+ if (pInstance)
+ pInstance->SetData(TYPE_IONAR, DONE);
}
void KilledUnit(Unit *victim)
@@ -125,13 +132,13 @@ struct boss_ionarAI : public ScriptedAI
void CallBackSparks()
{
//should never be empty here, but check
- if (m_sparkList.empty())
+ if (lSparkList.empty())
return;
Position pos;
m_creature->GetPosition(&pos);
- for (std::list<uint64>::const_iterator itr = m_sparkList.begin(); itr != m_sparkList.end(); ++itr)
+ for (std::list<uint64>::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr)
{
if (Creature* pSpark = Unit::GetCreature(*m_creature, *itr))
{
@@ -139,7 +146,7 @@ struct boss_ionarAI : public ScriptedAI
{
pSpark->SetSpeed(MOVE_RUN, 2.0f);
pSpark->GetMotionMaster()->Clear();
- pSpark->GetMotionMaster()->MovePoint(POINT_CALLBACK, pos);
+ pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos);
}
else
pSpark->ForcedDespawn();
@@ -157,9 +164,9 @@ struct boss_ionarAI : public ScriptedAI
{
if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR)
{
- m_sparkList.Summon(pSummoned);
+ lSparkList.Summon(pSummoned);
- pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER_N,SPELL_SPARK_VISUAL_TRIGGER_H), true);
+ pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER,H_SPELL_SPARK_VISUAL_TRIGGER), true);
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (pTarget)
@@ -174,7 +181,7 @@ struct boss_ionarAI : public ScriptedAI
void SummonedCreatureDespawn(Creature *pSummoned)
{
if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR)
- m_sparkList.Despawn(pSummoned);
+ lSparkList.Despawn(pSummoned);
}
void UpdateAI(const uint32 uiDiff)
@@ -186,59 +193,59 @@ struct boss_ionarAI : public ScriptedAI
// Splitted
if (m_creature->GetVisibility() == VISIBILITY_OFF)
{
- if (m_uiSplitTimer <= uiDiff)
+ if (uiSplitTimer <= uiDiff)
{
- m_uiSplitTimer = 2500;
+ uiSplitTimer = 2.5*IN_MILISECONDS;
// Return sparks to where Ionar splitted
- if (m_bIsSplitPhase)
+ if (bIsSplitPhase)
{
CallBackSparks();
- m_bIsSplitPhase = false;
+ bIsSplitPhase = false;
}
// Lightning effect and restore Ionar
- else if (m_sparkList.empty())
+ else if (lSparkList.empty())
{
m_creature->SetVisibility(VISIBILITY_ON);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE);
DoCast(m_creature, SPELL_SPARK_DESPAWN, false);
- m_uiSplitTimer = 25000;
- m_bIsSplitPhase = true;
+ uiSplitTimer = 25*IN_MILISECONDS;
+ bIsSplitPhase = true;
if (m_creature->getVictim())
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
}
}
else
- m_uiSplitTimer -= uiDiff;
+ uiSplitTimer -= uiDiff;
return;
}
- if (m_uiStaticOverloadTimer <= uiDiff)
+ if (uiStaticOverloadTimer <= uiDiff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
- DoCast(pTarget, DUNGEON_MODE(SPELL_STATIC_OVERLOAD_N, SPELL_STATIC_OVERLOAD_H));
+ DoCast(pTarget, DUNGEON_MODE(SPELL_STATIC_OVERLOAD, H_SPELL_STATIC_OVERLOAD));
- m_uiStaticOverloadTimer = urand(5000, 6000);
+ uiStaticOverloadTimer = urand(5*IN_MILISECONDS, 6*IN_MILISECONDS);
}
else
- m_uiStaticOverloadTimer -= uiDiff;
+ uiStaticOverloadTimer -= uiDiff;
- if (m_uiBallLightningTimer <= uiDiff)
+ if (uiBallLightningTimer <= uiDiff)
{
- DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_BALL_LIGHTNING_N, SPELL_BALL_LIGHTNING_H));
- m_uiBallLightningTimer = urand(10000, 11000);
+ DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_BALL_LIGHTNING, H_SPELL_BALL_LIGHTNING));
+ uiBallLightningTimer = urand(10*IN_MILISECONDS, 11*IN_MILISECONDS);
}
else
- m_uiBallLightningTimer -= uiDiff;
+ uiBallLightningTimer -= uiDiff;
// Health check
- if (HealthBelowPct(100-(20*m_uiHealthAmountModifier)))
+ if (HealthBelowPct(100-(20*uiHealthAmountModifier)))
{
- ++m_uiHealthAmountModifier;
+ ++uiHealthAmountModifier;
DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), m_creature);
@@ -265,7 +272,7 @@ bool EffectDummyCreature_boss_ionar(Unit* pCaster, uint32 uiSpellId, uint32 uiEf
if (pCreatureTarget->GetEntry() != NPC_IONAR)
return true;
- for (uint8 i = 0; i < MAX_SPARKS; ++i)
+ for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i)
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true);
pCreatureTarget->AttackStop();
@@ -289,25 +296,25 @@ struct mob_spark_of_ionarAI : public ScriptedAI
{
mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature)
{
- m_pInstance = pCreature->GetInstanceData();
+ pInstance = pCreature->GetInstanceData();
}
- ScriptedInstance* m_pInstance;
+ ScriptedInstance* pInstance;
uint32 uiCheckTimer;
void Reset()
{
- uiCheckTimer = 2000;
+ uiCheckTimer = 2*IN_MILISECONDS;
m_creature->SetReactState(REACT_PASSIVE);
}
void MovementInform(uint32 uiType, uint32 uiPointId)
{
- if (uiType != POINT_MOTION_TYPE || !m_pInstance)
+ if (uiType != POINT_MOTION_TYPE || !pInstance)
return;
- if (uiPointId == POINT_CALLBACK)
+ if (uiPointId == DATA_POINT_CALLBACK)
m_creature->ForcedDespawn();
}
@@ -319,7 +326,7 @@ struct mob_spark_of_ionarAI : public ScriptedAI
void UpdateAI(const uint32 uiDiff)
{
// Despawn if the encounter is not running
- if (m_pInstance && m_pInstance->GetData(TYPE_IONAR) != IN_PROGRESS)
+ if (pInstance && pInstance->GetData(TYPE_IONAR) != IN_PROGRESS)
{
m_creature->ForcedDespawn();
return;
@@ -328,25 +335,25 @@ struct mob_spark_of_ionarAI : public ScriptedAI
// Prevent them to follow players through the whole instance
if (uiCheckTimer <= uiDiff)
{
- if (m_pInstance)
+ if (pInstance)
{
- Creature* pIonar = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_IONAR));
+ Creature* pIonar = pInstance->instance->GetCreature(pInstance->GetData64(DATA_IONAR));
if (pIonar && pIonar->isAlive())
{
- if (m_creature->GetDistance(pIonar) > MAX_SPARK_DISTANCE)
+ if (m_creature->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE)
{
Position pos;
pIonar->GetPosition(&pos);
m_creature->SetSpeed(MOVE_RUN, 2.0f);
m_creature->GetMotionMaster()->Clear();
- m_creature->GetMotionMaster()->MovePoint(POINT_CALLBACK, pos);
+ m_creature->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos);
}
}
else
m_creature->ForcedDespawn();
}
- uiCheckTimer = 2000;
+ uiCheckTimer = 2*IN_MILISECONDS;
}
else
uiCheckTimer -= uiDiff;