TrinityCore
Loading...
Searching...
No Matches
boss_adarogg.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 "InstanceScript.h"
19#include "MotionMaster.h"
20#include "Player.h"
21#include "ScriptMgr.h"
22#include "ScriptedCreature.h"
23#include "TaskScheduler.h"
24#include "ragefire_chasm.h"
25
27{
28 // Intro
31
32 // Combat
34 SPELL_INFERNO_CHARGE_SUMMON = 119297, // Serverside
35 SPELL_FIRE_BREATH = 119420
36};
37
46
52
57
59{
60 PATH_INTRO = 6140800,
61 PATH_INTRO2 = 6140801,
62 PATH_INTRO3 = 6140802,
63};
64
66{
67 { -282.31488f, -53.24906f, -60.802902f },
68 { -281.1894f, -54.73433f, -60.34256f }
69};
70
71// Areatrigger - 7904
73{
74public:
75 at_adarogg_intro() : OnlyOnceAreaTriggerScript("at_adarogg_intro") { }
76
77 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
78 {
79 if (player->IsGameMaster())
80 return false;
81
82 InstanceScript* instance = player->GetInstanceScript();
83 if (!instance)
84 return false;
85
86 Creature* adarogg = instance->GetCreature(BOSS_ADAROGG);
87 if (!adarogg)
88 return false;
89
91
92 return true;
93 }
94};
95
96// 61408 - Adarogg
97struct boss_adarogg : public BossAI
98{
99 boss_adarogg(Creature* creature) : BossAI(creature, BOSS_ADAROGG), _eatCounter(0) { }
100
101 void Reset() override
102 {
103 _Reset();
104
106
107 _eatCounter = 0;
108 }
109
117
129
130 void JustDied(Unit* /*killer*/) override
131 {
133
134 _JustDied();
135 }
136
137 void DoAction(int32 action) override
138 {
139 if (action != ACTION_KILL_HOUNDMASTERS)
140 return;
141
142 Creature* corruptedHoundmaster1 = me->FindNearestCreatureWithOptions(70.0f, { .StringId = "npc_corrupted_houndmaster_1" });
143 if (!corruptedHoundmaster1)
144 return;
145
146 Creature* corruptedHoundmaster2 = me->FindNearestCreatureWithOptions(70.0f, { .StringId = "npc_corrupted_houndmaster_2" });
147 if (!corruptedHoundmaster2)
148 return;
149
150 corruptedHoundmaster1->AI()->Talk(SAY_HOUNDMASTER_INTRO_0);
151 corruptedHoundmaster2->AI()->Talk(SAY_HOUNDMASTER_INTRO_1);
152
153 scheduler.Schedule(2s, [this](TaskContext& task)
154 {
157
158 task.Schedule(1s, [this](TaskContext& task)
159 {
162
163 task.Schedule(1s + 200ms, [this](TaskContext const& /*task*/)
164 {
167 });
168 });
169 });
170 }
171
172 void WaypointPathEnded(uint32 /*nodeId*/, uint32 pathId) override
173 {
174 switch (pathId)
175 {
176 case PATH_INTRO:
177 scheduler.Schedule(6148ms, [this](TaskContext const& /*task*/)
178 {
179 me->GetMotionMaster()->MovePath(PATH_INTRO2, false);
180 });
181 break;
182 case PATH_INTRO2:
183 scheduler.Schedule(6996ms, [this](TaskContext const& /*task*/)
184 {
185 me->GetMotionMaster()->MovePath(PATH_INTRO3, false);
186 });
187 break;
188 case PATH_INTRO3:
189 scheduler.Schedule(6148ms, [this](TaskContext const& /*task*/)
190 {
191 me->GetMotionMaster()->MovePath(PATH_INTRO2, false);
192 });
193 break;
194 default:
195 return;
196 }
197
198 _eatCounter = 0;
199 scheduler.Schedule(1s, [this](TaskContext& task)
200 {
201 if (_eatCounter >= 2)
202 return;
203
205 _eatCounter++;
206
207 task.Repeat(2s, 3s);
208 });
209 }
210
211 void UpdateAI(uint32 diff) override
212 {
213 scheduler.Update(diff);
214
215 if (!UpdateVictim())
216 return;
217
218 events.Update(diff);
219
221 return;
222
223 while (uint32 eventId = events.ExecuteEvent())
224 {
225 switch (eventId)
226 {
228 {
230 {
231 Talk(SAY_INFERNO_CHARGE, target);
234 }
235 events.Repeat(15s, 20s);
236 break;
237 }
239 {
241 events.Repeat(15s, 20s);
242 break;
243 }
244 default:
245 break;
246 }
247 }
248 }
249
250private:
252};
253
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:276
AdaroggSpells
@ SPELL_EAT_TROGG
@ SPELL_INFERNO_CHARGE_SUMMON
@ SPELL_FIRE_BREATH
@ SPELL_ADJULES_CHOW_TIME
@ SPELL_INFERNO_CHARGE_CAST
void AddSC_boss_adarogg()
AdaroggPaths
@ PATH_INTRO
@ PATH_INTRO3
@ PATH_INTRO2
AdaroggEvents
@ EVENT_FIRE_BREATH
@ EVENT_INFERNO_CHARGE
constexpr Position AdaroggIntroPoints[2]
AdaroggActions
@ ACTION_KILL_HOUNDMASTERS
AdaroggTexts
@ SAY_HOUNDMASTER_INTRO_1
@ SAY_INFERNO_CHARGE
@ SAY_HOUNDMASTER_INTRO_0
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
TaskScheduler scheduler
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
bool IsGameMaster() const
Definition Player.h:1309
TaskContext & Schedule(TaskScheduler::duration_t time, TaskScheduler::task_handler_t task)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & ClearValidator()
Clears the validator which is asked if tasks are allowed to be executed.
TaskScheduler & Update()
Update the scheduler to the current time.
virtual void DoAction(int32 param)
Definition UnitAI.h:73
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition Object.cpp:1526
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
@ BOSS_ADAROGG
#define RegisterRagefireChasmCreatureAI(ai_name)
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *who) override
void Reset() override
void DoAction(int32 action) override
void JustDied(Unit *) override
void WaypointPathEnded(uint32, uint32 pathId) override
void UpdateAI(uint32 diff) override
boss_adarogg(Creature *creature)