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
137{
139
140 void Reset() override
141 {
142 _Reset();
143 _inCombat = false;
145 }
146
147 void JustEngagedWith(Unit* who) override
148 {
149 if (!_inCombat)
150 {
151 _inCombat = true;
154 for (uint32 bossData : CouncilData)
155 {
156 if (Creature* council = instance->GetCreature(bossData))
157 {
159 DoZoneInCombat(council);
160 }
161 }
164 if (Creature* council = instance->GetCreature(CouncilData[urand(0, 3)]))
165 council->AI()->Talk(SAY_COUNCIL_AGRO);
166 }
167 }
168
169 void EnterEvadeMode(EvadeReason /*why*/) override
170 {
171 if (!me->IsInEvadeMode())
172 {
173 _inCombat = false;
174 for (uint32 bossData : CouncilData)
175 if (Creature* council = instance->GetCreature(bossData))
177
180 }
181 }
182
183 void JustDied(Unit* /*killer*/) override
184 {
185 _inCombat = false;
186 events.Reset();
188
189 for (uint32 bossData : CouncilData)
190 {
191 if (Creature* council = instance->GetCreature(bossData))
192 {
193 // Allow loot
195 council->LowerPlayerDamageReq(council->GetMaxHealth());
196 council->CastSpell(council, SPELL_QUIET_SUICIDE, true);
197 }
198 }
199 }
200
201 void UpdateAI(uint32 diff) override
202 {
203 if (!UpdateVictim())
204 return;
205
206 events.Update(diff);
207
209 return;
210
211 while (uint32 eventId = events.ExecuteEvent())
212 {
213 switch (eventId)
214 {
218 break;
219 case EVENT_BERSERK:
220 for (uint32 bossData : CouncilData)
221 {
222 if (Creature* council = instance->GetCreature(bossData))
223 {
224 council->CastSpell(council, SPELL_BERSERK, true);
225 council->AI()->Talk(SAY_COUNCIL_ENRAGE);
226 }
227 }
228 break;
229 default:
230 break;
231 }
232
234 return;
235 }
236 }
237
238private:
240};
241
243{
244 IllidariCouncilBossAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _bossId(bossId)
245 {
247 }
248
249 void Reset() override
250 {
251 events.Reset();
253 }
254
255 void JustEngagedWith(Unit* /*who*/) override
256 {
257 me->setActive(true);
259 DoZoneInCombat(illidari);
261 }
262
263 virtual void ScheduleEvents() = 0;
264
265 void JustDied(Unit* /*killer*/) override
266 {
268 }
269
270 void EnterEvadeMode(EvadeReason why) override
271 {
273 illidari->AI()->EnterEvadeMode(why);
274 }
275
276 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
277 {
278 if (damage >= me->GetHealth() && (!who || who->GetGUID() != me->GetGUID()))
279 damage = me->GetHealth() - 1;
280 }
281
282 void KilledUnit(Unit* victim) override
283 {
284 if (victim->GetTypeId() == TYPEID_PLAYER)
286
287 if (roll_chance(30))
289 boss->AI()->Talk(SAY_COUNCIL_COMNT);
290 }
291
292private:
294};
295
297{
298public:
299 HammerTargetSelector(Unit const* unit) : _me(unit) { }
300
301 bool operator()(Unit* unit) const
302 {
303 return _me->IsInRange(unit, 10.0f, 40.0f);
304 }
305
306private:
307 Unit const* _me;
308};
309
311{
313
323
324 void ExecuteEvent(uint32 eventId) override
325 {
326 switch (eventId)
327 {
328 case EVENT_BLESS:
329 {
330 std::list<Unit*> TargetList;
333 Cell::VisitAllObjects(me, searcher, 100.0f);
334
335 if (!TargetList.empty())
336 {
339 }
340 events.Repeat(Seconds(30), Seconds(45));
341 break;
342 }
343 case EVENT_AURA:
345 events.Repeat(Seconds(30));
346 break;
350 events.Repeat(Seconds(20));
351 break;
352 case EVENT_JUDGEMENT:
354 events.Repeat(Seconds(15));
355 break;
358 events.Repeat(Seconds(30), Seconds(35));
359 break;
360 default:
361 break;
362 }
363 }
364};
365
367{
369
370 void Reset() override
371 {
375 }
376
384
385 void DoAction(int32 actionId) override
386 {
387 if (actionId == ACTION_REFRESH_DAMPEN)
389 }
390 void ExecuteEvent(uint32 eventId) override
391 {
392 switch (eventId)
393 {
396 DoCast(target, SPELL_FLAMESTRIKE);
398 events.Repeat(Seconds(40));
399 break;
400 case EVENT_BLIZZARD:
402 DoCast(target, SPELL_BLIZZARD);
403 events.Repeat(Seconds(15), Seconds(40));
404 break;
407 break;
410 {
414 }
416 break;
419 break;
420 default:
421 break;
422 }
423 }
424
425 void UpdateAI(uint32 diff) override
426 {
427 if (!UpdateVictim())
428 return;
429
430 events.Update(diff);
431
433 return;
434
435 while (uint32 eventId = events.ExecuteEvent())
436 {
437 ExecuteEvent(eventId);
439 return;
440 }
441
443 }
444
445private:
447};
448
450{
452 {
453 me->SetCanMelee(false); // DoSpellAttackIfReady
454 }
455
462
463 void HealReceived(Unit* /*who*/, uint32& addhealth) override
464 {
465 // Need be negative to heal trigger
466 me->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(-int32(addhealth)));
467 }
468
469 void ExecuteEvent(uint32 eventId) override
470 {
471 switch (eventId)
472 {
475 events.Repeat(Seconds(20), Seconds(35));
476 break;
480 events.Repeat(Seconds(40));
481 break;
484 events.Repeat(Seconds(20));
485 break;
486 default:
487 break;
488 }
489 }
490
491 void UpdateAI(uint32 diff) override
492 {
493 if (!UpdateVictim())
494 return;
495
496 events.Update(diff);
497
499 return;
500
501 while (uint32 eventId = events.ExecuteEvent())
502 {
503 ExecuteEvent(eventId);
505 return;
506 }
507
509 }
510};
511
513{
515
516 void ScheduleEvents() override
517 {
519 }
520
521 bool CanSeeAlways(WorldObject const* who) override
522 {
523 return me->HasAura(SPELL_VANISH) ? true : ScriptedAI::CanSeeAlways(who);
524 }
525
526 void ExecuteEvent(uint32 eventId) override
527 {
528 switch (eventId)
529 {
530 case EVENT_VANISH:
534 events.Repeat(Seconds(60));
535 break;
536 default:
537 break;
538 }
539 }
540};
541
543{
544 npc_veras_vanish_effect(Creature* creature) : PassiveAI(creature) { }
545
546 void Reset() override
547 {
548 DoCastSelf(SPELL_BIRTH, true);
549 _scheduler.Schedule(Seconds(1), [this](TaskContext const& /*context*/)
550 {
552 });
553 }
554
555 void UpdateAI(uint32 diff) override
556 {
557 _scheduler.Update(diff);
558 }
559
560private:
562};
563
564// 41499 - Empyreal Balance
566{
567 void HandleDummy(SpellEffIndex /*effIndex*/)
568 {
569 Unit* target = GetHitUnit();
570 uint32 health = GetCaster()->CountPctFromCurHealth(25);
571 target->SetMaxHealth(health);
572 target->SetHealth(health);
573 }
574
579};
580
581// 41333 - Empyreal Equivalency
594
595// 41341 - Balance of Power
597{
598 bool Validate(SpellInfo const* /*spellInfo*/) override
599 {
601 }
602
603 void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
604 {
606 GetTarget()->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(aurEff).AddSpellBP0(dmgInfo.GetDamage()));
607 }
608
613};
614
615// 41480 - Deadly Strike
617{
618 bool Validate(SpellInfo const* /*spellInfo*/) override
619 {
621 }
622
623 void OnTrigger(AuraEffect const* aurEff)
624 {
626
627 if (Unit* victim = GetTarget()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true))
628 GetTarget()->CastSpell(victim, SPELL_DEADLY_POISON, aurEff);
629 }
630
635};
636
637// 41485 - Deadly Poison
639{
640 bool Validate(SpellInfo const* /*spellInfo*/) override
641 {
643 }
644
645 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
646 {
647 if (Unit* caster = GetCaster())
648 {
649 Unit* target = GetTarget();
650 caster->CastSpell(target, SPELL_ENVENOM, true);
651 target->CastSpell(nullptr, SPELL_ENVENOM_VISUAL, true);
652 }
653 }
654
659};
660
661// 41476 - Vanish
663{
664 bool Validate(SpellInfo const* /*spellInfo*/) override
665 {
667 }
668
669 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
670 {
672 }
673
678};
679
680// 41475 - Reflective Shield
682{
683 bool Validate(SpellInfo const* /*spellInfo*/) override
684 {
686 }
687
688 void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
689 {
690 Unit* target = GetTarget();
691 if (dmgInfo.GetAttacker() == target)
692 return;
693
694 target->CastSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(absorbAmount/2));
695 }
696
701};
702
703// 41467 - Judgement
705{
706 bool Validate(SpellInfo const* /*spellInfo*/) override
707 {
708 return ValidateSpellInfo(
709 {
713 });
714 }
715
716 void HandleScript(SpellEffIndex /*effIndex*/)
717 {
718 Unit* caster = GetCaster();
719 Unit* target = GetHitUnit();
721 caster->CastSpell(target, SPELL_JUDGEMENT_PRIMER, true);
722 caster->CastSpell(target, judgementId, true);
723 }
724
726 {
727 if (Creature* caster = GetCaster()->ToCreature())
728 caster->AI()->Talk(SAY_COUNCIL_SPECIAL);
729 }
730
736};
737
738/* 41469 - Seal of Command
739 41459 - Seal of Blood */
741{
742 bool Validate(SpellInfo const* /*spellInfo*/) override
743 {
744 return ValidateSpellInfo(
745 {
748 });
749 }
750
751 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
752 {
753 Unit* target = GetTarget();
754 if (target->IsInWorld() && target->IsAlive())
755 {
757 target->CastSpell(target, spellId, true);
758 }
759 }
760
765};
766
767// 41478 - Dampen Magic
769{
770 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
771 {
772 if (Creature* target = GetTarget()->ToCreature())
773 {
776 target->AI()->DoAction(ACTION_REFRESH_DAMPEN);
777 }
778 }
779
784};
785
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
AuraRemoveMode
@ AURA_REMOVE_BY_EXPIRE
@ AURA_REMOVE_BY_ENEMY_SPELL
@ 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
Used when doing CastSpell with triggered == true.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
#define AuraEffectAbsorbFn(F, I)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_ILLIDARI_COUNCIL
@ DATA_HIGH_NETHERMANCER_ZEREVOR
@ DATA_GATHIOS_THE_SHATTERER
@ DATA_VERAS_DARKSHADOW
@ DATA_LADY_MALANDE
@ SAY_COUNCIL_DEATH
@ SAY_COUNCIL_COMNT
@ SAY_COUNCIL_ENRAGE
@ SAY_COUNCIL_SPECIAL
@ EVENT_REFLECTIVE_SHIELD
@ EVENT_CIRCLE_OF_HEALING
@ EVENT_HAMMER_OF_JUSTICE
@ EVENT_FLAMESTRIKE
@ EVENT_ARCANE_EXPLOSION
@ EVENT_EMPYREAL_EQUIVALENCY
@ EVENT_ARCANE_EXPLOSION_CHECK
void AddSC_boss_illidari_council()
uint32 const CouncilData[4]
@ 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
static uint32 GetRandomBossExcept(uint32 exception)
@ ACTION_REFRESH_DAMPEN
@ SUMMON_COUNCIL_GROUP
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:96
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
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
TypeID GetTypeId() const
Definition BaseEntity.h:166
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:232
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:63
void SetCanMelee(bool canMelee, bool fleeFromMelee=false)
bool IsInEvadeMode() const
Definition Creature.h:217
Unit * GetAttacker() const
Definition Unit.h:446
uint32 GetDamage() const
Definition Unit.h:452
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
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
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
bool DoSpellAttackIfReady(uint32 spellId)
Definition UnitAI.cpp:61
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void SetHealth(uint64 val)
Definition Unit.cpp:9973
uint64 CountPctFromCurHealth(float pct) const
Definition Unit.h:798
bool IsAlive() const
Definition Unit.h:1185
uint64 GetHealth() const
Definition Unit.h:788
void SetMaxHealth(uint64 val)
Definition Unit.cpp:10004
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void setActive(bool isActiveObject)
Definition Object.cpp:276
bool IsInRange(WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
Definition Object.cpp:592
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:1507
void Absorb(AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void OnTrigger(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void OnAbsorb(AuraEffect *aurEff, DamageInfo &dmgInfo, uint32 &absorbAmount)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:203
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)