Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_novos.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 "SpellScript.h"
8#include "ScriptedCreature.h"
9#include "drak_tharon_keep.h"
10
20
38
48
53
61
62#define MAX_Y_COORD_OH_NOVOS -771.95f
63
65{
66public:
67 boss_novos() : CreatureScript("boss_novos") { }
68
69 struct boss_novosAI : public BossAI
70 {
71 boss_novosAI(Creature* creature) : BossAI(creature, DATA_NOVOS) { }
72
74 {
75 _Reset();
76
77 _ohNovos = true;
79 SetCrystalsStatus(false);
80 SetSummonerStatus(false);
81 SetBubbled(false);
82 }
83
84 void EnterCombat(Unit* /* victim */) OVERRIDE
85 {
88
91 SetBubbled(true);
92 }
93
95 {
96 if (!target)
97 return;
98
99 if (me->Attack(target, true))
100 DoStartNoMovement(target);
101 }
102
104 {
105 if (who->GetTypeId() == TypeID::TYPEID_PLAYER)
106 Talk(SAY_KILL);
107 }
108
109 void JustDied(Unit* /*killer*/) OVERRIDE
110 {
111 _JustDied();
113 }
114
116 {
117 if (!UpdateVictim() || _bubbled)
118 return;
119
120 events.Update(diff);
121
122 if (me->HasUnitState(UNIT_STATE_CASTING))
123 return;
124
125 if (uint32 eventId = events.ExecuteEvent())
126 {
127 switch (eventId)
128 {
131 events.ScheduleEvent(EVENT_SUMMON_MINIONS, 15000);
132 break;
133 case EVENT_ATTACK:
136 events.ScheduleEvent(EVENT_ATTACK, 3000);
137 break;
138 default:
139 break;
140 }
141 }
142 }
143
145 {
146 if (action == ACTION_CRYSTAL_HANDLER_DIED)
148 }
149
151 {
153
154 if (!_ohNovos || !who || who->GetTypeId() != TypeID::TYPEID_UNIT || who->GetPositionY() > MAX_Y_COORD_OH_NOVOS)
155 return;
156
157 uint32 entry = who->GetEntry();
158 if (entry == NPC_HULKING_CORPSE || entry == NPC_RISEN_SHADOWCASTER || entry == NPC_FETID_TROLL_CORPSE)
159 _ohNovos = false;
160 }
161
163 {
164 return type == DATA_NOVOS_ACHIEV && _ohNovos ? 1 : 0;
165 }
166
168 {
169 summons.Summon(summon);
170 }
171
172 private:
173 void SetBubbled(bool state)
174 {
175 _bubbled = state;
176 if (!state)
177 {
182 if (me->HasUnitState(UNIT_STATE_CASTING))
183 me->CastStop();
184 }
185 else
186 {
192 }
193 }
194
195 void SetSummonerStatus(bool active)
196 {
197 for (uint8 i = 0; i < 4; i++)
198 if (uint64 guid = instance->GetData64(summoners[i].data))
199 if (Creature* crystalChannelTarget = instance->instance->GetCreature(guid))
200 {
201 if (active)
202 crystalChannelTarget->AI()->SetData(summoners[i].spell, summoners[i].timer);
203 else
204 crystalChannelTarget->AI()->Reset();
205 }
206 }
207
208 void SetCrystalsStatus(bool active)
209 {
210 for (uint8 i = 0; i < 4; i++)
211 if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
212 if (GameObject* crystal = instance->instance->GetGameObject(guid))
213 SetCrystalStatus(crystal, active);
214 }
215
216 void SetCrystalStatus(GameObject* crystal, bool active)
217 {
219 if (Creature* crystalChannelTarget = crystal->FindNearestCreature(NPC_CRYSTAL_CHANNEL_TARGET, 5.0f))
220 {
221 if (active)
222 crystalChannelTarget->AI()->DoCastAOE(SPELL_BEAM_CHANNEL);
223 else if (crystalChannelTarget->HasUnitState(UNIT_STATE_CASTING))
224 crystalChannelTarget->CastStop();
225 }
226 }
227
229 {
230 for (uint8 i = 0; i < 4; i++)
231 if (uint64 guid = instance->GetData64(DATA_NOVOS_CRYSTAL_1 + i))
232 if (GameObject* crystal = instance->instance->GetGameObject(guid))
233 if (crystal->GetGoState() == GOState::GO_STATE_ACTIVE)
234 {
235 SetCrystalStatus(crystal, false);
236 break;
237 }
238
239 if (++_crystalHandlerCount >= 4)
240 {
242 SetSummonerStatus(false);
243 SetBubbled(false);
244 events.ScheduleEvent(EVENT_ATTACK, 3000);
245 if (IsHeroic())
246 events.ScheduleEvent(EVENT_SUMMON_MINIONS, 15000);
247 }
248 else if (uint64 guid = instance->GetData64(DATA_NOVOS_SUMMONER_4))
249 if (Creature* crystalChannelTarget = instance->instance->GetCreature(guid))
250 crystalChannelTarget->AI()->SetData(SPELL_SUMMON_CRYSTAL_HANDLER, 15000);
251 }
252
256 };
257
259 {
260 return GetDrakTharonKeepAI<boss_novosAI>(creature);
261 }
262};
263
265{
266public:
267 npc_crystal_channel_target() : CreatureScript("npc_crystal_channel_target") { }
268
270 {
272
274 {
275 _spell = 0;
276 _timer = 0;
277 _temp = 0;
278 }
279
281 {
282 if (_spell)
283 {
284 if (_temp <= diff)
285 {
286 DoCast(_spell);
287 _temp = _timer;
288 }
289 else
290 _temp -= diff;
291 }
292 }
293
295 {
296 _spell = id;
297 _timer = value;
298 _temp = value;
299 }
300
302 {
303 if (InstanceScript* instance = me->GetInstanceScript())
304 if (uint64 guid = instance->GetData64(DATA_NOVOS))
305 if (Creature* novos = Creature::GetCreature(*me, guid))
306 novos->AI()->JustSummoned(summon);
307
308 if (summon)
309 summon->GetMotionMaster()->MovePath(summon->GetEntry() * 100, false);
310
312 Reset();
313 }
314
315 private:
319 };
320
322 {
324 }
325};
326
328{
329public:
330 achievement_oh_novos() : AchievementCriteriaScript("achievement_oh_novos") { }
331
332 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
333 {
334 return target && target->GetTypeId() == TypeID::TYPEID_UNIT && target->ToCreature()->AI()->GetData(DATA_NOVOS_ACHIEV);
335 }
336};
337
339{
340 public:
341 spell_novos_summon_minions() : SpellScriptLoader("spell_novos_summon_minions") { }
342
344 {
346
347 bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
348 {
349 if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_COPY_OF_MINIONS))
350 return false;
351 return true;
352 }
353
354 void HandleScript(SpellEffIndex /*effIndex*/)
355 {
356 for (uint8 i = 0; i < 2; ++i)
358 }
359
364 };
365
370};
371
const T & RAND(const T &v1, const T &v2)
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ GO_STATE_ACTIVE
Definition GameObject.h:576
@ GO_STATE_READY
Definition GameObject.h:577
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_UNIT
Definition Object.h:54
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define sSpellMgr
Definition SpellMgr.h:744
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ 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_FROSTBOLT
@ SPELL_ARCANE_BLAST
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ EVENT_SUMMON_MINIONS
@ EVENT_ATTACK
@ ACTION_DEACTIVATE
@ ACTION_ACTIVATE_CRYSTAL
@ ACTION_RESET_CRYSTALS
@ DATA_NOVOS_ACHIEV
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_ARCANE_FIELD
@ EMOTE_SUMMONING_ADDS
@ SAY_SUMMONING_ADDS
@ SPELL_FROSTBOLT
@ SPELL_SUMMON_CRYSTAL_HANDLER
@ SPELL_SUMMON_FETID_TROLL_CORPSE
@ SPELL_ARCANE_FIELD
@ SPELL_BLIZZARD
@ SPELL_BEAM_CHANNEL
@ SPELL_SUMMON_RISEN_SHADOWCASTER
@ SPELL_SUMMON_COPY_OF_MINIONS
@ SPELL_SUMMON_MINIONS
@ SPELL_ARCANE_BLAST
@ SPELL_WRATH_OF_MISERY
@ SPELL_SUMMON_HULKING_CORPSE
const SummonerInfo summoners[]
#define MAX_Y_COORD_OH_NOVOS
void AddSC_boss_novos()
AchievementCriteriaScript(const char *name)
InstanceScript *const instance
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void SetGoState(GOState state)
HookList< EffectHandler > OnEffectHitTarget
Unit * GetCaster()
SpellScriptLoader(const char *name)
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 CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2801
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareSpellScript(spell_novos_summon_minions_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
AI * GetDrakTharonKeepAI(Creature *creature)
@ NPC_RISEN_SHADOWCASTER
@ NPC_CRYSTAL_CHANNEL_TARGET
@ NPC_HULKING_CORPSE
@ NPC_FETID_TROLL_CORPSE
@ DATA_NOVOS_SUMMONER_4
@ DATA_NOVOS_SUMMONER_3
@ DATA_NOVOS_SUMMONER_1
@ DATA_NOVOS_SUMMONER_2
@ DATA_NOVOS
@ ACTION_CRYSTAL_HANDLER_DIED
@ DATA_NOVOS_CRYSTAL_1
bool IsHeroic() const
void DoStartNoMovement(Unit *target)
Creature * me
ScriptedAI(Creature *creature)
uint32 GetData(uint32 type) const OVERRIDE
void Reset() OVERRIDE
void SetCrystalStatus(GameObject *crystal, bool active)
void SetCrystalsStatus(bool active)
void EnterCombat(Unit *) OVERRIDE
void KilledUnit(Unit *who) OVERRIDE
void AttackStart(Unit *target) OVERRIDE
void JustDied(Unit *) OVERRIDE
void SetBubbled(bool state)
void DoAction(int32 action) OVERRIDE
void SetSummonerStatus(bool active)
void MoveInLineOfSight(Unit *who) OVERRIDE
boss_novosAI(Creature *creature)
void JustSummoned(Creature *summon) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetData(uint32 id, uint32 value) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================