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 update
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
63
71
80
81// 17798 - Warlord Kalithresh
83{
85
86 void Reset() override
87 {
88 _Reset();
90 }
91
92 void JustEngagedWith(Unit* who) override
93 {
96
101 }
102
104 void MoveInLineOfSight(Unit* who) override
105 {
106 if (!_introDone && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 50.0f))
107 {
108 _introDone = true;
110 }
111
113 }
114
115 void MovementInform(uint32 type, uint32 pointId) override
116 {
117 if (type != POINT_MOTION_TYPE)
118 return;
119
120 if (pointId == POINT_DISTILLER)
121 {
126
128 distiller->AI()->DoAction(ACTION_DISTILLER_CHANNEL);
129 }
130 }
131
132 void DoAction(int32 action) override
133 {
134 if (action == ACTION_DISTILLER_DEAD)
136 }
137
138 void KilledUnit(Unit* /*victim*/) override
139 {
140 if (roll_chance_i(50))
141 Talk(SAY_SLAY);
142 else
144 }
145
146 void JustDied(Unit* /*killer*/) override
147 {
149 _JustDied();
150
151 std::vector<Creature*> distillers;
153 for (Creature* distiller : distillers)
154 if (distiller->IsAlive())
155 distiller->CastSpell(distiller, SPELL_QUIET_SUICIDE, true);
156 }
157
158 void UpdateAI(uint32 diff) override
159 {
160 if (!UpdateVictim())
161 return;
162
163 events.Update(diff);
164
165 while (uint32 eventId = events.ExecuteEvent())
166 {
167 switch (eventId)
168 {
169 case EVENT_HEAD_CRACK:
171 events.Repeat(20s, 30s);
172 break;
173 case EVENT_REFLECTION:
175 events.Repeat(15s, 25s);
176 break;
177 case EVENT_IMPALE:
179 DoCast(target, SPELL_IMPALE);
180 events.Repeat(7s, 12s);
181 break;
182 case EVENT_RAGE:
183 if (Creature* distiller = me->FindNearestCreature(NPC_NAGA_DISTILLER, 150.0f))
184 {
185 _distillerGUID = distiller->GetGUID();
187
188 float x, y, z;
189 distiller->GetContactPoint(me, x, y, z);
190
192 }
193 events.Repeat(50s);
194 break;
195 default:
196 break;
197 }
198 }
199
201 }
202
203private:
206};
207
208// 17954 - Naga Distiller
210{
211 npc_naga_distiller(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
212
213 void Reset() override
214 {
215 me->SetCorpseDelay(2, true);
218 }
219
220 void DoAction(int32 action) override
221 {
222 if (action == ACTION_DISTILLER_CHANNEL)
223 {
224 // Creature is stunned, cast as triggered
227 }
228 }
229
230 void JustDied(Unit* /*killer*/) override
231 {
233 kalithresh->AI()->DoAction(ACTION_DISTILLER_DEAD);
234 }
235
236private:
238};
239
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
@ SPELL_DISTILLER_DUMMY_TRIGGER_2
@ SPELL_DISTILLER_DUMMY_TRIGGER_1
@ SPELL_SUMMON_DISTILLER_2
@ SPELL_DISTILLER_DUMMY
@ SPELL_DISTILLER_DUMMY_COMBAT
@ SPELL_DISTILLER_DUMMY_DESPAWN
@ SPELL_SUMMON_DISTILLER_1
@ SPELL_SUMMON_DISTILLER_3
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:119
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:89
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 MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
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
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_WARLORD_KALITHRESH
Definition steam_vault.h:32
#define RegisterSteamVaultCreatureAI(ai_name)
Definition steam_vault.h:70
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)