Ulduar, Halls of Lightning: Cleanup Ionar's script
--HG-- branch : trunk
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
/* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -14,17 +15,30 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ScriptData
|
/*
|
||||||
SDName: Boss Ionar
|
* Comment: Timer check pending
|
||||||
SD%Complete: 90%
|
*/
|
||||||
SDComment: Timer check
|
|
||||||
SDCategory: Halls of Lightning
|
|
||||||
EndScriptData */
|
|
||||||
|
|
||||||
#include "ScriptedPch.h"
|
#include "ScriptedPch.h"
|
||||||
#include "halls_of_lightning.h"
|
#include "halls_of_lightning.h"
|
||||||
|
|
||||||
enum eEnums
|
enum Spells
|
||||||
|
{
|
||||||
|
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 = 52667,
|
||||||
|
H_SPELL_SPARK_VISUAL_TRIGGER = 59833
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Yells
|
||||||
{
|
{
|
||||||
SAY_AGGRO = -1602011,
|
SAY_AGGRO = -1602011,
|
||||||
SAY_SLAY_1 = -1602012,
|
SAY_SLAY_1 = -1602012,
|
||||||
@@ -32,26 +46,19 @@ enum eEnums
|
|||||||
SAY_SLAY_3 = -1602014,
|
SAY_SLAY_3 = -1602014,
|
||||||
SAY_DEATH = -1602015,
|
SAY_DEATH = -1602015,
|
||||||
SAY_SPLIT_1 = -1602016,
|
SAY_SPLIT_1 = -1602016,
|
||||||
SAY_SPLIT_2 = -1602017,
|
SAY_SPLIT_2 = -1602017
|
||||||
|
};
|
||||||
|
|
||||||
SPELL_BALL_LIGHTNING_N = 52780,
|
enum Creatures
|
||||||
SPELL_BALL_LIGHTNING_H = 59800,
|
{
|
||||||
SPELL_STATIC_OVERLOAD_N = 52658,
|
NPC_SPARK_OF_IONAR = 28926
|
||||||
SPELL_STATIC_OVERLOAD_H = 59795,
|
};
|
||||||
|
|
||||||
SPELL_DISPERSE = 52770,
|
enum Misc
|
||||||
SPELL_SUMMON_SPARK = 52746,
|
{
|
||||||
SPELL_SPARK_DESPAWN = 52776,
|
DATA_MAX_SPARKS = 5,
|
||||||
|
DATA_MAX_SPARK_DISTANCE = 90, // Distance to boss - prevent runs through the whole instance
|
||||||
//Spark of Ionar
|
DATA_POINT_CALLBACK = 0
|
||||||
SPELL_SPARK_VISUAL_TRIGGER_N = 52667,
|
|
||||||
SPELL_SPARK_VISUAL_TRIGGER_H = 59833,
|
|
||||||
|
|
||||||
NPC_SPARK_OF_IONAR = 28926,
|
|
||||||
|
|
||||||
MAX_SPARKS = 5,
|
|
||||||
MAX_SPARK_DISTANCE = 90, // Distance to boss - prevent runs through the whole instance
|
|
||||||
POINT_CALLBACK = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*######
|
/*######
|
||||||
@@ -60,60 +67,60 @@ enum eEnums
|
|||||||
|
|
||||||
struct boss_ionarAI : public ScriptedAI
|
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;
|
bool bIsSplitPhase;
|
||||||
uint32 m_uiSplitTimer;
|
uint32 uiSplitTimer;
|
||||||
|
|
||||||
uint32 m_uiStaticOverloadTimer;
|
uint32 uiStaticOverloadTimer;
|
||||||
uint32 m_uiBallLightningTimer;
|
uint32 uiBallLightningTimer;
|
||||||
|
|
||||||
uint32 m_uiHealthAmountModifier;
|
uint32 uiHealthAmountModifier;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
m_sparkList.DespawnAll();
|
lSparkList.DespawnAll();
|
||||||
|
|
||||||
m_bIsSplitPhase = true;
|
bIsSplitPhase = true;
|
||||||
m_uiSplitTimer = 25000;
|
uiSplitTimer = 25*IN_MILISECONDS;
|
||||||
|
|
||||||
m_uiStaticOverloadTimer = urand(5000, 6000);
|
uiStaticOverloadTimer = urand(5*IN_MILISECONDS, 6*IN_MILISECONDS);
|
||||||
m_uiBallLightningTimer = urand(10000, 11000);
|
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);
|
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE);
|
||||||
|
|
||||||
if (m_creature->GetVisibility() == VISIBILITY_OFF)
|
if (m_creature->GetVisibility() == VISIBILITY_OFF)
|
||||||
m_creature->SetVisibility(VISIBILITY_ON);
|
m_creature->SetVisibility(VISIBILITY_ON);
|
||||||
|
|
||||||
if (m_pInstance)
|
if (pInstance)
|
||||||
m_pInstance->SetData(TYPE_IONAR, NOT_STARTED);
|
pInstance->SetData(TYPE_IONAR, NOT_STARTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnterCombat(Unit* who)
|
void EnterCombat(Unit* who)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_AGGRO, m_creature);
|
DoScriptText(SAY_AGGRO, m_creature);
|
||||||
|
|
||||||
if (m_pInstance)
|
if (pInstance)
|
||||||
m_pInstance->SetData(TYPE_IONAR, IN_PROGRESS);
|
pInstance->SetData(TYPE_IONAR, IN_PROGRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustDied(Unit* killer)
|
void JustDied(Unit* killer)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_DEATH, m_creature);
|
DoScriptText(SAY_DEATH, m_creature);
|
||||||
|
|
||||||
m_sparkList.DespawnAll();
|
lSparkList.DespawnAll();
|
||||||
|
|
||||||
if (m_pInstance)
|
if (pInstance)
|
||||||
m_pInstance->SetData(TYPE_IONAR, DONE);
|
pInstance->SetData(TYPE_IONAR, DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KilledUnit(Unit *victim)
|
void KilledUnit(Unit *victim)
|
||||||
@@ -125,13 +132,13 @@ struct boss_ionarAI : public ScriptedAI
|
|||||||
void CallBackSparks()
|
void CallBackSparks()
|
||||||
{
|
{
|
||||||
//should never be empty here, but check
|
//should never be empty here, but check
|
||||||
if (m_sparkList.empty())
|
if (lSparkList.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Position pos;
|
Position pos;
|
||||||
m_creature->GetPosition(&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))
|
if (Creature* pSpark = Unit::GetCreature(*m_creature, *itr))
|
||||||
{
|
{
|
||||||
@@ -139,7 +146,7 @@ struct boss_ionarAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
pSpark->SetSpeed(MOVE_RUN, 2.0f);
|
pSpark->SetSpeed(MOVE_RUN, 2.0f);
|
||||||
pSpark->GetMotionMaster()->Clear();
|
pSpark->GetMotionMaster()->Clear();
|
||||||
pSpark->GetMotionMaster()->MovePoint(POINT_CALLBACK, pos);
|
pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pSpark->ForcedDespawn();
|
pSpark->ForcedDespawn();
|
||||||
@@ -157,9 +164,9 @@ struct boss_ionarAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR)
|
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);
|
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
|
||||||
if (pTarget)
|
if (pTarget)
|
||||||
@@ -174,7 +181,7 @@ struct boss_ionarAI : public ScriptedAI
|
|||||||
void SummonedCreatureDespawn(Creature *pSummoned)
|
void SummonedCreatureDespawn(Creature *pSummoned)
|
||||||
{
|
{
|
||||||
if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR)
|
if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR)
|
||||||
m_sparkList.Despawn(pSummoned);
|
lSparkList.Despawn(pSummoned);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 uiDiff)
|
void UpdateAI(const uint32 uiDiff)
|
||||||
@@ -186,59 +193,59 @@ struct boss_ionarAI : public ScriptedAI
|
|||||||
// Splitted
|
// Splitted
|
||||||
if (m_creature->GetVisibility() == VISIBILITY_OFF)
|
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
|
// Return sparks to where Ionar splitted
|
||||||
if (m_bIsSplitPhase)
|
if (bIsSplitPhase)
|
||||||
{
|
{
|
||||||
CallBackSparks();
|
CallBackSparks();
|
||||||
m_bIsSplitPhase = false;
|
bIsSplitPhase = false;
|
||||||
}
|
}
|
||||||
// Lightning effect and restore Ionar
|
// Lightning effect and restore Ionar
|
||||||
else if (m_sparkList.empty())
|
else if (lSparkList.empty())
|
||||||
{
|
{
|
||||||
m_creature->SetVisibility(VISIBILITY_ON);
|
m_creature->SetVisibility(VISIBILITY_ON);
|
||||||
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE);
|
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);
|
DoCast(m_creature, SPELL_SPARK_DESPAWN, false);
|
||||||
|
|
||||||
m_uiSplitTimer = 25000;
|
uiSplitTimer = 25*IN_MILISECONDS;
|
||||||
m_bIsSplitPhase = true;
|
bIsSplitPhase = true;
|
||||||
|
|
||||||
if (m_creature->getVictim())
|
if (m_creature->getVictim())
|
||||||
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
|
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_uiSplitTimer -= uiDiff;
|
uiSplitTimer -= uiDiff;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_uiStaticOverloadTimer <= uiDiff)
|
if (uiStaticOverloadTimer <= uiDiff)
|
||||||
{
|
{
|
||||||
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
|
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
|
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));
|
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_BALL_LIGHTNING, H_SPELL_BALL_LIGHTNING));
|
||||||
m_uiBallLightningTimer = urand(10000, 11000);
|
uiBallLightningTimer = urand(10*IN_MILISECONDS, 11*IN_MILISECONDS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_uiBallLightningTimer -= uiDiff;
|
uiBallLightningTimer -= uiDiff;
|
||||||
|
|
||||||
// Health check
|
// 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);
|
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)
|
if (pCreatureTarget->GetEntry() != NPC_IONAR)
|
||||||
return true;
|
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->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true);
|
||||||
|
|
||||||
pCreatureTarget->AttackStop();
|
pCreatureTarget->AttackStop();
|
||||||
@@ -289,25 +296,25 @@ struct mob_spark_of_ionarAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature)
|
mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature)
|
||||||
{
|
{
|
||||||
m_pInstance = pCreature->GetInstanceData();
|
pInstance = pCreature->GetInstanceData();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptedInstance* m_pInstance;
|
ScriptedInstance* pInstance;
|
||||||
|
|
||||||
uint32 uiCheckTimer;
|
uint32 uiCheckTimer;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
uiCheckTimer = 2000;
|
uiCheckTimer = 2*IN_MILISECONDS;
|
||||||
m_creature->SetReactState(REACT_PASSIVE);
|
m_creature->SetReactState(REACT_PASSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovementInform(uint32 uiType, uint32 uiPointId)
|
void MovementInform(uint32 uiType, uint32 uiPointId)
|
||||||
{
|
{
|
||||||
if (uiType != POINT_MOTION_TYPE || !m_pInstance)
|
if (uiType != POINT_MOTION_TYPE || !pInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (uiPointId == POINT_CALLBACK)
|
if (uiPointId == DATA_POINT_CALLBACK)
|
||||||
m_creature->ForcedDespawn();
|
m_creature->ForcedDespawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +326,7 @@ struct mob_spark_of_ionarAI : public ScriptedAI
|
|||||||
void UpdateAI(const uint32 uiDiff)
|
void UpdateAI(const uint32 uiDiff)
|
||||||
{
|
{
|
||||||
// Despawn if the encounter is not running
|
// 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();
|
m_creature->ForcedDespawn();
|
||||||
return;
|
return;
|
||||||
@@ -328,25 +335,25 @@ struct mob_spark_of_ionarAI : public ScriptedAI
|
|||||||
// Prevent them to follow players through the whole instance
|
// Prevent them to follow players through the whole instance
|
||||||
if (uiCheckTimer <= uiDiff)
|
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 (pIonar && pIonar->isAlive())
|
||||||
{
|
{
|
||||||
if (m_creature->GetDistance(pIonar) > MAX_SPARK_DISTANCE)
|
if (m_creature->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE)
|
||||||
{
|
{
|
||||||
Position pos;
|
Position pos;
|
||||||
pIonar->GetPosition(&pos);
|
pIonar->GetPosition(&pos);
|
||||||
|
|
||||||
m_creature->SetSpeed(MOVE_RUN, 2.0f);
|
m_creature->SetSpeed(MOVE_RUN, 2.0f);
|
||||||
m_creature->GetMotionMaster()->Clear();
|
m_creature->GetMotionMaster()->Clear();
|
||||||
m_creature->GetMotionMaster()->MovePoint(POINT_CALLBACK, pos);
|
m_creature->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_creature->ForcedDespawn();
|
m_creature->ForcedDespawn();
|
||||||
}
|
}
|
||||||
uiCheckTimer = 2000;
|
uiCheckTimer = 2*IN_MILISECONDS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
uiCheckTimer -= uiDiff;
|
uiCheckTimer -= uiDiff;
|
||||||
|
|||||||
Reference in New Issue
Block a user