TrinityCore
boss_gyth.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "blackrock_spire.h"
20#include "GameObject.h"
21#include "InstanceScript.h"
22#include "MotionMaster.h"
23#include "ScriptedCreature.h"
24
26{
27 SPELL_REND_MOUNTS = 16167, // Change model
28 SPELL_CORROSIVE_ACID = 16359, // Combat (self cast)
29 SPELL_FLAMEBREATH = 16390, // Combat (Self cast)
30 SPELL_FREEZE = 16350, // Combat (Self cast)
31 SPELL_KNOCK_AWAY = 10101, // Combat
32 SPELL_SUMMON_REND = 16328 // Summons Rend near death
33};
34
35enum Misc
36{
37 NEFARIUS_PATH_2 = 1379671,
38 NEFARIUS_PATH_3 = 1379672,
39 GYTH_PATH_1 = 11037448,
40};
41
43{
50};
51
52struct boss_gyth : public BossAI
53{
54 boss_gyth(Creature* creature) : BossAI(creature, DATA_GYTH)
55 {
56 Initialize();
57 }
58
60 {
61 SummonedRend = false;
62 }
63
65
66 void Reset() override
67 {
68 Initialize();
70 {
73 }
74 }
75
76 void JustEngagedWith(Unit* who) override
77 {
79
84 }
85
86 void JustDied(Unit* /*killer*/) override
87 {
89 }
90
91 void SetData(uint32 /*type*/, uint32 data) override
92 {
93 switch (data)
94 {
95 case 1:
97 break;
98 default:
99 break;
100 }
101 }
102
103 void UpdateAI(uint32 diff) override
104 {
105
106 if (!SummonedRend && HealthBelowPct(5))
107 {
110 SummonedRend = true;
111 }
112
113 if (!UpdateVictim())
114 {
115 events.Update(diff);
116
117 while (uint32 eventId = events.ExecuteEvent())
118 {
119 switch (eventId)
120 {
121 case EVENT_SUMMONED_1:
123 if (GameObject* portcullis = me->FindNearestGameObject(GO_DR_PORTCULLIS, 40.0f))
124 portcullis->UseDoorOrButton();
125 if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 75.0f, true))
126 victor->AI()->SetData(1, 1);
128 break;
129 case EVENT_SUMMONED_2:
131 break;
132 default:
133 break;
134 }
135 }
136 return;
137 }
138
139 events.Update(diff);
140
142 return;
143
144 while (uint32 eventId = events.ExecuteEvent())
145 {
146 switch (eventId)
147 {
151 break;
152 case EVENT_FREEZE:
155 break;
159 break;
160 case EVENT_KNOCK_AWAY:
163 break;
164 default:
165 break;
166 }
167
169 return;
170 }
171 }
172};
173
175{
177}
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
Spells
Definition: PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackrockSpireCreatureAI(ai_name)
@ GO_DR_PORTCULLIS
@ NPC_LORD_VICTOR_NEFARIUS
@ DATA_GYTH
void AddSC_boss_gyth()
Definition: boss_gyth.cpp:174
@ NEFARIUS_PATH_2
Definition: boss_gyth.cpp:37
@ GYTH_PATH_1
Definition: boss_gyth.cpp:39
@ NEFARIUS_PATH_3
Definition: boss_gyth.cpp:38
@ SPELL_REND_MOUNTS
Definition: boss_gyth.cpp:27
@ SPELL_SUMMON_REND
Definition: boss_gyth.cpp:32
@ SPELL_FREEZE
Definition: boss_gyth.cpp:30
@ SPELL_FLAMEBREATH
Definition: boss_gyth.cpp:29
@ SPELL_KNOCK_AWAY
Definition: boss_gyth.cpp:31
@ SPELL_CORROSIVE_ACID
Definition: boss_gyth.cpp:28
@ EVENT_FLAME_BREATH
Definition: boss_gyth.cpp:46
@ EVENT_SUMMONED_1
Definition: boss_gyth.cpp:48
@ EVENT_KNOCK_AWAY
Definition: boss_gyth.cpp:47
@ EVENT_SUMMONED_2
Definition: boss_gyth.cpp:49
@ EVENT_FREEZE
Definition: boss_gyth.cpp:45
@ EVENT_CORROSIVE_ACID
Definition: boss_gyth.cpp:44
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
virtual bool SetBossState(uint32 id, EncounterState state)
EncounterState GetBossState(uint32 id) const
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, bool generatePath=true)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Definition: Object.cpp:2170
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool HealthBelowPct(uint32 pct) const
boss_gyth(Creature *creature)
Definition: boss_gyth.cpp:54
void JustDied(Unit *) override
Definition: boss_gyth.cpp:86
void SetData(uint32, uint32 data) override
Definition: boss_gyth.cpp:91
void JustEngagedWith(Unit *who) override
Definition: boss_gyth.cpp:76
void UpdateAI(uint32 diff) override
Definition: boss_gyth.cpp:103
bool SummonedRend
Definition: boss_gyth.cpp:64
void Initialize()
Definition: boss_gyth.cpp:59
void Reset() override
Definition: boss_gyth.cpp:66