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
24 #include "precompiled.h"
29 NPC_RAZZASHI_COBRA
= 11373,
31 SAY_TRANSFORM
= -1309000,
34 SPELL_HOLY_FIRE
= 23860,
35 SPELL_HOLY_WRATH
= 23979,
36 SPELL_VENOMSPIT
= 23862,
37 SPELL_HOLY_NOVA
= 23858,
38 SPELL_POISON_CLOUD
= 23861,
39 SPELL_SNAKE_FORM
= 23849,
41 SPELL_BERSERK
= 23537,
42 SPELL_DISPELL
= 23859,
43 SPELL_PARASITIC
= 23865,
47 struct MANGOS_DLL_DECL boss_venoxisAI
: public ScriptedAI
49 boss_venoxisAI(Creature
* pCreature
) : ScriptedAI(pCreature
)
51 m_pInstance
= (ScriptedInstance
*)pCreature
->GetInstanceData();
52 m_fDefaultSize
= m_creature
->GetFloatValue(OBJECT_FIELD_SCALE_X
);
56 ScriptedInstance
* m_pInstance
;
58 uint32 m_uiHolyFire_Timer
;
59 uint32 m_uiHolyWrath_Timer
;
60 uint32 m_uiVenomSpit_Timer
;
61 uint32 m_uiRenew_Timer
;
62 uint32 m_uiPoisonCloud_Timer
;
63 uint32 m_uiHolyNova_Timer
;
64 uint32 m_uiDispell_Timer
;
65 uint32 m_uiParasitic_Timer
;
66 uint32 m_uiTrash_Timer
;
68 uint8 m_uiTargetsInRangeCount
;
77 m_uiHolyFire_Timer
= 10000;
78 m_uiHolyWrath_Timer
= 60500;
79 m_uiVenomSpit_Timer
= 5500;
80 m_uiRenew_Timer
= 30500;
81 m_uiPoisonCloud_Timer
= 2000;
82 m_uiHolyNova_Timer
= 5000;
83 m_uiDispell_Timer
= 35000;
84 m_uiParasitic_Timer
= 10000;
85 m_uiTrash_Timer
= 5000;
87 m_uiTargetsInRangeCount
= 0;
89 m_creature
->SetFloatValue(OBJECT_FIELD_SCALE_X
, m_fDefaultSize
);
95 void JustReachedHome()
97 std::list
<Creature
*> m_lCobras
;
98 GetCreatureListWithEntryInGrid(m_lCobras
, m_creature
, NPC_RAZZASHI_COBRA
, DEFAULT_VISIBILITY_INSTANCE
);
100 if (m_lCobras
.empty())
101 debug_log("SD2: boss_venoxis, no Cobras with the entry %u were found", NPC_RAZZASHI_COBRA
);
104 for(std::list
<Creature
*>::iterator iter
= m_lCobras
.begin(); iter
!= m_lCobras
.end(); ++iter
)
106 if ((*iter
) && !(*iter
)->isAlive())
112 void JustDied(Unit
* pKiller
)
114 DoScriptText(SAY_DEATH
, m_creature
);
117 m_pInstance
->SetData(TYPE_VENOXIS
, DONE
);
120 void DamageTaken(Unit
* pDoneBy
, uint32
&uiDamage
)
122 if (!m_bPhaseTwo
&& (m_creature
->GetHealth()+uiDamage
)*100 / m_creature
->GetMaxHealth() < 50)
124 DoScriptText(SAY_TRANSFORM
, m_creature
);
126 m_creature
->InterruptNonMeleeSpells(false);
127 DoCastSpellIfCan(m_creature
,SPELL_SNAKE_FORM
);
129 m_creature
->SetFloatValue(OBJECT_FIELD_SCALE_X
, m_fDefaultSize
*2);
130 const CreatureInfo
*cinfo
= m_creature
->GetCreatureInfo();
131 m_creature
->SetBaseWeaponDamage(BASE_ATTACK
, MINDAMAGE
, (cinfo
->mindmg
+((cinfo
->mindmg
/100) * 25)));
132 m_creature
->SetBaseWeaponDamage(BASE_ATTACK
, MAXDAMAGE
, (cinfo
->maxdmg
+((cinfo
->maxdmg
/100) * 25)));
133 m_creature
->UpdateDamagePhysical(BASE_ATTACK
);
138 if (m_bPhaseTwo
&& !m_bInBerserk
&& (m_creature
->GetHealth()+uiDamage
)*100 / m_creature
->GetMaxHealth() < 11)
140 m_creature
->InterruptNonMeleeSpells(false);
141 DoCastSpellIfCan(m_creature
, SPELL_BERSERK
);
146 void UpdateAI(const uint32 uiDiff
)
148 if (!m_creature
->SelectHostileTarget() || !m_creature
->getVictim())
153 if (m_uiDispell_Timer
< uiDiff
)
155 DoCastSpellIfCan(m_creature
, SPELL_DISPELL
);
156 m_uiDispell_Timer
= urand(15000, 30000);
159 m_uiDispell_Timer
-= uiDiff
;
161 if (m_uiRenew_Timer
< uiDiff
)
163 DoCastSpellIfCan(m_creature
, SPELL_RENEW
);
164 m_uiRenew_Timer
= urand(20000, 30000);
167 m_uiRenew_Timer
-= uiDiff
;
169 if (m_uiHolyWrath_Timer
< uiDiff
)
171 DoCastSpellIfCan(m_creature
->getVictim(), SPELL_HOLY_WRATH
);
172 m_uiHolyWrath_Timer
= urand(15000, 25000);
175 m_uiHolyWrath_Timer
-= uiDiff
;
177 if (m_uiHolyNova_Timer
< uiDiff
)
179 m_uiTargetsInRangeCount
= 0;
180 for(uint8 i
= 0; i
< 10; ++i
)
182 if (Unit
* pTarget
= SelectUnit(SELECT_TARGET_TOPAGGRO
,i
))
183 if (m_creature
->IsWithinDistInMap(pTarget
, ATTACK_DISTANCE
))
184 ++m_uiTargetsInRangeCount
;
187 if (m_uiTargetsInRangeCount
> 1)
189 DoCastSpellIfCan(m_creature
->getVictim(),SPELL_HOLY_NOVA
);
190 m_uiHolyNova_Timer
= 1000;
194 m_uiHolyNova_Timer
= 2000;
198 m_uiHolyNova_Timer
-= uiDiff
;
200 if (m_uiHolyFire_Timer
< uiDiff
&& m_uiTargetsInRangeCount
< 3)
202 if (Unit
* pTarget
= SelectUnit(SELECT_TARGET_RANDOM
,0))
203 DoCastSpellIfCan(pTarget
, SPELL_HOLY_FIRE
);
205 m_uiHolyFire_Timer
= 8000;
208 m_uiHolyFire_Timer
-= uiDiff
;
212 if (m_uiPoisonCloud_Timer
< uiDiff
)
214 DoCastSpellIfCan(m_creature
->getVictim(), SPELL_POISON_CLOUD
);
215 m_uiPoisonCloud_Timer
= 15000;
218 m_uiPoisonCloud_Timer
-= uiDiff
;
220 if (m_uiVenomSpit_Timer
< uiDiff
)
222 if (Unit
* pTarget
= SelectUnit(SELECT_TARGET_RANDOM
,0))
223 DoCastSpellIfCan(pTarget
, SPELL_VENOMSPIT
);
225 m_uiVenomSpit_Timer
= urand(15000, 20000);
228 m_uiVenomSpit_Timer
-= uiDiff
;
230 if (m_uiParasitic_Timer
< uiDiff
)
232 if (Unit
* pTarget
= SelectUnit(SELECT_TARGET_RANDOM
,0))
233 DoCastSpellIfCan(pTarget
, SPELL_PARASITIC
);
235 m_uiParasitic_Timer
= 10000;
238 m_uiParasitic_Timer
-= uiDiff
;
241 if (m_uiTrash_Timer
< uiDiff
)
243 DoCastSpellIfCan(m_creature
->getVictim(), SPELL_TRASH
);
244 m_uiTrash_Timer
= urand(10000, 20000);
247 m_uiTrash_Timer
-= uiDiff
;
249 DoMeleeAttackIfReady();
253 CreatureAI
* GetAI_boss_venoxis(Creature
* pCreature
)
255 return new boss_venoxisAI(pCreature
);
258 void AddSC_boss_venoxis()
261 newscript
= new Script
;
262 newscript
->Name
= "boss_venoxis";
263 newscript
->GetAI
= &GetAI_boss_venoxis
;
264 newscript
->RegisterSelf();