TrinityCore
Loading...
Searching...
No Matches
boss_swamplord_muselek.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/*
19 * Timers requires to be revisited
20 * What does SPELL_NOTIFY_OF_DEATH is unknown
21 * What does Script Effect of spell SPELL_HUNTERS_MARK is unknown
22 */
23
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "SpellScript.h"
27#include "SpellInfo.h"
28#include "MotionMaster.h"
29#include "Player.h"
30#include "the_underbog.h"
31
39
41{
42 // Musel'ek - Combat - Ranged
43 SPELL_SHOOT = 22907,
45
46 // Musel'ek - Combat - Melee
51
52 // Musel'ek - Combat - Sequence
59
60 // Musel'ek - Combat - Death
62
63 // Claw
65 SPELL_MAUL = 34298,
66 SPELL_FRENZY = 34971,
67 SPELL_FERAL_CHARGE = 39435
68};
69
96
106
113
115{
116 { 290.53226f, -125.35236f, 29.697079f, 0.0f },
117 { 295.05692f, -123.32802f, 29.659490f, 0.0f }
118};
119
120// 17826 - Swamplord Musel'ek
122{
124
125 void Reset() override
126 {
127 _Reset();
130 }
131
145
146 void AttackStart(Unit* who) override
147 {
149 }
150
151 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
152 {
153 if (_phase < PHASE_HEALTH_70 && me->HealthBelowPctDamaged(70, damage))
154 {
155 _phase++;
157 }
158
159 if (_phase < PHASE_HEALTH_30 && me->HealthBelowPctDamaged(30, damage))
160 {
161 _phase++;
163 }
164 }
165
166 void OnSpellCast(SpellInfo const* spellInfo) override
167 {
168 if (spellInfo->Id == SPELL_BEAR_COMMAND)
170 }
171
172 void MovementInform(uint32 type, uint32 pointId) override
173 {
174 if (type != POINT_MOTION_TYPE)
175 return;
176
177 if (pointId == POINT_MOVE_AWAY)
179 }
180
181 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
182 {
183 if (spellInfo->Id == SPELL_FACE_HIGHEST_THREAT)
185 me->SetFacingToObject(target);
186 }
187
188 void KilledUnit(Unit* /*victim*/) override
189 {
190 Talk(SAY_SLAY);
191 }
192
193 void JustDied(Unit* /*killer*/) override
194 {
195 _JustDied();
197
198 if (Creature* claw = me->FindNearestCreature(NPC_CLAW, 100.0f))
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 if (!UpdateVictim())
205 return;
206
207 events.Update(diff);
208
210 return;
211
212 while (uint32 eventId = events.ExecuteEvent())
213 {
214 switch (eventId)
215 {
216 // Ranged
217 case EVENT_SHOOT:
219 events.Repeat(2s, 4s);
220 break;
221 case EVENT_MULTI_SHOT:
223 events.Repeat(25s, 35s);
224 break;
225
226 // Melee
227 case EVENT_KNOCK_AWAY:
229 events.Repeat(30s, 40s);
230 break;
233 events.Repeat(25s);
234 break;
237 events.Repeat(10s, 20s);
238 break;
239
240 // Sequence
243
246
249 break;
253
254 // Not always? Or wrong place? This is based only on one cast in sniff, need more info
255 if (roll_chance_i(50))
257 break;
262
264 DoCast(target, SPELL_AIMED_SHOT);
265 break;
266 default:
267 break;
268 }
269
271 return;
272 }
273
275 }
276
277private:
279};
280
281// 17827 - Claw
282struct npc_claw : public ScriptedAI
283{
285
286 void Reset() override
287 {
288 _events.Reset();
289 _chargeCounter = 0;
291 }
292
293 void JustEngagedWith(Unit* /*who*/) override
294 {
297 }
298
299 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
300 {
301 if (spellInfo->Id == SPELL_BEAR_COMMAND)
303 }
304
305 bool OnGossipHello(Player* player) override
306 {
308 return false;
309 }
310
311 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
312 {
313 // This CAN occur even if Musel'ek is NOT yet dead
314 if (!_canPerformOutro && me->HealthBelowPctDamaged(20, damage))
315 {
316 _canPerformOutro = true;
318 me->SetImmuneToAll(true);
320 }
321 }
322
329
330 void MovementInform(uint32 type, uint32 pointId) override
331 {
332 if (type != POINT_MOTION_TYPE)
333 return;
334
335 switch (pointId)
336 {
337 case POINT_OUTRO_1:
339 break;
340 case POINT_OUTRO_2:
342 break;
343 }
344 }
345
346 void UpdateAI(uint32 diff) override
347 {
348 if (!UpdateVictim())
349 {
351 {
352 _events.Update(diff);
353
354 while (uint32 eventId = _events.ExecuteEvent())
355 {
356 switch (eventId)
357 {
358 case EVENT_OUTRO_1:
359 me->SetWalk(true);
365 me->SetImmuneToAll(true);
366 break;
367 case EVENT_OUTRO_2:
369 break;
370 case EVENT_OUTRO_3:
371 me->SetFacingTo(3.420845270156860351f);
373 break;
374 default:
375 break;
376 }
377 }
378 }
379
380 return;
381 }
382
383 _events.Update(diff);
384
386 return;
387
388 while (uint32 eventId = _events.ExecuteEvent())
389 {
390 switch (eventId)
391 {
394 _events.Repeat(10s, 20s);
395 break;
396 case EVENT_MAUL:
398 _events.Repeat(10s, 15s);
399 break;
402 // 0 seems to be valid value. He doesn't obey always, perhaps. Or something is more tricky than it seems
403 _chargeCounter = RAND(0, 1, 2, 3, 4);
406 break;
409 {
411 DoCast(target, SPELL_FERAL_CHARGE);
412
414 _events.Repeat(2s, 5s);
415 }
416 break;
417 default:
418 break;
419 }
420
422 return;
423 }
424
426 }
427
428private:
433};
434
435// 31564 - Move Away Primer
450
#define M_PI
Definition Common.h:71
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
float frand(float min, float max)
Definition Random.cpp:55
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:35
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
void AddSC_boss_swamplord_muselek()
@ EVENT_COMBAT_SEQUENCE_1
@ EVENT_RAPTOR_STRIKE
@ EVENT_COMBAT_SEQUENCE_3
@ EVENT_COMBAT_SEQUENCE_2
@ EVENT_COMMAND_RESPONSE
Position const OutroPos[2]
@ FACTION_CENARION_EXP
@ SPELL_NOTIFY_OF_DEATH
@ SPELL_FREEZING_TRAP
@ SPELL_RAPTOR_STRIKE
@ SPELL_MOVE_AWAY_PRIMER
@ SPELL_FACE_HIGHEST_THREAT
void JustEngagedWith(Unit *who) override
EventMap events
virtual void JustReachedHome()
Definition CreatureAI.h:178
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetReactState(ReactStates st)
Definition Creature.h:128
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:541
void SetImmuneToAll(bool apply) override
Definition Creature.h:135
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
void Reset()
Definition EventMap.cpp:21
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16153
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
void AttackStartCaster(Unit *victim, float dist)
Definition UnitAI.cpp:48
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
void SetFaction(uint32 faction) override
Definition Unit.h:988
MotionMaster * GetMotionMaster()
Definition Unit.h:1683
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13235
bool SetWalk(bool enable)
Definition Unit.cpp:13244
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13226
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10340
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2100
PrepareSpellScript(spell_swamplord_muselek_move_away_primer)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *who) override
void AttackStart(Unit *who) override
void UpdateAI(uint32 diff) override
boss_swamplord_muselek(Creature *creature)
void KilledUnit(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void MovementInform(uint32 type, uint32 pointId) override
void JustReachedHome() override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
bool OnGossipHello(Player *player) override
void MovementInform(uint32 type, uint32 pointId) override
void UpdateAI(uint32 diff) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustEngagedWith(Unit *) override
void Reset() override
npc_claw(Creature *creature)
#define RegisterTheUnderbogCreatureAI(ai_name)
@ DATA_SWAMPLORD_MUSELEK