TrinityCore
Loading...
Searching...
No Matches
boss_rokmora.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "Conversation.h"
21#include "ConversationAI.h"
22#include "Creature.h"
23#include "InstanceScript.h"
24#include "Map.h"
25#include "MotionMaster.h"
26#include "PathGenerator.h"
27#include "Player.h"
28#include "ScriptedCreature.h"
29#include "ScriptMgr.h"
30#include "SpellAuras.h"
31#include "SpellAuraEffects.h"
32#include "SpellScript.h"
33#include "TemporarySummon.h"
34#include "neltharions_lair.h"
35
37{
38 // Intro Spells
44
45 // Combat
52 // SPELL_CRYSTALLINE_GROUND_UNK = 470381 unknown purpose
58 SPELL_SHATTER = 188114,
60
61 SPELL_ROKMORA_COMBAT_CONVO_1 = 198122, // Rok shatter!
62 SPELL_ROKMORA_COMBAT_CONVO_2 = 198125, // Rok stronger! (unused?)
63 SPELL_ROKMORA_COMBAT_CONVO_3 = 198135, // Tiny piddle, big puddle.
64 SPELL_ROKMORA_COMBAT_CONVO_4 = 198136 // Nothing beat Rok!
65};
66
76
84
100
102{
104 NPC_ULAROGG = 105300,
105 NPC_SKITTER = 97720
107
108constexpr Position NavarroggIntroPosition = { 2959.8716f, 1390.5312f, 53.52835f, 2.721162f };
109constexpr Position NavarroggIntroPosition2 = { 2917.3196f, 1402.2882f, -2.405084f };
110constexpr Position NavarroggJumpIntroPosition = { 2930.9895f, 1395.7848f, -2.641485f, 2.721162f };
111
112// 91003 - Rokmora
113struct boss_rokmora : public BossAI
114{
115 boss_rokmora(Creature* creature) : BossAI(creature, DATA_ROKMORA) { }
116
117 void JustAppeared() override
118 {
120 me->SetImmuneToPC(false);
121 }
122
123 void JustDied(Unit* /*killer*/) override
124 {
126 _JustDied();
127 Talk(SAY_DIED);
128 }
129
130 void KilledUnit(Unit* victim) override
131 {
132 if (victim->GetEntry() == NPC_SKITTER)
133 {
135 DoCastSelf(spellId);
136 }
137 }
138
147
148 void JustEngagedWith(Unit* who) override
149 {
153
155 me->SetMaxPower(POWER_ENERGY, 100); // power is set to 0 in Creature::UpdateMaxPower
156
159
160 if (IsHeroicOrHigher()) // Casted once
162 }
163
164 void UpdateAI(uint32 diff) override
165 {
166 if (!UpdateVictim())
167 return;
168
169 events.Update(diff);
170
172 return;
173
174 while (uint32 eventId = events.ExecuteEvent())
175 {
176 switch (eventId)
177 {
179 {
182 events.Repeat(29200ms);
183 break;
184 }
186 {
189 break;
190 }
192 {
193 if (me->GetPower(POWER_ENERGY) >= 100)
194 {
197 }
198 events.Repeat(500ms);
199 break;
200 }
201 default:
202 break;
203 }
204
206 return;
207 }
208 }
209};
210
211// 215898 - Crystalline Ground
240
241// 188114 - Shatter
243{
244 bool Validate(SpellInfo const* /*spellInfo*/) override
245 {
247 }
248
249 void HandleShatter() const
250 {
251 Unit* caster = GetCaster();
254 caster->CastSpell(caster, SPELL_SHATTER_KILL_SKITTERS, args);
255
256 if (caster->GetMap()->IsHeroicOrHigher())
258
259 caster->SetPower(POWER_ENERGY, 0);
260 }
261
266};
267
268// 188169 - Razor Shards
270{
271 bool Validate(SpellInfo const* /*spellInfo*/) override
272 {
274 }
275
277 {
278 Position pos(*caster);
279 float randomAngle = frand(float(M_PI) / -7.0f, float(M_PI) / 7.0f);
280 float randomDist = frand(2.0f, 40.0f);
281
282 float angleToOrigin = caster->GetAbsoluteAngle(_targetOrigin);
283 caster->MovePosition(pos, randomDist, randomAngle - caster->GetOrientation() + angleToOrigin);
284 return pos;
285 }
286
287 void OnPrecast() override
288 {
289 Unit* target = GetExplTargetUnit();
290 _targetOrigin = target->GetPosition();
291 }
292
293 void HandleCast() const
294 {
295 Unit* caster = GetCaster();
296
297 for (uint8 i = 0; i < 20; ++i)
298 {
301 .TriggeringSpell = GetSpell()
302 });
303 }
304
305 for (uint8 i = 0; i < 7; ++i)
307 }
308
313
314private:
316};
317
318// 192799 - Choking Dust
319// ID - 4953
321{
323
324 void OnUnitEnter(Unit* unit) override
325 {
326 if (!unit->IsPlayer())
327 return;
328
329 Unit* caster = at->GetCaster();
330 if (!caster)
331 return;
332
334 }
335
336 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
337 {
339 }
340};
341
342// 198024 - Crystalline Ground and 216470 - Crystalline Ground
343// ID - 7415
361
362// Id - XXX
364{
365 at_rokmora_intro(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
366
367 void OnUnitEnter(Unit* unit) override
368 {
369 Player* player = unit->ToPlayer();
370 if (!player || player->IsGameMaster())
371 return;
372
374 navarrogg->SetScriptStringId("RokmoraIntro");
375
376 at->Remove();
377 }
378};
379
380// 100700 - Navarrogg
382{
384
385 void JustAppeared() override
386 {
387 if (me->HasStringId("RokmoraIntro"))
389 }
390
391 void WaypointReached(uint32 waypointId, uint32 pathId) override
392 {
393 if (pathId == PATH_NAVARROGG && waypointId == WAYPOINT_DESPAWN)
395 }
396
398 {
399 Seconds delay = 1s;
400
401 _scheduler.Schedule(delay, [this](TaskContext const&)
402 {
405 });
406
407 delay += 2s;
408
409 _scheduler.Schedule(delay, [this](TaskContext const&)
410 {
412 });
413
414 delay += 1s;
415
416 _scheduler.Schedule(delay, [this](TaskContext const&)
417 {
418 if (Creature* ularogg = me->FindNearestCreature(NPC_ULAROGG, 50.0f))
419 {
420 ularogg->InterruptSpell(CURRENT_CHANNELED_SPELL);
421 ularogg->SetFacingTo(5.480333f);
422 }
423
424 InstanceScript* instance = me->GetInstanceScript();
425 if (!instance)
426 return;
427
428 Creature* rokmora = instance->GetCreature(DATA_ROKMORA);
429 if (!rokmora)
430 return;
431
433
435 });
436
437 delay += 1s;
438
439 _scheduler.Schedule(delay, [this](TaskContext const&)
440 {
441 if (Creature* ularogg = me->FindNearestCreature(NPC_ULAROGG, 50.0f))
442 ularogg->CastSpell(ularogg->GetPosition(), SPELL_BOSS_INTRO_CONVERSATION);
443 });
444 }
445
446 void UpdateAI(uint32 diff) override
447 {
448 _scheduler.Update(diff);
449 }
450
451private:
453};
454
455// 209374 - Boss 01 Intro Convo
456// Id - 1885
458{
459public:
461
462 void OnCreate(Unit* creator) override
463 {
464 Creature* navarrogg = creator->FindNearestCreatureWithOptions(50.0f, { .CreatureId = NPC_NAVARROGG, .StringId = "RokmoraIntro" });
465 if (!navarrogg)
466 return;
467
469 }
470
471 void OnStart() override
472 {
474 _events.ScheduleEvent(EVENT_ROKMORA_INTRO_MOVE, *ularoggMoveStartTime + 3s);
475 }
476
477 void OnUpdate(uint32 diff) override
478 {
479 _events.Update(diff);
480
481 switch (_events.ExecuteEvent())
482 {
484 {
487 if (!ularogg || !navarrogg)
488 break;
489
490 ularogg->GetMotionMaster()->MovePath(PATH_ULAROGG, false);
491 navarrogg->GetMotionMaster()->MovePath(PATH_NAVARROGG, false);
492 break;
493 }
494 default:
495 break;
496 }
497 }
498
499private:
501};
502
503// 209394 - Boss 01 Intro Emerge
505{
506 bool Validate(SpellInfo const* /*spellInfo*/) override
507 {
509 }
510
511 void HandleShatter() const
512 {
513 Unit* caster = GetCaster();
514 InstanceScript* instance = caster->GetInstanceScript();
515 if (!instance)
516 return;
517
519
521 }
522
527};
528
547
548// 134730 - Update Interactions
550{
551 void HandleScript(SpellEffIndex /*effIndex*/) const
552 {
553 Creature* caster = GetCaster()->ToCreature();
554 if (!caster)
555 return;
556
557 caster->SetImmuneToPC(false);
558 }
559
564};
565
AreaTriggerExitReason
Definition AreaTrigger.h:69
#define DEFAULT_LOCALE
Definition Common.h:69
#define M_PI
Definition Common.h:118
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
float frand(float min, float max)
Definition Random.cpp:55
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterConversationAI(ai_name)
Definition ScriptMgr.h:1437
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_APPLY_AURA
@ POWER_ENERGY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_STUN
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:599
@ UNIT_STATE_ROOT
Definition Unit.h:271
@ UNIT_STATE_CASTING
Definition Unit.h:276
RokmoraMisc
@ NPC_SKITTER
@ NPC_NAVARROGG
@ NPC_ULAROGG
constexpr Position NavarroggIntroPosition
constexpr Position NavarroggJumpIntroPosition
RokmoraTexts
@ SAY_CRYSTALLINE_GROUND_WARNING
@ SAY_AGGRO
@ SAY_RAZOR_SHARDS_WARNING
@ SAY_DIED
RokmoraConversation
@ POINT_NAVAROGG_INTRO
@ CONVO_ULAROGG_INTRO_LINE_03
@ CONVO_ACTOR_ID_ULAROGG
@ WAYPOINT_DESPAWN
@ POINT_NAVAROGG_JUMP
@ PATH_NAVARROGG
@ PATH_ULAROGG
@ CONVO_ACTOR_ID_NAVARROGG
@ CONVO_ACTOR_NAVARROGG
RokmoraEvents
@ EVENT_CRYSTALLINE_GROUND
@ EVENT_SHATTER
@ EVENT_CHECK_ENERGY
@ EVENT_RAZOR_SHARDS
@ EVENT_ROKMORA_INTRO_MOVE
constexpr Position NavarroggIntroPosition2
RokmoraSpells
@ SPELL_ROKMORA_COMBAT_CONVO_4
@ SPELL_CRYSTALLINE_GROUND_AREATRIGGER
@ SPELL_RAZOR_SHARDS_VISUAL_2
@ SPELL_BOSS_INTRO_CONVERSATION
@ SPELL_ROKMORA_COMBAT_CONVO_2
@ SPELL_GAIN_ENERGY
@ SPELL_UPDATE_INTERACTIONS
@ SPELL_ROKMORA_COMBAT_CONVO_3
@ SPELL_ROKMORA_COMBAT_CONVO_1
@ SPELL_RUPTURING_SKITTER
@ SPELL_RAZOR_SHARDS
@ SPELL_CHOKING_DUST_DAMAGE
@ SPELL_CRYSTALLINE_GROUND_VISUAL
@ SPELL_CRYSTALLINE_GROUND_PERIODIC
@ SPELL_SHATTER_KILL_SKITTERS
@ SPELL_CRYSTALLINE_GROUND
@ SPELL_ULAROGG_COSMETIC
@ SPELL_CRYSTALLINE_GROUND_DAMAGE
@ SPELL_JUMP_TO_GROUND_COSMETIC
@ SPELL_SHATTER
@ SPELL_BOSS_INTRO_EMERGE
@ SPELL_RAZOR_SHARDS_VISUAL
void AddSC_boss_rokmora()
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
Unit * GetCaster() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectApplyHandler > OnEffectApply
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
Conversation *const conversation
ConversationAI(Conversation *c, uint32 scriptId={}) noexcept
void AddActor(int32 actorId, uint32 actorIdx, ObjectGuid const &actorGuid)
Milliseconds const * GetLineStartTime(LocaleConstant locale, int32 lineId) const
Creature * GetActorCreature(uint32 actorIdx) const
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool HasStringId(std::string_view id) const
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={})
bool IsHeroicOrHigher() const
Definition Map.cpp:3344
void MoveJump(uint32 id, Position const &pos, std::variant< std::monostate, float, Milliseconds > speedOrTime={}, Optional< float > minHeight={}, Optional< float > maxHeight={}, MovementFacingTarget const &facing={}, bool orientationFixed=false, bool unlimitedSpeed=false, Optional< float > speedMultiplier={}, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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={})
Player * ToPlayer()
Definition Object.h:126
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
bool IsGameMaster() const
Definition Player.h:1309
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
Unit * GetExplTargetUnit() const
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Definition Unit.h:635
void ClearUnitState(uint32 f)
Definition Unit.h:744
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10046
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void AddUnitState(uint32 f)
Definition Unit.h:742
bool isMoving() const
Definition Unit.h:1804
int32 GetPower(Powers power) const
Definition Unit.cpp:10028
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void SetMaxPower(Powers power, int32 val)
Definition Unit.cpp:10083
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
void MovePosition(Position &pos, float dist, float angle, float maxHeightChange=6.0f) const
Definition Object.cpp:2782
Map * GetMap() const
Definition Object.h:411
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition Object.cpp:1526
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
void OnCreate(Unit *creator) override
void OnUpdate(uint32 diff) override
void HandleEffectPeriodic(AuraEffect const *aurEff) const
bool Validate(SpellInfo const *) override
void OnApply(AuraEffect const *, AuraEffectHandleModes) const
void OnRemove(AuraEffect const *, AuraEffectHandleModes) const
bool Validate(SpellInfo const *) override
void HandleShatter() const
void Register() override
Position GetRandomRazorShardPosition(Unit *caster) const
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void Register() override
void HandleScript(SpellEffIndex) const
@ DATA_ROKMORA_INTRO_STATE
@ DATA_ROKMORA
#define RegisterNeltharionsLairCreatureAI(ai_name)
TriggerCastFlags TriggerFlags
float GetAbsoluteAngle(float x, float y) const
Definition Position.h:136
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetOrientation() const
Definition Position.h:90
bool IsHeroicOrHigher() const
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void OnUnitEnter(Unit *unit) override
void OnUnitEnter(Unit *unit) override
at_rokmora_intro(AreaTrigger *areatrigger)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void KilledUnit(Unit *victim) override
void JustAppeared() override
void JustDied(Unit *) override
boss_rokmora(Creature *creature)
void WaypointReached(uint32 waypointId, uint32 pathId) override
npc_rokmora_navarrogg_intro(Creature *creature)
void UpdateAI(uint32 diff) override