Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_warchief_kargath_bladefist.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/* ScriptData
7SDName: Boss_Warchief_Kargath_Bladefist
8SD%Complete: 90
9SDComment:
10SDCategory: Hellfire Citadel, Shattered Halls
11EndScriptData */
12
13/* ContentData
14boss_warchief_kargath_bladefist
15EndContentData */
16
17#include "ScriptMgr.h"
18#include "ScriptedCreature.h"
19#include "shattered_halls.h"
20
21enum Says
22{
26};
27
29{
32};
33
41
42#define TARGET_NUM 5
43
44float AssassEntrance[3] = { 275.136f, -84.29f, 2.3f }; // y -8
45float AssassExit[3] = { 184.233f, -84.29f, 2.3f }; // y -8
46float AddsEntrance[3] = { 306.036f, -84.29f, 1.93f };
47
49{
50 public:
51 boss_warchief_kargath_bladefist() : CreatureScript("boss_warchief_kargath_bladefist") { }
52
54 {
56
58 {
59 removeAdds();
60
61 me->SetSpeed(MOVE_RUN, 2);
62 me->SetWalk(false);
63
64 summoned = 2;
65 InBlade = false;
66 Wait_Timer = 0;
67
68 Charge_timer = 0;
69 Blade_Dance_Timer = 45000;
71 Assassins_Timer = 5000;
72 resetcheck_timer = 5000;
73 }
74
75 void JustDied(Unit* /*killer*/) OVERRIDE
76 {
78 removeAdds();
79
80 if (instance)
81 instance->SetBossState(DATA_KARGATH, DONE);
82 }
83
84 void EnterCombat(Unit* /*who*/) OVERRIDE
85 {
87 }
88
90 {
91 switch (summoned->GetEntry())
92 {
96 summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
97 adds.push_back(summoned->GetGUID());
98 break;
100 assassins.push_back(summoned->GetGUID());
101 break;
102 }
103 }
104
106 {
107 if (victim->GetTypeId() == TypeID::TYPEID_PLAYER)
108 {
109 Talk(SAY_SLAY);
110 }
111 }
112
114 {
115 if (InBlade)
116 {
117 if (type != POINT_MOTION_TYPE)
118 return;
119
120 if (id != 1)
121 return;
122
123 if (target_num > 0) // to prevent loops
124 {
125 Wait_Timer = 1;
127 target_num--;
128 }
129 }
130 }
131
133 {
134 for (std::vector<uint64>::const_iterator itr = adds.begin(); itr!= adds.end(); ++itr)
135 {
136 Creature* creature = Unit::GetCreature(*me, *itr);
137 if (creature && creature->IsAlive())
138 {
139 creature->GetMotionMaster()->Clear(true);
140 me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
141 creature->RemoveCorpse();
142 }
143 }
144 adds.clear();
145
146 for (std::vector<uint64>::const_iterator itr = assassins.begin(); itr!= assassins.end(); ++itr)
147 {
148 Creature* creature = Unit::GetCreature(*me, *itr);
149 if (creature && creature->IsAlive())
150 {
151 creature->GetMotionMaster()->Clear(true);
152 me->DealDamage(creature, creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
153 creature->RemoveCorpse();
154 }
155 }
156 assassins.clear();
157 }
165
167 {
168 //Return since we have no target
169 if (!UpdateVictim())
170 return;
171
172 if (Assassins_Timer)
173 {
174 if (Assassins_Timer <= diff)
175 {
177 Assassins_Timer = 0;
178 }
179 else
180 Assassins_Timer -= diff;
181 }
182
183 if (InBlade)
184 {
185 if (Wait_Timer)
186 {
187 if (Wait_Timer <= diff)
188 {
189 if (target_num <= 0)
190 {
191 // stop bladedance
192 InBlade = false;
193 me->SetSpeed(MOVE_RUN, 2);
194 me->GetMotionMaster()->MoveChase(me->GetVictim());
195 Blade_Dance_Timer = 30000;
196 Wait_Timer = 0;
197 if (IsHeroic())
198 Charge_timer = 5000;
199 }
200 else
201 {
202 //move in bladedance
203 float x, y, randx, randy;
204 randx = 0.0f + rand()%40;
205 randy = 0.0f + rand()%40;
206 x = 210+ randx;
207 y = -60- randy;
208 me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());
209 Wait_Timer = 0;
210 }
211 }
212 else
213 Wait_Timer -= diff;
214 }
215 }
216 else
217 {
219 {
220 if (Blade_Dance_Timer <= diff)
221 {
223 Wait_Timer = 1;
224 InBlade = true;
226 me->SetSpeed(MOVE_RUN, 4);
227 return;
228 }
229 else
230 Blade_Dance_Timer -= diff;
231 }
232
233 if (Charge_timer)
234 {
235 if (Charge_timer <= diff)
236 {
238 Charge_timer = 0;
239 }
240 else
241 Charge_timer -= diff;
242 }
243
244 if (Summon_Assistant_Timer <= diff)
245 {
246 for (uint8 i = 0; i < summoned; ++i)
247 {
248 switch (std::rand() % 2)
249 {
250 case 0:
252 break;
253 case 1:
255 break;
256 case 2:
258 break;
259 }
260 }
261 if ((std::rand() % 9) < 2)
262 ++summoned;
263 Summon_Assistant_Timer = std::rand() % 35000 + 25000;
264 }
265 else
267
269 }
270
271 if (resetcheck_timer <= diff)
272 {
273 uint32 tempx = uint32(me->GetPositionX());
274 if (tempx > 255 || tempx < 205)
275 {
277 return;
278 }
279 resetcheck_timer = 5000;
280 }
281 else
282 resetcheck_timer -= diff;
283 }
284
285 private:
286 std::vector<uint64> adds;
287 std::vector<uint64> assassins;
297 };
298
300 {
301 return new boss_warchief_kargath_bladefistAI(creature);
302 }
303};
304
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ DONE
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ SPELL_SCHOOL_MASK_NORMAL
@ MOVE_RUN
Definition Unit.h:556
@ DIRECT_DAMAGE
Definition Unit.h:614
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
Creatures
@ SPELL_BLADE_DANCE
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
void AddSC_boss_warchief_kargath_bladefist()
InstanceScript *const instance
BossAI(Creature *creature, uint32 bossId)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
void RemoveCorpse(bool setSpawnTime=true)
Definition Creature.cpp:230
CreatureScript(const char *name)
void Clear(bool reset=true)
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
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
uint32 GetHealth() const
Definition Unit.h:1600
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_KARGATH
bool IsHeroic() const
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================