TrinityCore
Loading...
Searching...
No Matches
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
62
78
83
88
90{
91 NPC_LEYLINE_SPROUTS = 190509
92};
93
94// 186644 - Leymor
95struct boss_leymor : public BossAI
96{
97 boss_leymor(Creature* creature) : BossAI(creature, DATA_LEYMOR) { }
98
99 void JustAppeared() override
100 {
102 return;
103
104 me->SetImmuneToAll(true);
106 }
107
108 void DoAction(int32 action) override
109 {
110 if (action == ACTION_FINISH_LEYMOR_INTRO)
111 {
112 scheduler.Schedule(1s, [this](TaskContext const& /*context*/)
113 {
115 me->SetImmuneToAll(false);
118 });
119 }
120 }
121
122 void JustDied(Unit* /*killer*/) override
123 {
124 _JustDied();
126 }
127
136
137 void OnChannelFinished(SpellInfo const* spell) override
138 {
139 if (spell->Id == SPELL_CONSUMING_STOMP)
141 }
142
153
154 void UpdateAI(uint32 diff) override
155 {
156 scheduler.Update(diff);
157
158 if (!UpdateVictim())
159 return;
160
161 events.Update(diff);
162
164 return;
165
166 while (uint32 eventId = events.ExecuteEvent())
167 {
168 switch (eventId)
169 {
173 break;
177 break;
181 break;
185 break;
189 break;
190 default:
191 break;
192 }
193
195 return;
196 }
197 }
198};
199
200// 191164 - Arcane Tender
202{
203 npc_arcane_tender(Creature* creature) : ScriptedAI(creature) { }
204
205 void JustAppeared() override
206 {
208 if (!leymor)
209 return;
210
212 }
213
214 void JustReachedHome() override
215 {
216 JustAppeared();
217 }
218
219 void Reset() override
220 {
221 _events.Reset();
222 }
223
229
230 void UpdateAI(uint32 diff) override
231 {
232 if (!UpdateVictim())
233 return;
234
235 _events.Update(diff);
236
238 return;
239
240 while (uint32 eventId = _events.ExecuteEvent())
241 {
242 switch (eventId)
243 {
247 break;
251 break;
252 default:
253 break;
254 }
255
257 return;
258 }
259 }
260private:
262};
263
264// 190509 - Ley-Line Sprout
266{
267 npc_ley_line_sprouts(Creature* creature) : ScriptedAI(creature) { }
268
269 void JustAppeared() override
270 {
272
274 }
275
276 void JustSummoned(Creature* summon) override
277 {
279 if (!leymor)
280 return;
281
282 if (!leymor->IsAIEnabled())
283 return;
284
285 leymor->AI()->JustSummoned(summon);
286 }
287
288 void JustDied(Unit* /*killer*/) override
289 {
290 if (IsMythic() || IsMythicPlus())
292
293 if (TempSummon* tempSummon = me->ToTempSummon())
294 {
295 if (Unit* summoner = tempSummon->GetSummonerUnit())
296 {
297 if (Aura* aura = summoner->GetAura(SPELL_ARCANE_POWER))
298 aura->ModStackAmount(-1);
299 }
300 }
301 }
302
303 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
304 {
306 return;
307
309 me->KillSelf();
310 }
311};
312
313// 196559 - Volatile Sapling
315{
317
318 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
319 {
320 if (me->GetHealth() <= damage)
321 {
322 damage = me->GetHealth() - 1;
323
325 {
326 me->CastSpell(nullptr, SPELL_SAPPY_BURST, false);
327 _isSappyBurstCast = true;
328 }
329 }
330 }
331
332 void OnSpellFailed(SpellInfo const* spell) override
333 {
334 if (spell->Id != SPELL_SAPPY_BURST)
335 return;
336
337 me->KillSelf();
338 }
339
340private:
342};
343
345{
346 { -5129.39f, 1253.30f, 555.58f },
347 { -5101.68f, 1253.71f, 555.90f },
348 { -5114.70f, 1230.28f, 555.89f },
349 { -5141.62f, 1230.33f, 555.83f },
350 { -5155.62f, 1253.60f, 555.87f },
351 { -5141.42f, 1276.70f, 555.89f },
352 { -5114.78f, 1277.42f, 555.87f }
353};
354
355// 374364 - Ley-Line Sprouts
357{
358 bool Validate(SpellInfo const* /*spellInfo*/) override
359 {
361 }
362
363 void HandleHit(SpellEffIndex /*effIndex*/)
364 {
365 for (Position const& pos : LeyLineSproutGroupOrigin)
366 {
367 for (int8 i = 0; i < 2; i++)
369 }
370 }
371
376};
377
378// 375732 - Stasis Ritual
380{
381 bool Validate(SpellInfo const* /*spellInfo*/) override
382 {
384 }
385
386 void HandlePeriodic(AuraEffect const* /*aurEff*/)
387 {
388 if (Unit* caster = GetCaster())
389 caster->CastSpell(nullptr, SPELL_STASIS_RITUAL_MISSILE, true);
390 }
391
396};
397
398// 375652 - Wild Eruption
400{
401 bool Validate(SpellInfo const* /*spellInfo*/) override
402 {
404 }
405
410
415};
416
417// 375749 - Arcane Eruption
419{
420 at_leymor_arcane_eruption(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
421
422 void OnUnitEnter(Unit* unit) override
423 {
424 if (!unit->IsPlayer())
425 return;
426
428 }
429
430 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
431 {
432 if (!unit->IsPlayer())
433 return;
434
436 }
437};
438
439// 374567 - Explosive Brand
441{
442 bool Validate(SpellInfo const* /*spellInfo*/) override
443 {
445 }
446
447 void HandleHit(SpellEffIndex /*effIndex*/)
448 {
450 }
451
456};
457
458// 374567 - Explosive Brand
460{
461 bool Validate(SpellInfo const* /*spellInfo*/) override
462 {
464 }
465
466 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
467 {
468 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
469 return;
470
471 if (Unit* caster = GetCaster())
472 caster->CastSpell(GetTarget(), SPELL_EXPLOSIVE_BRAND_DAMAGE, true);
473 }
474
479};
480
481// 374720 - Consuming Stomp
494
495// 386660 - Erupting Fissure
497{
498 bool Validate(SpellInfo const* /*spellInfo*/) override
499 {
501 }
502
507
512};
513
514// 375591 - Sappy Burst
527
AreaTriggerExitReason
Definition AreaTrigger.h:69
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ EFFECT_2
@ 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)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ ACTION_FINISH_LEYMOR_INTRO
Definition azure_vault.h:59
#define RegisterAzureVaultCreatureAI(ai_name)
Definition azure_vault.h:68
@ DATA_LEYMOR_INTRO_DONE
Definition azure_vault.h:36
@ DATA_LEYMOR
Definition azure_vault.h:31
LeymorTexts
@ SAY_ANNOUNCE_AWAKEN
LeymorSpells
@ SPELL_EXPLOSIVE_BRAND_KNOCKBACK
@ SPELL_WILD_ERUPTION
@ SPELL_ARCANE_ERUPTION
@ SPELL_CONSUMING_STOMP
@ SPELL_ARCANE_POWER
@ SPELL_EXPLOSIVE_BRAND_DAMAGE
@ SPELL_VOLATILE_SAPLING
@ SPELL_WILD_ERUPTION_MISSILE
@ SPELL_LEY_LINE_SPROUTS_MISSILE
@ SPELL_STASIS_RITUAL
@ SPELL_EXPLOSIVE_BRAND
@ SPELL_STASIS
@ SPELL_ERRATIC_GROWTH_CHANNEL
@ SPELL_LEY_LINE_SPROUTS
@ SPELL_SAPPY_BURST
@ SPELL_STASIS_RITUAL_MISSILE
@ SPELL_ERUPTING_FISSURE_SPROUT_SELECTOR
@ SPELL_INFUSED_STRIKE
@ SPELL_ERUPTING_FISSURE
@ SPELL_CONSUMING_STOMP_DAMAGE
@ SPELL_LEY_LINE_SPROUT_AT
static Position const LeyLineSproutGroupOrigin[]
LeymorNpcs
@ NPC_LEYLINE_SPROUTS
void AddSC_boss_leymor()
LeymorVisuals
@ SPELL_VISUAL_KIT_SPROUT_DEATH
LeymorEvents
@ EVENT_ERRATIC_GROWTH
@ EVENT_WILD_ERUPTION
@ EVENT_INFUSED_STRIKE
@ EVENT_LEYMOR_AWAKE
@ EVENT_CONSUMING_STOMP
@ EVENT_ERUPTING_FISSURE
@ EVENT_LEY_LINE_SPROUTS
@ EVENT_INFUSED_GROUND
@ EVENT_EXPLOSIVE_BRAND
AreaTrigger *const at
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
TaskScheduler scheduler
SummonList summons
EventMap events
virtual void JustSummoned(Creature *)
Definition CreatureAI.h:113
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToAll(bool apply) override
Definition Creature.h:181
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
Creature * GetCreature(uint32 type)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
WorldLocation * GetHitDest() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
HookList< EffectHandler > OnEffectHitTarget
TaskScheduler & Schedule(duration_t time, task_handler_t task)
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:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void ApplyMovementForce(ObjectGuid id, Position origin, float magnitude, MovementForceType type, Position direction={}, ObjectGuid transportGuid=ObjectGuid::Empty)
Definition Unit.cpp:14049
TempSummon * ToTempSummon()
Definition Unit.h:1828
bool IsAIEnabled() const
Definition Unit.h:666
uint64 GetHealth() const
Definition Unit.h:788
void RemoveMovementForce(ObjectGuid id)
Definition Unit.cpp:14084
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
Definition Unit.cpp:12342
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:936
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
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:92
bool IsMythic() const
bool IsMythicPlus() const
at_leymor_arcane_eruption(AreaTrigger *areatrigger)
void OnUnitEnter(Unit *unit) override
void OnUnitExit(Unit *unit, AreaTriggerExitReason) override
void UpdateAI(uint32 diff) override
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 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