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
183 }
184
185private:
188};
189
190// 24745 - Pure Energy
192{
193 npc_pure_energy(Creature* creature) : ScriptedAI(creature)
194 {
196 }
197
198 void JustDied(Unit* killer) override
199 {
200 // This is not correct as in sniff this spell was used not on killer
201 if (killer)
204 }
205};
206
207// 44328 - Energy Feedback
209{
211
212 bool Validate(SpellInfo const* /*spellInfo*/) override
213 {
215 }
216
217 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
218 {
220 }
221
222 void OnPeriodic(AuraEffect const* aurEff)
223 {
224 Creature* caster = GetCaster()->ToCreature();
225 if (!caster)
226 return;
227
228 switch (aurEff->GetTickNumber())
229 {
230 case 1:
231 case 2:
232 case 3:
233 case 4:
234 caster->CastSpell(caster, SPELL_ENERGY_FEEDBACK_SCALE, true);
235 break;
236 case 5:
237 caster->CastSpell(caster, SPELL_ENERGY_FEEDBACK_SCALE, true);
238 caster->DespawnOrUnsummon();
239 break;
240 default:
241 break;
242 }
243 }
244
250};
251
252// 47108 - Clear Energy Feedback
272
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
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)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
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:82
void SetDisplayId(uint32 modelId) override
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:186
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
void Reset()
Definition EventMap.cpp:21
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
static Creature * ToCreature(Object *o)
Definition Object.h:186
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void Summon(Creature const *summon)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_vexallus_clear_energy_feedback)
void OnPeriodic(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_vexallus_energy_feedback)
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)