Anub'Arak script, by Gyullo

--HG--
branch : trunk
This commit is contained in:
tartalo
2009-10-18 21:57:59 +02:00
parent 59b33475b5
commit 94e0a6bd53
4 changed files with 246 additions and 36 deletions
@@ -18,24 +18,35 @@
/* ScriptData
SDName: boss_anubarak
SDAuthor: LordVanMartin
SD%Complete: 0
SDComment:
SD%Complete: 90 %
SDComment: Says are not implemented.
SDCategory: Azjol Nerub
EndScriptData */
/*** SQL START ***
update creature_template set scriptname = 'boss_anub_arak' where entry = '';
*** SQL END ***/
#include "precompiled.h"
#include "def_azjol_nerub.h"
//Spells
#define SPELL_CARRION_BEETLES 53520
#define SPELL_LOCUST_SWARM 53467
#define SPELL_IMPALE 53454
#define SPELL_POUND 53472
enum
{
SPELL_CARRION_BEETLES = 53520,
SPELL_SUMMON_CARRION_BEETLES = 53521,
SPELL_LEECHING_SWARM = 53467,
SPELL_IMPALE = 53454,
H_SPELL_IMPALE = 59446,
SPELL_POUND = 53472,
H_SPELL_POUND = 59433,
SPELL_SUBMERGE = 53421,
CREATURE_GUARDIAN = 29216,
CREATURE_VENOMANCER = 29217,
CREATURE_DATTER = 29213
};
// not in db
//Yell
@@ -51,44 +62,239 @@ update creature_template set scriptname = 'boss_anub_arak' where entry = '';
#define SAY_SUBMERGE_2 -1601009
#define SAY_DEATH -1601004
#define SPAWNPOINT_Z 224.3
float SpawnPoint[2][2] =
{
{550.7, 282.8},
{551.1, 229.4},
};
struct TRINITY_DLL_DECL boss_anub_arakAI : public ScriptedAI
{
boss_anub_arakAI(Creature *c) : ScriptedAI(c) {}
boss_anub_arakAI(Creature *c) : ScriptedAI(c)
{
pInstance = c->GetInstanceData();
HeroicMode = c->GetMap()->IsHeroic();
}
uint32 phase;
ScriptedInstance* pInstance;
void Reset() {}
void EnterCombat(Unit* who)
bool Channeling;
bool HeroicMode;
bool Summoned_Guardian;
bool Summoned_Venomancer;
bool Summoned_Datter;
uint32 Phase;
uint32 Phase_Time;
uint32 SPELL_CARRION_BEETLES_Timer;
uint32 SPELL_LEECHING_SWARM_Timer;
uint32 SPELL_IMPALE_Timer;
uint32 SPELL_POUND_Timer;
uint32 SPELL_SUBMERGE_Timer;
uint32 UNDERGROUND_Timer;
uint32 VENOMANCER_Timer;
uint32 DATTER_Timer;
void Reset()
{
SPELL_CARRION_BEETLES_Timer = 8000;
SPELL_LEECHING_SWARM_Timer = 20000;
SPELL_IMPALE_Timer = 9000;
SPELL_POUND_Timer = 15000;
Phase = 0;
Phase_Time = 0;
Channeling = false;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveAura(SPELL_SUBMERGE);
}
/* void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
}
void AttackStart(Unit* who) {}
void MoveInLineOfSight(Unit* who) {}
}*/
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
phase =1;
if (Channeling == true)
{
for(int ind = 0 ; ind < 4; ind++) m_creature->CastSpell(m_creature->getVictim(),SPELL_SUMMON_CARRION_BEETLES,true);
Channeling = false;
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 33)
phase = 2;
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 15)
phase = 3;
}
DoMeleeAttackIfReady();
if (Phase == 1)
{
if (SPELL_IMPALE_Timer < diff)
{
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (m_creature->GetMap()->IsHeroic())
{
m_creature->CastSpell(target,H_SPELL_IMPALE,true);
}else{
m_creature->CastSpell(target,SPELL_IMPALE,true);
}
SPELL_IMPALE_Timer = 9000;
}else SPELL_IMPALE_Timer -= diff;
if(!Summoned_Guardian)
{
Creature* Guardian;
for(uint8 i=0; i < 2; ++i)
{
Guardian = m_creature->SummonCreature(CREATURE_GUARDIAN,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Guardian)
{
Guardian->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Guardian);
}
}
Summoned_Guardian = true;
}
if(!Summoned_Venomancer)
{
if(VENOMANCER_Timer < diff)
{
if(Phase_Time > 1)
{
Creature* Venomancer;
for(uint8 i=0; i < 2; ++i)
{
Venomancer = m_creature->SummonCreature(CREATURE_VENOMANCER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Venomancer)
{
Venomancer->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Venomancer);
}
}
Summoned_Venomancer = true;
}
}else VENOMANCER_Timer -= diff;
}
if(!Summoned_Datter)
{
if(DATTER_Timer < diff)
{
if(Phase_Time > 2)
{
Creature* Datter;
for(uint8 i=0; i < 2; ++i)
{
Datter = m_creature->SummonCreature(CREATURE_DATTER,SpawnPoint[i][0],SpawnPoint[i][1],SPAWNPOINT_Z,0,TEMPSUMMON_CORPSE_DESPAWN,0);
if(Datter)
{
Datter->AddThreat(m_creature->getVictim(), 0.0f);
DoZoneInCombat(Datter);
}
}
Summoned_Datter = true;
}
}else DATTER_Timer -= diff;
}
if (UNDERGROUND_Timer < diff)
{
m_creature->RemoveAura(SPELL_SUBMERGE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Phase = 0;
}else UNDERGROUND_Timer -= diff;
}
if (Phase == 0)
{
if (SPELL_LEECHING_SWARM_Timer < diff)
{
m_creature->CastSpell(m_creature,SPELL_LEECHING_SWARM,true);
SPELL_LEECHING_SWARM_Timer = 19000;
}else SPELL_LEECHING_SWARM_Timer -= diff;
if (SPELL_CARRION_BEETLES_Timer < diff)
{
Channeling = true;
m_creature->CastSpell(m_creature->getVictim(),SPELL_CARRION_BEETLES,false);
SPELL_CARRION_BEETLES_Timer = 25000;
}else SPELL_CARRION_BEETLES_Timer -= diff;
if (SPELL_POUND_Timer < diff)
{
DoCast(m_creature->getVictim(), HeroicMode ? H_SPELL_POUND : SPELL_POUND);
SPELL_POUND_Timer = 16500;
}else SPELL_POUND_Timer -= diff;
}
if ((Phase_Time == 0 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 75)
|| (Phase_Time == 1 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50)
|| (Phase_Time == 2 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 25))
{
++Phase_Time;
Summoned_Guardian = false;
Summoned_Venomancer = false;
Summoned_Datter = false;
UNDERGROUND_Timer = 40000;
VENOMANCER_Timer = 25000;
DATTER_Timer = 32000;
m_creature->CastSpell(m_creature,SPELL_SUBMERGE,false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Phase = 1;
}
if (!Phase == 1)
{
DoMeleeAttackIfReady();
}
}
void JustDied(Unit* killer)
/*void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, m_creature);
}
}*/
void KilledUnit(Unit *victim)
{
if (victim == m_creature)
return;
DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature);
/* switch(rand()%3)
{
case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
}*/
}
};
@@ -102,7 +308,7 @@ void AddSC_boss_anub_arak()
Script *newscript;
newscript = new Script;
newscript->Name = "boss_anub_arak";
newscript->Name="boss_anub_arak";
newscript->GetAI = &GetAI_boss_anub_arak;
newscript->RegisterSelf();
}
@@ -269,6 +269,7 @@ extern void AddSC_boss_eck();
extern void AddSC_instance_gundrak();
extern void AddSC_boss_krik_thir(); //Azjol-Nerub
extern void AddSC_boss_hadronox();
extern void AddSC_boss_anub_arak();
extern void AddSC_instance_azjol_nerub();
extern void AddSC_instance_ahnkahet(); //Azjol-Nerub Ahn'kahet
extern void AddSC_boss_amanitar();
@@ -707,6 +708,7 @@ void AddScripts()
AddSC_instance_ahnkahet();
AddSC_boss_krik_thir(); //Azjol-Nerub Azjol-Nerub
AddSC_boss_hadronox();
AddSC_boss_anub_arak();
AddSC_instance_azjol_nerub();
AddSC_boss_anubrekhan(); //Naxxramas
AddSC_boss_maexxna();