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
20 SDComment: Problem in finding the right flying batriders for spawning and making them fly.
24 #include "precompiled.h"
27 #define SAY_AGGRO -1309002
28 #define SAY_RAIN_FIRE -1309003
29 #define SAY_DEATH -1309004
31 #define SPELL_CHARGE 22911
32 #define SPELL_SONICBURST 23918
33 #define SPELL_SCREECH 6605
34 #define SPELL_SHADOW_WORD_PAIN 23952
35 #define SPELL_MIND_FLAY 23953
36 #define SPELL_CHAIN_MIND_FLAY 26044 //Right ID unknown. So disabled
37 #define SPELL_GREATERHEAL 23954
38 #define SPELL_BAT_FORM 23966
41 #define SPELL_BOMB 40332 //Wrong ID but Magmadars bomb is not working...
43 struct MANGOS_DLL_DECL boss_jeklikAI
: public ScriptedAI
45 boss_jeklikAI(Creature
* pCreature
) : ScriptedAI(pCreature
)
47 m_pInstance
= (ScriptedInstance
*)pCreature
->GetInstanceData();
51 ScriptedInstance
* m_pInstance
;
54 uint32 SonicBurst_Timer
;
56 uint32 SpawnBats_Timer
;
57 uint32 ShadowWordPain_Timer
;
58 uint32 MindFlay_Timer
;
59 uint32 ChainMindFlay_Timer
;
60 uint32 GreaterHeal_Timer
;
61 uint32 SpawnFlyingBats_Timer
;
68 SonicBurst_Timer
= 8000;
69 Screech_Timer
= 13000;
70 SpawnBats_Timer
= 60000;
71 ShadowWordPain_Timer
= 6000;
72 MindFlay_Timer
= 11000;
73 ChainMindFlay_Timer
= 26000;
74 GreaterHeal_Timer
= 50000;
75 SpawnFlyingBats_Timer
= 10000;
82 DoScriptText(SAY_AGGRO
, m_creature
);
83 DoCastSpellIfCan(m_creature
,SPELL_BAT_FORM
);
86 void JustDied(Unit
* Killer
)
88 DoScriptText(SAY_DEATH
, m_creature
);
91 m_pInstance
->SetData(TYPE_JEKLIK
, DONE
);
94 void UpdateAI(const uint32 diff
)
96 if (!m_creature
->SelectHostileTarget() || !m_creature
->getVictim())
99 if (m_creature
->GetHealthPercent() > 50.0f
)
101 if (Charge_Timer
< diff
)
103 if (Unit
* target
= SelectUnit(SELECT_TARGET_RANDOM
,0))
104 DoCastSpellIfCan(target
,SPELL_CHARGE
);
106 Charge_Timer
= urand(15000, 30000);
107 }else Charge_Timer
-= diff
;
109 if (SonicBurst_Timer
< diff
)
111 DoCastSpellIfCan(m_creature
->getVictim(),SPELL_SONICBURST
);
112 SonicBurst_Timer
= urand(8000, 13000);
113 }else SonicBurst_Timer
-= diff
;
115 if (Screech_Timer
< diff
)
117 DoCastSpellIfCan(m_creature
->getVictim(),SPELL_SCREECH
);
118 Screech_Timer
= urand(18000, 26000);
119 }else Screech_Timer
-= diff
;
121 if (SpawnBats_Timer
< diff
)
123 Unit
* target
= SelectUnit(SELECT_TARGET_RANDOM
,0);
125 Creature
* Bat
= NULL
;
126 Bat
= m_creature
->SummonCreature(11368, -12291.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
127 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
129 Bat
= m_creature
->SummonCreature(11368, -12289.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
130 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
132 Bat
= m_creature
->SummonCreature(11368, -12293.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
133 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
135 Bat
= m_creature
->SummonCreature(11368, -12291.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
136 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
138 Bat
= m_creature
->SummonCreature(11368, -12289.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
139 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
141 Bat
= m_creature
->SummonCreature(11368, -12293.6220f
, -1380.2640f
, 144.8304f
, 5.483f
, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
142 if (target
&& Bat
) Bat
->AI()->AttackStart(target
);
144 SpawnBats_Timer
= 60000;
145 }else SpawnBats_Timer
-= diff
;
151 if (PhaseTwo
&& ShadowWordPain_Timer
< diff
)
153 if (Unit
* target
= SelectUnit(SELECT_TARGET_RANDOM
,0))
155 DoCastSpellIfCan(target
, SPELL_SHADOW_WORD_PAIN
);
156 ShadowWordPain_Timer
= urand(12000, 18000);
158 }ShadowWordPain_Timer
-=diff
;
160 if (MindFlay_Timer
< diff
)
162 DoCastSpellIfCan(m_creature
->getVictim(), SPELL_MIND_FLAY
);
163 MindFlay_Timer
= 16000;
164 }MindFlay_Timer
-=diff
;
166 if (ChainMindFlay_Timer
< diff
)
168 m_creature
->InterruptNonMeleeSpells(false);
169 DoCastSpellIfCan(m_creature
->getVictim(), SPELL_CHAIN_MIND_FLAY
);
170 ChainMindFlay_Timer
= urand(15000, 30000);
171 }ChainMindFlay_Timer
-=diff
;
173 if (GreaterHeal_Timer
< diff
)
175 m_creature
->InterruptNonMeleeSpells(false);
176 DoCastSpellIfCan(m_creature
,SPELL_GREATERHEAL
);
177 GreaterHeal_Timer
= urand(25000, 35000);
178 }GreaterHeal_Timer
-=diff
;
180 if (SpawnFlyingBats_Timer
< diff
)
182 Unit
*target
= SelectUnit(SELECT_TARGET_RANDOM
, 0);
184 Creature
* FlyingBat
= m_creature
->SummonCreature(14965, target
->GetPositionX(), target
->GetPositionY(), target
->GetPositionZ()+15, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
, 15000);
188 FlyingBat
->AI()->AttackStart(target
);
191 SpawnFlyingBats_Timer
= urand(10000, 15000);
192 } else SpawnFlyingBats_Timer
-=diff
;
196 m_creature
->SetDisplayId(15219);
202 DoMeleeAttackIfReady();
207 struct MANGOS_DLL_DECL mob_batriderAI
: public ScriptedAI
209 mob_batriderAI(Creature
* pCreature
) : ScriptedAI(pCreature
)
211 m_pInstance
= (ScriptedInstance
*)pCreature
->GetInstanceData();
215 ScriptedInstance
* m_pInstance
;
225 m_creature
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_NOT_SELECTABLE
);
228 void UpdateAI (const uint32 diff
)
230 if (!m_creature
->SelectHostileTarget() || !m_creature
->getVictim())
234 if (Bomb_Timer
< diff
)
236 if (Unit
*target
= SelectUnit(SELECT_TARGET_RANDOM
, 0))
238 DoCastSpellIfCan(target
, SPELL_BOMB
);
241 }else Bomb_Timer
-= diff
;
244 if (Check_Timer
< diff
)
248 if (m_pInstance
->GetData(TYPE_JEKLIK
) == DONE
)
250 m_creature
->setDeathState(JUST_DIED
);
251 m_creature
->RemoveCorpse();
256 }else Check_Timer
-= diff
;
258 DoMeleeAttackIfReady();
262 CreatureAI
* GetAI_boss_jeklik(Creature
* pCreature
)
264 return new boss_jeklikAI(pCreature
);
267 CreatureAI
* GetAI_mob_batrider(Creature
* pCreature
)
269 return new mob_batriderAI(pCreature
);
272 void AddSC_boss_jeklik()
275 newscript
= new Script
;
276 newscript
->Name
= "boss_jeklik";
277 newscript
->GetAI
= &GetAI_boss_jeklik
;
278 newscript
->RegisterSelf();
280 newscript
= new Script
;
281 newscript
->Name
= "mob_batrider";
282 newscript
->GetAI
= &GetAI_mob_batrider
;
283 newscript
->RegisterSelf();