Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_moragg.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#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "violet_hold.h"
9
10//Spells
16
18{
19public:
20 boss_moragg() : CreatureScript("boss_moragg") { }
21
23 {
24 return new boss_moraggAI(creature);
25 }
26
27 struct boss_moraggAI : public ScriptedAI
28 {
29 boss_moraggAI(Creature* creature) : ScriptedAI(creature)
30 {
31 instance = creature->GetInstanceScript();
32 }
33
36
38
40 {
41 uiOpticLinkTimer = 10000;
43
44 if (instance)
45 {
46 if (instance->GetData(DATA_WAVE_COUNT) == 6)
48 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
50 }
51 }
52
53 void EnterCombat(Unit* /*who*/) OVERRIDE
54 {
55 if (instance)
56 {
57 if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_MORAGG_CELL)))
58 if (pDoor->GetGoState() == GOState::GO_STATE_READY)
59 {
61 return;
62 }
63 if (instance->GetData(DATA_WAVE_COUNT) == 6)
65 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
67 }
68 }
69
71 {
73 return;
74
75 if (me->Attack(who, true))
76 {
77 me->AddThreat(who, 0.0f);
78 me->SetInCombatWith(who);
79 who->SetInCombatWith(me);
80 DoStartMovement(who);
81 }
82 }
83
84 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
85
86
88 {
89 //Return since we have no target
90 if (!UpdateVictim())
91 return;
92
93 if (uiOpticLinkTimer <= diff)
94 {
95 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
96 DoCast(target, SPELL_OPTIC_LINK);
97 uiOpticLinkTimer = 15000;
98 } else uiOpticLinkTimer -= diff;
99
100 if (uiCorrosiveSalivaTimer <= diff)
101 {
104 } else uiCorrosiveSalivaTimer -= diff;
105
107 }
108 void JustDied(Unit* /*killer*/) OVERRIDE
109 {
110 if (instance)
111 {
112 if (instance->GetData(DATA_WAVE_COUNT) == 6)
113 {
115 instance->SetData(DATA_WAVE_COUNT, 7);
116 }
117 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
118 {
120 instance->SetData(DATA_WAVE_COUNT, 13);
121 }
122 }
123 }
124 };
125};
126
128{
129 new boss_moragg();
130}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GO_STATE_READY
Definition GameObject.h:577
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ SPELL_OPTIC_LINK
@ SPELL_CORROSIVE_SALIVA
void AddSC_boss_moragg()
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_WAVE_COUNT
Creature * me
ScriptedAI(Creature *creature)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
boss_moraggAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void AttackStart(Unit *who) OVERRIDE
void MoveInLineOfSight(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
InstanceScript * instance
@ DATA_MORAGG_CELL
Definition violet_hold.h:40
@ DATA_1ST_BOSS_EVENT
Definition violet_hold.h:11
@ DATA_2ND_BOSS_EVENT
Definition violet_hold.h:12