Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_buru.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#include "ScriptMgr.h"
6#include "ScriptedCreature.h"
7#include "SpellScript.h"
8#include "ruins_of_ahnqiraj.h"
9
11{
13};
14
28
37
39{
42};
43
45{
47};
48
50{
51 public:
52 boss_buru() : CreatureScript("boss_buru") { }
53
54 struct boss_buruAI : public BossAI
55 {
56 boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU)
57 {
58 }
59
61 {
63
64 for (std::list<uint64>::iterator i = Eggs.begin(); i != Eggs.end(); ++i)
65 if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
66 egg->Respawn();
67
68 Eggs.clear();
69 }
70
72 {
74 Talk(EMOTE_TARGET, who);
76
77 events.ScheduleEvent(EVENT_DISMEMBER, 5000);
78 events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
79 events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
80
82 }
83
84 void DoAction(int32 action) OVERRIDE
85 {
86 if (action == ACTION_EXPLODE)
87 if (_phase == PHASE_EGG)
88 me->DealDamage(me, 45000);
89 }
90
91 void KilledUnit(Unit* victim) OVERRIDE
92 {
93 if (victim->GetTypeId() == TypeID::TYPEID_PLAYER)
95 }
96
98 {
99 if (_phase != PHASE_EGG)
100 return;
101
102 me->RemoveAurasDueToSpell(SPELL_FULL_SPEED);
103 me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
104 events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
105 events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
106
107 if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
108 {
110 AttackStart(victim);
111 Talk(EMOTE_TARGET, victim);
112 }
113 }
114
115 void ManageRespawn(uint64 EggGUID)
116 {
118 Eggs.push_back(EggGUID);
119 events.ScheduleEvent(EVENT_RESPAWN_EGG, 100000);
120 }
121
123 {
124 if (!UpdateVictim())
125 return;
126
127 events.Update(diff);
128
129 while (uint32 eventId = events.ExecuteEvent())
130 {
131 switch (eventId)
132 {
133 case EVENT_DISMEMBER:
135 events.ScheduleEvent(EVENT_DISMEMBER, 5000);
136 break;
139 events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
140 break;
141 case EVENT_FULL_SPEED:
143 break;
146 events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 6000);
147 break;
149 if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
150 {
151 egg->Respawn();
152 Eggs.pop_front();
153 }
154 break;
155 default:
156 break;
157 }
158 }
159
160 if (me->GetHealthPct() < 20.0f && _phase == PHASE_EGG)
161 {
162 DoCast(me, SPELL_BURU_TRANSFORM); // Enrage
163 DoCast(me, SPELL_FULL_SPEED, true);
164 me->RemoveAurasDueToSpell(SPELL_THORNS);
166 }
167
169 }
170 private:
172 std::list<uint64> Eggs;
173 };
174
176 {
177 return new boss_buruAI(creature);
178 }
179};
180
182{
183 public:
184 npc_buru_egg() : CreatureScript("npc_buru_egg") { }
185
187 {
188 npc_buru_eggAI(Creature* creature) : ScriptedAI(creature)
189 {
190 _instance = me->GetInstanceScript();
191 SetCombatMovement(false);
192 }
193
194 void EnterCombat(Unit* attacker) OVERRIDE
195 {
196 if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
197 if (!buru->IsInCombat())
198 buru->AI()->AttackStart(attacker);
199 }
200
202 {
203 if (who->GetEntry() == NPC_HATCHLING)
204 if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
205 if (Unit* target = buru->AI()->SelectTarget(SELECT_TARGET_RANDOM))
206 who->AI()->AttackStart(target);
207 }
208
209 void JustDied(Unit* /*killer*/) OVERRIDE
210 {
212 DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose
214
215 if (Creature* buru = me->GetMap()->GetCreature(_instance->GetData64(DATA_BURU)))
216 if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI()))
217 buruAI->ManageRespawn(me->GetGUID());
218 }
219 private:
221 };
222
224 {
225 return new npc_buru_eggAI(creature);
226 }
227};
228
230{
231 public:
232 spell_egg_explosion() : SpellScriptLoader("spell_egg_explosion") { }
233
235 {
237
239 {
240 if (Creature* buru = GetCaster()->FindNearestCreature(NPC_BURU, 5.f))
241 buru->AI()->DoAction(ACTION_EXPLODE);
242 }
243
245 {
246 if (Unit* target = GetHitUnit())
247 GetCaster()->DealDamage(target, -16 * GetCaster()->GetDistance(target) + 500);
248 }
249
255 };
256
261};
262
264{
265 new boss_buru();
266 new npc_buru_egg();
268}
Actions
std::int32_t int32
Definition Define.h:73
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
@ TYPEID_PLAYER
Definition Object.h:55
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
#define SpellCastFn(F)
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ ACTION_EXPLODE
Definition boss_buru.cpp:46
@ EMOTE_TARGET
Definition boss_buru.cpp:12
@ SPELL_SUMMON_HATCHLING
Definition boss_buru.cpp:23
@ SPELL_FULL_SPEED
Definition boss_buru.cpp:20
@ SPELL_GATHERING_SPEED
Definition boss_buru.cpp:19
@ SPELL_THORNS
Definition boss_buru.cpp:21
@ SPELL_DISMEMBER
Definition boss_buru.cpp:18
@ SPELL_BURU_EGG_TRIGGER
Definition boss_buru.cpp:26
@ SPELL_CREEPING_PLAGUE
Definition boss_buru.cpp:17
@ SPELL_EXPLODE
Definition boss_buru.cpp:24
@ SPELL_BURU_TRANSFORM
Definition boss_buru.cpp:22
@ SPELL_EXPLODE_2
Definition boss_buru.cpp:25
@ PHASE_EGG
Definition boss_buru.cpp:40
@ PHASE_TRANSFORM
Definition boss_buru.cpp:41
void AddSC_boss_buru()
@ EVENT_DISMEMBER
Definition boss_buru.cpp:31
@ EVENT_GATHERING_SPEED
Definition boss_buru.cpp:32
@ EVENT_FULL_SPEED
Definition boss_buru.cpp:33
@ EVENT_RESPAWN_EGG
Definition boss_buru.cpp:35
@ EVENT_CREEPING_PLAGUE
Definition boss_buru.cpp:34
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
HookList< CastHandler > AfterCast
HookList< EffectHandler > OnEffectHitTarget
Unit * GetHitUnit()
Unit * GetCaster()
SpellScriptLoader(const char *name)
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
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareSpellScript(spell_egg_explosion_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
@ NPC_HATCHLING
@ NPC_BURU
@ DATA_BURU
void SetCombatMovement(bool allowMovement)
Creature * me
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
std::list< uint64 > Eggs
void KilledUnit(Unit *victim) OVERRIDE
Definition boss_buru.cpp:91
boss_buruAI(Creature *creature)
Definition boss_buru.cpp:56
void ManageRespawn(uint64 EggGUID)
void EnterEvadeMode() OVERRIDE
Definition boss_buru.cpp:60
void EnterCombat(Unit *who) OVERRIDE
Definition boss_buru.cpp:71
void DoAction(int32 action) OVERRIDE
Definition boss_buru.cpp:84
void EnterCombat(Unit *attacker) OVERRIDE
npc_buru_eggAI(Creature *creature)
void JustSummoned(Creature *who) OVERRIDE
void JustDied(Unit *) OVERRIDE