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/* ScriptData
19SDName: Boss_Murmur
20SD%Complete: 90
21SDComment: Timers may be incorrect
22SDCategory: Auchindoun, Shadow Labyrinth
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "shadow_labyrinth.h"
28#include "SpellAuraEffects.h"
29#include "SpellScript.h"
30
32{
34};
35
51
61
62struct boss_murmur : public BossAI
63{
64 boss_murmur(Creature* creature) : BossAI(creature, DATA_MURMUR)
65 {
66 SetCombatMovement(false);
67 }
68
69 void Reset() override
70 {
71 _Reset();
76 if (IsHeroic())
77 {
80 }
81
82 // database should have `RegenHealth`=0 to prevent regen
84 if (hp)
85 me->SetHealth(hp);
87 }
88
89 void UpdateAI(uint32 diff) override
90 {
91 if (!UpdateVictim())
92 return;
93
94 events.Update(diff);
95
97 return;
98
99 while (uint32 eventId = events.ExecuteEvent())
100 {
101 switch (eventId)
102 {
103 case EVENT_SONIC_BOOM:
108 break;
110 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 80.0f, true))
113 break;
114 case EVENT_RESONANCE:
115 if (!(me->IsWithinMeleeRange(me->GetVictim())))
116 {
119 }
120 break;
122 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
123 {
126 break;
127 }
129 break;
133 break;
135 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, false))
136 DoCast(target, SPELL_SONIC_SHOCK);
138 break;
139 }
140
142 return;
143 }
144
145 // Select nearest most aggro target if top aggro too far
146 if (!me->isAttackReady())
147 return;
148
151 }
152};
153
154// 33923, 38796 - Sonic Boom
156{
157 bool Validate(SpellInfo const* /*spellInfo*/) override
158 {
160 }
161
162 void HandleEffect(SpellEffIndex /*effIndex*/)
163 {
165 }
166
171};
172
173// 33666, 38795 - Sonic Boom Effect
175{
177 {
178 if (Unit* target = GetHitUnit())
179 SetHitDamage(target->CountPctFromMaxHealth(80));
180 }
181
186};
187
189{
190 public:
192
194 {
195 float distSq = _source->GetExactDist2dSq(obj);
196 return distSq < (25.0f * 25.0f) || distSq > (100.0f * 100.0f);
197 }
198
199 private:
201};
202
203// 39365 - Thundering Storm
205{
206 void FilterTarget(std::list<WorldObject*>& targets)
207 {
208 targets.remove_if(ThunderingStormCheck(GetCaster()));
209 }
210
215};
216
217// 33711, 38794 - Murmur's Touch
219{
220 bool Validate(SpellInfo const* /*spellInfo*/) override
221 {
222 return ValidateSpellInfo(
223 {
227 });
228 }
229
230 void OnPeriodic(AuraEffect const* aurEff)
231 {
232 Unit* target = GetTarget();
233
234 switch (GetId())
235 {
237 switch (aurEff->GetTickNumber())
238 {
239 case 7:
240 case 10:
241 case 12:
242 case 13:
243 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
244 break;
245 case 14:
246 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
247 target->CastSpell(target, SPELL_SHOCKWAVE, true);
248 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
249 break;
250 default:
251 break;
252 }
253 break;
255 switch (aurEff->GetTickNumber())
256 {
257 case 3:
258 case 6:
259 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
260 break;
261 case 7:
262 target->CastSpell(target, SPELL_MURMURS_TOUCH_DUMMY, true);
263 target->CastSpell(target, SPELL_SHOCKWAVE, true);
264 target->CastSpell(target, SPELL_SHOCKWAVE_KNOCK_BACK, true);
265 break;
266 default:
267 break;
268 }
269 break;
270 default:
271 break;
272 }
273 }
274
279};
280
uint32_t uint32
Definition Define.h:154
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ 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:276
@ 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
@ EMOTE_SONIC_BOOM
void AddSC_boss_murmur()
@ EVENT_MAGNETIC_PULL
@ EVENT_SONIC_BOOM
@ EVENT_MURMURS_TOUCH
@ EVENT_SONIC_SHOCK
@ EVENT_THUNDERING_STORM
@ EVENT_RESONANCE
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:415
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
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)
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:710
void SetHealth(uint64 val)
Definition Unit.cpp:9973
uint64 CountPctFromMaxHealth(float pct) const
Definition Unit.h:797
ThreatManager & GetThreatManager()
Definition Unit.h:1078
Unit * GetVictim() const
Definition Unit.h:726
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:701
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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)