TrinityCore
Loading...
Searching...
No Matches
boss_auriaya.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 "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "ScriptedCreature.h"
23#include "SpellAuras.h"
24#include "SpellScript.h"
25#include "ulduar.h"
26
66
90
99
105
117
119{
120public:
121 CatsTargetSelector(Unit const* unit, float minDist, float maxDist) : _me(unit), _minDist(minDist), _maxDist(maxDist) { }
122
123 bool operator()(Unit* unit) const
124 {
125 float dist = _me->GetDistance(unit);
126 return unit->GetTypeId() == TYPEID_PLAYER && dist >= _minDist && dist < _maxDist && _me->IsWithinLOSInMap(unit);
127 }
128
129private:
130 Unit const* _me;
131 float _minDist;
132 float _maxDist;
133};
134
135struct boss_auriaya : public BossAI
136{
137 boss_auriaya(Creature* creature) : BossAI(creature, DATA_AURIAYA), _crazyCatLady(true), _nineLives(false) { }
138
139 void Reset() override
140 {
141 _Reset();
142 _crazyCatLady = true;
143 _nineLives = false;
144 HandleCats(true);
145 }
146
147 void HandleCats(bool isResetting)
148 {
149 std::list<Creature*> catList;
151 for (std::list<Creature*>::const_iterator itr = catList.begin(); itr != catList.end(); ++itr)
152 {
153 if (!isResetting)
154 (*itr)->DespawnOrUnsummon();
155 else if (!(*itr)->IsAlive())
156 (*itr)->Respawn(true);
157 }
158 }
159
171
172 void KilledUnit(Unit* who) override
173 {
174 if (who->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
175 Talk(SAY_SLAY);
176 }
177
178 void DoAction(int32 action) override
179 {
180 switch (action)
181 {
183 _crazyCatLady = false;
184 break;
186 _nineLives = true;
187 break;
188 default:
189 break;
190 }
191 }
192
193 uint32 GetData(uint32 type) const override
194 {
195 switch (type)
196 {
197 case DATA_NINE_LIVES:
198 return _nineLives ? 1 : 0;
200 return _crazyCatLady ? 1 : 0;
201 default:
202 return 0;
203 }
204 }
205
206 void JustDied(Unit* /*killer*/) override
207 {
208 _JustDied();
211 HandleCats(false);
212 }
213
219
220 void UpdateAI(uint32 diff) override
221 {
222 if (!UpdateVictim())
223 return;
224
225 events.Update(diff);
226
228 return;
229
230 while (uint32 eventId = events.ExecuteEvent())
231 {
232 switch (eventId)
233 {
236 events.Repeat(22s, 30s);
237 break;
242 events.Repeat(36s, 45s);
243 break;
244 case EVENT_BLAST:
246 break;
251 break;
254 break;
256 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
258 events.Repeat(25s, 45s);
259 break;
260 case EVENT_BERSERK:
263 break;
264 default:
265 break;
266 }
267
269 return;
270 }
271
273 }
274
275private:
278};
279
281{
282 npc_sanctum_sentry(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
283
284 void Reset() override
285 {
286 _events.Reset();
288 me->SetWalk(true);
289 }
290
291 void JustEngagedWith(Unit* /*who*/) override
292 {
295 me->SetWalk(false);
296 }
297
298 void JustDied(Unit* /*killer*/) override
299 {
301 auriaya->AI()->DoAction(ACTION_CRAZY_CAT_LADY);
302 }
303
304 void UpdateAI(uint32 diff) override
305 {
306 if (!UpdateVictim())
307 return;
308
309 _events.Update(diff);
310
312 return;
313
314 while (uint32 eventId = _events.ExecuteEvent())
315 {
316 switch (eventId)
317 {
318 case EVENT_RIP:
320 _events.Repeat(10s, 12s);
321 break;
323 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(me, 10.0f, 15.0f)))
324 {
326 _events.Repeat(10s);
327 break;
328 }
329 _events.Repeat(1s);
330 break;
331 default:
332 break;
333 }
334
336 return;
337 }
338
340 }
341
342private:
345};
346
348{
349 npc_feral_defender(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
350
351 void Reset() override
352 {
360
362 auriaya->AI()->JustSummoned(me);
363 }
364
365 void UpdateAI(uint32 diff) override
366 {
368 return;
369
370 _events.Update(diff);
371
373 return;
374
375 while (uint32 eventId = _events.ExecuteEvent())
376 {
377 switch (eventId)
378 {
382 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
383 AttackStart(target);
386 break;
389 {
390 if (Unit* target = me->GetVictim())
391 {
392 float distance = me->GetDistance2d(target);
393 if (distance > 5.0f && distance <= 45.0f)
394 {
396 _events.Repeat(5s);
397 break;
398 }
399 }
400 }
401 _events.Repeat(1s);
402 break;
403 case EVENT_RUSH:
404 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, CatsTargetSelector(me, 10.0f, 11.0f)))
405 {
406 DoCast(target, SPELL_FERAL_RUSH, true);
407 _events.Repeat(5s);
408 break;
409 }
410 _events.Repeat(1s);
411 break;
413 me->SetDisableGravity(true);
414 me->SetHover(true);
418 break;
421 break;
427 me->SetDisableGravity(false);
428 me->SetHover(false);
430 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
431 AttackStart(target);
433 break;
434 default:
435 break;
436 }
437
439 return;
440 }
441
443 }
444
466
467 void JustDied(Unit* /*killer*/) override
468 {
471 auriaya->AI()->DoAction(ACTION_DEFENDER_DIED);
472 }
473
474private:
477};
478
480{
481 npc_swarming_guardian(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
482
483 void Reset() override
484 {
486 _scheduler.Schedule(1s, [this](TaskContext /*context*/)
487 {
490 });
492 auriaya->AI()->JustSummoned(me);
493 }
494
495 void UpdateAI(uint32 diff) override
496 {
497 _scheduler.Update(diff);
498 if (!UpdateVictim())
499 return;
500
502 }
503
504private:
507};
508
510{
511 npc_seeping_essence_stalker(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
512
513 void Reset() override
514 {
517 auriaya->AI()->JustSummoned(me);
518 }
519
520 void UpdateAI(uint32 /*diff*/) override { }
521
522private:
524};
525
526// 64381 - Strength of the Pack
541
542// 64392, 64679 - Sentinel Blast
544{
546
547 void FilterTargets(std::list<WorldObject*>& targets)
548 {
549 targets.remove_if([](WorldObject* object) -> bool
550 {
551 if (object->GetTypeId() == TYPEID_PLAYER)
552 return false;
553
554 if (Creature* creature = object->ToCreature())
555 return !creature->IsPet();
556
557 return true;
558 });
559 }
560
566};
567
568// 63709 - Aggro Creator
570{
572
573 bool Validate(SpellInfo const* /*spellInfo*/) override
574 {
576 }
577
579 {
580 Creature* caster = GetCaster()->ToCreature();
581 if (!caster || !caster->IsAIEnabled() || caster->HasReactState(REACT_PASSIVE))
582 return;
583
584 if (Unit* target = caster->AI()->SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(caster, 5.0f, 10.0f)))
585 {
586 caster->CastSpell(target, SPELL_POUNCE, true);
587 caster->GetThreatManager().AddThreat(target, 50000000.0f, nullptr, true);
588 caster->AI()->AttackStart(target);
589 }
590 }
591
596};
597
598// 64456 - Feral Essence Application Removal
600{
602
603 bool Validate(SpellInfo const* /*spellInfo*/) override
604 {
606 }
607
609 {
610 if (Aura* essence = GetCaster()->GetAura(SPELL_FERAL_ESSENCE))
611 essence->ModStackAmount(-1);
612 }
613
618};
619
620// 64496, 64674 - Feral Rush
640
642{
643 public:
644 achievement_nine_lives() : AchievementCriteriaScript("achievement_nine_lives") { }
645
646 bool OnCheck(Player* /*player*/, Unit* target) override
647 {
648 if (!target)
649 return false;
650
651 if (Creature* auriaya = target->ToCreature())
652 if (auriaya->AI()->GetData(DATA_NINE_LIVES))
653 return true;
654
655 return false;
656 }
657};
658
660{
661 public:
662 achievement_crazy_cat_lady() : AchievementCriteriaScript("achievement_crazy_cat_lady") { }
663
664 bool OnCheck(Player* /*player*/, Unit* target) override
665 {
666 if (!target)
667 return false;
668
669 if (Creature* auriaya = target->ToCreature())
670 if (auriaya->AI()->GetData(DATA_CRAZY_CAT_LADY))
671 return true;
672
673 return false;
674 }
675};
676
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ TARGET_UNIT_SRC_AREA_ALLY
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
AuriayaSpells
@ SPELL_RIP_FLESH
@ SPELL_CLEAR_ALL_DEBUFFS
@ SPELL_POUNCE
@ SPELL_SHADOW_PAWS
@ SPELL_RANDOM_AGRO_PERIODIC
@ SPELL_FERAL_ESSENCE_APPLICATION_REMOVAL
@ SPELL_SUMMON_ESSENCE
@ SPELL_SUMMON_SWARMING_GUARDIAN
@ SPELL_AGRO_CREATOR
@ SPELL_SAVAGE_POUNCE
@ SPELL_STRENGHT_OF_THE_PACK
@ SPELL_SENTINEL_BLAST
@ SPELL_FERAL_RUSH_2
@ SPELL_FERAL_POUNCE
@ SPELL_INSTAKILL_ARACHNOPOD
@ SPELL_DEFENDER_TRIGGER
@ SPELL_ACTIVATE_DEFENDER
@ SPELL_FERAL_RUSH
@ SPELL_FULL_HEAL
@ SPELL_TERRIFYING_SCREECH
@ SPELL_DROWNED_STATE
@ SPELL_BERSERK
@ SPELL_FERAL_ESSENCE
@ SPELL_SEEPING_ESSENCE
@ SPELL_PERMANENT_FEIGN_DEATH
@ SPELL_SONIC_SCREECH
@ SPELL_REDUCE_CRITCAL
@ SUMMON_GROUP_25_MAN
@ AURIAYA_DEATH_SOUNDID
@ SUMMON_GROUP_10_MAN
@ NPC_SANCTUM_SENTRY
@ PHASE_NONE
@ DATA_NINE_LIVES
@ DATA_CRAZY_CAT_LADY
@ PHASE_COMBAT
AuriayaEvents
@ EVENT_BLAST
@ EVENT_RUSH
@ EVENT_START_COMBAT
@ EVENT_ACTIVATE_DEFENDER
@ EVENT_SONIC_SCREECH
@ EVENT_FERAL_POUNCE
@ EVENT_SUMMON_DEFENDER
@ EVENT_RESPAWN_DEFENDER_3
@ EVENT_RIP
@ EVENT_BERSERK
@ EVENT_RESPAWN_DEFENDER
@ EVENT_TERRIFYING_SCREECH
@ EVENT_SWARNING_GUARDIAN
@ EVENT_SAVAGE_POUNCE
@ EVENT_RESPAWN_DEFENDER_2
AuriayaActions
@ ACTION_CRAZY_CAT_LADY
@ ACTION_DEFENDER_DIED
void AddSC_boss_auriaya()
AuriayaYells
@ EMOTE_FEAR
@ SAY_AGGRO
@ SAY_SLAY
@ EMOTE_DEFENDER
@ SAY_BERSERK
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
CatsTargetSelector(Unit const *unit, float minDist, float maxDist)
bool operator()(Unit *unit) const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
bool HasReactState(ReactStates state) const
Definition Creature.h:121
void SetReactState(ReactStates st)
Definition Creature.h:119
ReactStates GetReactState() const
Definition Creature.h:120
CreatureAI * AI() const
Definition Creature.h:154
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 CancelEvent(EventId eventId)
Definition EventMap.cpp:151
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
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit=nullptr, uint8 param1=0, uint8 param2=0)
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
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
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
ThreatManager & GetThreatManager()
Definition Unit.h:1155
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition Unit.cpp:12010
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13503
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
bool IsAIEnabled() const
Definition Unit.h:798
uint32 GetHealth() const
Definition Unit.h:913
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
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool AttackStop()
Definition Unit.cpp:5645
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3153
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1141
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition Object.cpp:1226
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
bool OnCheck(Player *, Unit *target) override
void HandleDummyEffect(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_auriaya_agro_creator)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_auriaya_feral_essence_removal)
void HandleOnHit(SpellEffIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_auriaya_feral_rush)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_auriaya_sentinel_blast)
void FilterTargets(std::list< WorldObject * > &unitList)
PrepareSpellScript(spell_auriaya_strenght_of_the_pack)
void AttackStart(Unit *) override
void ResetThreatList(Unit *who=nullptr)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void EnterEvadeMode(EvadeReason why) override
void DoAction(int32 action) override
void HandleCats(bool isResetting)
boss_auriaya(Creature *creature)
void Reset() override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
uint32 GetData(uint32 type) const override
void JustDied(Unit *) override
void Reset() override
npc_feral_defender(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
InstanceScript * _instance
void JustEngagedWith(Unit *) override
InstanceScript * _instance
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
npc_sanctum_sentry(Creature *creature)
void Reset() override
void UpdateAI(uint32) override
npc_seeping_essence_stalker(Creature *creature)
void UpdateAI(uint32 diff) override
InstanceScript * _instance
npc_swarming_guardian(Creature *creature)
void Reset() override
@ DATA_AURIAYA
Definition ulduar.h:42
#define RegisterUlduarCreatureAI(ai_name)
Definition ulduar.h:541