TrinityCore
Loading...
Searching...
No Matches
boss_grandmaster_vorpil.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 "Containers.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "ScriptedCreature.h"
24#include "shadow_labyrinth.h"
25
35
66
75
80
81// 18732 - Grandmaster Vorpil
83{
85
103
104 void KilledUnit(Unit* who) override
105 {
106 if (who->GetTypeId() == TYPEID_PLAYER)
107 Talk(SAY_SLAY);
108 }
109
110 // Despawn is handled by spells, don't store anything
111 void JustSummoned(Creature* /*summon*/) override { }
112
120
121 void JustDied(Unit* /*killer*/) override
122 {
123 _JustDied();
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 if (!UpdateVictim())
132 return;
133
134 events.Update(diff);
135
137 return;
138
139 while (uint32 eventId = events.ExecuteEvent())
140 {
141 switch (eventId)
142 {
143 case EVENT_HELP:
144 Talk(SAY_HELP);
145 break;
148 events.Repeat(10s, 25s);
149 break;
150 case EVENT_BANISH:
151 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f, false))
152 DoCast(target, SPELL_BANISH);
153 events.Repeat(20s, 30s);
154 break;
156 if (roll_chance_i(50))
157 Talk(SAY_DRAW);
159 events.Repeat(35s, 45s);
161 break;
164 break;
165 }
166
168 return;
169 }
170
172 }
173};
174
175// 19427 - Voidwalker Summoner
177{
178 npc_voidwalker_summoner(Creature* creature) : ScriptedAI(creature) { }
179
180 void JustAppeared() override
181 {
182 _scheduler.Schedule(10s, [this](TaskContext task)
183 {
185 task.Repeat(10s, 15s);
186 });
187 }
188
189 void UpdateAI(uint32 diff) override
190 {
191 _scheduler.Update(diff);
192 }
193
194private:
196};
197
198// 19226 - Void Traveler
200{
201 npc_void_traveler(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
202
203 void InitializeAI() override
204 {
206 }
207
208 // This part needs more work
209 void JustAppeared() override
210 {
212 me->GetMotionMaster()->MoveFollow(vorpil, 0, 0);
213
214 _scheduler.Schedule(500ms, [this](TaskContext task)
215 {
217 {
218 if (me->IsWithinDist(vorpil, 3))
219 {
220 DoCastSelf(SPELL_SACRIFICE);
221
222 task.Schedule(1s, [this](TaskContext /*task*/)
223 {
224 DoCastSelf(SPELL_EMPOWERING_SHADOWS);
225 DoCastSelf(SPELL_SHADOW_NOVA);
226 DoCastSelf(SPELL_INSTAKILL_SELF);
227 });
228 }
229 else
230 task.Repeat();
231 }
232 });
233 }
234
235 void UpdateAI(uint32 diff) override
236 {
237 _scheduler.Update(diff);
238 }
239
240private:
243};
244
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
std::array< uint32, 5 > const VoidwalkerSummonSpells
@ SPELL_SUMMON_VOID_PORTAL_D
@ SPELL_DESPAWN_VOID_PORTALS
@ SPELL_SUMMON_VOID_PORTAL_B
@ SPELL_SUMMON_VOIDWALKER_C
@ SPELL_EMPOWERING_SHADOWS
@ SPELL_SUMMON_VOIDWALKER_A
@ SPELL_SUMMON_VOIDWALKER_D
@ SPELL_GREAT_SACRIFICE
@ SPELL_SUMMON_VOID_SUMMONER
@ SPELL_SUMMON_VOID_PORTAL_C
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_SUMMON_VOIDWALKER_B
@ SPELL_SUMMON_VOIDWALKER_E
@ SPELL_SUMMON_VOID_PORTAL_E
@ SPELL_SUMMON_VOID_PORTAL_A
@ EVENT_SHADOWBOLT_VOLLEY
void AddSC_boss_grandmaster_vorpil()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetReactState(ReactStates st)
Definition Creature.h:119
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
TypeID GetTypeId() const
Definition Object.h:93
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
#define RegisterShadowLabyrinthCreatureAI(ai_name)
@ DATA_GRANDMASTER_VORPIL
bool IsHeroic() const
boss_grandmaster_vorpil(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void EnterEvadeMode(EvadeReason why) override
void JustSummoned(Creature *) override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
npc_void_traveler(Creature *creature)
npc_voidwalker_summoner(Creature *creature)
void UpdateAI(uint32 diff) override