TrinityCore
Loading...
Searching...
No Matches
boss_vexallus.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/* Timers requires to be revisited */
19
20#include "ScriptMgr.h"
21#include "ScriptedCreature.h"
22#include "SpellAuraEffects.h"
23#include "SpellScript.h"
24#include "magisters_terrace.h"
25#include "MotionMaster.h"
26
36
38{
39 // Vexallus
43
47
49
50 // Pure Energy
53 SPELL_TRIGGER_000 = 36294, // Triggers from 44326. NYI. Probably does what we did on creature death
57};
58
65
71
72// 24744 - Vexallus
73struct boss_vexallus : public BossAI
74{
76
77 void Reset() override
78 {
79 _Reset();
81 _enraged = false;
82 }
83
92
93 void JustSummoned(Creature* summoned) override
94 {
96 summoned->GetMotionMaster()->MoveFollow(temp, 0, 0);
97
98 summons.Summon(summoned);
99 }
100
101 void DamageTaken(Unit* /*who*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
102 {
103 if (_enraged)
104 return;
105
106 // 85%, 70%, 55%, 40%, 25%
108 {
109 // increase amount, unless we're at 10%, then we switch and return
111 {
112 _enraged = true;
113 events.Reset();
117 return;
118 }
119 else
121
124
125 if (IsHeroic())
126 {
129 }
130 else
132 }
133 }
134
135 void KilledUnit(Unit* /*victim*/) override
136 {
137 Talk(SAY_SLAY);
138 }
139
140 void JustDied(Unit* /*killer*/) override
141 {
142 _JustDied();
144 }
145
146 void UpdateAI(uint32 diff) override
147 {
148 if (!UpdateVictim())
149 return;
150
151 events.Update(diff);
152
154 return;
155
156 while (uint32 eventId = events.ExecuteEvent())
157 {
158 switch (eventId)
159 {
161 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
163 events.Repeat(8s);
164 break;
166 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 20.0f, true))
167 DoCast(target, SPELL_ARCANE_SHOCK);
168 events.Repeat(8s);
169 break;
170 case EVENT_OVERLOAD:
172 events.Repeat(2s);
173 break;
174 default:
175 break;
176 }
177
179 return;
180 }
181 }
182
183private:
186};
187
188// 24745 - Pure Energy
190{
191 npc_pure_energy(Creature* creature) : ScriptedAI(creature)
192 {
194 }
195
196 void JustDied(Unit* killer) override
197 {
198 // This is not correct as in sniff this spell was used not on killer
199 if (killer)
202 }
203};
204
205// 44328 - Energy Feedback
207{
208 bool Validate(SpellInfo const* /*spellInfo*/) override
209 {
211 }
212
213 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
214 {
216 }
217
218 void OnPeriodic(AuraEffect const* aurEff)
219 {
220 Creature* caster = GetCaster()->ToCreature();
221 if (!caster)
222 return;
223
224 switch (aurEff->GetTickNumber())
225 {
226 case 1:
227 case 2:
228 case 3:
229 case 4:
230 caster->CastSpell(caster, SPELL_ENERGY_FEEDBACK_SCALE, true);
231 break;
232 case 5:
233 caster->CastSpell(caster, SPELL_ENERGY_FEEDBACK_SCALE, true);
234 caster->DespawnOrUnsummon();
235 break;
236 default:
237 break;
238 }
239 }
240
246};
247
248// 47108 - Clear Energy Feedback
266
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
VexallusMisc
@ INTERVAL_MODIFIER
@ INTERVAL_SWITCH
VexallusSpells
@ SPELL_ENERGY_BOLT_PERIODIC
@ SPELL_CLEAR_ENERGY_FEEDBACK
@ SPELL_ARCANE_SHOCK
@ SPELL_ENERGY_FEEDBACK_PERIODIC
@ SPELL_OVERLOAD
@ SPELL_SUMMON_PURE_ENERGY_H_1
@ SPELL_TRIGGER_000
@ SPELL_CHAIN_LIGHTNING
@ SPELL_SUMMON_PURE_ENERGY_H_2
@ SPELL_ENERGY_FEEDBACK_SCALE
@ SPELL_ENERGY_FEEDBACK
@ SPELL_SUMMON_PURE_ENERGY
@ SPELL_PURE_ENERGY_PASSIVE
void AddSC_boss_vexallus()
VexallusTexts
@ SAY_AGGRO
@ SAY_ENERGY
@ EMOTE_OVERLOAD
@ SAY_SLAY
@ EMOTE_DISCHARGE_ENERGY
@ SAY_OVERLOAD
VexallusEvents
@ EVENT_CHAIN_LIGHTNING
@ EVENT_ARCANE_SHOCK
@ EVENT_OVERLOAD
uint32 GetTickNumber() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetDisplayFromModel(uint32 modelIdx)
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
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
void Reset()
Definition EventMap.cpp:25
void MoveFollow(Unit *target, float dist, Optional< ChaseAngle > angle={}, Optional< Milliseconds > duration={}, bool ignoreTargetWalk=false, MovementSlot slot=MOTION_SLOT_ACTIVE, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Creature * ToCreature()
Definition Object.h:121
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void Summon(Creature const *summon)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
#define RegisterMagistersTerraceCreatureAI(ai_name)
@ DATA_VEXALLUS
bool IsHeroic() const
bool HealthAbovePct(uint32 pct) const
void KilledUnit(Unit *) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
uint32 _intervalHealthAmount
void JustSummoned(Creature *summoned) override
void JustDied(Unit *) override
boss_vexallus(Creature *creature)
void Reset() override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *killer) override
npc_pure_energy(Creature *creature)