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(50))
157 Talk(SAY_DRAW);
159 events.Repeat(35s, 45s);
161 break;
164 break;
165 }
166
168 return;
169 }
170 }
171};
172
173// 19427 - Voidwalker Summoner
175{
176 npc_voidwalker_summoner(Creature* creature) : ScriptedAI(creature) { }
177
178 void JustAppeared() override
179 {
180 _scheduler.Schedule(10s, [this](TaskContext& task)
181 {
183 task.Repeat(10s, 15s);
184 });
185 }
186
187 void UpdateAI(uint32 diff) override
188 {
189 _scheduler.Update(diff);
190 }
191
192private:
194};
195
196// 19226 - Void Traveler
198{
199 npc_void_traveler(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
200
201 void InitializeAI() override
202 {
204 }
205
206 // This part needs more work
207 void JustAppeared() override
208 {
210 me->GetMotionMaster()->MoveFollow(vorpil, 0, 0);
211
212 _scheduler.Schedule(500ms, [this](TaskContext& task)
213 {
215 {
216 if (me->IsWithinDist(vorpil, 3))
217 {
218 DoCastSelf(SPELL_SACRIFICE);
219
220 task.Schedule(1s, [this](TaskContext const& /*task*/)
221 {
222 DoCastSelf(SPELL_EMPOWERING_SHADOWS);
223 DoCastSelf(SPELL_SHADOW_NOVA);
224 DoCastSelf(SPELL_INSTAKILL_SELF);
225 });
226 }
227 else
228 task.Repeat();
229 }
230 });
231 }
232
233 void UpdateAI(uint32 diff) override
234 {
235 _scheduler.Update(diff);
236 }
237
238private:
241};
242
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
EvadeReason
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:290
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()
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveFollow(Unit *target, float dist, Optional< ChaseAngle > angle={}, Optional< Milliseconds > duration={}, bool ignoreTargetWalk=false, MovementSlot slot=MOTION_SLOT_ACTIVE, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
#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