TrinityCore
boss_slabhide.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 "GameObject.h"
20#include "InstanceScript.h"
21#include "Map.h"
22#include "MotionMaster.h"
23#include "ScriptedCreature.h"
24#include "SpellScript.h"
25#include "stonecore.h"
26
28{
30
31 // Stalactite Trigger - Trash, On Ground
33
34 // Slabhide
38// SPELL_COOLDOWN_5S = 95323, Cooldown: Creature Special 1 (5s)?
41
42 // Lava Fissure
45
46 // Stalactite Trigger - Boss
50};
51
53{
57 GO_STALACTITE = 204337,
58};
59
61{
63};
64
66{
68
69 // Intro events
71
72 // Slabhide combat
81
82 // Lava Fissure
84
85 // Stalactite Trigger - Boss
87};
88
90{
92
95
99};
100
101constexpr Position SlabhideIntroPos = { 1292.27f, 1226.16f, 265.573f };
102constexpr Position SlabhideIntroLandPos = { 1292.352f, 1226.478f, 247.6368f, 3.630285f };
103
104constexpr Position SlabhideMiddlePos = { 1280.73f, 1212.31f, 247.3837f };
105constexpr Position SlabhideInAirPos = { 1280.73f, 1212.31f, 257.3837f };
106
108{
109 public:
110 boss_slabhide() : CreatureScript("boss_slabhide") { }
111
112 struct boss_slabhideAI : public BossAI
113 {
115 {
116 me->setActive(true);
117 me->SetCanFly(true);
118 me->SetDisableGravity(true);
121 _isFlying = false;
122 }
123
124 void Reset() override
125 {
127 return;
128
129 _Reset();
130 DespawnAll();
131
132 me->SetCanFly(false);
133 me->SetDisableGravity(false);
135 _isFlying = false;
136 }
137
138 void JustEngagedWith(Unit* who) override
139 {
141
146 }
147
148 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
149 {
150 if (_isFlying && damage >= me->GetHealth())
151 damage = me->GetHealth() - 1; // Let creature health fall to 1 hp but prevent it from dying during air phase.
152 }
153
154 void JustDied(Unit* /*killer*/) override
155 {
156 _JustDied();
157
158 // Despawn related npcs and gameobjects
159 DespawnAll();
160 }
161
162 void DoAction(int32 action) override
163 {
164 switch (action)
165 {
167 {
169 return;
170
172
173 // Execute Slabhide intro event
175 break;
176 }
177 default:
178 break;
179 }
180 }
181
182 void MovementInform(uint32 type, uint32 id) override
183 {
184 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
185 return;
186
187 switch (id)
188 {
192 break;
194 me->SetCanFly(false);
195 me->SetDisableGravity(false);
196 me->SetHover(false);
199 me->SetUninteractible(false);
202 break;
204 _isFlying = true;
206 break;
209 break;
211 _isFlying = false;
212 //DoCast(me, SPELL_COOLDOWN_5S); // unknown purpose
214 break;
215 default:
216 break;
217 }
218 }
219
220 void UpdateAI(uint32 diff) override
221 {
222 if (!UpdateVictim())
223 return;
224
225 events.Update(diff);
226
228 return;
229
230 while (uint32 eventId = events.ExecuteEvent())
231 {
232 switch (eventId)
233 {
234 case EVENT_HANDLE_ROCK_WALLS: // Close rock walls
236 break;
238 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
239 DoCast(target, SPELL_LAVA_FISSURE);
241 break;
242 case EVENT_SAND_BLAST:
245 break;
246 case EVENT_AIR_PHASE:
247 events.Reset();
249 me->AttackStop();
252 break;
253 case EVENT_TAKEOFF:
255 break;
256 case EVENT_STALACTITE:
257 me->SetCanFly(true);
258 me->SetDisableGravity(true);
259 me->SetHover(true);
260
262
264 break;
265 case EVENT_LAND:
266 {
267 Position pos = me->GetPosition();
270 break;
271 }
272 case EVENT_ATTACK:
273 me->SetCanFly(false);
274 me->SetDisableGravity(false);
275 me->SetHover(false);
276
281 break;
282 default:
283 break;
284 }
285 }
286 }
287
288 private:
290 {
291 // Despawn stalactite triggers npcs
292 std::list<Creature*> listStalactiteTrigger;
293 me->GetCreatureListWithEntryInGrid(listStalactiteTrigger, NPC_STALACTITE_TRIGGER, 200.0f);
294 if (!listStalactiteTrigger.empty())
295 for (std::list<Creature*>::const_iterator itr = listStalactiteTrigger.begin(); itr != listStalactiteTrigger.end(); ++itr)
296 (*itr)->DespawnOrUnsummon();
297
298 // Despawn stalactite objects
299 std::list<GameObject*> listStalactite;
300 me->GetGameObjectListWithEntryInGrid(listStalactite, GO_STALACTITE, 200.0f);
301 if (!listStalactite.empty())
302 for (std::list<GameObject*>::const_iterator itr = listStalactite.begin(); itr != listStalactite.end(); ++itr)
303 (*itr)->Delete();
304 }
305
307 };
308
309 CreatureAI* GetAI(Creature* creature) const override
310 {
311 return GetStonecoreAI<boss_slabhideAI>(creature);
312 }
313};
314
315// 43242 - Lava Fissure
317{
318public:
319 npc_lava_fissure() : CreatureScript("npc_lava_fissure") { }
320
322 {
324 {
327 }
328
329 void UpdateAI(uint32 diff) override
330 {
331 events.Update(diff);
332
333 while (uint32 eventId = events.ExecuteEvent())
334 {
335 switch (eventId)
336 {
340 me->DespawnOrUnsummon(14s);
341 break;
342 default:
343 break;
344 }
345 }
346 }
347
348 private:
350 };
351
352 CreatureAI* GetAI(Creature* creature) const override
353 {
354 return GetStonecoreAI<npc_lava_fissureAI>(creature);
355 }
356};
357
358// 43159 - Stalactite Trigger - Boss
360{
361public:
362 npc_stalactite_trigger() : CreatureScript("npc_stalactite_trigger") { }
363
365 {
367 {
368 me->SetDisableGravity(true);
371 }
372
373 void UpdateAI(uint32 diff) override
374 {
375 if (events.Empty())
376 return;
377
378 events.Update(diff);
379
380 while (uint32 eventId = events.ExecuteEvent())
381 {
382 switch (eventId)
383 {
386 me->DespawnOrUnsummon(11s);
387 break;
388 default:
389 break;
390 }
391 }
392 }
393
394 private:
396 };
397
398 CreatureAI* GetAI(Creature* creature) const override
399 {
400 return GetStonecoreAI<npc_stalactite_triggerAI>(creature);
401 }
402};
403
404// 81035 - Stalactite (check if player is near to summon stalactite)
406{
407public:
408 spell_s81035_stalactite() : SpellScriptLoader("spell_s81035_stalactite") { }
409
411 {
413 {
414 Unit* caster = GetCaster();
415 caster->CastSpell(caster, SPELL_STALACTITE_SUMMON_TRIGGER, true);
416 }
417
418 void Register() override
419 {
421 }
422 };
423
424 SpellScript* GetSpellScript() const override
425 {
427 }
428};
429
430// 81028 - Stalactite (summons "Stalactite Trigger - Boss", 20 yard radius)
431// 80650 - Stalactite (summons "Stalactite Trigger - Boss", 40 yard radius)
433{
434public:
435 spell_s81028_s80650_stalactite() : SpellScriptLoader("spell_s81028_s80650_stalactite") { }
436
438 {
440 {
441 // All stalactite triggers should have Z position 301.3837f, but no way to relocate (not relocateoffset!) height only.
442 Position offset = { 0.0f, 0.0f, 50.0f, 0.0f };
443 dest.RelocateOffset(offset);
444 }
445
446 void Register() override
447 {
449 }
450 };
451
452 SpellScript* GetSpellScript() const override
453 {
455 }
456};
457
458// 80654 - Stalactite (creates visual shade on ground)
459// 80643/92653 - Stalactite (launches missle to the ground)
460// 80647/92309 - Stalactite (creates stalactite object)
462{
463public:
464 spell_stalactite_mod_dest_height() : SpellScriptLoader("spell_stalactite_mod_dest_height") { }
465
467 {
469 {
470 Unit* caster = GetCaster();
471 Position pos = caster->GetPosition();
472 pos.m_positionZ = caster->GetMap()->GetHeight(caster->GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 100.0f);
473 dest.Relocate(pos);
474 }
475
476 void Register() override
477 {
479 }
480 };
481
482 SpellScript* GetSpellScript() const override
483 {
485 }
486};
487
488// 92306 - Crystal storm (heroic mode check)
490{
491public:
492 spell_s92306_crystal_storm() : SpellScriptLoader("spell_s92306_crystal_storm") { }
493
495 {
496 bool Validate(SpellInfo const* /*spellInfo*/) override
497 {
499 }
500
502 {
503 Unit* caster = GetCaster();
504 if (caster->GetMap()->IsHeroic())
505 caster->CastSpell(caster, SPELL_CRYSTAL_STORM_TRIGGER, true);
506 }
507
508 void Register() override
509 {
511 }
512 };
513
514 SpellScript* GetSpellScript() const override
515 {
517 }
518};
519
520// 92300 - Crystal Storm (damage)
522{
523 public:
525
527 {
528 for (std::list<GameObject*>::const_iterator itr = objectList.begin(); itr != objectList.end(); ++itr)
529 if (!(*itr)->IsInvisibleDueToDespawn(unit) && (*itr)->IsInBetween(caster, unit, 1.5f))
530 return true;
531 return false;
532 }
533
534 private:
536 std::list<GameObject*> objectList;
537};
538
540{
541public:
542 spell_s92300_crystal_storm() : SpellScriptLoader("spell_s92300_crystal_storm") { }
543
545 {
546 void FilterTargets(std::list<WorldObject*>& unitList)
547 {
548 Unit* caster = GetCaster();
549
550 std::list<GameObject*> goList;
551 caster->GetGameObjectListWithEntryInGrid(goList, GO_STALACTITE, 40.0f);
552 if (goList.empty())
553 return;
554
555 unitList.remove_if(BehindObjectCheck(caster, goList));
556 }
557
558 void Register() override
559 {
561 }
562 };
563
564 SpellScript* GetSpellScript() const override
565 {
567 }
568};
569
571{
572 new boss_slabhide();
573 new npc_lava_fissure();
580}
Actions
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
Spells
Definition: PlayerAI.cpp:32
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_CASTER_RANDOM
@ TARGET_UNIT_SRC_AREA_ENEMY
@ TARGET_DEST_CASTER
@ EMOTE_ONESHOT_ROAR
@ SPELL_EFFECT_APPLY_AURA
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
#define SpellHitFn(F)
Definition: SpellScript.h:854
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ NPC_STALACTITE_TRIGGER
@ GO_STALACTITE
@ NPC_STALACTITE_TRIGGER_GROUND
@ NPC_LAVA_FISSURE
@ ACTION_STALACTITE_MISSLE
@ SPELL_FACE_RANDOM_PLAYER
@ SPELL_STALACTITE_SUMMON_TRIGGER
@ SPELL_CRYSTAL_STORM
@ SPELL_CRYSTAL_STORM_TRIGGER
@ SPELL_STALACTITE_MISSLE
@ SPELL_SAND_BLAST
@ SPELL_LAVA_FISSURE
@ SPELL_STALACTITE_SHADE
@ SPELL_STALACTITE_SUMMON
@ SPELL_LAVA_FISSURE_CRACK
@ SPELL_LAVA_FISSURE_ERUPTION
@ SPELL_STALACTITE_CREATE
void AddSC_boss_slabhide()
constexpr Position SlabhideInAirPos
@ POINT_SLABHIDE_INTRO
@ POINT_SLABHIDE_INTRO_LAND
@ POINT_SLABHIDE_IN_AIR
@ POINT_NONE
@ POINT_SLABHIDE_LAND
@ POINT_SLABHIDE_MIDDLE
constexpr Position SlabhideIntroPos
constexpr Position SlabhideIntroLandPos
constexpr Position SlabhideMiddlePos
@ EVENT_ATTACK
@ EVENT_AIR_PHASE
@ EVENT_ROAR_EMOTE
@ EVENT_HANDLE_ROCK_WALLS
@ EVENT_LAVA_FISSURE
@ EVENT_STALACTITE_MISSLE
@ EVENT_LAVA_FISSURE_ERUPTION
@ EVENT_NONE
@ EVENT_SAND_BLAST
@ EVENT_TAKEOFF
@ EVENT_STALACTITE
@ EVENT_LAND
BehindObjectCheck(Unit *caster, std::list< GameObject * > objectList)
bool operator()(WorldObject *unit)
std::list< GameObject * > objectList
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:371
void SetReactState(ReactStates st)
Definition: Creature.h:160
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
bool Empty() const
Definition: EventMap.h:84
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.h:290
bool IsHeroic() const
Definition: Map.cpp:3282
void MoveTakeoff(uint32 id, Position const &pos, Optional< int32 > tierTransitionId={}, Optional< float > velocity={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void MoveLand(uint32 id, Position const &pos, Optional< int32 > tierTransitionId={}, Optional< float > velocity={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
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:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetHover(bool enable, bool updateAnimTier=true)
Definition: Unit.cpp:12938
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
bool SetCanFly(bool enable)
Definition: Unit.cpp:12820
uint64 GetHealth() const
Definition: Unit.h:776
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
bool AttackStop()
Definition: Unit.cpp:5781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
Map * GetMap() const
Definition: Object.h:624
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition: Object.cpp:3312
void GetGameObjectListWithEntryInGrid(Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition: Object.cpp:3292
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
PhaseShift & GetPhaseShift()
Definition: Object.h:523
void setActive(bool isActiveObject)
Definition: Object.cpp:922
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1360
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
void FilterTargets(std::list< WorldObject * > &unitList)
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
MovementPoints
@ DATA_SLABHIDE_INTRO
Definition: stonecore.h:41
@ DATA_SLABHIDE_ROCK_WALL
Definition: stonecore.h:42
@ DATA_SLABHIDE
Definition: stonecore.h:30
@ ACTION_SLABHIDE_INTRO
Definition: stonecore.h:52
constexpr float GetPositionX() const
Definition: Position.h:76
float m_positionZ
Definition: Position.h:55
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
void RelocateOffset(Position const &offset)
Definition: Spell.cpp:122
void Relocate(Position const &pos)
Definition: Spell.cpp:111
void DoAction(int32 action) override
void JustDied(Unit *) override
boss_slabhideAI(Creature *creature)
void JustEngagedWith(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void MovementInform(uint32 type, uint32 id) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override