TrinityCore
Loading...
Searching...
No Matches
boss_ulgrax_the_devourer.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 "InstanceScript.h"
22#include "MotionMaster.h"
23#include "Player.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "SpellScript.h"
27#include "nerubar_palace.h"
28
36
41
46
47constexpr Position UlgraxStartTeleportPosition = { -2991.9705f, -124.82639f, -1137.0024f };
48constexpr Position UlgraxStartCombatPosition = { -2862.7395f, -251.90973f, -1189.6f, 5.550147f };
49
50// Id xxxx - Areatrigger
52{
53 at_ulgrax_intro(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
54
55 void OnUnitEnter(Unit* unit) override
56 {
57 InstanceScript* instance = at->GetInstanceScript();
58 if (!instance)
59 return;
60
61 Player* player = unit->ToPlayer();
62 if (!player || player->IsGameMaster())
63 return;
64
65 if (Creature* queenAnsurek = instance->GetCreature(DATA_QUEEN_ANSUREK))
66 Conversation::CreateConversation(CONVERSATION_ULGRAX_INTRO, queenAnsurek, queenAnsurek->GetPosition(), ObjectGuid::Empty);
67
68 if (Creature* ulgrax = instance->GetCreature(DATA_ULGRAX_THE_DEVOURER))
69 ulgrax->GetMotionMaster()->MovePoint(POINT_ULGRAX_INTRO, UlgraxStartTeleportPosition);
70
71 at->Remove();
72 }
73};
74
75// 215657 - Ulgrax the Devourer
77{
79
80 void MovementInform(uint32 /*type*/, uint32 id) override
81 {
82 if (id == POINT_ULGRAX_INTRO)
83 {
85
86 scheduler.Schedule(2s, [this](TaskContext& context)
87 {
89
90 context.Schedule(11s, [this](TaskContext const& /*context*/)
91 {
93 me->SetImmuneToAll(false);
94 });
95 });
96 }
97 }
98
99 void UpdateAI(uint32 diff) override
100 {
101 scheduler.Update(diff);
102
103 if (!UpdateVictim())
104 return;
105 }
106};
107
108// 451409 - Swallowing Darkness
127
128// 451411 - Swallowing Darkness
153
uint32_t uint32
Definition Define.h:154
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ TARGET_DEST_NEARBY_ENTRY
@ EMOTE_ONESHOT_BATTLE_ROAR
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define SpellHitFn(F)
constexpr Position UlgraxStartCombatPosition
UlgraxTheDevourerConversations
@ CONVERSATION_ULGRAX_INTRO
void AddSC_boss_ulgrax_the_devourer()
@ SPELL_SWALLOWING_DARKNESS_TELEPORT
@ SPELL_SWALLOWING_DARKNESS_DAMAGE
@ SPELL_SWALLOWING_DARKNESS
constexpr Position UlgraxStartTeleportPosition
AreaTrigger *const at
TaskScheduler scheduler
static Conversation * CreateConversation(uint32 conversationEntry, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner, SpellInfo const *spellInfo=nullptr, bool autoStart=true)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:386
void SetImmuneToAll(bool apply) override
Definition Creature.h:181
Creature * GetCreature(uint32 type)
static ObjectGuid const Empty
Definition ObjectGuid.h:314
Player * ToPlayer()
Definition Object.h:126
bool IsGameMaster() const
Definition Player.h:1309
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< HitHandler > AfterHit
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
HookList< EffectHandler > OnEffectHitTarget
TaskContext & Schedule(TaskScheduler::duration_t time, TaskScheduler::task_handler_t task)
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
Definition Unit.h:635
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
@ DATA_QUEEN_ANSUREK
@ DATA_ULGRAX_THE_DEVOURER
#define RegisterNerubarPalaceCreatureAI(ai_name)
void Relocate(Position const &pos)
Definition Spell.cpp:82
void OnUnitEnter(Unit *unit) override
at_ulgrax_intro(AreaTrigger *areatrigger)
void UpdateAI(uint32 diff) override
void MovementInform(uint32, uint32 id) override
boss_ulgrax_the_devourer(Creature *creature)