Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_slad_ran.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 "SpellAuras.h"
9#include "gundrak.h"
10#include "Player.h"
11
21
31
37
45
47{
48 {1783.81f, 646.637f, 133.948f, 3.71755f},
49 {1775.03f, 606.586f, 134.165f, 1.43117f},
50 {1717.39f, 630.041f, 129.282f, 5.96903f},
51 {1765.66f, 646.542f, 134.02f, 5.11381f},
52 {1716.76f, 635.159f, 129.282f, 0.191986f}
53};
54
59
61{
62public:
63 boss_slad_ran() : CreatureScript("boss_slad_ran") { }
64
66 {
67 return new boss_slad_ranAI(creature);
68 }
69
71 {
73 {
74 instance = creature->GetInstanceScript();
75 }
76
81
83
84 std::set<uint64> lWrappedPlayers;
86
88
103
104 void EnterCombat(Unit* /*who*/) OVERRIDE
105 {
107
108 if (instance)
110 }
111
113 {
114 //Return since we have no target
115 if (!UpdateVictim())
116 return;
117
118 if (uiPoisonNovaTimer <= diff)
119 {
123 } else uiPoisonNovaTimer -= diff;
124
125 if (uiPowerfullBiteTimer <= diff)
126 {
129 } else uiPowerfullBiteTimer -= diff;
130
131 if (uiVenomBoltTimer <= diff)
132 {
135 } else uiVenomBoltTimer -= diff;
136
137 if (uiPhase)
138 {
139 if (uiSpawnTimer <= diff)
140 {
141 if (uiPhase == 1)
142 for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
144 if (uiPhase == 2)
145 for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
148 } else uiSpawnTimer -= diff;
149 }
150
151 if (uiPhase == 0 && HealthBelowPct(30))
152 {
154 uiPhase = 1;
155 }
156
157 if (uiPhase == 1 && HealthBelowPct(25))
158 {
160 uiPhase = 2;
161 }
162
164 }
165
166 void JustDied(Unit* /*killer*/) OVERRIDE
167 {
169 lSummons.DespawnAll();
170
171 if (instance)
173 }
174
175 void KilledUnit(Unit* /*victim*/) OVERRIDE
176 {
177 Talk(SAY_SLAY);
178 }
179
181 {
182 summoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
183 lSummons.Summon(summoned);
184 }
185
186 void SetGUID(uint64 guid, int32 type) OVERRIDE
187 {
189 lWrappedPlayers.insert(guid);
190 }
191
193 {
194 return lWrappedPlayers.count(guid);
195 }
196 };
197};
198
200{
201public:
202 npc_slad_ran_constrictor() : CreatureScript("npc_slad_ran_constrictor") { }
203
205 {
206 return new npc_slad_ran_constrictorAI(creature);
207 }
208
210 {
212
214
219
221 {
222 if (!UpdateVictim())
223 return;
224
225 if (uiGripOfSladRanTimer <= diff)
226 {
227 Unit* target = me->GetVictim();
228
230 uiGripOfSladRanTimer = std::rand() % (6 * IN_MILLISECONDS) + (3 * IN_MILLISECONDS);
231
232 Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID());
233 if (grip && grip->GetStackAmount() == 5)
234 {
236 target->CastSpell(target, SPELL_SNAKE_WRAP, true);
237
238 if (TempSummon* _me = me->ToTempSummon())
239 if (Creature* sladran = _me->GetSummoner()->ToCreature())
240 sladran->AI()->SetGUID(target->GetGUID(), DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES);
241
242 me->DespawnOrUnsummon();
243 }
244 } else uiGripOfSladRanTimer -= diff;
245 }
246 };
247};
248
250{
251public:
252 npc_slad_ran_viper() : CreatureScript("npc_slad_ran_viper") { }
253
255 {
256 return new npc_slad_ran_viperAI(creature);
257 }
258
260 {
261 npc_slad_ran_viperAI(Creature* creature) : ScriptedAI(creature) { }
262
264
269
271 {
272 if (!UpdateVictim())
273 return;
274
275 if (uiVenomousBiteTimer <= diff)
276 {
279 } else uiVenomousBiteTimer -= diff;
280 }
281 };
282};
283
285{
286 public:
287 achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") { }
288
289 bool OnCheck(Player* player, Unit* target) OVERRIDE
290 {
291 if (!target)
292 return false;
293
295 return !sladRanAI->WasWrapped(player->GetGUID());
296 return false;
297 }
298};
299
@ IN_MILLISECONDS
Definition Common.h:125
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
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:73
#define CAST_AI(a, b)
Creatures
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_POISON_NOVA
@ CREATURE_SNAKE
@ CREATURE_CONSTRICTORS
ConstrictorSpells
@ SPELL_SNAKE_WRAP
@ H_SPELL_VENOMOUS_BITE
@ SPELL_GRIP_OF_SLAD_RAN
@ SPELL_VENOMOUS_BITE
@ DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES
@ SAY_DEATH
@ SAY_SUMMON_SNAKES
@ SAY_SUMMON_CONSTRICTORS
@ SAY_AGGRO
@ EMOTE_NOVA
@ SAY_SLAY
@ SPELL_VENOM_BOLT
@ SPELL_POWERFULL_BITE
@ H_SPELL_POWERFULL_BITE
@ H_SPELL_VENOM_BOLT
@ SPELL_POISON_NOVA
@ H_SPELL_POISON_NOVA
void AddSC_boss_slad_ran()
static Position SpawnLoc[]
AchievementCriteriaScript(const char *name)
uint8 GetStackAmount() const
Definition SpellAuras.h:133
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
Creature * ToCreature()
Definition Object.h:207
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
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)
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Aura * GetAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *player, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_SLAD_RAN_EVENT
Definition gundrak.h:11
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
const T & DUNGEON_MODE(const T &normal5, const T &heroic5) const
void EnterCombat(Unit *) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
std::set< uint64 > lWrappedPlayers
void SetGUID(uint64 guid, int32 type) OVERRIDE
boss_slad_ranAI(Creature *creature)
void JustDied(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================