TrinityCore
boss_vaelastrasz.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 "ScriptMgr.h"
19#include "blackwing_lair.h"
20#include "ObjectAccessor.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "ScriptedGossip.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26
27enum Says
28{
34};
35
37{
38 GOSSIP_ID = 6101,
39};
40
42{
47 SPELL_BURNINGADRENALINE = 18173, //Cast this one. It's what 3.3.5 DBM expects.
49 SPELL_CLEAVE = 19983 //Chain cleave is most likely named something different and contains a dummy effect
50};
51
53{
65};
66
67struct boss_vaelastrasz : public BossAI
68{
70 {
71 Initialize();
74 creature->SetUninteractible(false);
75 }
76
78 {
80 HasYelled = false;
81 }
82
83 void Reset() override
84 {
85 _Reset();
86
88 Initialize();
89 }
90
91 void JustEngagedWith(Unit* who) override
92 {
94
97 // now drop damage requirement to be able to take loot
99
106 }
107
108 void BeginSpeech(Unit* target)
109 {
110 PlayerGUID = target->GetGUID();
113 }
114
115 void KilledUnit(Unit* victim) override
116 {
117 if (rand32() % 5)
118 return;
119
120 Talk(SAY_KILLTARGET, victim);
121 }
122
123 void UpdateAI(uint32 diff) override
124 {
125 events.Update(diff);
126
127 // Speech
128 if (!UpdateVictim())
129 {
130 while (uint32 eventId = events.ExecuteEvent())
131 {
132 switch (eventId)
133 {
134 case EVENT_SPEECH_1:
139 break;
140 case EVENT_SPEECH_2:
144 break;
145 case EVENT_SPEECH_3:
149 break;
150 case EVENT_SPEECH_4:
153 AttackStart(player);
154 break;
155 }
156 }
157 return;
158 }
159
161 return;
162
163 while (uint32 eventId = events.ExecuteEvent())
164 {
165 switch (eventId)
166 {
167 case EVENT_CLEAVE:
170 break;
174 break;
175 case EVENT_FIRENOVA:
178 break;
179 case EVENT_TAILSWIPE:
180 //Only cast if we are behind
181 /*if (!me->HasInArc(M_PI, me->GetVictim()))
182 {
183 DoCast(me->GetVictim(), SPELL_TAILSWIPE);
184 }*/
186 break;
188 {
189 //selects a random target that isn't the current victim and is a mana user (selects mana users) but not pets
190 //it also ignores targets who have the aura. We don't want to place the debuff on the same target twice.
191 if (Unit *target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) { return u && !u->IsPet() && u->GetPowerType() == POWER_MANA && !u->HasAura(SPELL_BURNINGADRENALINE); }))
192 {
193 me->CastSpell(target, SPELL_BURNINGADRENALINE, true);
194 }
195 }
196 //reschedule the event
198 break;
200 //Vael has to cast it himself; contrary to the previous commit's comment. Nothing happens otherwise.
203 break;
204 }
205
207 return;
208 }
209
210 // Yell if hp lower than 15%
211 if (HealthBelowPct(15) && !HasYelled)
212 {
214 HasYelled = true;
215 }
216 }
217
218 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
219 {
220 if (menuId == GOSSIP_ID && gossipListId == 0)
221 {
222 CloseGossipMenuFor(player);
223 BeginSpeech(player);
224 }
225 return false;
226 }
227
228 private:
231};
232
233//Need to define an aurascript for EVENT_BURNINGADRENALINE's death effect.
234// 18173 - Burning Adrenaline
236{
237 void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
238 {
239 //The tooltip says the on death the AoE occurs. According to information: http://qaliaresponse.stage.lithium.com/t5/WoW-Mayhem/Surviving-Burning-Adrenaline-For-tanks/td-p/48609
240 //Burning Adrenaline can be survived therefore Blizzard's implementation was an AoE bomb that went off if you were still alive and dealt
241 //damage to the target. You don't have to die for it to go off. It can go off whether you live or die.
243 }
244
245 void Register() override
246 {
248 }
249};
250
252{
255}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
void CloseGossipMenuFor(Player *player)
@ EFFECT_2
Definition: SharedDefines.h:32
@ EMOTE_ONESHOT_TALK
@ POWER_MANA
@ FACTION_FRIENDLY
@ FACTION_DRAGONFLIGHT_BLACK
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_STAND_STATE_DEAD
Definition: UnitDefines.h:49
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:42
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackwingLairCreatureAI(ai_name)
@ DATA_VAELASTRAZ_THE_CORRUPT
Says
Gossip
@ SAY_LINE2
@ SAY_LINE3
@ SAY_KILLTARGET
@ SAY_LINE1
@ SAY_HALFLIFE
@ SPELL_CLEAVE
@ SPELL_ESSENCEOFTHERED
@ SPELL_FLAMEBREATH
@ SPELL_BURNINGADRENALINE
@ SPELL_FIRENOVA
@ SPELL_BURNINGADRENALINE_EXPLOSION
@ SPELL_TAILSWIPE
void AddSC_boss_vaelastrasz()
@ GOSSIP_ID
@ EVENT_SPEECH_2
@ EVENT_TAILSWIPE
@ EVENT_BURNINGADRENALINE_CASTER
@ EVENT_BURNINGADRENALINE_TANK
@ EVENT_SPEECH_3
@ EVENT_SPEECH_1
@ EVENT_CLEAVE
@ EVENT_ESSENCEOFTHERED
@ EVENT_FLAMEBREATH
@ EVENT_SPEECH_4
@ EVENT_FIRENOVA
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void ResetPlayerDamageReq()
Definition: Creature.h:400
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 Clear()
Definition: ObjectGuid.h:286
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
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:627
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
void SetFaction(uint32 faction) override
Definition: Unit.h:859
bool IsPet() const
Definition: Unit.h:740
Powers GetPowerType() const
Definition: Unit.h:799
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
Unit * GetVictim() const
Definition: Unit.h:715
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void OnAuraRemoveHandler(AuraEffect const *, AuraEffectHandleModes)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthBelowPct(uint32 pct) const
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override
boss_vaelastrasz(Creature *creature)
void UpdateAI(uint32 diff) override
void BeginSpeech(Unit *target)
void KilledUnit(Unit *victim) override
void Reset() override
void JustEngagedWith(Unit *who) override