Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_balinda.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
16
23
25{
27};
28
33
35{
36public:
37 npc_water_elemental() : CreatureScript("npc_water_elemental") { }
38
40 {
41 npc_water_elementalAI(Creature* creature) : ScriptedAI(creature) { }
42
46
52
54 {
55 if (!UpdateVictim())
56 return;
57
58 if (waterBoltTimer < diff)
59 {
62 } else waterBoltTimer -= diff;
63
64 // check if creature is not outside of building
65 if (resetTimer < diff)
66 {
67 if (Creature* pBalinda = Unit::GetCreature(*me, balindaGUID))
68 if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
71 } else resetTimer -= diff;
72
74 }
75 };
76
78 {
79 return new npc_water_elementalAI(creature);
80 }
81};
82
84{
85public:
86 boss_balinda() : CreatureScript("boss_balinda") { }
87
88 struct boss_balindaAI : public ScriptedAI
89 {
90 boss_balindaAI(Creature* creature) : ScriptedAI(creature), summons(me) { }
91
98
100
102 {
103 arcaneExplosionTimer = std::rand() % (15 * IN_MILLISECONDS) + (5 * IN_MILLISECONDS);
109
110 summons.DespawnAll();
111 }
112
113 void EnterCombat(Unit* /*who*/) OVERRIDE
114 {
116 }
117
119 {
120 Reset();
121 }
122
124 {
125 CAST_AI(npc_water_elemental::npc_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID();
126 summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true));
127 summoned->setFaction(me->getFaction());
128 summons.Summon(summoned);
129 }
130
131 void JustDied(Unit* /*killer*/) OVERRIDE
132 {
133 summons.DespawnAll();
134 }
135
137 {
138 if (!UpdateVictim())
139 return;
140
141 if (waterElementalTimer < diff)
142 {
143 if (summons.empty())
146 } else waterElementalTimer -= diff;
147
148 if (arcaneExplosionTimer < diff)
149 {
151 arcaneExplosionTimer = std::rand() % (15 * IN_MILLISECONDS) + (5 * IN_MILLISECONDS);
152 } else arcaneExplosionTimer -= diff;
153
154 if (coneOfColdTimer < diff)
155 {
157 coneOfColdTimer = std::rand() % (20 * IN_MILLISECONDS) + (10 * IN_MILLISECONDS);
158 } else coneOfColdTimer -= diff;
159
160 if (fireBoltTimer < diff)
161 {
163 fireBoltTimer = std::rand() % (9 * IN_MILLISECONDS) + (5 * IN_MILLISECONDS);
164 } else fireBoltTimer -= diff;
165
166 if (frostboltTimer < diff)
167 {
169 frostboltTimer = std::rand() % (12 * IN_MILLISECONDS) + (4 * IN_MILLISECONDS);
170 } else frostboltTimer -= diff;
171
172 // check if creature is not outside of building
173 if (resetTimer < diff)
174 {
175 if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
176 {
179 }
181 } else resetTimer -= diff;
182
184 }
185 };
186
188 {
189 return new boss_balindaAI(creature);
190 }
191};
192
194{
195 new boss_balinda;
197};
@ IN_MILLISECONDS
Definition Common.h:125
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
#define CAST_AI(a, b)
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
Creatures
WaterElementalSpells
@ SPELL_WATERBOLT
@ NPC_WATER_ELEMENTAL
@ YELL_SALVATION
@ YELL_EVADE
@ YELL_AGGRO
@ SPELL_FROSTBOLT
@ SPELL_ARCANE_EXPLOSION
@ SPELL_FIREBALL
@ SPELL_CONE_OF_COLD
void AddSC_boss_balinda()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
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
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void JustDied(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
boss_balindaAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================