Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_warlord_kalithresh.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_Warlord_Kalithres
8SD%Complete: 65
9SDComment: Contains workarounds regarding warlord's rage spells not acting as expected. Both scripts here require review and fine tuning.
10SDCategory: Coilfang Resevoir, The Steamvault
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "steam_vault.h"
16#include "SpellInfo.h"
17
33
35{
36public:
37 npc_naga_distiller() : CreatureScript("npc_naga_distiller") { }
38
40 {
41 return new npc_naga_distillerAI(creature);
42 }
43
45 {
47 {
48 instance = creature->GetInstanceScript();
49 }
50
52
54 {
57
58 //hack, due to really weird spell behaviour :(
59 if (instance)
60 {
61 if (instance->GetData(DATA_DISTILLER) == IN_PROGRESS)
62 {
65 }
66 }
67 }
68
69 void EnterCombat(Unit* /*who*/) OVERRIDE { }
70
71 void StartRageGen(Unit* /*caster*/)
72 {
75
77
78 if (instance)
80 }
81
82 void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE
83 {
84 if (me->GetHealth() <= damage)
85 if (instance)
86 instance->SetData(DATA_DISTILLER, DONE);
87 }
88 };
89};
90
92{
93public:
94 boss_warlord_kalithresh() : CreatureScript("boss_warlord_kalithresh") { }
95
97 {
98 return new boss_warlord_kalithreshAI(creature);
99 }
100
102 {
104 {
105 instance = creature->GetInstanceScript();
106 }
107
109
114
116 {
117 Reflection_Timer = 10000;
118 Impale_Timer = 7000+rand()%7000;
119 Rage_Timer = 45000;
120 CanRage = false;
121
122 if (instance)
124 }
125
126 void EnterCombat(Unit* /*who*/) OVERRIDE
127 {
129
130 if (instance)
132 }
133
134 void KilledUnit(Unit* /*victim*/) OVERRIDE
135 {
136 Talk(SAY_SLAY);
137 }
138
139 void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE
140 {
141 //hack :(
142 if (spell->Id == SPELL_WARLORDS_RAGE_PROC)
143 if (instance)
144 if (instance->GetData(DATA_DISTILLER) == DONE)
145 me->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC);
146 }
147
148 void JustDied(Unit* /*killer*/) OVERRIDE
149 {
151
152 if (instance)
153 instance->SetBossState(DATA_WARLORD_KALITHRESH, DONE);
154 }
155
157 {
158 if (!UpdateVictim())
159 return;
160
161 if (Rage_Timer <= diff)
162 {
163 if (Creature* distiller = me->FindNearestCreature(17954, 100.0f))
164 {
167 CAST_AI(npc_naga_distiller::npc_naga_distillerAI, distiller->AI())->StartRageGen(me);
168 }
169 Rage_Timer = 3000+rand()%15000;
170 } else Rage_Timer -= diff;
171
172 //Reflection_Timer
173 if (Reflection_Timer <= diff)
174 {
176 Reflection_Timer = 15000+rand()%10000;
177 } else Reflection_Timer -= diff;
178
179 //Impale_Timer
180 if (Impale_Timer <= diff)
181 {
182 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
183 DoCast(target, SPELL_IMPALE);
184
185 Impale_Timer = 7500+rand()%5000;
186 } else Impale_Timer -= diff;
187
189 }
190 };
191};
192
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define CAST_AI(a, b)
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ SAY_SLAY
@ SAY_INTRO
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_SPELL_REFLECTION
void AddSC_boss_warlord_kalithresh()
@ SPELL_WARLORDS_RAGE_NAGA
@ SPELL_WARLORDS_RAGE_PROC
@ SPELL_SPELL_REFLECTION
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
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_DISTILLER
Definition steam_vault.h:18
@ DATA_WARLORD_KALITHRESH
Definition steam_vault.h:17
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SpellHit(Unit *, const SpellInfo *spell) OVERRIDE
void DamageTaken(Unit *, uint32 &damage) OVERRIDE