TrinityCore
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
37{
46
50};
51
53{
60};
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
167 void Register() override
168 {
170 }
171};
172
173// 33666, 38795 - Sonic Boom Effect
175{
177 {
178 if (Unit* target = GetHitUnit())
179 SetHitDamage(target->CountPctFromMaxHealth(80));
180 }
181
182 void Register() override
183 {
185 }
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
211 void Register() override
212 {
214 }
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
275 void Register() override
276 {
278 }
279};
280
282{
288}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define SpellHitFn(F)
Definition: SpellScript.h:854
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_MURMURS_TOUCH
Definition: boss_murmur.cpp:44
@ SPELL_MAGNETIC_PULL
Definition: boss_murmur.cpp:39
@ SPELL_THUNDERING_STORM
Definition: boss_murmur.cpp:41
@ SPELL_RESONANCE
Definition: boss_murmur.cpp:38
@ SPELL_SONIC_BOOM_CAST
Definition: boss_murmur.cpp:42
@ SPELL_SONIC_BOOM_EFFECT
Definition: boss_murmur.cpp:43
@ SPELL_MURMURS_TOUCH_H
Definition: boss_murmur.cpp:45
@ SPELL_SHOCKWAVE_KNOCK_BACK
Definition: boss_murmur.cpp:49
@ SPELL_SONIC_SHOCK
Definition: boss_murmur.cpp:40
@ SPELL_SHOCKWAVE
Definition: boss_murmur.cpp:48
@ SPELL_MURMURS_TOUCH_DUMMY
Definition: boss_murmur.cpp:47
@ EMOTE_SONIC_BOOM
Definition: boss_murmur.cpp:33
void AddSC_boss_murmur()
@ EVENT_MAGNETIC_PULL
Definition: boss_murmur.cpp:57
@ EVENT_SONIC_BOOM
Definition: boss_murmur.cpp:54
@ EVENT_MURMURS_TOUCH
Definition: boss_murmur.cpp:55
@ EVENT_SONIC_SHOCK
Definition: boss_murmur.cpp:59
@ EVENT_THUNDERING_STORM
Definition: boss_murmur.cpp:58
@ EVENT_RESONANCE
Definition: boss_murmur.cpp:56
uint32 GetTickNumber() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetTarget() const
uint32 GetId() const
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void ResetPlayerDamageReq()
Definition: Creature.h:400
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
Unit * GetHitUnit() const
void SetHitDamage(int32 damage)
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
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:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:699
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
Unit * GetVictim() const
Definition: Unit.h:715
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:690
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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:97
bool IsHeroic() const
void SetCombatMovement(bool allowMovement)
void Reset() override
Definition: boss_murmur.cpp:69
void UpdateAI(uint32 diff) override
Definition: boss_murmur.cpp:89
boss_murmur(Creature *creature)
Definition: boss_murmur.cpp:64