#include "../../sc_defines.h"
//Majordomo Spell
#define SPELL_MAGICREFLECTION 20619
#define SPELL_DAMAGEREFLECTION 21075
#define SPELL_SPAWNRAGNA 19774
#define SPELL_VISUALTELEPORT 19484
//Ragnaros Spell
#define SPELL_HANDOFRAGNAROS 19780
#define SPELL_WRATHOFRAGNAROS 20566
#define SPELL_LAVABURST 21158
#define SPELL_ONESHOTMAJORDOMO 20566
#define SPELL_MAGMABURST 20565 //Ranged attack
#define SPELL_SONSOFFLAME_DUMMY 21108 //Server side effect
#define SPELL_RAGSUBMERGE 21107 //Stealth aura
#define SPELL_RAGEMERGE 20568 //Remove RagSubmerge aura with spawn animation
// Add Elite Spell
#define SPELL_FIRE_BLAST 25028
// Add Priest Spell
#define SPELL_SHADOWBOLT 24668
#define SPELL_DOT 23952
#define SPELL_INSTANT_HEAL 25807
// Spell Common
#define SPELL_AEGIS 20620
#define SPELL_BLASTWAVE 20229
//Majordomo Say
#define SAY_AGGRO "Reckless mortals, none may challenge the sons of the living flame!"
#define SOUND_AGGRO 8035
#define SAY_SPAWN "The runes of warding have been destroyed! Hunt down the infedels my bretheren."
#define SOUND_SPAWN 8039
#define SAY_DEFEAT "Impossible! Stay your attack mortals! I submitt! I submitt! Brashly you have come to rest the secrets of the living flame. You will soon regret the recklessness of your quest. I go now to summon the lord whos house this is. Should you seek an audiance with him your paltry lives will surly be forfit. Nevertheless seek out his lair if you dare!"
#define SOUND_DEFEAT 8038
#define SAY_KILL "Ashes to Ashes!"
#define SOUND_KILL 8037
#define SAY_SPECIAL "Burn mortals! Burn for this transgression!"
#define SOUND_SPECIAL 8036
#define SAY_SUMMON "Behold Ragnaros, the Firelord! He who was ancient when this world was young! Bow before him, mortals! Bow before your ending!"
#define SOUND_SUMMON 8040
#define SAY_ARRIVAL_2 "These mortal infidels, my lord! They have invaded your sanctum, and seek to steal your secrets!"
#define SOUND_ARRIVAL_2 8041
//Ragnaros Say
#define SAY_ARRIVAL_1 "TOO SOON! YOU HAVE AWAKENED ME TOO SOON, EXECUTUS! WHAT IS THE MEANING OF THIS INTRUSION?"
#define SAY_ARRIVAL_3 "FOOL! YOU ALLOWED THESE INSECTS TO RUN RAMPANT THROUGH THE HALLOWED CORE, AND NOW YOU LEAD THEM TO MY VERY LAIR? YOU HAVE FAILED ME, EXECUTUS! JUSTICE SHALL BE MET, INDEED!"
#define SAY_ARRIVAL_5 "NOW FOR YOU, INSECTS. BOLDLY YOU SAUGHT THE POWER OF RAGNAROS NOW YOU SHALL SEE IT FIRST HAND."
#define SAY_REINFORCEMENTS1 "COME FORTH, MY SERVANTS! DEFEND YOUR MASTER!"
#define SAY_REINFORCEMENTS2 "YOU CANNOT DEFEAT THE LIVING FLAME! COME YOU MINIONS OF FIRE! COME FORTH YOU CREATURES OF HATE! YOUR MASTER CALLS!"
#define SAY_HAND "BY FIRE BE PURGED!"
#define SAY_WRATH "TASTE THE FLAMES OF SULFURON!"
#define SAY_KILL2 "DIE INSECT!"
#define SAY_MAGMABURST "MY PATIENCE IS DWINDILING! COME NATS TO YOUR DEATH!"
#define SOUND_ARRIVAL_1 8043
#define SOUND_ARRIVAL_3 8044
#define SOUND_ARRIVAL_5 8045
#define SOUND_REINFORCEMENTS1 8049
#define SOUND_REINFORCEMENTS2 8050
#define SOUND_HAND 8046
#define SOUND_WRATH 8047
#define SOUND_KILL2 8051
#define SOUND_MAGMABURST 8048
//Majordomo Gossip
#define GOSSIP_ITEM "Summon Ragnaros!" // Not the real gossip
//Common variables
uint32 SpeachTimer;
uint32 SpeachNum;
uint32 Priestkilled;
uint32 Elitekilled;
uint32 MCBossesKilled;
// Target_domo; dunno how to target domo
bool Domodanger;
bool DoingSpeach;
Unit *PlayerHolder;
//Majordomo IA
struct MANGOS_DLL_DECL boss_majordomoAI : public ScriptedAI
{
boss_majordomoAI(Creature *c) : ScriptedAI(c) {Reset();friendly = false;}
uint32 MagicReflection_Timer;
uint32 DamageReflection_Timer;
uint32 Blastwave_Timer;
uint32 Teleport_timer;
uint32 position;
uint32 teleported;
bool friendly;
bool InCombat;
void Reset()
{
MagicReflection_Timer = 60000; //Damage reflection first so we alternate
DamageReflection_Timer = 30000;
Blastwave_Timer = 10000;
Priestkilled = 0;
Elitekilled = 0;
InCombat = false;
if (friendly == false)
{
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93873'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93872'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93871'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93795'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93874'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93875'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93790'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93789'");
Priestkilled = 0;
Elitekilled = 0;
}
if (m_creature)
EnterEvadeMode();
}
void BeginSpeach(Unit* target)
{
//Stand up and begin speach
PlayerHolder = target;
//14 seconds before he finish to cast spawn spell
DoCast(m_creature,SPELL_SPAWNRAGNA);
SpeachTimer = 14000;
DoingSpeach = true;
}
void KilledUnit(Unit* victim)
{
if (rand()%5)
return;
DoYell(SAY_KILL,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_KILL);
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (m_creature->getVictim() == NULL && who->isTargetableForAttack() && who!= m_creature)
{
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
//Say our dialog
if (!InCombat)
{
DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_AGGRO);
InCombat = true;
}
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDist(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE)
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
if (!InCombat)
{
DoYell(SAY_AGGRO,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_AGGRO);
InCombat = true;
}
DoStartMeleeAttack(who);
}
}
}
void UpdateAI(const uint32 diff)
{
//Special Timer before teleportation
if (friendly == true && teleported == 0)
{
Teleport_timer -= diff;
}
if (Priestkilled > 2 && Elitekilled < 2)
{
/* Insert into database creature respawn time 1 second to respawn death priest */
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93874'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93875'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93790'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93789'");
Priestkilled = 0;
}
if (Priestkilled < 2 && Elitekilled > 2)
{
/* Insert into database creature respawn time 1 second to respawn death elite */
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93873'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93872'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93871'");
sDatabase.PExecute("UPDATE `creature_respawn` SET respawntime = '1' WHERE guid = '93795'");
Elitekilled = 0;
}
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40 && friendly == false)
{
DoCast(m_creature,SPELL_INSTANT_HEAL);
// Domodanger = true;
}
if (Priestkilled == 4 && Elitekilled == 4 && friendly == false)
{
m_creature->setFaction(1080);
DoYell(SAY_DEFEAT,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_DEFEAT);
Teleport_timer = 32000;
friendly = true;
teleported = 0;
Reset();
}
if (Teleport_timer < diff && friendly == true && teleported == 0)
{
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 65);
DoCast(m_creature,SPELL_VISUALTELEPORT);
teleported = 1;
}
if (teleported == 1)
{
m_creature->SetMapId(409);
m_creature->Relocate(829,-815,-228);
teleported = 2;
}
if (DoingSpeach)
if (SpeachTimer < diff)
{
switch (SpeachNum)
{
case 0:
//8 seconds before ragna emerge
DoPlaySoundToSet(m_creature,SOUND_SUMMON);
DoYell(SAY_SUMMON,LANG_UNIVERSAL,NULL);
SpeachTimer = 8000;
SpeachNum++;
break;
case 3:
//12 seconds till next line
DoPlaySoundToSet(m_creature,SOUND_ARRIVAL_2);
DoYell(SAY_ARRIVAL_2,LANG_UNIVERSAL,NULL);
SpeachTimer = 12000;
SpeachNum++;
break;
case 5:
//8 seconds till next line
m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_STATE_DEAD);
m_creature->setDeathState(DEAD);
SpeachTimer = 8000;
SpeachNum++;
break;
default:
break;
}
}
//If we had a target and it wasn't cleared then it means the player died from some unknown soruce
//But we still need to reset
if (InCombat && !m_creature->SelectHostilTarget())
{
Reset();
return;
}
//Check if we have a current target
if( m_creature->getVictim() && m_creature->isAlive())
{
//MagicReflection_Timer
if (MagicReflection_Timer < diff)
{
//Cast NYI in core
//DoCast(m_creature,SPELL_MAGICREFLECTION);
//60 seconds until we should cast this agian
MagicReflection_Timer = 60000;
}else MagicReflection_Timer -= diff;
//DamageReflection_Timer
if (DamageReflection_Timer < diff)
{
//Cast NYI in core
//DoCast(m_creature,SPELL_DAMAGEREFLECTION);
//60 seconds until we should cast this agian
DamageReflection_Timer = 60000;
}else DamageReflection_Timer -= diff;
//Blastwave_Timer
if (Blastwave_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_BLASTWAVE);
//10 seconds until we should cast this agian
Blastwave_Timer = 10000;
}else Blastwave_Timer -= diff;
//If we are within range melee the target
if( m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DIST))
{
//Make sure our attack is ready and we arn't currently casting
if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
}
};
void SendDefaultMenu_boss_majordomo(Player *player, Creature *_Creature, uint32 action)
{
if (action == GOSSIP_ACTION_INFO_DEF + 1)//Summon time
{
player->PlayerTalkClass->CloseGossip();
((boss_majordomoAI&)_Creature->AI()).BeginSpeach((Unit*)player);
}
}
bool GossipSelect_boss_majordomo(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
if (sender == GOSSIP_SENDER_MAIN)
SendDefaultMenu_boss_majordomo(player, _Creature, action);
return true;
}
bool GossipHello_boss_majordomo(Player *player, Creature *_Creature)
{
player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->PlayerTalkClass->SendGossipMenu(907,_Creature->GetGUID()); //We need the real gossip menu of majordomo but it's database related just correct when it is added
return true;
}
CreatureAI* GetAI_boss_majordomo(Creature *_Creature)
{
return new boss_majordomoAI (_Creature);
}
void AddSC_boss_majordomo()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_majordomo";
newscript->GetAI = GetAI_boss_majordomo;
newscript->pGossipHello = &GossipHello_boss_majordomo;
newscript->pGossipSelect = &GossipSelect_boss_majordomo;
m_scripts[nrscripts++] = newscript;
}
//Ragnaros IA
struct MANGOS_DLL_DECL boss_ragnarosAI : public ScriptedAI
{
boss_ragnarosAI(Creature *c) : ScriptedAI(c) {Reset();IsSubmerged = false;}
uint32 WrathOfRagnaros_Timer;
uint32 HandOfRagnaros_Timer;
uint32 LavaBurst_Timer;
uint32 MagmaBurst_Timer;
uint32 Submerge_Timer;
bool HasYelledMagmaBurst;
bool HasSubmergedOnce;
bool InCombat;
bool IsEmerged;
bool IsSubmerged;
void Reset()
{
WrathOfRagnaros_Timer = 30000;
HandOfRagnaros_Timer = 25000;
LavaBurst_Timer = 10000;
MagmaBurst_Timer = 12000;
Submerge_Timer = 180000;
HasYelledMagmaBurst = false;
HasSubmergedOnce = false;
InCombat = false;
Submerge_Timer = 180000;
if (!IsSubmerged)
{
DoCast(m_creature, SPELL_RAGSUBMERGE);
m_creature->setFaction(1080);
IsSubmerged = true;
IsEmerged = false;
}
if (m_creature)
EnterEvadeMode();
}
void KilledUnit(Unit* victim)
{
if (rand()%5)
return;
DoYell(SAY_KILL, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(m_creature, SOUND_KILL);
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (m_creature->getVictim() == NULL && who->isTargetableForAttack() && who!= m_creature)
{
//Begin ranged attack because Ragnaros is rooted at all times
DoStartRangedAttack(who);
InCombat = true;
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDist(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE)
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
//Begin ranged attack because Ragnaros is rooted at all times
DoStartRangedAttack(who);
//Say our dialog on initial aggro
if (!InCombat)
{
DoYell(SAY_ARRIVAL_5,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_ARRIVAL_5);
InCombat = true;
}
}
}
}
void UpdateAI(const uint32 diff)
{
if (!IsSubmerged)
{
DoCast(m_creature, SPELL_RAGSUBMERGE);
m_creature->setFaction(1080);
IsSubmerged = true;
IsEmerged = false;
}
//Speach
if (DoingSpeach)
if (SpeachTimer < diff)
{
switch (SpeachNum)
{
case 1:
DoCast(m_creature, SPELL_RAGEMERGE);
SpeachTimer = 7000;
SpeachNum++;
break;
case 2:
//12 seconds till next line
DoPlaySoundToSet(m_creature,SOUND_ARRIVAL_1);
DoYell(SAY_ARRIVAL_1,LANG_UNIVERSAL,NULL);
SpeachTimer = 12000;
SpeachNum++;
break;
case 4:
//17 seconds till next line
DoPlaySoundToSet(m_creature,SOUND_ARRIVAL_3);
DoYell(SAY_ARRIVAL_3,LANG_UNIVERSAL,NULL);
SpeachTimer = 17000;
SpeachNum++;
break;
case 6:
//change his faction for killing majordomo
m_creature->setFaction(91);
if (PlayerHolder)
{
DoCast(m_creature,SPELL_ONESHOTMAJORDOMO);
}
SpeachTimer = 1000;
SpeachNum++;
break;
case 7:
//reset his faction for the speach
m_creature->setFaction(1080);
DoPlaySoundToSet(m_creature,SOUND_ARRIVAL_5);
DoYell(SAY_ARRIVAL_5,LANG_UNIVERSAL,NULL);
SpeachTimer = 4000;
SpeachNum++;
break;
case 8:
//he become aggressive and fight start
m_creature->setFaction(91);
if (PlayerHolder)
{
DoStartMeleeAttack(PlayerHolder);
}
SpeachTimer = 0;
DoingSpeach = false;
break;
default :
break;
}
}else SpeachTimer -= diff;
//If we had a target and it wasn't cleared then it means the target died from some unknown soruce
//But we still need to reset
if (InCombat && !m_creature->SelectHostilTarget())
{
Reset();
return;
}
//Check if we have a current target
if( m_creature->getVictim() && m_creature->isAlive())
{
//WrathOfRagnaros_Timer
if (WrathOfRagnaros_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_WRATHOFRAGNAROS);
if (rand()%2 == 0)
{
//Say our dialog
DoYell(SAY_WRATH,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_WRATH);
}
//60 seconds until we should cast this agian
WrathOfRagnaros_Timer = 30000;
}else WrathOfRagnaros_Timer -= diff;
//HandOfRagnaros_Timer
if (HandOfRagnaros_Timer < diff)
{
//Cast
DoCast(m_creature,SPELL_HANDOFRAGNAROS);
if (rand()%2==0)
{
//Say our dialog
DoYell(SAY_HAND,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_HAND);
}
//60 seconds until we should cast this agian
HandOfRagnaros_Timer = 25000;
}else HandOfRagnaros_Timer -= diff;
//LavaBurst_Timer
if (LavaBurst_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_LAVABURST);
//10 seconds until we should cast this agian
LavaBurst_Timer = 10000;
}else LavaBurst_Timer -= diff;
//Submerge_Timer
if (Submerge_Timer < diff)
{
//Creature spawning and ragnaros becomming unattackable
//is not very well supported in the core
//so for now we are just going to yell some lines
if (!HasSubmergedOnce)
{
//Say our dialog
DoYell(SAY_REINFORCEMENTS1,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_REINFORCEMENTS1);
HasSubmergedOnce = true;
}else
{
//Say our dialog
DoYell(SAY_REINFORCEMENTS2,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_REINFORCEMENTS2);
}
//3 minutes until we should cast this agian
Submerge_Timer = 180000;
}else Submerge_Timer -= diff;
//If we are within range melee the target
if( m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DIST))
{
//Make sure our attack is ready and we arn't currently casting
if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}else
{
//MagmaBurst_Timer
if (MagmaBurst_Timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_MAGMABURST);
if (!HasYelledMagmaBurst)
{
//Say our dialog
DoYell(SAY_MAGMABURST,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_MAGMABURST);
HasYelledMagmaBurst = true;
}
//8 seconds until we should cast this agian
MagmaBurst_Timer = 8000;
}else MagmaBurst_Timer -= diff;
}
}
}
};
CreatureAI* GetAI_boss_ragnaros(Creature *_Creature)
{
return new boss_ragnarosAI (_Creature);
}
void AddSC_boss_ragnaros()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_ragnaros";
newscript->GetAI = GetAI_boss_ragnaros;
m_scripts[nrscripts++] = newscript;
}
// **** This script is still under Developement ****
struct MANGOS_DLL_DECL priest_domoAI : public ScriptedAI
{
priest_domoAI(Creature *c) : ScriptedAI(c) {Reset();}
uint32 Dot_timer;
uint32 Shadowbolt_timer;
uint32 Aegis_timer;
bool InCombat;
void Reset()
{
Dot_timer = 15000;
Shadowbolt_timer = 45000;
Aegis_timer = 140000;
InCombat = false;
if (m_creature)
EnterEvadeMode();
}
void JustDied(Unit* Killer)
{
Priestkilled++;
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (m_creature->getVictim() == NULL && who->isTargetableForAttack() && who!= m_creature)
{
DoStartMeleeAttack(who);
InCombat = true;
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDist(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE)
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
}
void UpdateAI(const uint32 diff)
{
//If we had a target and it wasn't cleared then it means the target died from some unknown soruce
//But we still need to reset
if (InCombat && !m_creature->SelectHostilTarget())
{
Reset();
return;
}
//Check if we have a current target
if( m_creature->getVictim() && m_creature->isAlive())
{
/* if (Domodanger == true)
{
DoCast(Target_domo,SPELL_INSTANT_HEAL);
Domodanger == false;
}
*/
//Dot timer
if (Dot_timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_DOT);
//45 seconds until we should cast this agian
Dot_timer = 15000;
}else Dot_timer -= diff;
//Dot timer
if (Shadowbolt_timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_SHADOWBOLT);
//45 seconds until we should cast this agian
Shadowbolt_timer = 45000;
}else Shadowbolt_timer -= diff;
//Aegis timer
if (Aegis_timer < diff)
{
//Cast
DoCast(m_creature,SPELL_AEGIS);
//140 seconds until we should cast this again
Aegis_timer = 140000;
}else Aegis_timer < diff;
//If we are within range melee the target
if( m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DIST))
{
//Make sure our attack is ready and we arn't currently casting
if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
}
};
CreatureAI* GetAI_priest_domo(Creature *_Creature)
{
return new priest_domoAI (_Creature);
}
void AddSC_priest_domo()
{
Script *newscript;
newscript = new Script;
newscript->Name="priest_domo";
newscript->GetAI = GetAI_priest_domo;
m_scripts[nrscripts++] = newscript;
}
// Add elite
struct MANGOS_DLL_DECL elite_domoAI : public ScriptedAI
{
elite_domoAI(Creature *c) : ScriptedAI(c) {Reset();}
uint32 Blastweave_timer;
uint32 Fireblast_timer;
uint32 Aegis_timer;
bool InCombat;
void Reset()
{
Blastweave_timer = 35000;
Fireblast_timer = 45000;
Aegis_timer = 140000;
InCombat = false;
if (m_creature)
EnterEvadeMode();
}
void JustDied(Unit* Killer)
{
Elitekilled++;
}
void AttackStart(Unit *who)
{
if (!who)
return;
if (m_creature->getVictim() == NULL && who->isTargetableForAttack() && who!= m_creature)
{
DoStartMeleeAttack(who);
InCombat = true;
}
}
void MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
return;
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
{
float attackRadius = m_creature->GetAttackDistance(who);
if (m_creature->IsWithinDist(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE)
{
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
//Begin melee attack if we are within range
DoStartMeleeAttack(who);
InCombat = true;
}
}
}
void UpdateAI(const uint32 diff)
{
//If we had a target and it wasn't cleared then it means the target died from some unknown soruce
//But we still need to reset
if (InCombat && !m_creature->SelectHostilTarget())
{
Reset();
return;
}
//Check if we have a current target
if( m_creature->getVictim() && m_creature->isAlive())
{
//Blastweave_Timer
if (Blastweave_timer < diff)
{
//Cast
DoCast(m_creature,SPELL_BLASTWAVE);
//35 seconds until we should cast this agian
Blastweave_timer = 35000;
}else Blastweave_timer -= diff;
//Fireblast_Timer
if (Fireblast_timer < diff)
{
//Cast
DoCast(m_creature->getVictim(),SPELL_FIRE_BLAST);
//45 seconds until we should cast this agian
Fireblast_timer = 45000;
}else Fireblast_timer -= diff;
//Aegis_Timer
if (Aegis_timer < diff)
{
//Cast
DoCast(m_creature,SPELL_AEGIS);
//140 seconds until we should cast this agian
Aegis_timer = 140000;
}else Aegis_timer -= diff;
//If we are within range melee the target
if( m_creature->IsWithinDist(m_creature->getVictim(), ATTACK_DIST))
{
//Make sure our attack is ready and we arn't currently casting
if( m_creature->isAttackReady() && !m_creature->m_currentSpell)
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
}
}
}
}
};
CreatureAI* GetAI_elite_domo(Creature *_Creature)
{
return new elite_domoAI (_Creature);
}
void AddSC_elite_domo()
{
Script *newscript;
newscript = new Script;
newscript->Name="elite_domo";
newscript->GetAI = GetAI_elite_domo;
m_scripts[nrscripts++] = newscript;
}