TrinityCore
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
26{
32};
33
35{
47 SPELL_SACRIFICE = 30115
48};
49
51{
54};
55
57{
64};
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
75 void Reset() override
76 {
79 _Reset();
80
87 }
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);
189 }
190
191 private:
193 };
194
195 CreatureAI* GetAI(Creature* creature) const override
196 {
197 return GetKarazhanAI<npc_kilrekAI>(creature);
198 }
199};
200
202{
203public:
204 npc_demon_chain() : CreatureScript("npc_demon_chain") { }
205
207 {
208 npc_demon_chainAI(Creature* creature) : PassiveAI(creature) { }
209
210 void IsSummonedBy(WorldObject* summoner) override
211 {
212 _sacrificeGUID = summoner->GetGUID();
214 }
215
216 void JustDied(Unit* /*killer*/) override
217 {
218 if (Unit* sacrifice = ObjectAccessor::GetUnit(*me, _sacrificeGUID))
219 sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
220 }
221
222 private:
224 };
225
226 CreatureAI* GetAI(Creature* creature) const override
227 {
228 return GetKarazhanAI<npc_demon_chainAI>(creature);
229 }
230};
231
233{
234public:
235 npc_fiendish_portal() : CreatureScript("npc_fiendish_portal") { }
236
238 {
240
241 void Reset() override
242 {
243 _scheduler.Schedule(Milliseconds(2400), Seconds(8), [this](TaskContext summonImp)
244 {
246 summonImp.Repeat();
247 });
248 }
249
250 void DoAction(int32 action) override
251 {
252 if (action == ACTION_DESPAWN_IMPS)
254 }
255
256 void JustSummoned(Creature* summon) override
257 {
258 _summons.Summon(summon);
259 DoZoneInCombat(summon);
260 }
261
262 void UpdateAI(uint32 diff) override
263 {
264 _scheduler.Update(diff);
265 }
266
267 private:
270 };
271
272 CreatureAI* GetAI(Creature* creature) const override
273 {
274 return GetKarazhanAI<npc_fiendish_portalAI>(creature);
275 }
276};
277
279{
280public:
281 npc_fiendish_imp() : CreatureScript("npc_fiendish_imp") { }
282
284 {
285 npc_fiendish_impAI(Creature* creature) : ScriptedAI(creature) { }
286
287 void Reset() override
288 {
289 _scheduler.Schedule(Seconds(2), [this](TaskContext firebolt)
290 {
292 firebolt.Repeat(Milliseconds(2400));
293 });
294
296 }
297
298 void UpdateAI(uint32 diff) override
299 {
300 if (!UpdateVictim())
301 return;
302
303 _scheduler.Update(diff);
304 }
305
306 private:
308 };
309
310 CreatureAI* GetAI(Creature* creature) const override
311 {
312 return GetKarazhanAI<npc_fiendish_impAI>(creature);
313 }
314};
315
317{
319 new npc_kilrek();
320 new npc_demon_chain();
322 new npc_fiendish_imp();
323}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
@ SPELL_SCHOOL_MASK_FIRE
@ IMMUNITY_SCHOOL
void AddSC_boss_terestian_illhoof()
@ SAY_SUMMON_PORTAL
@ SPELL_DEMON_CHAINS
@ SPELL_SUMMON_DEMONCHAINS
@ SPELL_FIENDISH_PORTAL_1
@ SPELL_AMPLIFY_FLAMES
@ SPELL_SHADOW_BOLT
@ SPELL_SUMMON_FIENDISH_IMP
@ SPELL_BROKEN_PACT
@ SPELL_SUMMON_IMP
@ SPELL_FIENDISH_PORTAL_2
@ EVENT_SHADOWBOLT
@ 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 _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
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 DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
uint32 const Id
Definition: SpellInfo.h:325
void Summon(Creature const *summon)
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
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