Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_kazrogal.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 "SpellAuraEffects.h"
9#include "SpellScript.h"
10#include "hyjal.h"
11#include "hyjal_trash.h"
12
14{
15 SPELL_CLEAVE = 31436,
17 SPELL_MARK = 31447,
19};
20
22{
26};
27
29{
31};
32
34{
35public:
36 boss_kazrogal() : CreatureScript("boss_kazrogal") { }
37
39 {
40 return new boss_kazrogalAI(creature);
41 }
42
44 {
45 boss_kazrogalAI(Creature* creature) : hyjal_trashAI(creature)
46 {
47 instance = creature->GetInstanceScript();
48 go = false;
49 }
50
55 bool go;
56
58 {
59 damageTaken = 0;
60 CleaveTimer = 5000;
61 WarStompTimer = 15000;
62 MarkTimer = 45000;
63 MarkTimerBase = 45000;
64
65 if (instance && IsEvent)
67 }
68
69 void EnterCombat(Unit* /*who*/) OVERRIDE
70 {
71 if (instance && IsEvent)
74 }
75
76 void KilledUnit(Unit* /*victim*/) OVERRIDE
77 {
79 }
80
82 {
83 if (waypointId == 7 && instance)
84 {
85 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_THRALL));
86 if (target && target->IsAlive())
87 me->AddThreat(target, 0.0f);
88 }
89 }
90
98
100 {
101 if (IsEvent)
102 {
103 //Must update npc_escortAI
105 if (!go)
106 {
107 go = true;
108 if (instance)
109 {
110 AddWaypoint(0, 5492.91f, -2404.61f, 1462.63f);
111 AddWaypoint(1, 5531.76f, -2460.87f, 1469.55f);
112 AddWaypoint(2, 5554.58f, -2514.66f, 1476.12f);
113 AddWaypoint(3, 5554.16f, -2567.23f, 1479.90f);
114 AddWaypoint(4, 5540.67f, -2625.99f, 1480.89f);
115 AddWaypoint(5, 5508.16f, -2659.2f, 1480.15f);
116 AddWaypoint(6, 5489.62f, -2704.05f, 1482.18f);
117 AddWaypoint(7, 5457.04f, -2726.26f, 1485.10f);
118 Start(false, true);
119 SetDespawnAtEnd(false);
120 }
121 }
122 }
123
124 //Return since we have no target
125 if (!UpdateVictim())
126 return;
127
128 if (CleaveTimer <= diff)
129 {
131 CleaveTimer = 6000+rand()%15000;
132 } else CleaveTimer -= diff;
133
134 if (WarStompTimer <= diff)
135 {
137 WarStompTimer = 60000;
138 } else WarStompTimer -= diff;
139
140 if (MarkTimer <= diff)
141 {
143
144 MarkTimerBase -= 5000;
145 if (MarkTimerBase < 5500)
146 MarkTimerBase = 5500;
148 Talk(SAY_MARK);
149 } else MarkTimer -= diff;
150
152 }
153 };
154};
155
157{
158 public:
159 bool operator()(WorldObject* target) const
160 {
161 if (Unit* unit = target->ToUnit())
162 return unit->getPowerType() != POWER_MANA;
163 return false;
164 }
165};
166
168{
169 public:
170 spell_mark_of_kazrogal() : SpellScriptLoader("spell_mark_of_kazrogal") { }
171
186
188 {
190
191 bool Validate(SpellInfo const* /*spell*/) OVERRIDE
192 {
193 if (!sSpellMgr->GetSpellInfo(SPELL_MARK_DAMAGE))
194 return false;
195 return true;
196 }
197
198 void OnPeriodic(AuraEffect const* aurEff)
199 {
200 Unit* target = GetTarget();
201
202 if (target->GetPower(POWER_MANA) == 0)
203 {
204 target->CastSpell(target, SPELL_MARK_DAMAGE, true, NULL, aurEff);
205 // Remove aura
206 SetDuration(0);
207 }
208 }
209
214 };
215
220
225};
226
228{
229 new boss_kazrogal();
231}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ EFFECT_0
@ POWER_MANA
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_AURA_PERIODIC_MANA_LEECH
#define sSpellMgr
Definition SpellMgr.h:744
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ SPELL_CLEAVE
@ SAY_ONAGGRO
@ SAY_ONSLAY
void AddSC_boss_kazrogal()
@ SOUND_ONDEATH
@ SPELL_CLEAVE
@ SPELL_MARK_DAMAGE
@ SPELL_MARK
@ SPELL_WARSTOMP
@ SAY_ONAGGRO
@ SAY_ONSLAY
@ SAY_MARK
@ SPELL_WARSTOMP
HookList< EffectPeriodicHandler > OnEffectPeriodic
void SetDuration(int32 duration, bool withMods=false)
Unit * GetTarget() const
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
bool operator()(WorldObject *target) const
Unit * ToUnit()
Definition Object.h:210
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
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)
bool IsAlive() const
Definition Unit.h:2032
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
int32 GetPower(Powers power) const
Definition Unit.cpp:5237
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareAuraScript(spell_mark_of_kazrogal_AuraScript)
PrepareSpellScript(spell_mark_of_kazrogal_SpellScript)
void FilterTargets(std::list< WorldObject * > &targets)
SpellScript * GetSpellScript() const OVERRIDE
AuraScript * GetAuraScript() const OVERRIDE
@ DATA_THRALL
Definition hyjal.h:26
@ DATA_KAZROGALEVENT
Definition hyjal.h:23
Creature * me
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
boss_kazrogalAI(Creature *creature)
void KilledUnit(Unit *) OVERRIDE
void JustDied(Unit *killer) OVERRIDE
void WaypointReached(uint32 waypointId) OVERRIDE
void JustDied(Unit *)
uint32 damageTaken
Definition hyjal_trash.h:34
InstanceScript * instance
Definition hyjal_trash.h:25
hyjal_trashAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetDespawnAtEnd(bool despawn)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)