TrinityCore
Loading...
Searching...
No Matches
boss_lord_jaraxxus.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 "ScriptMgr.h"
19#include "Containers.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "SpellInfo.h"
25#include "SpellMgr.h"
26#include "SpellScript.h"
28
44
46{
49 NPC_FEL_INFERNAL = 34815, // immune to all CC on Heroic (stuns, banish, interrupt, etc)
52};
53
80
103
111
112struct boss_jaraxxus : public BossAI
113{
114 boss_jaraxxus(Creature* creature) : BossAI(creature, DATA_JARAXXUS) { }
115
132
146
147 void EnterEvadeMode(EvadeReason /*why*/) override
148 {
152 }
153
154 void DoAction(int32 action) override
155 {
156 if (action == ACTION_JARAXXUS_INTRO)
157 {
161 }
162 else if (action == ACTION_JARAXXUS_ENGAGE)
163 {
165 me->SetImmuneToPC(false);
168 }
169 }
170
171 void MovementInform(uint32 type, uint32 pointId) override
172 {
173 if (type == SPLINE_CHAIN_MOTION_TYPE && pointId == POINT_SUMMONED)
175 {
176 me->SetFacingToObject(wilfred);
178 }
179 }
180
181 void KilledUnit(Unit* who) override
182 {
183 if (who->GetTypeId() == TYPEID_PLAYER)
185 }
186
187 void JustDied(Unit* /*killer*/) override
188 {
190 _JustDied();
191 }
192
193 void UpdateAI(uint32 diff) override
194 {
196 return;
197
198 events.Update(diff);
199
201 return;
202
203 while (uint32 eventId = events.ExecuteEvent())
204 {
205 switch (eventId)
206 {
209 events.Repeat(11s, 13s);
210 break;
212 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
214 events.Repeat(10s, 30s);
215 break;
217 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
218 {
219 Talk(EMOTE_INCINERATE, target);
222 }
223 events.Repeat(23s);
224 break;
226 {
228 args.AddSpellMod(SPELLVALUE_AURA_STACK, RAID_MODE(5, 10, 5, 10));
230 events.Repeat(42s);
231 break;
232 }
234 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
235 {
236 Talk(EMOTE_LEGION_FLAME, target);
237 DoCast(target, SPELL_LEGION_FLAME);
238 }
239 events.Repeat(30s);
240 break;
245 events.Repeat(2min);
246 break;
251 events.Repeat(2min);
252 break;
253 case EVENT_INTRO:
256 break;
260 break;
261 case EVENT_KILL_GNOME:
264 break;
266 me->SetFacingTo(4.729842f);
268 break;
270 me->SetImmuneToPC(false);
273 break;
274 case EVENT_ENRAGE:
277 break;
278 default:
279 break;
280 }
281
283 return;
284 }
285
287 }
288};
289
291{
292 npc_legion_flame(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
293 {
294 SetCombatMovement(false);
295 }
296
297 void Reset() override
298 {
300 {
302 return;
303 }
304
306 jaraxxus->AI()->JustSummoned(me);
307
310 }
311
312private:
314};
315
317{
319 {
320 SetCombatMovement(false);
321 }
322
330};
331
333{
334 npc_fel_infernal(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
335
336 void Reset() override
337 {
339 {
341 return;
342 }
343
345 jaraxxus->AI()->JustSummoned(me);
346
348 {
350 });
351
352 _scheduler.Schedule(Seconds(2), [this](TaskContext context)
353 {
354 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
356 context.Repeat(Seconds(15));
357 });
358
360 }
361
362 void UpdateAI(uint32 diff) override
363 {
364 if (!UpdateVictim())
365 return;
366
367 _scheduler.Update(diff, [this]
368 {
370 });
371 }
372
373private:
376};
377
379{
380 npc_nether_portal(Creature* creature) : ScriptedAI(creature)
381 {
382 SetCombatMovement(false);
383 }
384
392};
393
395{
396 npc_mistress_of_pain(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
397
398 void Reset() override
399 {
401 {
403 return;
404 }
405
407 jaraxxus->AI()->JustSummoned(me);
408
411 }
412
420
421 void JustDied(Unit* /*killer*/) override
422 {
424 }
425
426 void UpdateAI(uint32 diff) override
427 {
428 if (!UpdateVictim())
429 return;
430
431 _events.Update(diff);
432
434 return;
435
436 while (uint32 eventId = _events.ExecuteEvent())
437 {
438 switch (eventId)
439 {
442 _events.Repeat(3s, 10s);
443 return;
445 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
447 _events.Repeat(20s);
448 return;
451 _events.Repeat(30s);
452 return;
453 default:
454 break;
455 }
456
458 return;
459 }
460
462 }
463
464private:
467};
468
469// 66334, 67905, 67906, 67907 - Mistress' Kiss
471{
473
474 bool Validate(SpellInfo const* /*spellInfo*/) override
475 {
477 }
478
479 void HandleDummyTick(AuraEffect const* /*aurEff*/)
480 {
481 Unit* target = GetTarget();
482 if (Unit* caster = GetCaster())
483 if (target->HasUnitState(UNIT_STATE_CASTING))
484 {
485 caster->CastSpell(target, SPELL_MISTRESS_KISS_DAMAGE_SILENCE, true);
486 target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
487 }
488 }
489
494};
495
496// 66336, 67076, 67077, 67078 - Mistress' Kiss
498{
500
501 bool Validate(SpellInfo const* spellInfo) override
502 {
503 return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
504 }
505
506 void FilterTargets(std::list<WorldObject*>& targets)
507 {
508 // get a list of players with mana
509 targets.remove_if([](WorldObject* target)
510 {
511 return target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->GetPowerType() == POWER_MANA;
512 });
513
514 if (targets.empty())
515 return;
516
518 targets.clear();
519 targets.push_back(target);
520 }
521
522 void HandleScript(SpellEffIndex /*effIndex*/)
523 {
525 }
526
532};
533
534// 66493 - Fel Streak
536{
538
539 bool Validate(SpellInfo const* spellInfo) override
540 {
541 return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
542 }
543
544 void HandleScript(SpellEffIndex /*effIndex*/)
545 {
546 GetCaster()->CastSpell(GetHitUnit(), static_cast<uint32>(GetEffectValue()), true);
547 }
548
553};
554
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
@ IN_PROGRESS
@ FAIL
@ NOT_STARTED
@ SPLINE_CHAIN_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
@ POWER_MANA
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_AURA_STACK
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ POINT_SUMMONED
@ SPLINE_INITIAL_MOVEMENT
@ SAY_MISTRESS_OF_PAIN
@ EMOTE_NETHER_PORTAL
@ SAY_INCINERATE
@ SAY_INFERNAL_ERUPTION
@ EMOTE_LEGION_FLAME
@ EMOTE_INCINERATE
@ EMOTE_INFERNAL_ERUPTION
@ SAY_KILL_PLAYER
@ SAY_BERSERK
@ SPELL_INFERNAL_ERUPTION
@ SPELL_NETHER_PORTAL
@ SPELL_LEGION_FLAME_EFFECT
@ SPELL_SPINNING_SPIKE
@ SPELL_INCINERATE_FLESH
@ SPELL_BURNING_INFERNO
@ SPELL_INFERNAL_ERUPTION_EFFECT
@ SPELL_NETHER_POWER
@ SPELL_FEL_LIGHTNING
@ SPELL_NETHER_PORTAL_EFFECT
@ SPELL_FEL_FIREBALL
@ SPELL_LEGION_FLAME
@ SPELL_MISTRESS_KISS
@ SPELL_MISTRESS_KISS_DAMAGE_SILENCE
@ SPELL_SHIVAN_SLASH
@ SPELL_FEL_LIGHTNING_INTRO
@ SPELL_BERSERK
@ SPELL_FEL_STREAK_VISUAL
@ SPELL_LORD_JARAXXUS_HITTIN_YA
@ NPC_NETHER_PORTAL
@ NPC_MISTRESS_OF_PAIN
@ NPC_INFERNAL_VOLCANO
@ NPC_LEGION_FLAME
@ NPC_FEL_INFERNAL
void AddSC_boss_jaraxxus()
@ EVENT_TAUNT_GNOME
@ EVENT_NETHER_POWER
@ EVENT_START_COMBAT
@ EVENT_FEL_LIGHTNING
@ EVENT_ENRAGE
@ EVENT_CHANGE_ORIENTATION
@ EVENT_KILL_GNOME
@ EVENT_SPINNING_SPIKE
@ EVENT_LEGION_FLAME
@ EVENT_SUMMON_NETHER_PORTAL
@ EVENT_MISTRESS_KISS
@ EVENT_SHIVAN_SLASH
@ EVENT_INCINERATE_FLESH
@ EVENT_INTRO
@ EVENT_FEL_FIREBALL
@ EVENT_SUMMON_INFERNAL_ERUPTION
Yells
HookList< EffectPeriodicHandler > OnEffectPeriodic
SpellInfo const * GetSpellInfo() const
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetCombatPulseDelay(uint32 delay)
Definition Creature.h:269
void ResetLootMode()
Definition Creature.h:227
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk)
TypeID GetTypeId() const
Definition Object.h:93
static Player * ToPlayer(Object *o)
Definition Object.h:180
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
Unit * GetCaster() const
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
Powers GetPowerType() const
Definition Unit.h:931
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13259
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 RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_fel_streak_visual)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *spellInfo) override
bool Validate(SpellInfo const *spellInfo) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_mistress_kiss_area)
void HandleScript(SpellEffIndex)
PrepareAuraScript(spell_mistress_kiss)
bool Validate(SpellInfo const *) override
void HandleDummyTick(AuraEffect const *)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
bool IsHeroic() const
void SetCombatMovement(bool allowMovement)
T const & RAID_MODE(T const &normal10, T const &normal25) const
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *who) override
boss_jaraxxus(Creature *creature)
void JustDied(Unit *) override
void DoAction(int32 action) override
void Reset() override
void KilledUnit(Unit *who) override
void MovementInform(uint32 type, uint32 pointId) override
void UpdateAI(uint32 diff) override
InstanceScript * _instance
npc_fel_infernal(Creature *creature)
npc_infernal_volcano(Creature *creature)
npc_legion_flame(Creature *creature)
InstanceScript * _instance
npc_mistress_of_pain(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
npc_nether_portal(Creature *creature)
@ SPELL_JARAXXUS_CHAINS
@ ACTION_JARAXXUS_ENGAGE
@ ACTION_JARAXXUS_INTRO
@ DATA_JARAXXUS
@ DATA_MISTRESS_OF_PAIN_COUNT
@ DATA_FIZZLEBANG
#define RegisterTrialOfTheCrusaderCreatureAI(ai_name)