Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_mograine_and_whitemane.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss_Mograine_And_Whitemane
8SD%Complete: 90
9SDComment:
10SDCategory: Scarlet Monastery
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "scarlet_monastery.h"
16#include "SpellInfo.h"
17
18enum Says
19{
20 //Mograine says
24
25 //Whitemane says
29};
30
32{
33 //Mograine Spells
38
39 //Whitemanes Spells
44 SPELL_HEAL = 12039,
46};
47
49{
50public:
51 boss_scarlet_commander_mograine() : CreatureScript("boss_scarlet_commander_mograine") { }
52
54 {
55 return new boss_scarlet_commander_mograineAI(creature);
56 }
57
59 {
61 {
62 instance = creature->GetInstanceScript();
63 }
64
66
69
71 bool _bHeal;
73
75 {
78
79 //Incase wipe during phase that mograine fake death
82 me->SetStandState(UNIT_STAND_STATE_STAND);
83
84 if (instance)
85 if (me->IsAlive())
87
88 _bHasDied = false;
89 _bHeal = false;
90 _bFakeDeath = false;
91 }
92
94 {
95 if (instance)
96 {
99 }
100 }
101
102 void EnterCombat(Unit* /*who*/) OVERRIDE
103 {
106
107 me->CallForHelp(VISIBLE_RANGE);
108 }
109
110 void KilledUnit(Unit* /*victim*/) OVERRIDE
111 {
113 }
114
115 void DamageTaken(Unit* /*doneBy*/, uint32 &damage) OVERRIDE
116 {
117 if (damage < me->GetHealth() || _bHasDied || _bFakeDeath)
118 return;
119
120 if (!instance)
121 return;
122
123 //On first death, fake death and open door, as well as initiate whitemane if exist
124 if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
125 {
127
128 Whitemane->GetMotionMaster()->MovePoint(1, 1163.113370f, 1398.856812f, 32.527786f);
129
130 me->GetMotionMaster()->MovementExpired();
131 me->GetMotionMaster()->MoveIdle();
132
133 me->SetHealth(0);
134
135 if (me->IsNonMeleeSpellCasted(false))
136 me->InterruptNonMeleeSpells(false);
137
138 me->ClearComboPointHolders();
139 me->RemoveAllAuras();
140 me->ClearAllReactives();
141
143 me->SetStandState(UNIT_STAND_STATE_DEAD);
144
145 _bHasDied = true;
146 _bFakeDeath = true;
147
148 damage = 0;
149 }
150 }
151
152 void SpellHit(Unit* /*who*/, const SpellInfo* spell) OVERRIDE
153 {
154 //When hit with ressurection say text
155 if (spell->Id == SPELL_SCARLETRESURRECTION)
156 {
158 _bFakeDeath = false;
159
160 if (instance)
162 }
163 }
164
166 {
167 if (!UpdateVictim())
168 return;
169
171 {
172 //On ressurection, stop fake death and heal whitemane and resume fight
173 if (Unit* Whitemane = Unit::GetUnit(*me, instance->GetData64(DATA_WHITEMANE)))
174 {
176 me->SetStandState(UNIT_STAND_STATE_STAND);
177 DoCast(Whitemane, SPELL_LAYONHANDS);
178
179 CrusaderStrike_Timer = 10000;
180 HammerOfJustice_Timer = 10000;
181
182 if (me->GetVictim())
183 me->GetMotionMaster()->MoveChase(me->GetVictim());
184
185 _bHeal = true;
186 }
187 }
188
189 //This if-check to make sure mograine does not attack while fake death
190 if (_bFakeDeath)
191 return;
192
193 //CrusaderStrike_Timer
194 if (CrusaderStrike_Timer <= diff)
195 {
197 CrusaderStrike_Timer = 10000;
198 }
199 else CrusaderStrike_Timer -= diff;
200
201 //HammerOfJustice_Timer
202 if (HammerOfJustice_Timer <= diff)
203 {
205 HammerOfJustice_Timer = 60000;
206 }
207 else HammerOfJustice_Timer -= diff;
208
210 }
211 };
212};
213
215{
216public:
217 boss_high_inquisitor_whitemane() : CreatureScript("boss_high_inquisitor_whitemane") { }
218
220 {
221 return new boss_high_inquisitor_whitemaneAI(creature);
222 }
223
225 {
227 {
228 instance = creature->GetInstanceScript();
229 }
230
232
237
240
242 {
243 Wait_Timer = 7000;
244 Heal_Timer = 10000;
245 PowerWordShield_Timer = 15000;
246 HolySmite_Timer = 6000;
247
248 _bCanResurrectCheck = false;
249 _bCanResurrect = false;
250
251 if (instance)
252 if (me->IsAlive())
254 }
255
257 {
259 return;
260
262 }
263
264 void EnterCombat(Unit* /*who*/) OVERRIDE
265 {
267 }
268
269 void KilledUnit(Unit* /*victim*/) OVERRIDE
270 {
272 }
273
274 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
275 {
276 if (!_bCanResurrectCheck && damage >= me->GetHealth())
277 damage = me->GetHealth() - 1;
278 }
279
281 {
282 if (!UpdateVictim())
283 return;
284
285 if (_bCanResurrect)
286 {
287 //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out
288 if (instance && Wait_Timer <= diff)
289 {
290 if (Unit* Mograine = Unit::GetUnit(*me, instance->GetData64(DATA_MOGRAINE)))
291 {
294 _bCanResurrect = false;
295 }
296 }
297 else Wait_Timer -= diff;
298 }
299
300 //Cast Deep sleep when health is less than 50%
302 {
303 if (me->IsNonMeleeSpellCasted(false))
304 me->InterruptNonMeleeSpells(false);
305
307 _bCanResurrectCheck = true;
308 _bCanResurrect = true;
309 return;
310 }
311
312 //while in "resurrect-mode", don't do anything
313 if (_bCanResurrect)
314 return;
315
316 //If we are <75% hp cast healing spells at self or Mograine
317 if (Heal_Timer <= diff)
318 {
319 Creature* target = NULL;
320
321 if (!HealthAbovePct(75))
322 target = me;
323
324 if (instance)
325 {
327 {
328 // checking _bCanResurrectCheck prevents her healing Mograine while he is "faking death"
329 if (_bCanResurrectCheck && mograine->IsAlive() && !mograine->HealthAbovePct(75))
330 target = mograine;
331 }
332 }
333
334 if (target)
335 DoCast(target, SPELL_HEAL);
336
337 Heal_Timer = 13000;
338 }
339 else Heal_Timer -= diff;
340
341 //PowerWordShield_Timer
342 if (PowerWordShield_Timer <= diff)
343 {
345 PowerWordShield_Timer = 15000;
346 }
347 else PowerWordShield_Timer -= diff;
348
349 //HolySmite_Timer
350 if (HolySmite_Timer <= diff)
351 {
353 HolySmite_Timer = 6000;
354 }
355 else HolySmite_Timer -= diff;
356
358 }
359 };
360};
361
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ FAIL
@ SPECIAL
@ NOT_STARTED
#define VISIBLE_RANGE
Definition ScriptMgr.h:56
@ UNIT_STAND_STATE_DEAD
Definition Unit.h:169
@ UNIT_STAND_STATE_STAND
Definition Unit.h:162
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ UNIT_FIELD_FLAGS
void AddSC_boss_mograine_and_whitemane()
@ SPELL_HAMMEROFJUSTICE
mograine
Definition chapter5.cpp:15
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_MOGRAINE
@ DATA_WHITEMANE
@ TYPE_MOGRAINE_AND_WHITE_EVENT
Creature * me
bool HealthAbovePct(uint32 pct) const
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================