TrinityCore
Loading...
Searching...
No Matches
boss_warlord_kalithresh.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/*
19 * Timers requires to be revisited
20 * Distillers should respawn at some point, probably in case of wipe
21 */
22
23#include "ScriptMgr.h"
24#include "InstanceScript.h"
25#include "MotionMaster.h"
26#include "ObjectAccessor.h"
27#include "ScriptedCreature.h"
28#include "steam_vault.h"
29
39
52
59
68
69// 17798 - Warlord Kalithresh
71{
73
74 void Reset() override
75 {
76 _Reset();
78 }
79
93
95 void MoveInLineOfSight(Unit* who) override
96 {
97 if (!_introDone && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 50.0f))
98 {
99 _introDone = true;
101 }
102
104 }
105
106 void MovementInform(uint32 type, uint32 pointId) override
107 {
108 if (type != POINT_MOTION_TYPE)
109 return;
110
111 if (pointId == POINT_DISTILLER)
112 {
117
119 distiller->AI()->DoAction(ACTION_DISTILLER_CHANNEL);
120 }
121 }
122
123 void DoAction(int32 action) override
124 {
125 if (action == ACTION_DISTILLER_DEAD)
127 }
128
136
137 void KilledUnit(Unit* /*victim*/) override
138 {
139 if (roll_chance_i(50))
140 Talk(SAY_SLAY);
141 else
143 }
144
145 void JustDied(Unit* /*killer*/) override
146 {
147 _JustDied();
149
150 std::vector<Creature*> distillers;
152 for (Creature* distiller : distillers)
153 if (distiller->IsAlive())
154 distiller->CastSpell(distiller, SPELL_QUIET_SUICIDE, true);
155
158 }
159
160 void UpdateAI(uint32 diff) override
161 {
162 if (!UpdateVictim())
163 return;
164
165 events.Update(diff);
166
167 while (uint32 eventId = events.ExecuteEvent())
168 {
169 switch (eventId)
170 {
171 case EVENT_HEAD_CRACK:
173 events.Repeat(20s, 30s);
174 break;
175 case EVENT_REFLECTION:
177 events.Repeat(20s, 40s);
178 break;
179 case EVENT_RAGE:
180 if (Creature* distiller = me->FindNearestCreature(NPC_NAGA_DISTILLER, 150.0f))
181 {
182 _distillerGUID = distiller->GetGUID();
184
185 float x, y, z;
186 distiller->GetContactPoint(me, x, y, z);
187
189 }
190 events.Repeat(50s);
191 break;
192 default:
193 break;
194 }
195 }
196
198 }
199
200private:
203};
204
205// 17954 - Naga Distiller
207{
208 npc_naga_distiller(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
209
210 void Reset() override
211 {
212 me->SetCorpseDelay(2, true);
215 }
216
217 void DoAction(int32 action) override
218 {
219 if (action == ACTION_DISTILLER_CHANNEL)
220 {
221 // Creature is stunned, cast as triggered
224 }
225 }
226
227 void JustDied(Unit* /*killer*/) override
228 {
230 kalithresh->AI()->DoAction(ACTION_DISTILLER_DEAD);
231 }
232
233private:
235};
236
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
void AddSC_boss_warlord_kalithresh()
@ ACTION_DISTILLER_DEAD
@ ACTION_DISTILLER_CHANNEL
@ SPELL_WARLORDS_RAGE_DISTILLER
InstanceScript *const instance
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
virtual void MoveInLineOfSight(Unit *)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:128
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
GameObject * GetGameObject(uint32 type)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
static ObjectGuid const Empty
Definition ObjectGuid.h:140
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Definition Unit.h:783
MotionMaster * GetMotionMaster()
Definition Unit.h:1683
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:968
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2100
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1193
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_MAIN_CHAMBERS_DOOR
Definition steam_vault.h:36
@ DATA_WARLORD_KALITHRESH
Definition steam_vault.h:32
#define RegisterSteamVaultCreatureAI(ai_name)
Definition steam_vault.h:61
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void DoAction(int32 action) override
void MoveInLineOfSight(Unit *who) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 pointId) override
boss_warlord_kalithresh(Creature *creature)
void DoAction(int32 action) override
void JustDied(Unit *) override
npc_naga_distiller(Creature *creature)