TrinityCore
Loading...
Searching...
No Matches
boss_terestian_illhoof.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 "karazhan.h"
20#include "ObjectAccessor.h"
21#include "PassiveAI.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24
33
49
55
65
67{
68public:
69 boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { }
70
71 struct boss_terestianAI : public BossAI
72 {
73 boss_terestianAI(Creature* creature) : BossAI(creature, DATA_TERESTIAN) { }
74
88
89 void JustEngagedWith(Unit* who) override
90 {
93 }
94
95 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
96 {
97 if (spellInfo->Id == SPELL_BROKEN_PACT)
99 }
100
101 void KilledUnit(Unit* victim) override
102 {
103 if (victim->GetTypeId() == TYPEID_PLAYER)
104 Talk(SAY_SLAY);
105 }
106
107 void JustDied(Unit* /*killer*/) override
108 {
112 _JustDied();
113 }
114
115 void ExecuteEvent(uint32 eventId) override
116 {
117 switch (eventId)
118 {
119 case EVENT_SACRIFICE:
120 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
121 {
122 DoCast(target, SPELL_SACRIFICE, true);
123 target->CastSpell(target, SPELL_SUMMON_DEMONCHAINS, true);
125 }
126 events.Repeat(Seconds(42));
127 break;
128 case EVENT_SHADOWBOLT:
130 DoCast(target, SPELL_SHADOW_BOLT);
131 events.Repeat(Seconds(4), Seconds(10));
132 break;
136 break;
140 break;
143 break;
144 case EVENT_ENRAGE:
146 break;
147 default:
148 break;
149 }
150 }
151 };
152
153 CreatureAI* GetAI(Creature* creature) const override
154 {
155 return GetKarazhanAI<boss_terestianAI>(creature);
156 }
157};
158
160{
161public:
162 npc_kilrek() : CreatureScript("npc_kilrek") { }
163
164 struct npc_kilrekAI : public ScriptedAI
165 {
166 npc_kilrekAI(Creature* creature) : ScriptedAI(creature) { }
167
168 void Reset() override
169 {
170 _scheduler.Schedule(Seconds(8), [this](TaskContext amplify)
171 {
173 amplify.Repeat(Seconds(9));
174 });
175 }
176
177 void JustDied(Unit* /*killer*/) override
178 {
181 }
182
183 void UpdateAI(uint32 diff) override
184 {
185 if (!UpdateVictim())
186 return;
187
188 _scheduler.Update(diff, [this]
189 {
191 });
192 }
193
194 private:
196 };
197
198 CreatureAI* GetAI(Creature* creature) const override
199 {
200 return GetKarazhanAI<npc_kilrekAI>(creature);
201 }
202};
203
205{
206public:
207 npc_demon_chain() : CreatureScript("npc_demon_chain") { }
208
210 {
211 npc_demon_chainAI(Creature* creature) : PassiveAI(creature) { }
212
213 void IsSummonedBy(WorldObject* summoner) override
214 {
215 _sacrificeGUID = summoner->GetGUID();
217 }
218
219 void JustDied(Unit* /*killer*/) override
220 {
221 if (Unit* sacrifice = ObjectAccessor::GetUnit(*me, _sacrificeGUID))
222 sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
223 }
224
225 private:
227 };
228
229 CreatureAI* GetAI(Creature* creature) const override
230 {
231 return GetKarazhanAI<npc_demon_chainAI>(creature);
232 }
233};
234
236{
237public:
238 npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { }
239
241 {
243
244 void Reset() override
245 {
246 _scheduler.Schedule(Milliseconds(2400), Seconds(8), [this](TaskContext summonImp)
247 {
249 summonImp.Repeat();
250 });
251 }
252
253 void DoAction(int32 action) override
254 {
255 if (action == ACTION_DESPAWN_IMPS)
257 }
258
259 void JustSummoned(Creature* summon) override
260 {
261 _summons.Summon(summon);
262 DoZoneInCombat(summon);
263 }
264
265 void UpdateAI(uint32 diff) override
266 {
267 _scheduler.Update(diff);
268 }
269
270 private:
273 };
274
275 CreatureAI* GetAI(Creature* creature) const override
276 {
277 return GetKarazhanAI<npc_fiendish_portalAI>(creature);
278 }
279};
280
282{
283public:
284 npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { }
285
287 {
288 npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) { }
289
290 void Reset() override
291 {
292 _scheduler.Schedule(Seconds(2), [this](TaskContext firebolt)
293 {
295 firebolt.Repeat(Milliseconds(2400));
296 });
297
299 }
300
301 void UpdateAI(uint32 diff) override
302 {
303 if (!UpdateVictim())
304 return;
305
306 _scheduler.Update(diff, [this]
307 {
309 });
310 }
311
312 private:
314 };
315
316 CreatureAI* GetAI(Creature* creature) const override
317 {
318 return GetKarazhanAI<npc_fiendish_impAI>(creature);
319 }
320};
321
323{
325 new npc_kilrek();
326 new npc_demon_chain();
328 new npc_fiendish_imp();
329}
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ SPELL_SCHOOL_MASK_FIRE
@ IMMUNITY_SCHOOL
void AddSC_boss_terestian_illhoof()
@ SPELL_SUMMON_DEMONCHAINS
@ SPELL_FIENDISH_PORTAL_1
@ SPELL_AMPLIFY_FLAMES
@ SPELL_SUMMON_FIENDISH_IMP
@ SPELL_FIENDISH_PORTAL_2
@ EVENT_SUMMON_PORTAL_2
@ EVENT_SUMMON_KILREK
@ EVENT_SUMMON_PORTAL_1
@ NPC_FIENDISH_PORTAL
@ ACTION_DESPAWN_IMPS
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 Id
Definition SpellInfo.h:289
void Summon(Creature const *summon)
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_TERESTIAN
Definition karazhan.h:37
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void IsSummonedBy(WorldObject *summoner) override
void UpdateAI(uint32 diff) override