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
170
171 void KilledUnit(Unit* who) override
172 {
173 if (who->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50))
174 Talk(SAY_SLAY);
175 }
176
177 void DoAction(int32 action) override
178 {
179 switch (action)
180 {
182 _crazyCatLady = false;
183 break;
185 _nineLives = true;
186 break;
187 default:
188 break;
189 }
190 }
191
192 uint32 GetData(uint32 type) const override
193 {
194 switch (type)
195 {
196 case DATA_NINE_LIVES:
197 return _nineLives ? 1 : 0;
199 return _crazyCatLady ? 1 : 0;
200 default:
201 return 0;
202 }
203 }
204
205 void JustDied(Unit* /*killer*/) override
206 {
207 _JustDied();
209 HandleCats(false);
210 }
211
212 void UpdateAI(uint32 diff) override
213 {
214 if (!UpdateVictim())
215 return;
216
217 events.Update(diff);
218
220 return;
221
222 while (uint32 eventId = events.ExecuteEvent())
223 {
224 switch (eventId)
225 {
228 events.Repeat(22s, 30s);
229 break;
234 events.Repeat(36s, 45s);
235 break;
236 case EVENT_BLAST:
238 break;
243 break;
246 break;
248 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
250 events.Repeat(25s, 45s);
251 break;
252 case EVENT_BERSERK:
255 break;
256 default:
257 break;
258 }
259
261 return;
262 }
263
265 }
266
267private:
270};
271
273{
274 npc_sanctum_sentry(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
275
276 void Reset() override
277 {
278 _events.Reset();
280 me->SetWalk(true);
281 }
282
283 void JustEngagedWith(Unit* /*who*/) override
284 {
287 me->SetWalk(false);
288 }
289
290 void JustDied(Unit* /*killer*/) override
291 {
293 auriaya->AI()->DoAction(ACTION_CRAZY_CAT_LADY);
294 }
295
296 void UpdateAI(uint32 diff) override
297 {
298 if (!UpdateVictim())
299 return;
300
301 _events.Update(diff);
302
304 return;
305
306 while (uint32 eventId = _events.ExecuteEvent())
307 {
308 switch (eventId)
309 {
310 case EVENT_RIP:
312 _events.Repeat(10s, 12s);
313 break;
315 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(me, 10.0f, 15.0f)))
316 {
318 _events.Repeat(10s);
319 break;
320 }
321 _events.Repeat(1s);
322 break;
323 default:
324 break;
325 }
326
328 return;
329 }
330
332 }
333
334private:
337};
338
340{
341 npc_feral_defender(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
342
343 void Reset() override
344 {
352
354 auriaya->AI()->JustSummoned(me);
355 }
356
357 void UpdateAI(uint32 diff) override
358 {
360 return;
361
362 _events.Update(diff);
363
365 return;
366
367 while (uint32 eventId = _events.ExecuteEvent())
368 {
369 switch (eventId)
370 {
374 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
375 AttackStart(target);
378 break;
381 {
382 if (Unit* target = me->GetVictim())
383 {
384 float distance = me->GetDistance2d(target);
385 if (distance > 5.0f && distance <= 45.0f)
386 {
388 _events.Repeat(5s);
389 break;
390 }
391 }
392 }
393 _events.Repeat(1s);
394 break;
395 case EVENT_RUSH:
396 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, CatsTargetSelector(me, 10.0f, 11.0f)))
397 {
398 DoCast(target, SPELL_FERAL_RUSH, true);
399 _events.Repeat(5s);
400 break;
401 }
402 _events.Repeat(1s);
403 break;
405 me->SetDisableGravity(true);
406 me->SetHover(true);
410 break;
413 break;
419 me->SetDisableGravity(false);
420 me->SetHover(false);
422 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
423 AttackStart(target);
425 break;
426 default:
427 break;
428 }
429
431 return;
432 }
433
435 }
436
458
459 void JustDied(Unit* /*killer*/) override
460 {
463 auriaya->AI()->DoAction(ACTION_DEFENDER_DIED);
464 }
465
466private:
469};
470
472{
473 npc_swarming_guardian(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
474
475 void Reset() override
476 {
478 _scheduler.Schedule(1s, [this](TaskContext /*context*/)
479 {
482 });
484 auriaya->AI()->JustSummoned(me);
485 }
486
487 void UpdateAI(uint32 diff) override
488 {
489 _scheduler.Update(diff);
490 if (!UpdateVictim())
491 return;
492
494 }
495
496private:
499};
500
502{
503 npc_seeping_essence_stalker(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
504
505 void Reset() override
506 {
509 auriaya->AI()->JustSummoned(me);
510 }
511
512 void UpdateAI(uint32 /*diff*/) override { }
513
514private:
516};
517
518// 64381 - Strength of the Pack
533
534// 64392, 64679 - Sentinel Blast
536{
538
539 void FilterTargets(std::list<WorldObject*>& targets)
540 {
541 targets.remove_if([](WorldObject* object) -> bool
542 {
543 if (object->GetTypeId() == TYPEID_PLAYER)
544 return false;
545
546 if (Creature* creature = object->ToCreature())
547 return !creature->IsPet();
548
549 return true;
550 });
551 }
552
558};
559
560// 63709 - Aggro Creator
562{
564
565 bool Validate(SpellInfo const* /*spellInfo*/) override
566 {
568 }
569
571 {
572 Creature* caster = GetCaster()->ToCreature();
573 if (!caster || !caster->IsAIEnabled() || caster->HasReactState(REACT_PASSIVE))
574 return;
575
576 if (Unit* target = caster->AI()->SelectTarget(SelectTargetMethod::Random, 0, CatsTargetSelector(caster, 5.0f, 10.0f)))
577 {
578 caster->CastSpell(target, SPELL_POUNCE, true);
579 caster->GetThreatManager().AddThreat(target, 50000000.0f, nullptr, true);
580 caster->AI()->AttackStart(target);
581 }
582 }
583
588};
589
590// 64456 - Feral Essence Application Removal
592{
594
595 bool Validate(SpellInfo const* /*spellInfo*/) override
596 {
598 }
599
601 {
602 if (Aura* essence = GetCaster()->GetAura(SPELL_FERAL_ESSENCE))
603 essence->ModStackAmount(-1);
604 }
605
610};
611
612// 64496, 64674 - Feral Rush
632
634{
635 public:
636 achievement_nine_lives() : AchievementCriteriaScript("achievement_nine_lives") { }
637
638 bool OnCheck(Player* /*player*/, Unit* target) override
639 {
640 if (!target)
641 return false;
642
643 if (Creature* auriaya = target->ToCreature())
644 if (auriaya->AI()->GetData(DATA_NINE_LIVES))
645 return true;
646
647 return false;
648 }
649};
650
652{
653 public:
654 achievement_crazy_cat_lady() : AchievementCriteriaScript("achievement_crazy_cat_lady") { }
655
656 bool OnCheck(Player* /*player*/, Unit* target) override
657 {
658 if (!target)
659 return false;
660
661 if (Creature* auriaya = target->ToCreature())
662 if (auriaya->AI()->GetData(DATA_CRAZY_CAT_LADY))
663 return true;
664
665 return false;
666 }
667};
668
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ 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:249
DamageEffectType
Definition Unit.h:366
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
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
bool HasReactState(ReactStates state) const
Definition Creature.h:130
void SetReactState(ReactStates st)
Definition Creature.h:128
ReactStates GetReactState() const
Definition Creature.h:129
CreatureAI * AI() const
Definition Creature.h:163
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)
static Creature * ToCreature(Object *o)
Definition Object.h:189
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:783
ThreatManager & GetThreatManager()
Definition Unit.h:1169
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition Unit.cpp:11981
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13475
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4558
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13262
bool IsAIEnabled() const
Definition Unit.h:812
uint32 GetHealth() const
Definition Unit.h:927
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
Unit * GetVictim() const
Definition Unit.h:873
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:968
bool AttackStop()
Definition Unit.cpp:5587
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3154
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1142
bool IsWithinLOSInMap(WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition Object.cpp:1227
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1124
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 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