Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_gyth.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 "blackrock_spire.h"
9
11{
12 SPELL_REND_MOUNTS = 16167, // Change model
13 SPELL_CORROSIVE_ACID = 16359, // Combat (self cast)
14 SPELL_FLAMEBREATH = 16390, // Combat (Self cast)
15 SPELL_FREEZE = 16350, // Combat (Self cast)
16 SPELL_KNOCK_AWAY = 10101, // Combat
17 SPELL_SUMMON_REND = 16328 // Summons Rend near death
18};
19
20enum Misc
21{
22 NEFARIUS_PATH_2 = 1379671,
23 NEFARIUS_PATH_3 = 1379672,
24 GYTH_PATH_1 = 1379681,
25};
26
36
38{
39public:
40 boss_gyth() : CreatureScript("boss_gyth") { }
41
42 struct boss_gythAI : public BossAI
43 {
44 boss_gythAI(Creature* creature) : BossAI(creature, DATA_GYTH) { }
45
47
49 {
50 SummonedRend = false;
51 if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS)
52 {
53 instance->SetBossState(DATA_GYTH, DONE);
54 me->DespawnOrUnsummon();
55 }
56 }
57
58 void EnterCombat(Unit* /*who*/) OVERRIDE
59 {
61
62 events.ScheduleEvent(EVENT_CORROSIVE_ACID, std::rand() % 16000 + 8000);
63 events.ScheduleEvent(EVENT_FREEZE, std::rand() % 16000 + 8000);
64 events.ScheduleEvent(EVENT_FLAME_BREATH, std::rand() % 16000 + 8000);
65 events.ScheduleEvent(EVENT_KNOCK_AWAY, std::rand() % 18000 + 12000);
66 }
67
68 void JustDied(Unit* /*killer*/) OVERRIDE
69 {
70 instance->SetBossState(DATA_GYTH, DONE);
71 }
72
73 void SetData(uint32 /*type*/, uint32 data) OVERRIDE
74 {
75 switch (data)
76 {
77 case 1:
78 events.ScheduleEvent(EVENT_SUMMONED_1, 1000);
79 break;
80 default:
81 break;
82 }
83 }
84
86 {
88 {
90 me->RemoveAura(SPELL_REND_MOUNTS);
91 SummonedRend = true;
92 }
93
94 if (!UpdateVictim())
95 {
96 events.Update(diff);
97
98 while (uint32 eventId = events.ExecuteEvent())
99 {
100 switch (eventId)
101 {
102 case EVENT_SUMMONED_1:
103 me->AddAura(SPELL_REND_MOUNTS, me);
104 if (GameObject* portcullis = me->FindNearestGameObject(GO_DR_PORTCULLIS, 40.0f))
105 portcullis->UseDoorOrButton();
106 if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 75.0f, true))
107 victor->AI()->SetData(1, 1);
108 events.ScheduleEvent(EVENT_SUMMONED_2, 2000);
109 break;
110 case EVENT_SUMMONED_2:
111 me->GetMotionMaster()->MovePath(GYTH_PATH_1, false);
112 break;
113 default:
114 break;
115 }
116 }
117 return;
118 }
119
120 events.Update(diff);
121
122 while (uint32 eventId = events.ExecuteEvent())
123 {
124 switch (eventId)
125 {
128 events.ScheduleEvent(EVENT_CORROSIVE_ACID, std::rand() % 16000 + 10000);
129 break;
130 case EVENT_FREEZE:
132 events.ScheduleEvent(EVENT_FREEZE, std::rand() % 16000 + 10000);
133 break;
136 events.ScheduleEvent(EVENT_FLAME_BREATH, std::rand() % 16000 + 10000);
137 break;
138 case EVENT_KNOCK_AWAY:
140 events.ScheduleEvent(EVENT_KNOCK_AWAY, std::rand() % 20000 + 14000);
141 break;
142 default:
143 break;
144 }
145 }
147 }
148 };
149
151 {
152 return new boss_gythAI(creature);
153 }
154};
155
157{
158 new boss_gyth();
159}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NPC_LORD_VICTOR_NEFARIUS
@ GO_DR_PORTCULLIS
@ DATA_GYTH
void AddSC_boss_gyth()
@ NEFARIUS_PATH_2
Definition boss_gyth.cpp:22
@ GYTH_PATH_1
Definition boss_gyth.cpp:24
@ NEFARIUS_PATH_3
Definition boss_gyth.cpp:23
@ SPELL_REND_MOUNTS
Definition boss_gyth.cpp:12
@ SPELL_SUMMON_REND
Definition boss_gyth.cpp:17
@ SPELL_FREEZE
Definition boss_gyth.cpp:15
@ SPELL_FLAMEBREATH
Definition boss_gyth.cpp:14
@ SPELL_KNOCK_AWAY
Definition boss_gyth.cpp:16
@ SPELL_CORROSIVE_ACID
Definition boss_gyth.cpp:13
@ EVENT_FLAME_BREATH
Definition boss_gyth.cpp:31
@ EVENT_SUMMONED_1
Definition boss_gyth.cpp:33
@ EVENT_KNOCK_AWAY
Definition boss_gyth.cpp:32
@ EVENT_SUMMONED_2
Definition boss_gyth.cpp:34
@ EVENT_FREEZE
Definition boss_gyth.cpp:30
@ EVENT_CORROSIVE_ACID
Definition boss_gyth.cpp:29
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
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
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthBelowPct(uint32 pct) const
void Reset() OVERRIDE
Definition boss_gyth.cpp:48
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Definition boss_gyth.cpp:85
void EnterCombat(Unit *) OVERRIDE
Definition boss_gyth.cpp:58
void SetData(uint32, uint32 data) OVERRIDE
Definition boss_gyth.cpp:73
void JustDied(Unit *) OVERRIDE
Definition boss_gyth.cpp:68
boss_gythAI(Creature *creature)
Definition boss_gyth.cpp:44