forked from insider42/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboss_taerar.cpp
More file actions
262 lines (220 loc) · 7.72 KB
/
boss_taerar.cpp
File metadata and controls
262 lines (220 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/* Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Taerar
SD%Complete: 70
SDComment: Mark of Nature & Teleport NYI. Fix the way to be banished.
SDCategory: Bosses
EndScriptData */
#include "precompiled.h"
enum
{
SAY_AGGRO = -1000399,
SAY_SUMMONSHADE = -1000400,
//Spells of Taerar
SPELL_SLEEP = 24777,
SPELL_NOXIOUSBREATH = 24818,
SPELL_TAILSWEEP = 15847,
// SPELL_MARKOFNATURE = 25040, // Not working
SPELL_ARCANEBLAST = 24857,
SPELL_BELLOWINGROAR = 22686,
SPELL_SUMMONSHADE_1 = 24841,
SPELL_SUMMONSHADE_2 = 24842,
SPELL_SUMMONSHADE_3 = 24843,
//Spells of Shades of Taerar
SPELL_POSIONCLOUD = 24840,
SPELL_POSIONBREATH = 20667
};
uint32 m_auiSpellSummonShade[]=
{
SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3
};
struct MANGOS_DLL_DECL boss_taerarAI : public ScriptedAI
{
boss_taerarAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
uint32 m_uiSleep_Timer;
uint32 m_uiNoxiousBreath_Timer;
uint32 m_uiTailSweep_Timer;
//uint32 m_uiMarkOfNature_Timer;
uint32 m_uiArcaneBlast_Timer;
uint32 m_uiBellowingRoar_Timer;
uint32 m_uiShades_Timer;
uint32 m_uiShadesSummoned;
bool m_bShades;
void Reset()
{
m_uiSleep_Timer = urand(15000, 20000);
m_uiNoxiousBreath_Timer = 8000;
m_uiTailSweep_Timer = 4000;
//m_uiMarkOfNature_Timer = 45000;
m_uiArcaneBlast_Timer = 12000;
m_uiBellowingRoar_Timer = 30000;
m_uiShades_Timer = 60000; //The time that Taerar is banished
m_uiShadesSummoned = 0;
m_bShades = false;
}
void Aggro(Unit* pWho)
{
DoScriptText(SAY_AGGRO, m_creature);
}
void JustSummoned(Creature* pSummoned)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
pSummoned->AI()->AttackStart(pTarget);
}
void UpdateAI(const uint32 uiDiff)
{
if (m_bShades && m_uiShades_Timer < uiDiff)
{
//Become unbanished again
m_creature->setFaction(14);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_bShades = false;
}
else if (m_bShades)
{
m_uiShades_Timer -= uiDiff;
//Do nothing while banished
return;
}
//Return since we have no target
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
//Sleep_Timer
if (m_uiSleep_Timer < uiDiff)
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
DoCastSpellIfCan(pTarget, SPELL_SLEEP);
m_uiSleep_Timer = urand(8000, 15000);
}
else
m_uiSleep_Timer -= uiDiff;
//NoxiousBreath_Timer
if (m_uiNoxiousBreath_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_NOXIOUSBREATH);
m_uiNoxiousBreath_Timer = urand(14000, 20000);
}
else
m_uiNoxiousBreath_Timer -= uiDiff;
//Tailsweep every 2 seconds
if (m_uiTailSweep_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_TAILSWEEP);
m_uiTailSweep_Timer = 2000;
}
else
m_uiTailSweep_Timer -= uiDiff;
//MarkOfNature_Timer
//if (m_uiMarkOfNature_Timer < uiDiff)
//{
// DoCastSpellIfCan(m_creature->getVictim(), SPELL_MARKOFNATURE);
// m_uiMarkOfNature_Timer = 45000;
//}
//else
//m_uiMarkOfNature_Timer -= uiDiff;
//ArcaneBlast_Timer
if (m_uiArcaneBlast_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANEBLAST);
m_uiArcaneBlast_Timer = urand(7000, 12000);
}
else
m_uiArcaneBlast_Timer -= uiDiff;
//BellowingRoar_Timer
if (m_uiBellowingRoar_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_BELLOWINGROAR);
m_uiBellowingRoar_Timer = urand(20000, 30000);
}
else
m_uiBellowingRoar_Timer -= uiDiff;
//Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again)
if (!m_bShades && m_creature->GetHealthPercent() < float(100 - 25*m_uiShadesSummoned))
{
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
{
//Inturrupt any spell casting
m_creature->InterruptNonMeleeSpells(false);
//horrible workaround, need to fix
m_creature->setFaction(35);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoScriptText(SAY_SUMMONSHADE, m_creature);
int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32);
for(int i = 0; i < iSize; ++i)
m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true);
++m_uiShadesSummoned; // prevent casting twice at same health
m_bShades = true;
}
m_uiShades_Timer = 60000;
}
DoMeleeAttackIfReady();
}
};
// Shades of Taerar Script
struct MANGOS_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI
{
boss_shadeoftaerarAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
uint32 m_uiPoisonCloud_Timer;
uint32 m_uiPosionBreath_Timer;
void Reset()
{
m_uiPoisonCloud_Timer = 8000;
m_uiPosionBreath_Timer = 12000;
}
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
//PoisonCloud_Timer
if (m_uiPoisonCloud_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_POSIONCLOUD);
m_uiPoisonCloud_Timer = 30000;
}
else
m_uiPoisonCloud_Timer -= uiDiff;
//PosionBreath_Timer
if (m_uiPosionBreath_Timer < uiDiff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_POSIONBREATH);
m_uiPosionBreath_Timer = 12000;
}
else
m_uiPosionBreath_Timer -= uiDiff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_taerar(Creature* pCreature)
{
return new boss_taerarAI(pCreature);
}
CreatureAI* GetAI_boss_shadeoftaerar(Creature* pCreature)
{
return new boss_shadeoftaerarAI(pCreature);
}
void AddSC_boss_taerar()
{
Script *newscript;
newscript = new Script;
newscript->Name = "boss_taerar";
newscript->GetAI = &GetAI_boss_taerar;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "boss_shade_of_taerar";
newscript->GetAI = &GetAI_boss_shadeoftaerar;
newscript->RegisterSelf();
}