Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_ormorok.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 "nexus.h"
9#include "SpellScript.h"
10
27
35
37{
38 public:
39 OrmorokTanglerPredicate(Unit* unit) : me(unit) { }
40
41 bool operator() (WorldObject* object) const
42 {
43 return object->GetDistance2d(me) >= 5.0f;
44 }
45
46 private:
48};
49
51{
52public:
53 boss_ormorok() : CreatureScript("boss_ormorok") { }
54
55 struct boss_ormorokAI : public BossAI
56 {
58
59 void EnterCombat(Unit* /*who*/) OVERRIDE
60 {
62
63 events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000);
64 events.ScheduleEvent(EVENT_TRAMPLE, 10000);
65 events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000);
66 if (IsHeroic())
67 events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000);
68
70
71 if (instance)
73 }
74
75 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
76 {
77 if (!frenzy && HealthBelowPct(25))
78 {
80 frenzy = true;
81 }
82 }
83
84 void JustDied(Unit* /*killer*/) OVERRIDE
85 {
86 _JustDied();
87
89
90 if (instance)
92 }
93
94 void KilledUnit(Unit* /*victim*/) OVERRIDE
95 {
97 }
98
100 {
101 if (!UpdateVictim())
102 return;
103
104 events.Update(diff);
105
106 if (me->HasUnitState(UNIT_STATE_CASTING))
107 return;
108
109 while (uint32 eventId = events.ExecuteEvent())
110 {
111 switch (eventId)
112 {
113 case EVENT_TRAMPLE:
115 events.ScheduleEvent(EVENT_TRAMPLE, 10000);
116 break;
120 events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000);
121 break;
125 events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000);
126 break;
130 events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000);
131 break;
132 default:
133 break;
134 }
135 }
136
138 }
139
140 private:
141 bool frenzy;
142 };
143
145 {
146 return new boss_ormorokAI(creature);
147 }
148};
149
162
164{
165 47936,
166 47942,
167 47943
168};
169
171{
172public:
173 npc_crystal_spike_trigger() : CreatureScript("npc_crystal_spike_trigger") { }
174
176 {
178
180 {
181 switch (me->GetEntry())
182 {
184 _count = 0;
185 me->SetFacingToObject(owner);
186 break;
188 if (Creature* trigger = owner->ToCreature())
189 _count = trigger->AI()->GetData(DATA_COUNT) + 1;
190 break;
191 default:
193 break;
194 }
195
196 if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
197 if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f))
198 trap->Use(me);
199
200 _despawntimer = 2000;
201 }
202
204 {
205 return type == DATA_COUNT ? _count : 0;
206 }
207
209 {
210 if (_despawntimer <= diff)
211 {
212 if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
213 if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f))
214 trap->Delete();
215
216 me->DespawnOrUnsummon();
217 }
218 else
219 _despawntimer -= diff;
220 }
221
222 private:
225 };
226
228 {
229 return new npc_crystal_spike_triggerAI(creature);
230 }
231};
232
234{
235 public:
236 spell_crystal_spike() : SpellScriptLoader("spell_crystal_spike") { }
237
239 {
241
242 void HandlePeriodic(AuraEffect const* /*aurEff*/)
243 {
244 Unit* target = GetTarget();
246 if (Creature* trigger = target->ToCreature())
247 {
248 uint32 spell = target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL ? crystalSpikeSummon[0] : crystalSpikeSummon[std::rand() % 2];
249 if (trigger->AI()->GetData(DATA_COUNT) < MAX_COUNT)
250 trigger->CastSpell(trigger, spell, true);
251 }
252 }
253
258 };
259
261 {
263 }
264};
265
267{
268 new boss_ormorok();
271}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ EFFECT_0
@ SPELL_AURA_PERIODIC_DUMMY
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ SPELL_FRENZY
@ EVENT_TRAMPLE
Definition boss_moam.cpp:29
@ SAY_DEATH
@ SAY_CRYSTAL_SPIKES
@ SAY_REFLECT
@ SAY_AGGRO
@ SAY_KILL
@ SPELL_TRAMPLE
@ SPELL_CRYSTAL_SPIKES
@ SPELL_FRENZY
@ SPELL_SPELL_REFLECTION
@ SPELL_SUMMON_CRYSTALLINE_TANGLER
void AddSC_boss_ormorok()
uint32 const crystalSpikeSummon[3]
CrystalSpikes
@ NPC_CRYSTAL_SPIKE_INITIAL
@ NPC_CRYSTAL_SPIKE_TRIGGER
@ GO_CRYSTAL_SPIKE_TRAP
@ DATA_COUNT
@ MAX_COUNT
@ SPELL_CRYSTAL_SPIKE_DAMAGE
@ EVENT_CRYSTALLINE_TANGLER
@ EVENT_SPELL_REFLECTION
@ EVENT_CRYSTAL_SPIKES
@ EVENT_TRAMPLE
@ EVENT_SPELL_REFLECTION
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
bool operator()(WorldObject *object) const
OrmorokTanglerPredicate(Unit *unit)
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
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareAuraScript(spell_crystal_spike_AuraScript)
AuraScript * GetAuraScript() const OVERRIDE
@ DATA_ORMOROK_EVENT
Definition nexus.h:13
bool IsHeroic() const
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void KilledUnit(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
boss_ormorokAI(Creature *creature)
void DamageTaken(Unit *, uint32 &) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================