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 "ObjectAccessor.h"
22#include "ScriptedCreature.h"
23#include "shadow_labyrinth.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26
31
47
57
58// 18708 - Murmur
59struct boss_murmur : public BossAI
60{
61 boss_murmur(Creature* creature) : BossAI(creature, DATA_MURMUR)
62 {
63 SetCombatMovement(false);
64 }
65
66 void Reset() override
67 {
68 _Reset();
73 if (IsHeroic())
74 {
77 }
78
79 // database should have `RegenHealth`=0 to prevent regen
81 if (hp)
82 me->SetHealth(hp);
84 }
85
86 void UpdateAI(uint32 diff) override
87 {
88 if (!UpdateVictim())
89 return;
90
91 events.Update(diff);
92
94 return;
95
96 while (uint32 eventId = events.ExecuteEvent())
97 {
98 switch (eventId)
99 {
100 case EVENT_SONIC_BOOM:
103 events.Repeat(30s);
105 break;
107 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 80.0f, true))
109 events.Repeat(25s, 35s);
110 break;
111 case EVENT_RESONANCE:
112 if (!(me->IsWithinMeleeRange(me->GetVictim())))
113 {
115 events.Repeat(5s);
116 }
117 break;
119 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
120 {
123 break;
124 }
126 break;
129 events.Repeat(15s);
130 break;
132 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, false))
133 DoCast(target, SPELL_SONIC_SHOCK);
134 events.Repeat(10s, 20s);
135 break;
136 }
137
139 return;
140 }
141
142 // Select nearest most aggro target if top aggro too far
143 if (!me->isAttackReady())
144 return;
145
148
150 }
151};
152
153// 33923, 38796 - Sonic Boom
155{
157
158 bool Validate(SpellInfo const* /*spellInfo*/) override
159 {
161 }
162
163 void HandleEffect(SpellEffIndex /*effIndex*/)
164 {
166 }
167
172};
173
174// 33666, 38795 - Sonic Boom Effect
176{
178
180 {
181 if (Unit* target = GetHitUnit())
182 SetHitDamage(target->CountPctFromMaxHealth(80));
183 }
184
189};
190
192{
193 public:
195
197 {
198 float distSq = _source->GetExactDist2dSq(obj);
199 return distSq < (25.0f * 25.0f) || distSq > (100.0f * 100.0f);
200 }
201
202 private:
204};
205
206// 39365 - Thundering Storm
221
222// 33711, 38794 - Murmur's Touch
224{
226
227 bool Validate(SpellInfo const* /*spellInfo*/) override
228 {
229 return ValidateSpellInfo(
230 {
234 });
235 }
236
237 void OnPeriodic(AuraEffect const* aurEff)
238 {
239 Unit* target = GetTarget();
240
241 switch (GetId())
242 {
244 switch (aurEff->GetTickNumber())
245 {
246 case 7:
247 case 10:
248 case 12:
249 case 13:
250 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
251 break;
252 case 14:
253 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
254 target->CastSpell(target, SPELL_SHOCKWAVE, true);
255 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
256 break;
257 default:
258 break;
259 }
260 break;
262 switch (aurEff->GetTickNumber())
263 {
264 case 3:
265 case 6:
266 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
267 break;
268 case 7:
269 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
270 target->CastSpell(target, SPELL_SHOCKWAVE, true);
271 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
272 break;
273 default:
274 break;
275 }
276 break;
277 default:
278 break;
279 }
280 }
281
286};
287
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
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:235
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:82
void ResetPlayerDamageReq()
Definition Creature.h:323
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
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)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:844
ThreatManager & GetThreatManager()
Definition Unit.h:1155
void SetHealth(uint32 val)
Definition Unit.cpp:9361
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:922
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:835
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_murmur_murmurs_touch)
PrepareSpellScript(spell_murmur_sonic_boom_effect)
void Register() override
void HandleEffect(SpellEffIndex)
PrepareSpellScript(spell_murmur_sonic_boom)
bool Validate(SpellInfo const *) override
void FilterTarget(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_murmur_thundering_storm)
#define RegisterShadowLabyrinthCreatureAI(ai_name)
@ DATA_MURMUR
float GetExactDist2dSq(const float x, const float y) const
Definition Position.h:100
bool IsHeroic() const
void SetCombatMovement(bool allowMovement)
void Reset() override
void UpdateAI(uint32 diff) override
boss_murmur(Creature *creature)