TrinityCore
Loading...
Searching...
No Matches
boss_moroes.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 update
20 * Find a more elegant way to force guests into combat & summon guests
21 * Currently linked aggro works only if Moroes is aggroed first (guests can be killed without aggroing Moroes)
22 * Moroes does not play sound after casting Vanish (SAY_SPECIAL)
23 * Behavior while in Vanish requires rechecks, seems like it is not working properly
24 */
25
26#include "ScriptMgr.h"
27#include "Containers.h"
28#include "karazhan.h"
29#include "InstanceScript.h"
30#include "ObjectAccessor.h"
31#include "ScriptedCreature.h"
32#include "SpellScript.h"
33#include "SpellInfo.h"
34#include "TemporarySummon.h"
35
44
46{
47 // Moroes
48 SPELL_VANISH = 29448,
50 SPELL_BLIND = 34694,
51 SPELL_GOUGE = 29425,
52 SPELL_FRENZY = 37023,
53
56
57 // Baroness Dorothea Millstipe
62
63 // Baron Rafe Dreuger
67
68 // Lady Catriona Von'Indi
73
74 // Lady Keira Berrybuck
79
80 // Lord Robin Daris
84
85 // Lord Crispin Ference
89 SPELL_SHIELD_WALL = 29390
90};
91
100
102{
103 {-10991.0f, -1884.33f, 81.73f, 0.614315f},
104 {-10989.4f, -1885.88f, 81.73f, 0.904913f},
105 {-10978.1f, -1887.07f, 81.73f, 2.035550f},
106 {-10975.9f, -1885.81f, 81.73f, 2.253890f},
107};
108
109constexpr std::array<uint32, 6> Adds =
110{
111 17007,
112 19872,
113 19873,
114 19874,
115 19875,
116 19876,
117};
118
119// 15687 - Moroes
120struct boss_moroes : public BossAI
121{
122 boss_moroes(Creature* creature) : BossAI(creature, DATA_MOROES), _frenzied(false), AddId()
123 {
124 }
125
126 void Reset() override
127 {
128 _Reset();
129 _frenzied = false;
130
131 if (me->IsAlive())
132 SpawnGuests();
133 }
134
135 void JustEngagedWith(Unit* who) override
136 {
139 GuestsAttack();
140
144 }
145
146 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
147 {
148 if (!_frenzied && me->HealthBelowPctDamaged(30, damage))
149 {
150 _frenzied = true;
152 }
153 }
154
155 void OnSpellCast(SpellInfo const* spell) override
156 {
157 switch (spell->Id)
158 {
159 case SPELL_VANISH:
161 break;
162 case SPELL_FRENZY:
164 break;
165 default:
166 break;
167 }
168 }
169
170 // Do not despawn guests
171 void JustSummoned(Creature* /*summon*/) override { }
172
173 void KilledUnit(Unit* /*victim*/) override
174 {
175 Talk(SAY_SLAY);
176 }
177
178 void JustDied(Unit* /*killer*/) override
179 {
180 _JustDied();
182
184 }
185
187 {
188 if (IsGuestListEmpty())
189 {
190 std::array<uint32, 6> AddList = Adds;
191
193
194 for (std::size_t i = 0; i < AddId.size(); ++i)
195 AddId[i] = AddList[i];
196 }
197 else
199
200 for (std::size_t i = 0; i < AddId.size(); ++i)
202 AddGUID[i] = creature->GetGUID();
203 }
204
206 {
207 return std::ranges::find(AddId, 0u) != AddId.end();
208 }
209
211 {
212 for (ObjectGuid addGuid : AddGUID)
213 if (!addGuid.IsEmpty())
214 if (Creature* temp = ObjectAccessor::GetCreature(*me, addGuid))
215 temp->DespawnOrUnsummon();
216 }
217
219 {
220 for (ObjectGuid addGuid : AddGUID)
221 {
222 if (!addGuid.IsEmpty())
223 {
224 Creature* temp = ObjectAccessor::GetCreature(*me, addGuid);
225 if (temp && temp->IsAlive())
226 {
227 temp->AI()->AttackStart(me->GetVictim());
228 DoZoneInCombat(temp);
229 }
230 else
232 }
233 }
234 }
235
236 void UpdateAI(uint32 diff) override
237 {
238 if (!UpdateVictim())
239 return;
240
241 events.Update(diff);
242
244 return;
245
246 while (uint32 eventId = events.ExecuteEvent())
247 {
248 switch (eventId)
249 {
250 case EVENT_VANISH:
253 events.Repeat(45s, 50s);
254 break;
255 case EVENT_GARROTE:
257 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 10.0f, true))
258 // Ignore Stealthed Only attribute
259 DoCast(target, SPELL_GARROTE_TRIGGER, true);
260 break;
261 case EVENT_BLIND:
262 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 10.0f, true))
263 DoCast(target, SPELL_BLIND);
264 events.Repeat(40s);
265 break;
266 case EVENT_GOUGE:
268 events.Repeat(23s);
269 break;
270 case EVENT_FRENZY:
272 break;
273 default:
274 break;
275 }
276
278 return;
279 }
280 }
281
282private:
284 std::array<ObjectGuid, 4> AddGUID;
285 std::array<uint32, 4> AddId;
286};
287
288struct GuestBaseAI : public ScriptedAI
289{
290 GuestBaseAI(Creature* creature) : ScriptedAI(creature) { }
291
292 void Reset() override
293 {
296 {
298 });
299 }
300
301 void JustEngagedWith(Unit* /*who*/) override
302 {
304 }
305
306 virtual void ScheduleEvents() = 0;
307
308 void UpdateAI(uint32 diff) override
309 {
310 if (!UpdateVictim())
311 return;
312
313 scheduler.Update(diff);
314 }
315
316protected:
318};
319
320// 19875 - Baroness Dorothea Millstipe (Shadow Priest)
322{
324
325 void ScheduleEvents() override
326 {
328 .Schedule(0s, [this](TaskContext const& /*task*/)
329 {
331 })
332 .Schedule(10s, 20s, [this](TaskContext& task)
333 {
334 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
335 if (target->GetPowerType() == POWER_MANA)
336 DoCast(target, SPELL_MANA_BURN);
337 task.Repeat(10s, 20s);
338 })
339 .Schedule(10s, 15s, [this](TaskContext& task)
340 {
342 task.Repeat(15s, 25s);
343 })
344 .Schedule(20s, 30s, [this](TaskContext& task)
345 {
346 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
348 task.Repeat(20s, 30s);
349 });
350 }
351};
352
353// 19874 - Baron Rafe Dreuger (Retribution Paladin)
355{
357
358 void ScheduleEvents() override
359 {
361 .Schedule(20s, 30s, [this](TaskContext& task)
362 {
364 task.Repeat(20s, 30s);
365 })
366 .Schedule(10s, 15s, [this](TaskContext& task)
367 {
369 task.Repeat(20s, 25s);
370 })
371 .Schedule(5s, 15s, [this](TaskContext& task)
372 {
374 task.Repeat(10s, 20s);
375 });
376 }
377};
378
379// 19872 - Lady Catriona Von'Indi (Holy Priest)
381{
383
384 void ScheduleEvents() override
385 {
387 .Schedule(10s, 15s, [this](TaskContext& task)
388 {
389 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
390 DoCast(target, SPELL_DISPEL_MAGIC);
391 task.Repeat(20s, 30s);
392 })
393 .Schedule(15s, 20s, [this](TaskContext& task)
394 {
396 task.Repeat(15s, 20s);
397 })
398 .Schedule(5s, 15s, [this](TaskContext& task)
399 {
401 task.Repeat(15s, 25s);
402 })
403 .Schedule(10s, 15s, [this](TaskContext& task)
404 {
405 if (Unit* target = DoSelectLowestHpFriendly(40.0f))
406 DoCast(target, SPELL_GREATER_HEAL);
407 task.Repeat(15s, 25s);
408 });
409 }
410};
411
412// 17007 - Lady Keira Berrybuck (Holy Paladin)
414{
416
417 void ScheduleEvents() override
418 {
420 .Schedule(5s, 10s, [this](TaskContext& task)
421 {
423 task.Repeat(10s);
424 })
425 .Schedule(10s, 15s, [this](TaskContext& task)
426 {
428 task.Repeat(50s);
429 })
430 .Schedule(10s, 15s, [this](TaskContext& task)
431 {
432 if (Unit* target = DoSelectLowestHpFriendly(40.0f))
433 DoCast(target, SPELL_HOLY_LIGHT);
434 task.Repeat(15s, 20s);
435 })
436 .Schedule(25s, 35s, [this](TaskContext& task)
437 {
439 task.Repeat(25s, 35s);
440 });
441 }
442};
443
444// 19876 - Lord Robin Daris (Arms Warrior)
446{
447 boss_lord_robin_daris(Creature* creature) : GuestBaseAI(creature) { }
448
449 void ScheduleEvents() override
450 {
452 .Schedule(5s, 10s, [this](TaskContext& task)
453 {
455 task.Repeat(10s, 15s);
456 })
457 .Schedule(15s, 30s, [this](TaskContext& task)
458 {
460 task.Repeat(15s, 30s);
461 })
462 .Schedule(20s, 35s, [this](TaskContext& task)
463 {
465 task.Repeat(20s, 35s);
466 });
467 }
468};
469
470// 19873 - Lord Crispin Ference (Protection Warrior)
472{
474
475 void ScheduleEvents() override
476 {
478 .Schedule(10s, 20s, [this](TaskContext& task)
479 {
481 task.Repeat(10s, 20s);
482 })
483 .Schedule(10s, 15s, [this](TaskContext& task)
484 {
486 task.Repeat(15s, 20s);
487 })
488 .Schedule(10s, 15s, [this](TaskContext& task)
489 {
491 task.Repeat(15s, 25s);
492 })
493 .Schedule(30s, 45s, [this](TaskContext& task)
494 {
496 task.Repeat(30s, 45s);
497 });
498 }
499};
500
501// 37870 - Garrote Remove
503{
504 bool Validate(SpellInfo const* /*spellInfo*/) override
505 {
507 }
508
509 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
510 {
512 }
513
518};
519
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ POWER_MANA
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define AuraEffectApplyFn(F, I, N, M)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
MoroesEvents
@ EVENT_BLIND
@ EVENT_GOUGE
@ EVENT_GARROTE
@ EVENT_VANISH
@ EVENT_FRENZY
void AddSC_boss_moroes()
Position const Locations[4]
MoroesSpells
@ SPELL_HAMMER_OF_JUSTICE
@ SPELL_HAMSTRING
@ SPELL_SHIELD_BASH
@ SPELL_SHADOWFORM
@ SPELL_GREATER_HEAL
@ SPELL_SHIELD_WALL
@ SPELL_GREATER_BLESS_OF_MIGHT
@ SPELL_CLEANSE
@ SPELL_GARROTE_TRIGGER
@ SPELL_JUDGEMENT_OF_COMMAND
@ SPELL_BLIND
@ SPELL_MIND_FLY
@ SPELL_DISPEL_MAGIC
@ SPELL_POWER_WORD_SHIELD
@ SPELL_SHADOW_WORD_PAIN
@ SPELL_MORTAL_STRIKE
@ SPELL_DIVINE_SHIELD
@ SPELL_HEROIC_STRIKE
@ SPELL_VANISH
@ SPELL_FRENZY
@ SPELL_HOLY_FIRE
@ SPELL_GOUGE
@ SPELL_GARROTE_REMOVE
@ SPELL_SEAL_OF_COMMAND
@ SPELL_WHIRLWIND
@ SPELL_GARROTE
@ SPELL_MANA_BURN
@ SPELL_DISARM
@ SPELL_HOLY_LIGHT
constexpr std::array< uint32, 6 > Adds
MoroesTexts
@ SAY_DEATH
@ SAY_AGGRO
@ EMOTE_FRENZY
@ SAY_SPECIAL
@ SAY_SLAY
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:235
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool IsAlive() const
Definition Unit.h:1205
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1403
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
@ DATA_MOROES
Definition karazhan.h:31
#define RegisterKarazhanCreatureAI(ai_name)
Definition karazhan.h:135
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
Definition Containers.h:171
virtual void ScheduleEvents()=0
void JustEngagedWith(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
GuestBaseAI(Creature *creature)
TaskScheduler scheduler
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
void ScheduleEvents() override
boss_baron_rafe_dreuger(Creature *creature)
boss_baroness_dorothea_millstipe(Creature *creature)
boss_lady_catriona_von_indi(Creature *creature)
boss_lady_keira_berrybuck(Creature *creature)
void ScheduleEvents() override
boss_lord_crispin_ference(Creature *creature)
void ScheduleEvents() override
boss_lord_robin_daris(Creature *creature)
void ScheduleEvents() override
void JustSummoned(Creature *) override
void GuestsAttack()
void KilledUnit(Unit *) override
bool IsGuestListEmpty()
void Reset() override
void SpawnGuests()
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
std::array< uint32, 4 > AddId
void DespawnGuests()
boss_moroes(Creature *creature)
std::array< ObjectGuid, 4 > AddGUID