Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_warlord_najentus.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_Warlord_Najentus
8SD%Complete: 95
9SDComment:
10SDCategory: Black Temple
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "black_temple.h"
16#include "Player.h"
17#include "SpellInfo.h"
18
28
39
41{
43};
44
53
54enum Misc
55{
58};
59
61{
62public:
63 boss_najentus() : CreatureScript("boss_najentus") { }
64
66 {
67 boss_najentusAI(Creature* creature) : ScriptedAI(creature)
68 {
69 instance = creature->GetInstanceScript();
71 }
72
74 {
75 events.Reset();
76
78
79 if (instance)
81 }
82
83 void KilledUnit(Unit* /*victim*/) OVERRIDE
84 {
86 events.DelayEvents(5000, GCD_YELL);
87 }
88
89 void JustDied(Unit* /*killer*/) OVERRIDE
90 {
91 if (instance)
93
95 }
96
97 void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE
98 {
99 if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
100 {
101 me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
103 ResetTimer();
104 }
105 }
106
107 void EnterCombat(Unit* /*who*/) OVERRIDE
108 {
109 if (instance)
111
114 events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
115 events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL);
116 ResetTimer();
117 }
118
120 {
121 if (!SpineTargetGUID)
122 return false;
123
125 if (target && target->HasAura(SPELL_IMPALING_SPINE))
128 return true;
129 }
130
131 void ResetTimer(uint32 inc = 0)
132 {
133 events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
134 events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
135 events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
136 }
137
139 {
140 if (!UpdateVictim())
141 return;
142
143 events.Update(diff);
144
145 while (uint32 eventId = events.ExecuteEvent())
146 {
147 switch (eventId)
148 {
149 case EVENT_SHIELD:
151 ResetTimer(45000);
152 break;
153 case EVENT_BERSERK:
155 DoCast(me, SPELL_BERSERK, true);
156 events.DelayEvents(15000, GCD_YELL);
157 break;
158 case EVENT_SPINE:
159 {
161 if (!target) target = me->GetVictim();
162 if (target)
163 {
164 DoCast(target, SPELL_IMPALING_SPINE, true);
165 SpineTargetGUID = target->GetGUID();
166 //must let target summon, otherwise you cannot click the spine
167 target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
169 events.DelayEvents(1500, GCD_CAST);
170 events.DelayEvents(15000, GCD_YELL);
171 }
172 events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
173 return;
174 }
175 case EVENT_NEEDLE:
176 {
177 //DoCast(me, SPELL_NEEDLE_SPINE, true);
178 std::list<Unit*> targets;
179 SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
180 for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
181 DoCast(*i, 39835, true);
182 events.ScheduleEvent(EVENT_NEEDLE, std::rand() % 25000 + 15000, GCD_CAST);
183 events.DelayEvents(1500, GCD_CAST);
184 return;
185 }
186 case EVENT_YELL:
188 events.ScheduleEvent(EVENT_YELL, std::rand() % 100000 + 25000, GCD_YELL);
189 events.DelayEvents(15000, GCD_YELL);
190 break;
191 }
192 }
193
195 }
196 private:
199
201 };
202
204 {
205 return new boss_najentusAI(creature);
206 }
207};
208
210{
211public:
212 go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
213
215 {
216 if (InstanceScript* instance = go->GetInstanceScript())
217 if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_HIGH_WARLORD_NAJENTUS)))
218 if (CAST_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
219 {
220 player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
221 go->Delete();
222 }
223 return true;
224 }
225};
226
228{
229 new boss_najentus();
230 new go_najentus_spine();
231}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define CAST_AI(a, b)
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ DATA_HIGH_WARLORD_NAJENTUS
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SAY_ENRAGE
#define SPELL_BERSERK
@ EVENT_BERSERK
@ SPELL_IMPALING_SPINE
@ SPELL_NEEDLE_SPINE
@ SPELL_CREATE_NAJENTUS_SPINE
@ SPELL_TIDAL_SHIELD
@ SPELL_TIDAL_BURST
void AddSC_boss_najentus()
#define GCD_CAST
Definition chapter1.cpp:23
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
GameObjectScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
uint64 GetGUID() const
Definition Object.h:119
void SelectTargetList(std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:71
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
Definition Unit.h:1367
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition Object.cpp:2729
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, GameObject *go) OVERRIDE
float GetPositionZ() const
Definition Object.h:330
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE