TrinityCore
boss_leymor.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 "AreaTrigger.h"
19#include "AreaTriggerAI.h"
20#include "CreatureAI.h"
21#include "CreatureAIImpl.h"
22#include "InstanceScript.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "SpellScript.h"
26#include "SpellAuras.h"
27#include "SharedDefines.h"
28#include "TemporarySummon.h"
29#include "azure_vault.h"
30
32{
33 // Leymor
34 SPELL_STASIS = 375729,
46
47 // Ley-Line Sprout
51
52 // Volatile Sapling
54
55 // Arcane Tender
61};
62
64{
65 // Leymor
72
73 // Arcane Tender
77};
78
80{
82};
83
85{
87};
88
90{
91 NPC_LEYLINE_SPROUTS = 190509
92};
93
95{
97};
98
99// 186644 - Leymor
100struct boss_leymor : public BossAI
101{
103
104 void JustAppeared() override
105 {
107 return;
108
111 }
112
113 void DoAction(int32 action) override
114 {
115 if (action == ACTION_ARCANE_TENDER_DEATH)
116 {
118 if (_killedArcaneTender >= 3)
119 {
121
122 scheduler.Schedule(1s, [this](TaskContext /*context*/)
123 {
128 });
129 }
130 }
131 }
132
133 void JustDied(Unit* /*killer*/) override
134 {
135 _JustDied();
137 }
138
139 void EnterEvadeMode(EvadeReason /*why*/) override
140 {
142
146 }
147
148 void OnChannelFinished(SpellInfo const* spell) override
149 {
150 if (spell->Id == SPELL_CONSUMING_STOMP)
152 };
153
154 void JustEngagedWith(Unit* who) override
155 {
163 }
164
165 void UpdateAI(uint32 diff) override
166 {
167 scheduler.Update(diff);
168
169 if (!UpdateVictim())
170 return;
171
172 events.Update(diff);
173
175 return;
176
177 while (uint32 eventId = events.ExecuteEvent())
178 {
179 switch (eventId)
180 {
184 break;
188 break;
192 break;
196 break;
200 break;
201 default:
202 break;
203 }
204
206 return;
207 }
208 }
209
210private:
212};
213
214// 191164 - Arcane Tender
216{
217 npc_arcane_tender(Creature* creature) : ScriptedAI(creature) { }
218
219 void JustDied(Unit* /*killer*/) override
220 {
222 if (!leymor)
223 return;
224
225 if (!leymor->IsAIEnabled())
226 return;
227
229 }
230
231 void JustAppeared() override
232 {
234 if (!leymor)
235 return;
236
238 }
239
240 void JustReachedHome() override
241 {
242 JustAppeared();
243 }
244
245 void Reset() override
246 {
247 _events.Reset();
248 }
249
250 void JustEngagedWith(Unit* /*who*/) override
251 {
254 }
255
256 void UpdateAI(uint32 diff) override
257 {
258 if (!UpdateVictim())
259 return;
260
261 _events.Update(diff);
262
264 return;
265
266 while (uint32 eventId = _events.ExecuteEvent())
267 {
268 switch (eventId)
269 {
273 break;
277 break;
278 default:
279 break;
280 }
281
283 return;
284 }
285 }
286private:
288};
289
290// 190509 - Ley-Line Sprout
292{
293 npc_ley_line_sprouts(Creature* creature) : ScriptedAI(creature) { }
294
295 void JustAppeared() override
296 {
298
300 }
301
302 void JustSummoned(Creature* summon) override
303 {
305 if (!leymor)
306 return;
307
308 if (!leymor->IsAIEnabled())
309 return;
310
311 leymor->AI()->JustSummoned(summon);
312 }
313
314 void JustDied(Unit* /*killer*/) override
315 {
316 if (IsMythic() || IsMythicPlus())
318
319 if (TempSummon* tempSummon = me->ToTempSummon())
320 {
321 if (Unit* summoner = tempSummon->GetSummonerUnit())
322 {
323 if (Aura* aura = summoner->GetAura(SPELL_ARCANE_POWER))
324 aura->ModStackAmount(-1);
325 }
326 }
327 }
328
329 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
330 {
332 return;
333
335 me->KillSelf();
336 }
337};
338
339// 196559 - Volatile Sapling
341{
343
344 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
345 {
346 if (me->GetHealth() <= damage)
347 {
348 damage = me->GetHealth() - 1;
349
351 {
352 me->CastSpell(nullptr, SPELL_SAPPY_BURST, false);
353 _isSappyBurstCast = true;
354 }
355 }
356 }
357
358 void OnSpellFailed(SpellInfo const* spell) override
359 {
360 if (spell->Id != SPELL_SAPPY_BURST)
361 return;
362
363 me->KillSelf();
364 }
365
366private:
368};
369
371{
372 { -5129.39f, 1253.30f, 555.58f },
373 { -5101.68f, 1253.71f, 555.90f },
374 { -5114.70f, 1230.28f, 555.89f },
375 { -5141.62f, 1230.33f, 555.83f },
376 { -5155.62f, 1253.60f, 555.87f },
377 { -5141.42f, 1276.70f, 555.89f },
378 { -5114.78f, 1277.42f, 555.87f }
379};
380
381// 374364 - Ley-Line Sprouts
383{
384 bool Validate(SpellInfo const* /*spellInfo*/) override
385 {
387 }
388
389 void HandleHit(SpellEffIndex /*effIndex*/)
390 {
391 for (Position const& pos : LeyLineSproutGroupOrigin)
392 {
393 for (int8 i = 0; i < 2; i++)
395 }
396 }
397
398 void Register() override
399 {
401 }
402};
403
404// 375732 - Stasis Ritual
406{
407 bool Validate(SpellInfo const* /*spellInfo*/) override
408 {
410 }
411
412 void HandlePeriodic(AuraEffect const* /*aurEff*/)
413 {
414 if (Unit* caster = GetCaster())
415 caster->CastSpell(nullptr, SPELL_STASIS_RITUAL_MISSILE, true);
416 }
417
418 void Register() override
419 {
421 }
422};
423
424// 375652 - Wild Eruption
426{
427 bool Validate(SpellInfo const* /*spellInfo*/) override
428 {
430 }
431
433 {
435 }
436
437 void Register() override
438 {
440 }
441};
442
443// 375749 - Arcane Eruption
445{
446 at_leymor_arcane_eruption(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
447
448 void OnUnitEnter(Unit* unit) override
449 {
450 if (!unit->IsPlayer())
451 return;
452
454 }
455
456 void OnUnitExit(Unit* unit) override
457 {
458 if (!unit->IsPlayer())
459 return;
460
462 }
463};
464
465// 374567 - Explosive Brand
467{
468 bool Validate(SpellInfo const* /*spellInfo*/) override
469 {
471 }
472
473 void HandleHit(SpellEffIndex /*effIndex*/)
474 {
476 }
477
478 void Register() override
479 {
481 }
482};
483
484// 374567 - Explosive Brand
486{
487 bool Validate(SpellInfo const* /*spellInfo*/) override
488 {
490 }
491
492 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
493 {
494 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
495 return;
496
497 if (Unit* caster = GetCaster())
498 caster->CastSpell(GetTarget(), SPELL_EXPLOSIVE_BRAND_DAMAGE, true);
499 }
500
501 void Register() override
502 {
504 }
505};
506
507// 374720 - Consuming Stomp
509{
510 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
511 {
512 GetTarget()->KillSelf();
513 }
514
515 void Register() override
516 {
518 }
519};
520
521// 386660 - Erupting Fissure
523{
524 bool Validate(SpellInfo const* /*spellInfo*/) override
525 {
527 }
528
529 void HandleHit(SpellEffIndex /*effIndex*/)
530 {
532 }
533
534 void Register() override
535 {
537 }
538};
539
540// 375591 - Sappy Burst
542{
544 {
545 GetCaster()->KillSelf();
546 }
547
548 void Register() override
549 {
551 }
552};
553
555{
556 // Creature
561
562 // Spells
570
571 // AreaTrigger
573}
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition: ScriptMgr.h:1371
#define RegisterAreaTriggerAI(ai_name)
Definition: ScriptMgr.h:1416
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_APPLY_AURA
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
EvadeReason
Definition: UnitAICommon.h:30
DamageEffectType
Definition: UnitDefines.h:131
UnitFlags
Definition: UnitDefines.h:143
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition: UnitDefines.h:153
@ UNIT_FLAG_IMMUNE_TO_PC
Definition: UnitDefines.h:152
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterAzureVaultCreatureAI(ai_name)
Definition: azure_vault.h:63
@ DATA_LEYMOR_INTRO_DONE
Definition: azure_vault.h:36
@ DATA_LEYMOR
Definition: azure_vault.h:31
LeymorActions
Definition: boss_leymor.cpp:95
@ ACTION_ARCANE_TENDER_DEATH
Definition: boss_leymor.cpp:96
LeymorTexts
Definition: boss_leymor.cpp:80
@ SAY_ANNOUNCE_AWAKEN
Definition: boss_leymor.cpp:81
LeymorSpells
Definition: boss_leymor.cpp:32
@ SPELL_EXPLOSIVE_BRAND_KNOCKBACK
Definition: boss_leymor.cpp:44
@ SPELL_WILD_ERUPTION
Definition: boss_leymor.cpp:59
@ SPELL_ARCANE_ERUPTION
Definition: boss_leymor.cpp:35
@ SPELL_CONSUMING_STOMP
Definition: boss_leymor.cpp:38
@ SPELL_ARCANE_POWER
Definition: boss_leymor.cpp:50
@ SPELL_EXPLOSIVE_BRAND_DAMAGE
Definition: boss_leymor.cpp:43
@ SPELL_VOLATILE_SAPLING
Definition: boss_leymor.cpp:48
@ SPELL_WILD_ERUPTION_MISSILE
Definition: boss_leymor.cpp:60
@ SPELL_LEY_LINE_SPROUTS_MISSILE
Definition: boss_leymor.cpp:37
@ SPELL_STASIS_RITUAL
Definition: boss_leymor.cpp:56
@ SPELL_EXPLOSIVE_BRAND
Definition: boss_leymor.cpp:42
@ SPELL_STASIS
Definition: boss_leymor.cpp:34
@ SPELL_ERRATIC_GROWTH_CHANNEL
Definition: boss_leymor.cpp:58
@ SPELL_LEY_LINE_SPROUTS
Definition: boss_leymor.cpp:36
@ SPELL_SAPPY_BURST
Definition: boss_leymor.cpp:53
@ SPELL_STASIS_RITUAL_MISSILE
Definition: boss_leymor.cpp:57
@ SPELL_ERUPTING_FISSURE_SPROUT_SELECTOR
Definition: boss_leymor.cpp:41
@ SPELL_INFUSED_STRIKE
Definition: boss_leymor.cpp:45
@ SPELL_ERUPTING_FISSURE
Definition: boss_leymor.cpp:40
@ SPELL_CONSUMING_STOMP_DAMAGE
Definition: boss_leymor.cpp:39
@ SPELL_LEY_LINE_SPROUT_AT
Definition: boss_leymor.cpp:49
static Position const LeyLineSproutGroupOrigin[]
LeymorNpcs
Definition: boss_leymor.cpp:90
@ NPC_LEYLINE_SPROUTS
Definition: boss_leymor.cpp:91
void AddSC_boss_leymor()
LeymorVisuals
Definition: boss_leymor.cpp:85
@ SPELL_VISUAL_KIT_SPROUT_DEATH
Definition: boss_leymor.cpp:86
LeymorEvents
Definition: boss_leymor.cpp:64
@ EVENT_ERRATIC_GROWTH
Definition: boss_leymor.cpp:74
@ EVENT_WILD_ERUPTION
Definition: boss_leymor.cpp:75
@ EVENT_INFUSED_STRIKE
Definition: boss_leymor.cpp:71
@ EVENT_LEYMOR_AWAKE
Definition: boss_leymor.cpp:66
@ EVENT_CONSUMING_STOMP
Definition: boss_leymor.cpp:68
@ EVENT_ERUPTING_FISSURE
Definition: boss_leymor.cpp:69
@ EVENT_LEY_LINE_SPROUTS
Definition: boss_leymor.cpp:67
@ EVENT_INFUSED_GROUND
Definition: boss_leymor.cpp:76
@ EVENT_EXPLOSIVE_BRAND
Definition: boss_leymor.cpp:70
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
TaskScheduler scheduler
SummonList summons
EventMap events
void _JustDied()
virtual void JustSummoned(Creature *)
Definition: CreatureAI.h:111
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:299
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
CreatureAI * AI() const
Definition: Creature.h:214
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
bool IsPlayer() const
Definition: Object.h:212
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
WorldLocation * GetHitDest() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
virtual void DoAction(int32)
Definition: UnitAI.h:72
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ApplyMovementForce(ObjectGuid id, Position origin, float magnitude, MovementForceType type, Position direction={}, ObjectGuid transportGuid=ObjectGuid::Empty)
Definition: Unit.cpp:13193
TempSummon * ToTempSummon()
Definition: Unit.h:1756
bool IsAIEnabled() const
Definition: Unit.h:658
uint64 GetHealth() const
Definition: Unit.h:776
void RemoveMovementForce(ObjectGuid id)
Definition: Unit.cpp:13228
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
Definition: Unit.cpp:11711
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:921
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
void Register() override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandleHit(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandleHit(SpellEffIndex)
void Register() override
void Register() override
void HandleHit(SpellEffIndex)
bool Validate(SpellInfo const *) override
void Register() override
void HandleHitTarget(SpellEffIndex)
void HandlePeriodic(AuraEffect const *)
void Register() override
bool Validate(SpellInfo const *) override
void Register() override
bool Validate(SpellInfo const *) override
void HandleHitTarget(SpellEffIndex)
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
bool IsMythic() const
bool IsMythicPlus() const
at_leymor_arcane_eruption(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit) override
void UpdateAI(uint32 diff) override
int32 _killedArcaneTender
void EnterEvadeMode(EvadeReason) override
void OnChannelFinished(SpellInfo const *spell) override
void JustDied(Unit *) override
boss_leymor(Creature *creature)
void JustEngagedWith(Unit *who) override
void JustAppeared() override
void DoAction(int32 action) override
void JustDied(Unit *) override
void JustAppeared() override
void Reset() override
npc_arcane_tender(Creature *creature)
void JustReachedHome() override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
npc_ley_line_sprouts(Creature *creature)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustSummoned(Creature *summon) override
void JustAppeared() override
npc_volatile_sapling(Creature *creature)
void OnSpellFailed(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override