Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_vaelastrasz.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "blackwing_lair.h"
9#include "ScriptedGossip.h"
10#include "Player.h"
11
20
22{
23 GOSSIP_ID = 21334,
24};
25
27{
33 SPELL_CLEAVE = 20684 //Chain cleave is most likely named something different and contains a dummy effect
34};
35
50
52{
53public:
54 boss_vaelastrasz() : CreatureScript("boss_vaelastrasz") { }
55
56 struct boss_vaelAI : public BossAI
57 {
59 {
60 PlayerGUID = 0;
61 HasYelled = false;
63 creature->setFaction(35);
65 }
66
68 {
69 _Reset();
70
71 me->SetStandState(UNIT_STAND_STATE_DEAD);
72 PlayerGUID = 0;
73
74 HasYelled = false;
75 }
76
77 void EnterCombat(Unit* /*who*/) OVERRIDE
78 {
80
82 me->SetHealth(me->CountPctFromMaxHealth(30));
83 // now drop damage requirement to be able to take loot
84 me->ResetPlayerDamageReq();
85
86 events.ScheduleEvent(EVENT_CLEAVE, 10000);
87 events.ScheduleEvent(EVENT_FLAMEBREATH, 15000);
88 events.ScheduleEvent(EVENT_FIRENOVA, 20000);
89 events.ScheduleEvent(EVENT_TAILSWIPE, 11000);
90 events.ScheduleEvent(EVENT_BURNINGADRENALINE_CASTER, 15000);
91 events.ScheduleEvent(EVENT_BURNINGADRENALINE_TANK, 45000);
92 }
93
94 void BeginSpeech(Unit* target)
95 {
96 PlayerGUID = target->GetGUID();
98 events.ScheduleEvent(EVENT_SPEECH_1, 1000);
99 }
100
102 {
103 if (rand()%5)
104 return;
105
106 Talk(SAY_KILLTARGET, victim);
107 }
108
110 {
111 events.Update(diff);
112
113 // Speech
114 if (!UpdateVictim())
115 {
116 while (uint32 eventId = events.ExecuteEvent())
117 {
118 switch (eventId)
119 {
120 case EVENT_SPEECH_1:
122 me->SetStandState(UNIT_STAND_STATE_STAND);
123 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
124 events.ScheduleEvent(EVENT_SPEECH_2, 12000);
125 break;
126 case EVENT_SPEECH_2:
128 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
129 events.ScheduleEvent(EVENT_SPEECH_3, 12000);
130 break;
131 case EVENT_SPEECH_3:
133 me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
134 events.ScheduleEvent(EVENT_SPEECH_4, 16000);
135 break;
136 case EVENT_SPEECH_4:
137 me->setFaction(103);
140 break;
141 }
142 }
143 return;
144 }
145
146 if (me->HasUnitState(UNIT_STATE_CASTING))
147 return;
148
149 while (uint32 eventId = events.ExecuteEvent())
150 {
151 switch (eventId)
152 {
153 case EVENT_CLEAVE:
154 events.ScheduleEvent(EVENT_CLEAVE, 15000);
156 break;
159 events.ScheduleEvent(EVENT_FLAMEBREATH, std::rand() % 14000 + 8000);
160 break;
161 case EVENT_FIRENOVA:
163 events.ScheduleEvent(EVENT_FIRENOVA, 15000);
164 break;
165 case EVENT_TAILSWIPE:
166 //Only cast if we are behind
167 /*if (!me->HasInArc(M_PI, me->GetVictim()))
168 {
169 DoCast(me->GetVictim(), SPELL_TAILSWIPE);
170 }*/
171 events.ScheduleEvent(EVENT_TAILSWIPE, 15000);
172 break;
174 {
175 Unit* target = NULL;
176
177 uint8 i = 0;
178 while (i < 3) // max 3 tries to get a random target with power_mana
179 {
180 ++i;
181 target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader
182 if (target && target->getPowerType() == POWER_MANA)
183 i = 3;
184 }
185 if (target) // cast on self (see below)
186 target->CastSpell(target, SPELL_BURNINGADRENALINE, true);
187 }
188 events.ScheduleEvent(EVENT_BURNINGADRENALINE_CASTER, 15000);
189 break;
191 // have the victim cast the spell on himself otherwise the third effect aura will be applied to Vael instead of the player
192 me->GetVictim()->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
193 events.ScheduleEvent(EVENT_BURNINGADRENALINE_TANK, 45000);
194 break;
195 }
196 }
197
198 // Yell if hp lower than 15%
199 if (HealthBelowPct(15) && !HasYelled)
200 {
202 HasYelled = true;
203 }
204
206 }
207
208 void sGossipSelect(Player* player, uint32 sender, uint32 action) OVERRIDE
209 {
210 if (sender == GOSSIP_ID && action == 0)
211 {
212 player->CLOSE_GOSSIP_MENU();
213 BeginSpeech(player);
214 }
215 }
216
217 private:
220 };
221
223 {
224 return new boss_vaelAI(creature);
225 }
226};
227
229{
230 new boss_vaelastrasz();
231}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ EMOTE_ONESHOT_TALK
@ POWER_MANA
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ UNIT_STAND_STATE_DEAD
Definition Unit.h:169
@ UNIT_STAND_STATE_STAND
Definition Unit.h:162
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
@ SPELL_CLEAVE
@ EVENT_CLEAVE
@ BOSS_VAELASTRAZ
@ SPELL_FIRENOVA
@ SPELL_FLAMEBREATH
Definition boss_gyth.cpp:14
@ GOSSIP_ID
@ SAY_LINE2
@ SAY_LINE3
@ SAY_KILLTARGET
@ SAY_LINE1
@ SAY_HALFLIFE
@ SPELL_CLEAVE
@ SPELL_ESSENCEOFTHERED
@ SPELL_FLAMEBREATH
@ SPELL_BURNINGADRENALINE
@ SPELL_FIRENOVA
@ 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
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
void setFaction(uint32 faction)
Definition Unit.h:1699
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
Powers getPowerType() const
Definition Unit.h:1651
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthBelowPct(uint32 pct) const
void AttackStart(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void KilledUnit(Unit *victim) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void sGossipSelect(Player *player, uint32 sender, uint32 action) OVERRIDE