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
282 }
283
284private:
286 std::array<ObjectGuid, 4> AddGUID;
287 std::array<uint32, 4> AddId;
288};
289
290struct GuestBaseAI : public ScriptedAI
291{
292 GuestBaseAI(Creature* creature) : ScriptedAI(creature) { }
293
294 void Reset() override
295 {
298 {
300 });
301 }
302
303 void JustEngagedWith(Unit* /*who*/) override
304 {
306 }
307
308 virtual void ScheduleEvents() = 0;
309
310 void UpdateAI(uint32 diff) override
311 {
312 if (!UpdateVictim())
313 return;
314
315 scheduler.Update(diff);
316
318 }
319
320protected:
322};
323
324// 19875 - Baroness Dorothea Millstipe (Shadow Priest)
326{
328
329 void ScheduleEvents() override
330 {
332 .Schedule(0s, [this](TaskContext /*task*/)
333 {
335 })
336 .Schedule(10s, 20s, [this](TaskContext task)
337 {
338 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
339 if (target->GetPowerType() == POWER_MANA)
340 DoCast(target, SPELL_MANA_BURN);
341 task.Repeat(10s, 20s);
342 })
343 .Schedule(10s, 15s, [this](TaskContext task)
344 {
346 task.Repeat(15s, 25s);
347 })
348 .Schedule(20s, 30s, [this](TaskContext task)
349 {
350 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
352 task.Repeat(20s, 30s);
353 });
354 }
355};
356
357// 19874 - Baron Rafe Dreuger (Retribution Paladin)
359{
361
362 void ScheduleEvents() override
363 {
365 .Schedule(20s, 30s, [this](TaskContext task)
366 {
368 task.Repeat(20s, 30s);
369 })
370 .Schedule(10s, 15s, [this](TaskContext task)
371 {
373 task.Repeat(20s, 25s);
374 })
375 .Schedule(5s, 15s, [this](TaskContext task)
376 {
378 task.Repeat(10s, 20s);
379 });
380 }
381};
382
383// 19872 - Lady Catriona Von'Indi (Holy Priest)
385{
387
388 void ScheduleEvents() override
389 {
391 .Schedule(10s, 15s, [this](TaskContext task)
392 {
393 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
394 DoCast(target, SPELL_DISPEL_MAGIC);
395 task.Repeat(20s, 30s);
396 })
397 .Schedule(15s, 20s, [this](TaskContext task)
398 {
400 task.Repeat(15s, 20s);
401 })
402 .Schedule(5s, 15s, [this](TaskContext task)
403 {
405 task.Repeat(15s, 25s);
406 })
407 .Schedule(10s, 15s, [this](TaskContext task)
408 {
409 if (Unit* target = DoSelectLowestHpFriendly(40.0f))
410 DoCast(target, SPELL_GREATER_HEAL);
411 task.Repeat(15s, 25s);
412 });
413 }
414};
415
416// 17007 - Lady Keira Berrybuck (Holy Paladin)
418{
420
421 void ScheduleEvents() override
422 {
424 .Schedule(5s, 10s, [this](TaskContext task)
425 {
427 task.Repeat(10s);
428 })
429 .Schedule(10s, 15s, [this](TaskContext task)
430 {
432 task.Repeat(50s);
433 })
434 .Schedule(10s, 15s, [this](TaskContext task)
435 {
436 if (Unit* target = DoSelectLowestHpFriendly(40.0f))
437 DoCast(target, SPELL_HOLY_LIGHT);
438 task.Repeat(15s, 20s);
439 })
440 .Schedule(25s, 35s, [this](TaskContext task)
441 {
443 task.Repeat(25s, 35s);
444 });
445 }
446};
447
448// 19876 - Lord Robin Daris (Arms Warrior)
450{
451 boss_lord_robin_daris(Creature* creature) : GuestBaseAI(creature) { }
452
453 void ScheduleEvents() override
454 {
456 .Schedule(5s, 10s, [this](TaskContext task)
457 {
459 task.Repeat(10s, 15s);
460 })
461 .Schedule(15s, 30s, [this](TaskContext task)
462 {
464 task.Repeat(15s, 30s);
465 })
466 .Schedule(20s, 35s, [this](TaskContext task)
467 {
469 task.Repeat(20s, 35s);
470 });
471 }
472};
473
474// 19873 - Lord Crispin Ference (Protection Warrior)
476{
478
479 void ScheduleEvents() override
480 {
482 .Schedule(10s, 20s, [this](TaskContext task)
483 {
485 task.Repeat(10s, 20s);
486 })
487 .Schedule(10s, 15s, [this](TaskContext task)
488 {
490 task.Repeat(15s, 20s);
491 })
492 .Schedule(10s, 15s, [this](TaskContext task)
493 {
495 task.Repeat(15s, 25s);
496 })
497 .Schedule(30s, 45s, [this](TaskContext task)
498 {
500 task.Repeat(30s, 45s);
501 });
502 }
503};
504
505// 37870 - Garrote Remove
525
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ POWER_MANA
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define AuraEffectApplyFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
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(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
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
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
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
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsAlive() const
Definition Unit.h:1234
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
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
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:1992
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_moroes_garrote_remove)
@ DATA_MOROES
Definition karazhan.h:31
#define RegisterKarazhanCreatureAI(ai_name)
Definition karazhan.h:121
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void RandomShuffle(C &container)
Reorder the elements of the container randomly.
Definition Containers.h:166
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