TrinityCore
Loading...
Searching...
No Matches
worldboss_julak_doom.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 "ScriptedCreature.h"
19#include "ScriptMgr.h"
20#include "SpellAuraEffects.h"
21#include "SpellScript.h"
22#include "Unit.h"
23
25{
26 namespace Spells
27 {
28 static constexpr uint32 SpellBlackBreath = 93611;
29 static constexpr uint32 SpellMassiveShockwave = 93610;
30 static constexpr uint32 SpellDarkWhisper = 93621;
31 }
32 namespace Events
33 {
34 static constexpr uint32 EventBlackBreath = 1;
35 static constexpr uint32 EventMassiveShockwave = 2;
36 static constexpr uint32 EventDarkWhisper = 3;
37 }
38
39 // 50089 - Julak-Doom
41 {
43
52
53 void UpdateAI(uint32 diff) override
54 {
55 if (!UpdateVictim())
56 return;
57
58 events.Update(diff);
59
61 return;
62
63 while (uint32 eventId = events.ExecuteEvent())
64 {
65 switch (eventId)
66 {
68 {
69 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 60.0f, true))
72 break;
73 }
75 {
78 break;
79 }
81 {
82 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 60.0f, true))
85 break;
86 }
87 default:
88 break;
89 }
90 }
91 }
92 };
93
94 // 93612 - Black Breath
96 {
97 void FilterTargets(std::list<WorldObject*>& targets)
98 {
99 float maxRadius = 5.0f * GetCaster()->GetObjectScale();
100 targets.remove_if([this, maxRadius](WorldObject* target) -> bool
101 {
102 return target->GetExactDist(GetCaster()) > maxRadius;
103 });
104 }
105
110 };
111
112 // 93621 - Dark Whisper
114 {
115 bool CheckProc(ProcEventInfo& eventInfo)
116 {
117 if (eventInfo.GetActionTarget()->HealthBelowPct(90))
118 return true;
119
120 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
121 if (damageInfo && damageInfo->GetDamage())
122 if (GetTarget()->HealthBelowPctDamaged(90, damageInfo->GetDamage()))
123 return true;
124
125 return false;
126 }
127
132 };
133}
134
uint32_t uint32
Definition Define.h:154
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraCheckProcFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:290
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 GetDamage() const
Definition Unit.h:466
void Update(uint32 time)
Definition EventMap.h:77
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
float GetObjectScale() const
Definition Object.h:92
Unit * GetActionTarget() const
Definition Unit.h:514
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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
bool HealthBelowPct(float pct) const
Definition Unit.h:804
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void JustEngagedWith(Unit *) override
WorldBossAI(Creature *creature) noexcept
float GetExactDist(float x, float y, float z) const
Definition Position.h:129
void AddSC_worldboss_julak_doom()