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#include "ScriptedCreature.h"
19#include "ScriptMgr.h"
20#include "SpellScript.h"
21#include "SpellInfo.h"
22#include "MotionMaster.h"
23#include "Player.h"
24#include "the_underbog.h"
25
33
56
80
89
91{
92 { 290.53226f, -125.35236f, 29.697079f, 0.0f },
93 { 295.05692f, -123.32802f, 29.659490f, 0.0f }
94};
95
96// 17826 - Swamplord Musel'ek
98{
100
115
116 void AttackStart(Unit* who) override
117 {
119 }
120
121 void OnSpellCast(SpellInfo const* spell) override
122 {
123 if (spell->Id == SPELL_BEAR_COMMAND)
125 }
126
127 void MovementInform(uint32 type, uint32 pointId) override
128 {
129 if (type != POINT_MOTION_TYPE)
130 return;
131
132 if (pointId == POINT_MOVE_AWAY)
134 }
135
136 void KilledUnit(Unit* /*victim*/) override
137 {
138 Talk(SAY_SLAY);
139 }
140
141 void JustDied(Unit* /*killer*/) override
142 {
144 _JustDied();
145 }
146
147 void UpdateAI(uint32 diff) override
148 {
149 if (!UpdateVictim())
150 return;
151
152 events.Update(diff);
153
155 return;
156
157 while (uint32 eventId = events.ExecuteEvent())
158 {
159 switch (eventId)
160 {
161 case EVENT_SHOOT:
163 events.Repeat(2s, 4s);
164 break;
165 case EVENT_MULTI_SHOT:
167 events.Repeat(25s, 35s);
168 break;
169 case EVENT_KNOCK_AWAY:
171 events.Repeat(30s, 40s);
172 break;
175 events.Repeat(25s);
176 break;
177
178 // This part requires additional research
181
184
187 events.Repeat(25s, 50s);
188 break;
192
193 // This is based only on one cast in sniff, need more info
194 if (roll_chance_i(50))
196 break;
198 // NYI
202
203 // On next update, otherwise it will not work
205 break;
208 break;
209 default:
210 break;
211 }
212
214 return;
215 }
216
218 }
219};
220
221// 17827 - Claw
222struct npc_claw : public ScriptedAI
223{
225
226 void Reset() override
227 {
228 _events.Reset();
229 _chargeCounter = 0;
231 }
232
233 void JustEngagedWith(Unit* /*who*/) override
234 {
237 }
238
239 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
240 {
241 if (spellInfo->Id == SPELL_BEAR_COMMAND)
243 }
244
245 bool OnGossipHello(Player* player) override
246 {
248 return false;
249 }
250
251 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
252 {
253 // This CAN occur even if Musel'ek is NOT yet dead
254 if (!_canPerformOutro && me->HealthBelowPctDamaged(20, damage))
255 {
256 _canPerformOutro = true;
258 me->SetImmuneToAll(true);
260 }
261 }
262
269
270 void MovementInform(uint32 type, uint32 pointId) override
271 {
272 if (type != POINT_MOTION_TYPE)
273 return;
274
275 switch (pointId)
276 {
277 case POINT_OUTRO_1:
279 break;
280 case POINT_OUTRO_2:
282 break;
283 }
284 }
285
286 void UpdateAI(uint32 diff) override
287 {
288 if (!UpdateVictim())
289 {
291 {
292 _events.Update(diff);
293
294 while (uint32 eventId = _events.ExecuteEvent())
295 {
296 switch (eventId)
297 {
298 case EVENT_OUTRO_1:
299 me->SetWalk(true);
305 me->SetImmuneToAll(true);
306 break;
307 case EVENT_OUTRO_2:
309 break;
310 case EVENT_OUTRO_3:
311 me->SetFacingTo(3.420845270156860351f);
313 break;
314 default:
315 break;
316 }
317 }
318 }
319
320 return;
321 }
322
323 _events.Update(diff);
324
326 return;
327
328 while (uint32 eventId = _events.ExecuteEvent())
329 {
330 switch (eventId)
331 {
334 _events.Repeat(10s, 20s);
335 break;
336 case EVENT_MAUL:
338 _events.Repeat(10s, 15s);
339 break;
342 // 0 seems to be valid value. He doesn't obey always, perhaps. Or something is more tricky than it seems
343 _chargeCounter = RAND(0, 1, 2, 3, 4);
346 break;
349 {
351 DoCast(target, SPELL_FERAL_CHARGE);
352
354 _events.Repeat(2s, 5s);
355 }
356 break;
357 default:
358 break;
359 }
360
362 return;
363 }
364
366 }
367
368private:
373};
374
375// 31564 - Move Away Primer
377{
379
380 void HandleDummy(SpellEffIndex /*effIndex*/)
381 {
382 // This should be more tricky. More like random position but with min and max distance, not just random
385 }
386
391};
392
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
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:235
DamageEffectType
Definition Unit.h:352
void AddSC_boss_swamplord_muselek()
@ EVENT_COMBAT_SEQUENCE_1
@ EVENT_COMBAT_SEQUENCE_4
@ EVENT_COMBAT_SEQUENCE_3
@ EVENT_COMBAT_SEQUENCE_2
@ EVENT_COMMAND_RESPONSE
Position const OutroPos[2]
@ FACTION_CENARION_EXP
@ NPC_WINDCALLER_CLAW
@ SPELL_FREEZING_TRAP
@ 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:119
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:540
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
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:16140
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:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetWalk(bool enable)
Definition Unit.cpp:13268
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
Position GetRandomNearPosition(float radius)
Definition Object.cpp:3264
PrepareSpellScript(spell_swamplord_muselek_move_away_primer)
void JustEngagedWith(Unit *who) override
void AttackStart(Unit *who) override
void UpdateAI(uint32 diff) override
void OnSpellCast(SpellInfo const *spell) override
boss_swamplord_muselek(Creature *creature)
void KilledUnit(Unit *) 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