TrinityCore
boss_high_priestess_azil.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 "DynamicObject.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "MoveSplineInit.h"
23#include "ObjectAccessor.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "Spell.h"
27#include "SpellScript.h"
28#include "stonecore.h"
29#include "Vehicle.h"
30#include <G3D/Vector3.h>
31
33{
35
40
41 // Gravity Well
45
48
49 // Fury of Earth phase
60
61 // Add wave spells
66};
67
68enum NPCs
69{
72};
73
75{
79};
80
82{
84
86
92
95
98
99 // Phase 2: Fury of Earth
106
110
112{
114
120};
121
122Position const GroundPos = { 1331.82f, 980.314f, 207.542f };
123Position const AbovePlatformPos = { 1336.21f, 960.813f, 215.0f };
124
125// TO-DO:
126// - Find more sniffs and script Force Grip spell (79351)
127
129{
130 public:
131 boss_high_priestess_azil() : CreatureScript("boss_high_priestess_azil") { }
132
134 {
136 void Reset() override
137 {
138 _Reset();
139
140 me->SetCanFly(false);
141 me->SetDisableGravity(false);
143
151 }
152
153 void JustEngagedWith(Unit* who) override
154 {
156
159 }
160
161 void JustDied(Unit* /*killer*/) override
162 {
163 _JustDied();
164
166 }
167
168 void MovementInform(uint32 type, uint32 id) override
169 {
170 if (type != POINT_MOTION_TYPE && id != POINT_INTRO_MOVE)
171 return;
172
173 switch (id)
174 {
175 case POINT_INTRO_MOVE:
179 break;
180 case POINT_FLY_UP:
181 me->SetCanFly(true);
182 me->SetDisableGravity(true);
184 break;
186 me->SetFacingTo(5.218534f);
192 break;
193 case POINT_GROUND:
195 me->SetCanFly(false);
196 me->SetDisableGravity(false);
199 // Find more sniffs to correct these timers, this was copied from Reset() void.
203 break;
204 default:
205 break;
206 }
207 }
208
209 void UpdateAI(uint32 diff) override
210 {
211 if (!UpdateVictim())
212 return;
213
214 events.Update(diff);
215
217 return;
218
219 while (uint32 eventId = events.ExecuteEvent())
220 {
221 switch (eventId)
222 {
223 case EVENT_INTRO_MOVE:
225 break;
227 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
230 break;
231 case EVENT_FORCE_GRIP:
234 break;
236 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
239 break;
241 events.Reset();
244 break;
245 case EVENT_EARTH_FURY:
248 me->SetFacingTo(5.862942f);
250 break;
254 break;
257 break;
261 break;
263 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
264 {
265 me->SetFacingToObject(target);
269 }
271 break;
273 {
276 Position pos = me->GetPosition();
279 break;
280 }
282 if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f))
283 worldtrigger->CastSpell(worldtrigger, SPELL_SUMMON_WAVE_SOUTH);
285 break;
287 if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 150.0f))
288 worldtrigger->CastSpell(worldtrigger, SPELL_SUMMON_WAVE_WEST);
290 break;
291 default:
292 break;
293 }
294 }
295 }
296
297 private:
299 };
300
301 CreatureAI* GetAI(Creature* creature) const override
302 {
303 return GetStonecoreAI<boss_high_priestess_azilAI>(creature);
304 }
305};
306
307// 42428 - Devout Follower
309{
310public:
311 npc_devout_follower() : CreatureScript("npc_devout_follower") { }
312
314 {
315 npc_devout_followerAI(Creature* creature) : ScriptedAI(creature) { }
316
317 void IsSummonedBy(WorldObject* summoner) override
318 {
319 if (summoner->GetEntry() != NPC_WORLDTRIGGER)
320 return;
321
322 if (Unit* target = me->SelectNearestPlayer(200.0f))
323 {
324 AddThreat(target, 0.0f);
325 me->SetInCombatWith(target);
326 target->SetInCombatWith(me);
327 DoStartMovement(target);
328 me->Attack(target, true);
329 }
330 else
332 }
333 };
334
335 CreatureAI* GetAI(Creature* creature) const override
336 {
337 return GetStonecoreAI<npc_devout_followerAI>(creature);
338 }
339};
340
341// 42499 - Gravity Well
343{
344public:
345 npc_gravity_well() : CreatureScript("npc_gravity_well") { }
346
348 {
350 {
354 if (!IsHeroic())
355 me->DespawnOrUnsummon(23200ms);
356 }
357
358 void KilledUnit(Unit* victim) override
359 {
360 if (victim->GetEntry() != NPC_DEVOUT_FOLLOWER)
361 return;
362
363 me->SetObjectScale(me->GetObjectScale() - 0.25f);
364 if (me->GetObjectScale() <= 0.0f)
366 }
367
368 void UpdateAI(uint32 diff) override
369 {
370 events.Update(diff);
371
372 while (uint32 eventId = events.ExecuteEvent())
373 {
374 switch (eventId)
375 {
379 break;
382 break;
383 default:
384 break;
385 }
386 }
387 }
388
389 private:
391 };
392
393 CreatureAI* GetAI(Creature* creature) const override
394 {
395 return GetStonecoreAI<npc_gravity_wellAI>(creature);
396 }
397};
398
399// 42355 - Seismic Shard
401{
402public:
403 npc_seismic_shard() : CreatureScript("npc_seismic_shard") { }
404
406 {
408 {
409 instance = creature->GetInstanceScript();
410 me->SetDisableGravity(true);
412
414 FillPath(me->GetPosition(), init.Path());
415 init.SetFly();
416 init.Launch();
417
419 }
420
421 void UpdateAI(uint32 diff) override
422 {
423 events.Update(diff);
424
425 while (uint32 eventId = events.ExecuteEvent())
426 {
427 switch (eventId)
428 {
431 if (Vehicle* vehicle = highPriestAzil->GetVehicleKit())
432 me->EnterVehicle(highPriestAzil, vehicle->GetNextEmptySeat(0, false)->first);
433 break;
434 default:
435 break;
436 }
437 }
438
439 }
440
441 private:
443 {
444 G3D::Vector3 point;
445
446 point.x = pos.GetPositionX();
447 point.y = pos.GetPositionY();
448 point.z = pos.GetPositionZ();
449
450 point.x -= 1.0f;
451 path.push_back(point);
452
453 point.x += 1.0f;
454 path.push_back(point);
455
456 point.z += 25.0f;
457 path.push_back(point);
458
459 path.push_back(point);
460 }
461
464 };
465
466 CreatureAI* GetAI(Creature* creature) const override
467 {
468 return GetStonecoreAI<npc_seismic_shardAI>(creature);
469 }
470};
471
472// 79200 - Summon Follower
474{
475public:
476 spell_summon_wave_south() : SpellScriptLoader("spell_summon_wave_south") { }
477
479 {
480 bool Validate(SpellInfo const* /*spellInfo*/) override
481 {
483 }
484
485 void HandleScript(SpellEffIndex /*effIndex*/)
486 {
487 Unit* caster = GetCaster();
488 for (int i = 0; i < 3; i++)
489 caster->CastSpell(caster, SPELL_SUMMON_ADD_SOUTH, true);
490 }
491
492 void Register() override
493 {
495 }
496 };
497
498 SpellScript* GetSpellScript() const override
499 {
501 }
502};
503
504// 79196 - Summon Follower
506{
507public:
508 spell_summon_wave_west() : SpellScriptLoader("spell_summon_wave_west") { }
509
511 {
512 bool Validate(SpellInfo const* /*spellInfo*/) override
513 {
515 }
516
517 void HandleScript(SpellEffIndex /*effIndex*/)
518 {
519 Unit* caster = GetCaster();
520 for (int i = 0; i < 10; i++)
521 caster->CastSpell(caster, SPELL_SUMMON_ADD_WEST, true);
522 }
523
524 void Register() override
525 {
527 }
528 };
529
530 SpellScript* GetSpellScript() const override
531 {
533 }
534};
535
536// 79251 - Gravity Well (casts damage spell on units within 10 yards)
538{
539public:
540 bool operator()(WorldObject* object) const
541 {
542 // Valid targets are players, pets and Devout Followers
543 if (object->GetTypeId() == TYPEID_UNIT)
544 return !object->ToUnit()->IsPet() && object->GetEntry() != NPC_DEVOUT_FOLLOWER;
545 return object->GetTypeId() != TYPEID_PLAYER;
546 }
547};
548
550{
551public:
552 spell_gravity_well_damage_nearby() : SpellScriptLoader("spell_gravity_well_damage_nearby") { }
553
555 {
557 {
558 GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, int32(GetCaster()->GetObjectScale() * 10000 * 2 / 3));
559 }
560
561 void FilterTargets(std::list<WorldObject*>& unitList)
562 {
563 unitList.remove_if(PlayerPetOrDevoutFollowerCheck());
564 }
565
566 void HandleScript(SpellEffIndex /*effIndex*/)
567 {
569 }
570
571 void Register() override
572 {
576 }
577 };
578
579 SpellScript* GetSpellScript() const override
580 {
582 }
583};
584
585// 79249 - Gravity Well (damage)
587{
588public:
589 spell_gravity_well_damage() : SpellScriptLoader("spell_gravity_well_damage") { }
590
592 {
594 {
595 Unit* target = GetHitUnit();
596 if (!target)
597 return;
598
599 float distance = GetCaster()->GetDistance2d(target);
600
601 if (target->GetEntry() == NPC_DEVOUT_FOLLOWER)
602 SetHitDamage(int32(200000 - (1000 * distance))); //need more research on this formula, damage values from sniffs: 189264, 190318, 190478, 196134, 197672, 199735
603 else
604 SetHitDamage(int32(4000 - (200 * distance)));
605 }
606
607 void Register() override
608 {
610 }
611 };
612
613 SpellScript* GetSpellScript() const override
614 {
616 }
617};
618
619// 79332 - Gravity Well (pull units within 10 yards)
621{
622public:
623 spell_gravity_well_pull() : SpellScriptLoader("spell_gravity_well_pull") { }
624
626 {
628 {
629 GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, int32(GetCaster()->GetObjectScale() * 10000 * 2 / 3));
630 }
631
632 void Register() override
633 {
635 }
636 };
637
638 SpellScript* GetSpellScript() const override
639 {
641 }
642};
643
644// 86863 - Seismic Shard (makes shard reenter Azil)
646{
647public:
648 spell_seismic_shard_change_seat() : SpellScriptLoader("spell_seismic_shard_change_seat") { }
649
651 {
653 {
655 }
656
657 void Register() override
658 {
660 }
661 };
662
663 SpellScript* GetSpellScript() const override
664 {
666 }
667};
668
669// 79015 - Seismic Shard (launches shard)
671{
672public:
673 spell_seismic_shard() : SpellScriptLoader("spell_seismic_shard") { }
674
676 {
677 void HandleScript(SpellEffIndex /*effIndex*/)
678 {
679 Creature* target = GetHitUnit()->ToCreature();
680 if (!target)
681 return;
682
683 target->ExitVehicle();
684 if (DynamicObject* dynamicObject = GetCaster()->GetDynObject(SPELL_SEISMIC_SHARD_TARGETING))
685 target->CastSpell(dynamicObject->GetPosition(), SPELL_SEISMIC_SHARD_MISSLE, true);
686 }
687
688 void Register() override
689 {
691 }
692 };
693
694 SpellScript* GetSpellScript() const override
695 {
697 }
698};
699
701{
704 new npc_gravity_well();
705 new npc_seismic_shard();
713}
Texts
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ POINT_MOTION_TYPE
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ SPELLVALUE_RADIUS_MOD
Definition: SpellDefines.h:229
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define SpellCastFn(F)
Definition: SpellScript.h:825
@ MOVE_FLIGHT
Definition: UnitDefines.h:123
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_high_priestess_azil()
@ SPELL_SEISMIC_SHARD_VISUAL
@ SPELL_SEISMIC_SHARD_LAUNCH
@ SPELL_GRAVITY_WELL_AURA_DAMAGE
@ SPELL_GRAVITY_WELL_DAMAGE
@ SPELL_GRAVITY_WELL_AURA_PULL
@ SPELL_CURSE_OF_BLOOD
@ SPELL_SUMMON_ADD_WEST
@ SPELL_SEISMIC_SHARD_TARGETING
@ SPELL_GRAVITY_WELL_PULL
@ SPELL_SEISMIC_SHARD_SUMMON_3
@ SPELL_EARTH_FURY_ENERGY_SHIELD
@ SPELL_SEISMIC_SHARD_SUMMON_2
@ SPELL_SUMMON_ADD_SOUTH
@ SPELL_EARTH_FURY_CASTING_VISUAL
@ SPELL_SEISMIC_SHARD_SUMMON_1
@ SPELL_EJECT_ALL_PASSENGERS
@ SPELL_SUMMON_WAVE_WEST
@ SPELL_SEISMIC_SHARD_MISSLE
@ SPELL_GRAVITY_WELL_VISUAL
@ SPELL_SEISMIC_SHARD_PREPARE
@ SPELL_SUMMON_GRAVITY_WELL
@ SPELL_SUMMON_WAVE_SOUTH
Position const GroundPos
Position const AbovePlatformPos
@ EVENT_GRAVITY_WELL_AURA_PULL
@ EVENT_SEISMIC_SHARD_MOUNT
@ EVENT_SUMMON_GRAVITY_WELL
@ EVENT_EARTH_FURY_PREPARE_SHARD
@ EVENT_SUMMON_WAVE_WEST
@ EVENT_EARTH_FURY_FLY_DOWN
@ EVENT_CURSE_OF_BLOOD
@ EVENT_GRAVITY_WELL_AURA_DAMAGE
@ EVENT_EARTH_FURY_FLY_ABOVE_PLATFORM
@ EVENT_EARTH_FURY_LAUNCH_SHARD
@ EVENT_SUMMON_WAVE_SOUTH
@ EVENT_EARTH_FURY_FLY_UP
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetObjectScale(float scale) override
Definition: Creature.cpp:3391
void SetReactState(ReactStates st)
Definition: Creature.h:160
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void ExitVehicle(Position const *exitPosition=nullptr) override
Definition: Creature.cpp:3676
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=EVENT_JUMP, bool hasOrientation=false, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static Creature * ToCreature(Object *o)
Definition: Object.h:219
float GetObjectScale() const
Definition: Object.h:164
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
bool operator()(WorldObject *object) const
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< CastHandler > BeforeCast
Definition: SpellScript.h:820
Spell * GetSpell() const
Definition: SpellScript.h:987
void SetHitDamage(int32 damage)
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
void SetSpellValue(SpellValueMod mod, int32 value)
Definition: Spell.cpp:8566
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:627
void EnterVehicle(Unit *base, int8 seatId=-1)
Definition: Unit.cpp:12118
float GetSpeed(UnitMoveType mtype) const
Definition: Unit.cpp:8515
void SetInCombatWith(Unit *enemy, bool addSecondUnitSuppressed=false)
Definition: Unit.h:1045
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
bool SetCanFly(bool enable)
Definition: Unit.cpp:12820
Unit * GetVictim() const
Definition: Unit.h:715
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
virtual void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:12204
Player * SelectNearestPlayer(float range) const
Definition: Object.cpp:2210
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1096
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1360
CreatureAI * GetAI(Creature *creature) const override
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
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
std::vector< Vector3 > PointsArray
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_HIGH_PRIESTESS_AZIL
Definition: stonecore.h:32
@ NPC_WORLDTRIGGER
Definition: stonecore.h:54
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 GetPositionZ() const
Definition: Position.h:78
bool IsHeroic() const
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
void IsSummonedBy(WorldObject *summoner) override
void FillPath(Position const &pos, Movement::PointsArray &path)