Small cleanup in boss Ouro script.
[scriptdev2-git.git] / scripts / eastern_kingdoms / zulgurub / boss_grilek.cpp
blob4807d45c4597b01f653d74a101b60d919eecc368
1 /* Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 /* ScriptData
18 SDName: Boss_Grilek
19 SD%Complete: 100
20 SDComment:
21 SDCategory: Zul'Gurub
22 EndScriptData */
24 #include "precompiled.h"
25 #include "zulgurub.h"
27 #define SPELL_AVARTAR 24646 //The Enrage Spell
28 #define SPELL_GROUNDTREMOR 6524
30 struct MANGOS_DLL_DECL boss_grilekAI : public ScriptedAI
32 boss_grilekAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
34 uint32 Avartar_Timer;
35 uint32 GroundTremor_Timer;
37 void Reset()
39 Avartar_Timer = urand(15000, 25000);
40 GroundTremor_Timer = urand(8000, 16000);
43 void UpdateAI(const uint32 diff)
45 //Return since we have no target
46 if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
47 return;
49 //Avartar_Timer
50 if (Avartar_Timer < diff)
53 DoCastSpellIfCan(m_creature, SPELL_AVARTAR);
54 Unit* target = NULL;
56 target = SelectUnit(SELECT_TARGET_RANDOM,1);
58 if (m_creature->getThreatManager().getThreat(m_creature->getVictim()))
59 m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-50);
60 if (target)
61 AttackStart(target);
63 Avartar_Timer = urand(25000, 35000);
64 }else Avartar_Timer -= diff;
66 //GroundTremor_Timer
67 if (GroundTremor_Timer < diff)
69 DoCastSpellIfCan(m_creature->getVictim(), SPELL_GROUNDTREMOR);
70 GroundTremor_Timer = urand(12000, 16000);
71 }else GroundTremor_Timer -= diff;
73 DoMeleeAttackIfReady();
76 CreatureAI* GetAI_boss_grilek(Creature* pCreature)
78 return new boss_grilekAI(pCreature);
81 void AddSC_boss_grilek()
83 Script *newscript;
84 newscript = new Script;
85 newscript->Name = "boss_grilek";
86 newscript->GetAI = &GetAI_boss_grilek;
87 newscript->RegisterSelf();