Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_ancient_stone_keeper.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_Ancient_Stone_Keeper
8SD%Complete: 100
9SDComment:
10SDCategory: Uldaman
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15
20
22{
23public:
24 boss_ancient_stone_keeper() : CreatureScript("boss_ancient_stone_keeper") { }
25
27 {
29
31
33 {
34 uiSandStormTimer = 10000;
35 }
36
38 {
39 //Return since we have no target
40 if (!UpdateVictim())
41 return;
42
43 //uiSandStormTimer
44 if (uiSandStormTimer <= uiDiff)
45 {
46 float x = 0.0f, y = 0.0f;
47 GetPositionWithDistInOrientation(me, 10.0f, me->GetOrientation() + frand(-M_PI, M_PI), x, y);
48
49 if (Creature* sandStorm = me->SummonCreature(7226, x, y, me->GetPositionZ(), me->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 10000))
50 {
51 sandStorm->CastSpell(sandStorm, 10092, true);
52 sandStorm->SetSpeed(UnitMoveType::MOVE_RUN, 0.1f, true);
53
54 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true))
55 sandStorm->GetMotionMaster()->MoveChase(target, 1.0f, 1.0f);
56 }
57
58 GetPositionWithDistInOrientation(me, 10.0f, me->GetOrientation() - frand(-M_PI, M_PI), x, y);
59
60 if (Creature* sandStorm2 = me->SummonCreature(7226, x, y, me->GetPositionZ(), me->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 10000))
61 {
62 sandStorm2->CastSpell(sandStorm2, 10092, true);
63 sandStorm2->SetSpeed(UnitMoveType::MOVE_RUN, 0.1f, true);
64
65 if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true))
66 sandStorm2->GetMotionMaster()->MoveChase(target2, 1.0f, 1.0f);
67 }
68
69 uiSandStormTimer = 11000;
70 }
71 else uiSandStormTimer -= uiDiff;
72
74 }
75 };
76
78 {
79 return new boss_ancient_stone_keeperAI(creature);
80 }
81};
82
#define M_PI
Definition Common.h:192
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
void GetPositionWithDistInOrientation(Unit *pUnit, float dist, float orientation, float &x, float &y)
@ MOVE_RUN
Definition Unit.h:556
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
float frand(float min, float max)
Definition Util.cpp:39
void AddSC_boss_ancient_stone_keeper()
bool UpdateVictim()
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
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================