TrinityCore
Loading...
Searching...
No Matches
boss_illidari_council.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 "black_temple.h"
20#include "CellImpl.h"
21#include "Containers.h"
22#include "GridNotifiersImpl.h"
23#include "InstanceScript.h"
24#include "PassiveAI.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellScript.h"
28
38
40{
41 // Illidari Council (Trigger)
44
45 // Generic
50
51 // High Nethermancer Zerevor's
57
58 // Lady Malande's
64
65 // Gathios the Shatterer's
78
79 // Veras Darkshadow's
84 SPELL_VANISH = 41476,
86
87 // Veras Vanish Effect
88 SPELL_BIRTH = 40031,
90};
91
111
117
125
127{
128 std::vector<uint32> bossData;
129 for (uint32 data : CouncilData)
130 if (data != exception)
131 bossData.emplace_back(data);
132
134}
135
136// 23426 - The Illidari Council
138{
140
141 void Reset() override
142 {
143 _Reset();
144 _inCombat = false;
146 }
147
148 void JustEngagedWith(Unit* who) override
149 {
150 if (!_inCombat)
151 {
152 _inCombat = true;
155 for (uint32 bossData : CouncilData)
156 {
157 if (Creature* council = instance->GetCreature(bossData))
158 DoZoneInCombat(council);
159 }
162 if (Creature* council = instance->GetCreature(CouncilData[urand(0, 3)]))
163 council->AI()->Talk(SAY_COUNCIL_AGRO);
164 }
165 }
166
167 void EnterEvadeMode(EvadeReason /*why*/) override
168 {
169 if (!me->IsInEvadeMode())
170 {
171 _inCombat = false;
174 }
175 }
176
177 void JustDied(Unit* /*killer*/) override
178 {
179 _inCombat = false;
180 events.Reset();
182
183 for (uint32 bossData : CouncilData)
184 {
185 if (Creature* council = instance->GetCreature(bossData))
186 {
187 // Allow loot
188 council->LowerPlayerDamageReq(council->GetMaxHealth());
189 council->CastSpell(council, SPELL_QUIET_SUICIDE, true);
190 }
191 }
192 }
193
194 void UpdateAI(uint32 diff) override
195 {
196 if (!UpdateVictim())
197 return;
198
199 events.Update(diff);
200
202 return;
203
204 while (uint32 eventId = events.ExecuteEvent())
205 {
206 switch (eventId)
207 {
210 events.Repeat(2s);
211 break;
212 case EVENT_BERSERK:
213 for (uint32 bossData : CouncilData)
214 {
215 if (Creature* council = instance->GetCreature(bossData))
216 {
217 council->CastSpell(council, SPELL_BERSERK, true);
218 council->AI()->Talk(SAY_COUNCIL_ENRAGE);
219 }
220 }
221 break;
222 default:
223 break;
224 }
225
227 return;
228 }
229 }
230
231private:
233};
234
236{
237 IllidariCouncilBossAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _bossId(bossId)
238 {
240 }
241
242 void Reset() override
243 {
245 events.Reset();
247 }
248
249 void JustEngagedWith(Unit* /*who*/) override
250 {
252 me->setActive(true);
254 DoZoneInCombat(illidari);
256 }
257
258 virtual void ScheduleEvents() = 0;
259
260 void JustDied(Unit* /*killer*/) override
261 {
263 }
264
265 void EnterEvadeMode(EvadeReason why) override
266 {
268 illidari->AI()->EnterEvadeMode(why);
269 }
270
271 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
272 {
273 if (damage >= me->GetHealth() && (!who || who->GetGUID() != me->GetGUID()))
274 damage = me->GetHealth() - 1;
275 }
276
277 void KilledUnit(Unit* victim) override
278 {
279 if (victim->GetTypeId() == TYPEID_PLAYER)
281
282 if (roll_chance_i(30))
284 boss->AI()->Talk(SAY_COUNCIL_COMNT);
285 }
286
287private:
289};
290
292{
293public:
294 HammerTargetSelector(Unit const* unit) : _me(unit) { }
295
296 bool operator()(Unit* unit) const
297 {
298 return _me->IsInRange(unit, 10.0f, 40.0f);
299 }
300
301private:
302 Unit const* _me;
303};
304
305// 22949 - Gathios the Shatterer
307{
309
319
320 void ExecuteEvent(uint32 eventId) override
321 {
322 switch (eventId)
323 {
324 case EVENT_BLESS:
325 {
326 std::list<Unit*> TargetList;
329 Cell::VisitAllObjects(me, searcher, 100.0f);
330
331 if (!TargetList.empty())
332 {
335 }
336 events.Repeat(30s, 45s);
337 break;
338 }
339 case EVENT_AURA:
341 events.Repeat(30s);
342 break;
346 events.Repeat(20s);
347 break;
348 case EVENT_JUDGEMENT:
350 events.Repeat(15s);
351 break;
354 events.Repeat(30s, 35s);
355 break;
356 default:
357 break;
358 }
359 }
360};
361
362// 22950 - High Nethermancer Zerevor
364{
366
367 void Reset() override
368 {
372 }
373
381
382 void DoAction(int32 actionId) override
383 {
384 if (actionId == ACTION_REFRESH_DAMPEN)
386 }
387
388 void ExecuteEvent(uint32 eventId) override
389 {
390 switch (eventId)
391 {
394 DoCast(target, SPELL_FLAMESTRIKE);
396 events.Repeat(40s);
397 break;
398 case EVENT_BLIZZARD:
400 DoCast(target, SPELL_BLIZZARD);
401 events.Repeat(15s, 40s);
402 break;
405 break;
408 {
412 }
413 events.Repeat(1s);
414 break;
417 break;
418 default:
419 break;
420 }
421 }
422
423 void UpdateAI(uint32 diff) override
424 {
425 if (!UpdateVictim())
426 return;
427
428 events.Update(diff);
429
431 return;
432
433 while (uint32 eventId = events.ExecuteEvent())
434 {
435 ExecuteEvent(eventId);
437 return;
438 }
439
441 }
442
443private:
445};
446
447// 22951 - Lady Malande
449{
451
458
459 void HealReceived(Unit* /*who*/, uint32& addhealth) override
460 {
461 // Need be negative to heal trigger
462 me->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(-int32(addhealth)));
463 }
464
465 void ExecuteEvent(uint32 eventId) override
466 {
467 switch (eventId)
468 {
471 events.Repeat(20s, 35s);
472 break;
476 events.Repeat(40s);
477 break;
480 events.Repeat(20s);
481 break;
482 default:
483 break;
484 }
485 }
486
487 void UpdateAI(uint32 diff) override
488 {
489 if (!UpdateVictim())
490 return;
491
492 events.Update(diff);
493
495 return;
496
497 while (uint32 eventId = events.ExecuteEvent())
498 {
499 ExecuteEvent(eventId);
501 return;
502 }
503
505 }
506};
507
508// 22952 - Veras Darkshadow
510{
512
513 void ScheduleEvents() override
514 {
516 }
517
518 bool CanSeeAlways(WorldObject const* who) override
519 {
520 return me->HasAura(SPELL_VANISH) ? true : ScriptedAI::CanSeeAlways(who);
521 }
522
523 void ExecuteEvent(uint32 eventId) override
524 {
525 switch (eventId)
526 {
527 case EVENT_VANISH:
531 events.Repeat(60s);
532 break;
533 default:
534 break;
535 }
536 }
537};
538
539// 23451 - Veras Vanish Effect
541{
542 npc_veras_vanish_effect(Creature* creature) : PassiveAI(creature) { }
543
544 void Reset() override
545 {
546 DoCastSelf(SPELL_BIRTH, true);
547 _scheduler.Schedule(1s, [this](TaskContext /*context*/)
548 {
550 });
551 }
552
553 void UpdateAI(uint32 diff) override
554 {
555 _scheduler.Update(diff);
556 }
557
558private:
560};
561
562// 41499 - Empyreal Balance
580
581// 41333 - Empyreal Equivalency
596
597// 41341 - Balance of Power
599{
601
602 bool Validate(SpellInfo const* /*spell*/) override
603 {
605 }
606
607 void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
608 {
610 GetTarget()->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(aurEff).AddSpellBP0(dmgInfo.GetDamage()));
611 }
612
617};
618
619// 41480 - Deadly Strike
621{
623
624 bool Validate(SpellInfo const* /*spellInfo*/) override
625 {
627 }
628
629 void OnTrigger(AuraEffect const* aurEff)
630 {
632
633 if (Unit* victim = GetTarget()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true))
634 GetTarget()->CastSpell(victim, SPELL_DEADLY_POISON, aurEff);
635 }
636
641};
642
643// 41485 - Deadly Poison
645{
647
648 bool Validate(SpellInfo const* /*spellInfo*/) override
649 {
651 }
652
653 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
654 {
655 if (Unit* caster = GetCaster())
656 {
657 Unit* target = GetTarget();
658 caster->CastSpell(target, SPELL_ENVENOM, true);
659 target->CastSpell(nullptr, SPELL_ENVENOM_VISUAL, true);
660 }
661 }
662
667};
668
669// 41476 - Vanish
689
690// 41475 - Reflective Shield
692{
694
695 bool Validate(SpellInfo const* /*spellInfo*/) override
696 {
698 }
699
700 void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
701 {
702 Unit* target = GetTarget();
703 if (dmgInfo.GetAttacker() == target)
704 return;
705
706 target->CastSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(absorbAmount/2));
707 }
708
713};
714
715// 41467 - Judgement
717{
719
720 bool Validate(SpellInfo const* /*spellInfo*/) override
721 {
722 return ValidateSpellInfo(
723 {
727 });
728 }
729
730 void HandleScript(SpellEffIndex /*effIndex*/)
731 {
732 Unit* caster = GetCaster();
733 Unit* target = GetHitUnit();
735 caster->CastSpell(target, SPELL_JUDGEMENT_PRIMER, true);
736 caster->CastSpell(target, judgementId, true);
737 }
738
740 {
741 if (Creature* caster = GetCaster()->ToCreature())
742 caster->AI()->Talk(SAY_COUNCIL_SPECIAL);
743 }
744
750};
751
752/* 41469 - Seal of Command
753 41459 - Seal of Blood */
755{
757
758 bool Validate(SpellInfo const* /*spellInfo*/) override
759 {
760 return ValidateSpellInfo(
761 {
764 });
765 }
766
767 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
768 {
769 Unit* target = GetTarget();
770 if (target->IsInWorld() && target->IsAlive())
771 {
773 target->CastSpell(target, spellId, true);
774 }
775 }
776
781};
782
783// 41478 - Dampen Magic
803
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraRemoveMode
@ AURA_REMOVE_BY_EXPIRE
@ AURA_REMOVE_BY_ENEMY_SPELL
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
@ SPELL_AURA_MOD_ROOT
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectAbsorbFn(F, I)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_ILLIDARI_COUNCIL
@ DATA_HIGH_NETHERMANCER_ZEREVOR
@ DATA_GATHIOS_THE_SHATTERER
@ DATA_VERAS_DARKSHADOW
@ DATA_LADY_MALANDE
void AddSC_boss_illidari_council()
uint32 const CouncilData[4]
static uint32 GetRandomBossExcept(uint32 exception)
@ SPELL_CIRCLE_OF_HEALING
@ SPELL_HAMMER_OF_JUSTICE
@ SPELL_SHARED_RULE
@ SPELL_DIVINE_WRATH
@ SPELL_JUDGEMENT_PRIMER
@ SPELL_FLAMESTRIKE
@ SPELL_JUDGEMENT_OF_COMMAND
@ SPELL_ENVENOM_VISUAL
@ SPELL_EMPYREAL_EQUIVALENCY
@ SPELL_EMPOWERED_SMITE
@ SPELL_VANISH_TELEPORT
@ SPELL_REFLECTIVE_SHIELD
@ SPELL_REFLECTIVE_SHIELD_DAMAGE
@ SPELL_BALANCE_OF_POWER
@ SPELL_CONSECRATION
@ SPELL_ARCANE_EXPLOSION
@ SPELL_DEADLY_POISON
@ SPELL_BLESS_PROTECTION
@ SPELL_CHROMATIC_AURA
@ SPELL_DEVOTION_AURA
@ SPELL_EMPYREAL_BALANCE
@ SPELL_SEAL_OF_BLOOD
@ SPELL_ARCANE_BOLT
@ SPELL_QUIET_SUICIDE
@ SPELL_DAMPEN_MAGIC
@ SPELL_JUDGEMENT_OF_BLOOD
@ SPELL_BLESS_SPELL_WARDING
@ SPELL_SEAL_OF_COMMAND
@ SPELL_DEADLY_STRIKE
@ SPELL_ENVENOM_DUMMY
@ EVENT_REFLECTIVE_SHIELD
@ EVENT_CIRCLE_OF_HEALING
@ EVENT_HAMMER_OF_JUSTICE
@ EVENT_FLAMESTRIKE
@ EVENT_ARCANE_EXPLOSION
@ EVENT_EMPYREAL_EQUIVALENCY
@ EVENT_ARCANE_EXPLOSION_CHECK
@ SAY_COUNCIL_DEATH
@ SAY_COUNCIL_COMNT
@ SAY_COUNCIL_ENRAGE
@ SAY_COUNCIL_SPECIAL
@ ACTION_REFRESH_DAMPEN
@ SUMMON_COUNCIL_GROUP
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:80
uint32 GetId() const
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectAbsorbHandler > AfterEffectAbsorb
Unit * GetCaster() const
HookList< EffectAbsorbHandler > OnEffectAbsorb
Unit * GetTarget() const
HookList< EffectApplyHandler > OnEffectRemove
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
virtual bool CanSeeAlways(WorldObject const *)
Definition CreatureAI.h:242
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:82
void SetCombatPulseDelay(uint32 delay)
Definition Creature.h:269
bool IsInEvadeMode() const
Definition Creature.h:146
Unit * GetAttacker() const
Definition Unit.h:458
uint32 GetDamage() const
Definition Unit.h:464
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
void Reset()
Definition EventMap.cpp:21
HammerTargetSelector(Unit const *unit)
bool operator()(Unit *unit) const
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
CreatureBoundary const * GetBossBoundary(uint32 id) const
bool IsInWorld() const
Definition Object.h:73
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
HookList< CastHandler > AfterCast
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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
bool DoSpellAttackIfReady(uint32 spell)
Definition UnitAI.cpp:78
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsAlive() const
Definition Unit.h:1234
void SetHealth(uint32 val)
Definition Unit.cpp:9361
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
uint32 CountPctFromCurHealth(int32 pct) const
Definition Unit.h:923
uint32 GetHealth() const
Definition Unit.h:913
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetMaxHealth(uint32 val)
Definition Unit.cpp:9393
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
void setActive(bool isActiveObject)
Definition Object.cpp:991
bool IsInRange(WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
Definition Object.cpp:1283
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void Absorb(AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_illidari_council_balance_of_power)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_illidari_council_deadly_poison)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void OnTrigger(AuraEffect const *aurEff)
PrepareAuraScript(spell_illidari_council_deadly_strike)
PrepareSpellScript(spell_illidari_council_empyreal_balance)
PrepareSpellScript(spell_illidari_council_empyreal_equivalency)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_illidari_council_judgement)
PrepareAuraScript(spell_illidari_council_reflective_shield)
void OnAbsorb(AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_illidari_council_seal)
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_illidari_council_vanish)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_illidari_dampen_magic)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:192
void DamageTaken(Unit *who, uint32 &damage, DamageEffectType, SpellInfo const *) override
virtual void ScheduleEvents()=0
IllidariCouncilBossAI(Creature *creature, uint32 bossId)
void EnterEvadeMode(EvadeReason why) override
void KilledUnit(Unit *victim) override
void JustEngagedWith(Unit *) override
void JustDied(Unit *) override
boss_gathios_the_shatterer(Creature *creature)
void ExecuteEvent(uint32 eventId) override
void ExecuteEvent(uint32 eventId) override
boss_high_nethermancer_zerevor(Creature *creature)
void DoAction(int32 actionId) override
void UpdateAI(uint32 diff) override
boss_illidari_council(Creature *creature)
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void EnterEvadeMode(EvadeReason) override
void UpdateAI(uint32 diff) override
void ExecuteEvent(uint32 eventId) override
void HealReceived(Unit *, uint32 &addhealth) override
void UpdateAI(uint32 diff) override
boss_lady_malande(Creature *creature)
boss_veras_darkshadow(Creature *creature)
bool CanSeeAlways(WorldObject const *who) override
void ExecuteEvent(uint32 eventId) override
void UpdateAI(uint32 diff) override
npc_veras_vanish_effect(Creature *creature)