TrinityCore
Loading...
Searching...
No Matches
boss_murmur.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/* Timers requires update */
19
20#include "ScriptMgr.h"
21#include "ScriptedCreature.h"
22#include "shadow_labyrinth.h"
23#include "SpellAuraEffects.h"
24#include "SpellScript.h"
25
30
46
56
57// 18708 - Murmur
58struct boss_murmur : public BossAI
59{
60 boss_murmur(Creature* creature) : BossAI(creature, DATA_MURMUR)
61 {
62 SetCombatMovement(false);
63 }
64
65 void Reset() override
66 {
67 _Reset();
72 if (IsHeroic())
73 {
76 }
77
78 // database should have `RegenHealth`=0 to prevent regen
80 if (hp)
81 me->SetHealth(hp);
83 }
84
85 void UpdateAI(uint32 diff) override
86 {
87 if (!UpdateVictim())
88 return;
89
90 events.Update(diff);
91
93 return;
94
95 while (uint32 eventId = events.ExecuteEvent())
96 {
97 switch (eventId)
98 {
102 events.Repeat(30s);
104 break;
106 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 80.0f, true))
108 events.Repeat(25s, 35s);
109 break;
110 case EVENT_RESONANCE:
111 if (!(me->IsWithinMeleeRange(me->GetVictim())))
112 {
114 events.Repeat(5s);
115 }
116 break;
118 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
119 {
122 break;
123 }
125 break;
128 events.Repeat(15s);
129 break;
131 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, false))
132 DoCast(target, SPELL_SONIC_SHOCK);
133 events.Repeat(10s, 20s);
134 break;
135 }
136
138 return;
139 }
140
141 // Select nearest most aggro target if top aggro too far
142 if (!me->isAttackReady())
143 return;
144
147 }
148};
149
150// 33923, 38796 - Sonic Boom
152{
153 bool Validate(SpellInfo const* /*spellInfo*/) override
154 {
156 }
157
158 void HandleEffect(SpellEffIndex /*effIndex*/)
159 {
161 }
162
167};
168
169// 33666, 38795 - Sonic Boom Effect
171{
173 {
174 if (Unit* target = GetHitUnit())
175 SetHitDamage(target->CountPctFromMaxHealth(80));
176 }
177
182};
183
185{
186 public:
188
190 {
191 float distSq = _source->GetExactDist2dSq(obj);
192 return distSq < (25.0f * 25.0f) || distSq > (100.0f * 100.0f);
193 }
194
195 private:
197};
198
199// 39365 - Thundering Storm
201{
202 void FilterTarget(std::list<WorldObject*>& targets)
203 {
204 targets.remove_if(ThunderingStormCheck(GetCaster()));
205 }
206
211};
212
213// 33711, 38794 - Murmur's Touch
215{
216 bool Validate(SpellInfo const* /*spellInfo*/) override
217 {
218 return ValidateSpellInfo(
219 {
223 });
224 }
225
226 void OnPeriodic(AuraEffect const* aurEff)
227 {
228 Unit* target = GetTarget();
229
230 switch (GetId())
231 {
233 switch (aurEff->GetTickNumber())
234 {
235 case 7:
236 case 10:
237 case 12:
238 case 13:
239 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
240 break;
241 case 14:
242 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
243 target->CastSpell(target, SPELL_SHOCKWAVE, true);
244 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
245 break;
246 default:
247 break;
248 }
249 break;
251 switch (aurEff->GetTickNumber())
252 {
253 case 3:
254 case 6:
255 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
256 break;
257 case 7:
258 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
259 target->CastSpell(target, SPELL_SHOCKWAVE, true);
260 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
261 break;
262 default:
263 break;
264 }
265 break;
266 default:
267 break;
268 }
269 }
270
275};
276
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellHitFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:290
MurmurEvents
@ EVENT_MAGNETIC_PULL
@ EVENT_SONIC_BOOM
@ EVENT_MURMURS_TOUCH
@ EVENT_SONIC_SHOCK
@ EVENT_THUNDERING_STORM
@ EVENT_RESONANCE
MurmurSpells
@ SPELL_MURMURS_TOUCH
@ SPELL_MAGNETIC_PULL
@ SPELL_THUNDERING_STORM
@ SPELL_RESONANCE
@ SPELL_SONIC_BOOM_CAST
@ SPELL_SONIC_BOOM_EFFECT
@ SPELL_MURMURS_TOUCH_H
@ SPELL_SHOCKWAVE_KNOCK_BACK
@ SPELL_SONIC_SHOCK
@ SPELL_SHOCKWAVE
@ SPELL_MURMURS_TOUCH_DUMMY
MurmurTexts
@ EMOTE_SONIC_BOOM
void AddSC_boss_murmur()
uint32 GetTickNumber() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
uint32 GetId() const
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void ResetPlayerDamageReq()
Definition Creature.h:423
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
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< HitHandler > OnHit
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
void SetHitDamage(int32 damage)
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void ResetThreat(Unit *target)
bool operator()(WorldObject *obj)
WorldObject const * _source
ThunderingStormCheck(WorldObject *source)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:722
void SetHealth(uint64 val)
Definition Unit.cpp:10041
uint64 CountPctFromMaxHealth(float pct) const
Definition Unit.h:809
ThreatManager & GetThreatManager()
Definition Unit.h:1093
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:713
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void Register() override
void HandleEffect(SpellEffIndex)
bool Validate(SpellInfo const *) override
void FilterTarget(std::list< WorldObject * > &targets)
#define RegisterShadowLabyrinthCreatureAI(ai_name)
@ DATA_MURMUR
constexpr float GetExactDist2dSq(const float x, const float y) const
Definition Position.h:108
bool IsHeroic() const
void SetCombatMovement(bool allowMovement)
void Reset() override
void UpdateAI(uint32 diff) override
boss_murmur(Creature *creature)