TrinityCore
Loading...
Searching...
No Matches
boss_kystia_manaheart.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 "Creature.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "MotionMaster.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "SpellAuras.h"
27#include "SpellInfo.h"
28#include "SpellMgr.h"
29#include "SpellScript.h"
30#include "murder_row.h"
31
33{
34 namespace Spells
35 {
36 static constexpr uint32 IllicitInfusionVisual = 1217464;
37 static constexpr uint32 FelCrazed = 474365;
38 static constexpr uint32 Felshield = 1217989;
39 static constexpr uint32 MirrorImages = 1264095;
40 static constexpr uint32 MirrorImage = 1264098;
41 static constexpr uint32 ChaosBarrage = 1230298;
42 static constexpr uint32 IllicitInfusion = 1230289;
43 static constexpr uint32 IllicitInfusionCast = 474238;
44 static constexpr uint32 FelNova = 1223906;
45 static constexpr uint32 FelNovaSelector = 474240;
46 static constexpr uint32 Blink = 474183;
47
48 // Nibbles
49 static constexpr uint32 FelSpray = 1253811;
50 static constexpr uint32 FelSprayDamage = 1253813;
51 static constexpr uint32 CorrodingSpittle = 1228198;
52 static constexpr uint32 LightInfusion = 1230304;
53 static constexpr uint32 Destabilized = 1265412;
54 static constexpr uint32 Escape = 1248184;
55 }
56
57 namespace Texts
58 {
59 // Kystia
60 static constexpr uint8 Aggro = 0;
61 static constexpr uint8 MirrorImages = 1;
62 static constexpr uint8 FelNova = 2;
63 static constexpr uint8 Destabilized = 3;
64 static constexpr uint8 IllicitInfusion = 4;
65 static constexpr uint8 Death = 5;
66 static constexpr uint8 Wipe = 6;
67
68 // Nibbles
69 static constexpr uint8 LightInfusion = 0;
70 static constexpr uint8 FelSprayWarning = 1;
71 static constexpr uint8 Escape = 2;
72 }
73
74 namespace Events
75 {
76 // Kystia
77 static constexpr uint8 ChaosBarrage = 1;
78 static constexpr uint8 MirrorImages = 2;
79 static constexpr uint8 FelNova = 3;
80
81 // Nibbles
82 static constexpr uint8 FelSpray = 4;
83 static constexpr uint8 CorrodingSpittle = 5;
84 static constexpr uint8 CheckHealth = 6;
85 }
86
87 namespace Positions
88 {
89 static constexpr Position NibblesEscapePosition = { 8861.71f, -4843.24f, 13.0376f };
90 }
91
92 namespace Points
93 {
94 static constexpr uint8 PointEscape = 0;
95 }
96
97 namespace SpellVisuals
98 {
99 static constexpr uint32 SpellVisualNibblesFriendly = 229191;
100 static constexpr uint32 SpellVisualNibblesUnfriendly = 249081;
101 }
102
103 namespace DisplayIds
104 {
105 static constexpr uint32 DisplayFriendly = 128332;
106 static constexpr uint32 DisplayUnfriendly = 126199;
107 }
108
109// 234648 - Kystia Manaheart
111{
113
119
120 void Reset() override
121 {
122 _Reset();
123 _felshieldCount = 0;
124 }
125
126 void JustDied(Unit* /*killer*/) override
127 {
128 _JustDied();
132
133 if (Creature* nibbles = instance->GetCreature(DATA_NIBBLES))
134 {
135 nibbles->SetDisplayId(DisplayIds::DisplayFriendly);
136 nibbles->SetAnimTier(AnimTier::Fly, true);
137 nibbles->SetDisableGravity(true);
138 nibbles->SetPlayHoverAnim(true);
140 nibbles->AI()->Talk(Texts::Escape);
141 nibbles->GetMotionMaster()->MovePoint(Points::PointEscape, Positions::NibblesEscapePosition);
142 }
143 }
144
145 void OnChannelFinished(SpellInfo const* spell) override
146 {
147 if (spell->Id != Spells::IllicitInfusionCast)
148 return;
149
150 uint8 stackAmount = 3 - _felshieldCount;
151 if (stackAmount == 0)
152 stackAmount = 1;
153
156
157 if (Creature* nibbles = instance->GetCreature(DATA_NIBBLES))
158 {
159 nibbles->SendPlaySpellVisualKit(SpellVisuals::SpellVisualNibblesUnfriendly, 0, 0);
160 nibbles->SetDisplayId(DisplayIds::DisplayUnfriendly);
161 nibbles->ClearUnitState(UNIT_STATE_ROOT);
163 }
164 }
165
166 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
167 {
168 if (spellInfo->Id == Spells::Destabilized)
170 }
171
172 void OnSpellStart(SpellInfo const* spellInfo) override
173 {
174 if (spellInfo->Id == Spells::IllicitInfusionCast)
175 {
177
178 if (Creature* nibbles = instance->GetCreature(DATA_NIBBLES))
179 nibbles->AddUnitState(UNIT_STATE_ROOT);
180 }
181 }
182
183 void EnterEvadeMode(EvadeReason why) override
184 {
187
189
193
194 if (Creature* nibbles = instance->GetCreature(DATA_NIBBLES))
195 nibbles->AI()->EnterEvadeMode(why);
196 }
197
215
216 void UpdateAI(uint32 diff) override
217 {
218 if (!UpdateVictim())
219 return;
220
221 events.Update(diff);
222
224 return;
225
226 while (uint32 eventId = events.ExecuteEvent())
227 {
228 switch (eventId)
229 {
231 {
233 events.Repeat(3500ms);
234 break;
235 }
237 {
240 events.Repeat(30500ms);
241 break;
242 }
243 case Events::FelNova:
244 {
247 events.Repeat(15s);
248 break;
249 }
250 default:
251 break;
252 }
253
255 return;
256 }
257 }
258
259private:
261};
262
263// 234660 - Nibbles
265{
271
279
280 void MovementInform(uint32 /*type*/, uint32 id) override
281 {
282 if (id == Points::PointEscape)
283 {
286 }
287 }
288
289 void JustEngagedWith(Unit* /*who*/) override
290 {
292
294 kystia->AI()->DoZoneInCombat();
295
299 }
300
301 void OnChannelFinished(SpellInfo const* spell) override
302 {
303 if (spell->Id != Spells::LightInfusion)
304 return;
305
308 }
309
310 void UpdateAI(uint32 diff) override
311 {
313 return;
314
315 if (!UpdateVictim())
316 return;
317
318 events.Update(diff);
319
321 return;
322
323 while (uint32 eventId = events.ExecuteEvent())
324 {
325 switch (eventId)
326 {
327 case Events::FelSpray:
328 {
332 events.Repeat(51s);
333 break;
334 }
336 {
339 events.Repeat(14500ms);
340 break;
341 }
343 {
344 SpellInfo const* illicitInfusion = sSpellMgr->AssertSpellInfo(Spells::IllicitInfusion, DIFFICULTY_NONE);
345 if (me->GetHealthPct() < illicitInfusion->GetEffect(EFFECT_0).CalcValue(me))
346 {
349 me->AttackStop();
353
355 {
358 }
359
361 }
362 events.Repeat(1s);
363 break;
364 }
365 default:
366 break;
367 }
368
370 return;
371 }
372 }
373};
374
375// 1230304 - Light Infusion
394
395// 1264095 - Mirror Images
417
418// 1264098 - Mirror Image
420{
421 void SetDest(SpellDestination& dest) const
422 {
423 dest.RelocateOffset({ frand(-30.0f, 25.0f), frand(-15.0f, 26.0f), 0.0f, 0.0f });
424 }
425
430};
431
432// 474240 - Fel Nova
453
454// 474183 - Blink
456{
457 bool Validate(SpellInfo const* /*spellInfo*/) override
458 {
460 }
461
462 void HandleCast() const
463 {
464 Unit* caster = GetCaster();
467 .TriggeringSpell = GetSpell()
468 });
469 }
470
475};
476
477// 474365 - Fel Crazed
479{
480 bool Validate(SpellInfo const* /*spellInfo*/) override
481 {
483 }
484
486 {
487 PreventHitDefaultEffect(effIndex);
488
489 Unit* caster = GetCaster();
491 .SetTriggerFlags(TRIGGERED_FULL_MASK)
492 .SetTriggeringSpell(GetSpell())
493 .AddSpellMod(SPELLVALUE_AURA_STACK, 4));
494 }
495
500};
501
502// 1264106 - Felstorm
504{
505 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
506 {
507 if (Creature* targetCreature = GetTarget()->ToCreature())
508 targetCreature->DespawnOrUnsummon(1ms);
509 }
510
515};
516
517// 1253811 - Fel Spray
518// ID - 39560
520{
522
523 void OnUnitEnter(Unit* unit) override
524 {
525 Unit* caster = at->GetCaster();
526 if (!caster)
527 return;
528
529 if (!unit->IsPlayer())
530 return;
531
533 }
534
535 void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override
536 {
538 }
539};
540}
541
AreaTriggerExitReason
Definition AreaTrigger.h:69
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ FAIL
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
Spells
Definition PlayerAI.cpp:32
float frand(float min, float max)
Definition Random.cpp:55
#define RegisterAreaTriggerAI(ai_name)
Definition ScriptMgr.h:1428
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ TARGET_DEST_DEST
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_TRIGGER_SPELL
@ FACTION_FRIENDLY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_AURA_STACK
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
#define sSpellMgr
Definition SpellMgr.h:812
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
EvadeReason
@ UNIT_STATE_ROOT
Definition Unit.h:271
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_kystia_manaheart()
DisplayIds
AreaTrigger *const at
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
Unit * GetCaster() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
void SetBoundary(CreatureBoundary const *boundary, bool negativeBoundaries=false)
Creature *const me
Definition CreatureAI.h:63
void SetUnkillable(bool unkillable)
Definition Creature.h:189
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetDisplayId(uint32 displayId, bool setNative=false) override
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:56
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
CreatureBoundary const * GetBossBoundary(uint32 id) const
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
SpellEffectValue CalcValue(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
HookList< EffectHandler > OnEffectLaunch
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
float GetHealthPct() const
Definition Unit.h:796
void SetFaction(uint32 faction) override
Definition Unit.h:872
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3231
uint32 GetFaction() const override
Definition Unit.h:871
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
Definition Unit.cpp:12342
bool AttackStop()
Definition Unit.cpp:5965
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
#define RegisterMurderRowCreatureAI(ai_name)
Definition murder_row.h:63
@ DATA_NIBBLES
Definition murder_row.h:37
@ DATA_KYSTIA_MANAHEART
Definition murder_row.h:31
TriggerCastFlags TriggerFlags
bool IsHeroicOrHigher() const
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void RelocateOffset(Position const &offset)
Definition Spell.cpp:90