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 {
160 DoZoneInCombat(council);
161 }
162 }
165 if (Creature* council = instance->GetCreature(CouncilData[urand(0, 3)]))
166 council->AI()->Talk(SAY_COUNCIL_AGRO);
167 }
168 }
169
170 void EnterEvadeMode(EvadeReason /*why*/) override
171 {
172 if (!me->IsInEvadeMode())
173 {
174 _inCombat = false;
175 for (uint32 bossData : CouncilData)
176 if (Creature* council = instance->GetCreature(bossData))
178
181 }
182 }
183
184 void JustDied(Unit* /*killer*/) override
185 {
186 _inCombat = false;
187 events.Reset();
189
190 for (uint32 bossData : CouncilData)
191 {
192 if (Creature* council = instance->GetCreature(bossData))
193 {
194 // Allow loot
196 council->LowerPlayerDamageReq(council->GetMaxHealth());
197 council->CastSpell(council, SPELL_QUIET_SUICIDE, true);
198 }
199 }
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 if (!UpdateVictim())
205 return;
206
207 events.Update(diff);
208
210 return;
211
212 while (uint32 eventId = events.ExecuteEvent())
213 {
214 switch (eventId)
215 {
218 events.Repeat(2s);
219 break;
220 case EVENT_BERSERK:
221 for (uint32 bossData : CouncilData)
222 {
223 if (Creature* council = instance->GetCreature(bossData))
224 {
225 council->CastSpell(council, SPELL_BERSERK, true);
226 council->AI()->Talk(SAY_COUNCIL_ENRAGE);
227 }
228 }
229 break;
230 default:
231 break;
232 }
233
235 return;
236 }
237 }
238
239private:
241};
242
244{
245 IllidariCouncilBossAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _bossId(bossId)
246 {
248 }
249
250 void Reset() override
251 {
252 events.Reset();
254 }
255
256 void JustEngagedWith(Unit* /*who*/) override
257 {
258 me->setActive(true);
260 DoZoneInCombat(illidari);
262 }
263
264 virtual void ScheduleEvents() = 0;
265
266 void JustDied(Unit* /*killer*/) override
267 {
269 }
270
271 void EnterEvadeMode(EvadeReason why) override
272 {
274 illidari->AI()->EnterEvadeMode(why);
275 }
276
277 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
278 {
279 if (damage >= me->GetHealth() && (!who || who->GetGUID() != me->GetGUID()))
280 damage = me->GetHealth() - 1;
281 }
282
283 void KilledUnit(Unit* victim) override
284 {
285 if (victim->GetTypeId() == TYPEID_PLAYER)
287
288 if (roll_chance(30))
290 boss->AI()->Talk(SAY_COUNCIL_COMNT);
291 }
292
293private:
295};
296
298{
299public:
300 HammerTargetSelector(Unit const* unit) : _me(unit) { }
301
302 bool operator()(Unit* unit) const
303 {
304 return _me->IsInRange(unit, 10.0f, 40.0f);
305 }
306
307private:
308 Unit const* _me;
309};
310
311// 22949 - Gathios the Shatterer
313{
315
325
326 void ExecuteEvent(uint32 eventId) override
327 {
328 switch (eventId)
329 {
330 case EVENT_BLESS:
331 {
332 std::list<Unit*> TargetList;
335 Cell::VisitAllObjects(me, searcher, 100.0f);
336
337 if (!TargetList.empty())
338 {
341 }
342 events.Repeat(30s, 45s);
343 break;
344 }
345 case EVENT_AURA:
347 events.Repeat(30s);
348 break;
352 events.Repeat(20s);
353 break;
354 case EVENT_JUDGEMENT:
356 events.Repeat(15s);
357 break;
360 events.Repeat(30s, 35s);
361 break;
362 default:
363 break;
364 }
365 }
366};
367
368// 22950 - High Nethermancer Zerevor
370{
372
373 void Reset() override
374 {
378 }
379
387
388 void DoAction(int32 actionId) override
389 {
390 if (actionId == ACTION_REFRESH_DAMPEN)
392 }
393
394 void ExecuteEvent(uint32 eventId) override
395 {
396 switch (eventId)
397 {
400 DoCast(target, SPELL_FLAMESTRIKE);
402 events.Repeat(40s);
403 break;
404 case EVENT_BLIZZARD:
406 DoCast(target, SPELL_BLIZZARD);
407 events.Repeat(15s, 40s);
408 break;
411 break;
414 {
418 }
419 events.Repeat(1s);
420 break;
423 break;
424 default:
425 break;
426 }
427 }
428
429 void UpdateAI(uint32 diff) override
430 {
431 if (!UpdateVictim())
432 return;
433
434 events.Update(diff);
435
437 return;
438
439 while (uint32 eventId = events.ExecuteEvent())
440 {
441 ExecuteEvent(eventId);
443 return;
444 }
445
447 }
448
449private:
451};
452
453// 22951 - Lady Malande
455{
457 {
458 me->SetCanMelee(false); // DoSpellAttackIfReady
459 }
460
467
468 void HealReceived(Unit* /*who*/, uint32& addhealth) override
469 {
470 // Need be negative to heal trigger
471 me->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellBP0(-int32(addhealth)));
472 }
473
474 void ExecuteEvent(uint32 eventId) override
475 {
476 switch (eventId)
477 {
480 events.Repeat(20s, 35s);
481 break;
485 events.Repeat(40s);
486 break;
489 events.Repeat(20s);
490 break;
491 default:
492 break;
493 }
494 }
495
496 void UpdateAI(uint32 diff) override
497 {
498 if (!UpdateVictim())
499 return;
500
501 events.Update(diff);
502
504 return;
505
506 while (uint32 eventId = events.ExecuteEvent())
507 {
508 ExecuteEvent(eventId);
510 return;
511 }
512
514 }
515};
516
517// 22952 - Veras Darkshadow
519{
521
522 void ScheduleEvents() override
523 {
525 }
526
527 bool CanSeeAlways(WorldObject const* who) override
528 {
529 return me->HasAura(SPELL_VANISH) ? true : ScriptedAI::CanSeeAlways(who);
530 }
531
532 void ExecuteEvent(uint32 eventId) override
533 {
534 switch (eventId)
535 {
536 case EVENT_VANISH:
540 events.Repeat(60s);
541 break;
542 default:
543 break;
544 }
545 }
546};
547
548// 23451 - Veras Vanish Effect
550{
551 npc_veras_vanish_effect(Creature* creature) : PassiveAI(creature) { }
552
553 void Reset() override
554 {
555 DoCastSelf(SPELL_BIRTH, true);
556 _scheduler.Schedule(1s, [this](TaskContext const& /*context*/)
557 {
559 });
560 }
561
562 void UpdateAI(uint32 diff) override
563 {
564 _scheduler.Update(diff);
565 }
566
567private:
569};
570
571// 41499 - Empyreal Balance
573{
574 void HandleDummy(SpellEffIndex /*effIndex*/)
575 {
576 Unit* target = GetHitUnit();
577 uint32 health = GetCaster()->CountPctFromCurHealth(25);
578 target->SetMaxHealth(health);
579 target->SetHealth(health);
580 }
581
586};
587
588// 41333 - Empyreal Equivalency
601
602// 41341 - Balance of Power
604{
605 bool Validate(SpellInfo const* /*spellInfo*/) override
606 {
608 }
609
610 void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/)
611 {
613 GetTarget()->CastSpell(nullptr, SPELL_SHARED_RULE, CastSpellExtraArgs(aurEff).AddSpellBP0(dmgInfo.GetDamage()));
614 }
615
620};
621
622// 41480 - Deadly Strike
624{
625 bool Validate(SpellInfo const* /*spellInfo*/) override
626 {
628 }
629
630 void OnTrigger(AuraEffect const* aurEff)
631 {
633
634 if (Unit* victim = GetTarget()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, true))
635 GetTarget()->CastSpell(victim, SPELL_DEADLY_POISON, aurEff);
636 }
637
642};
643
644// 41485 - Deadly Poison
646{
647 bool Validate(SpellInfo const* /*spellInfo*/) override
648 {
650 }
651
652 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
653 {
654 if (Unit* caster = GetCaster())
655 {
656 Unit* target = GetTarget();
657 caster->CastSpell(target, SPELL_ENVENOM, true);
658 target->CastSpell(nullptr, SPELL_ENVENOM_VISUAL, true);
659 }
660 }
661
666};
667
668// 41476 - Vanish
670{
671 bool Validate(SpellInfo const* /*spellInfo*/) override
672 {
674 }
675
676 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
677 {
679 }
680
685};
686
687// 41475 - Reflective Shield
689{
690 bool Validate(SpellInfo const* /*spellInfo*/) override
691 {
693 }
694
695 void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
696 {
697 Unit* target = GetTarget();
698 if (dmgInfo.GetAttacker() == target)
699 return;
700
701 target->CastSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_DAMAGE, CastSpellExtraArgs(aurEff).AddSpellBP0(absorbAmount/2));
702 }
703
708};
709
710// 41467 - Judgement
712{
713 bool Validate(SpellInfo const* /*spellInfo*/) override
714 {
715 return ValidateSpellInfo(
716 {
720 });
721 }
722
723 void HandleScript(SpellEffIndex /*effIndex*/)
724 {
725 Unit* caster = GetCaster();
726 Unit* target = GetHitUnit();
728 caster->CastSpell(target, SPELL_JUDGEMENT_PRIMER, true);
729 caster->CastSpell(target, judgementId, true);
730 }
731
733 {
734 if (Creature* caster = GetCaster()->ToCreature())
735 caster->AI()->Talk(SAY_COUNCIL_SPECIAL);
736 }
737
743};
744
745/* 41469 - Seal of Command
746 41459 - Seal of Blood */
748{
749 bool Validate(SpellInfo const* /*spellInfo*/) override
750 {
751 return ValidateSpellInfo(
752 {
755 });
756 }
757
758 void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
759 {
760 Unit* target = GetTarget();
761 if (target->IsInWorld() && target->IsAlive())
762 {
764 target->CastSpell(target, spellId, true);
765 }
766 }
767
772};
773
774// 41478 - Dampen Magic
776{
777 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
778 {
779 if (Creature* target = GetTarget()->ToCreature())
780 {
783 target->AI()->DoAction(ACTION_REFRESH_DAMPEN);
784 }
785 }
786
791};
792
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
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:43
#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:290
#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: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:224
Unit * GetAttacker() const
Definition Unit.h:460
uint32 GetDamage() const
Definition Unit.h:466
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
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:53
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void SetHealth(uint64 val)
Definition Unit.cpp:10041
uint64 CountPctFromCurHealth(float pct) const
Definition Unit.h:810
bool IsAlive() const
Definition Unit.h:1205
uint64 GetHealth() const
Definition Unit.h:800
void SetMaxHealth(uint64 val)
Definition Unit.cpp:10072
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void setActive(bool isActiveObject)
Definition Object.cpp:274
bool IsInRange(WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
Definition Object.cpp:590
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:1512
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)
Definition CellImpl.h:160
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)