Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_kelris.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 "blackfathom_deeps.h"
9
11{
14
18};
19
21{
22public:
23 boss_kelris() : CreatureScript("boss_kelris") { }
24
26 {
27 return new boss_kelrisAI(creature);
28 }
29
30 struct boss_kelrisAI : public ScriptedAI
31 {
32 boss_kelrisAI(Creature* creature) : ScriptedAI(creature)
33 {
34 instance = creature->GetInstanceScript();
35 }
36
39
41
43 {
44 mindBlastTimer = std::rand() % 5000 + 2000;
45 sleepTimer = std::rand() % 12000 + 9000;
46 if (instance)
48 }
49
50 void EnterCombat(Unit* /*who*/) OVERRIDE
51 {
53 if (instance)
55 }
56
57 void JustDied(Unit* /*killer*/) OVERRIDE
58 {
60 if (instance)
61 instance->SetData(TYPE_KELRIS, DONE);
62 }
63
65 {
66 if (!UpdateVictim())
67 return;
68
69 if (mindBlastTimer < diff)
70 {
72 mindBlastTimer = std::rand() % 9000 + 7000;
73 } else mindBlastTimer -= diff;
74
75 if (sleepTimer < diff)
76 {
77 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
78 {
80 DoCast(target, SPELL_SLEEP);
81 }
82 sleepTimer = std::rand() % 20000 + 15000;
83 } else sleepTimer -= diff;
84
86 }
87 };
88};
89
91{
92 new boss_kelris();
93}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ TYPE_KELRIS
#define SAY_DEATH
#define SAY_AGGRO
@ SAY_DEATH
@ SPELL_SLEEP
@ SAY_AGGRO
@ SPELL_MIND_BLAST
@ SAY_SLEEP
void AddSC_boss_kelris()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(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
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
ScriptedAI(Creature *creature)
void JustDied(Unit *) OVERRIDE
boss_kelrisAI(Creature *creature)
InstanceScript * instance
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================