Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_mekgineer_steamrigger.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_Mekgineer_Steamrigger
8SD%Complete: 60
9SDComment: Mechanics' interrrupt heal doesn't work very well, also a proper movement needs to be implemented -> summon further away and move towards target to repair.
10SDCategory: Coilfang Resevoir, The Steamvault
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "steam_vault.h"
16
24
35
40
42{
43public:
44 boss_mekgineer_steamrigger() : CreatureScript("boss_mekgineer_steamrigger") { }
45
47 {
48 return new boss_mekgineer_steamriggerAI(creature);
49 }
50
52 {
54 {
55 instance = creature->GetInstanceScript();
56 }
57
59
66
68 {
69 Shrink_Timer = 20000;
70 Saw_Blade_Timer = 15000;
72
73 Summon75 = false;
74 Summon50 = false;
75 Summon25 = false;
76
77 if (instance)
79 }
80
81 void JustDied(Unit* /*killer*/) OVERRIDE
82 {
84
85 if (instance)
87 }
88
89 void KilledUnit(Unit* /*victim*/) OVERRIDE
90 {
92 }
93
94 void EnterCombat(Unit* /*who*/) OVERRIDE
95 {
97
98 if (instance)
100 }
101
102 //no known summon spells exist
116
118 {
119 if (!UpdateVictim())
120 return;
121
122 if (Shrink_Timer <= diff)
123 {
125 Shrink_Timer = 20000;
126 } else Shrink_Timer -= diff;
127
128 if (Saw_Blade_Timer <= diff)
129 {
130 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
131 DoCast(target, SPELL_SAW_BLADE);
132 else
134
135 Saw_Blade_Timer = 15000;
136 } else Saw_Blade_Timer -= diff;
137
138 if (Electrified_Net_Timer <= diff)
139 {
141 Electrified_Net_Timer = 10000;
142 }
143 else Electrified_Net_Timer -= diff;
144
145 if (!Summon75)
146 {
147 if (HealthBelowPct(75))
148 {
150 Summon75 = true;
151 }
152 }
153
154 if (!Summon50)
155 {
156 if (HealthBelowPct(50))
157 {
159 Summon50 = true;
160 }
161 }
162
163 if (!Summon25)
164 {
165 if (HealthBelowPct(25))
166 {
168 Summon25 = true;
169 }
170 }
171
173 }
174 };
175};
176
177#define MAX_REPAIR_RANGE (13.0f) //we should be at least at this range for repair
178#define MIN_REPAIR_RANGE (7.0f) //we can stop movement at this range to repair but not required
179
181{
182public:
183 npc_steamrigger_mechanic() : CreatureScript("npc_steamrigger_mechanic") { }
184
186 {
187 return new npc_steamrigger_mechanicAI(creature);
188 }
189
191 {
193 {
194 instance = creature->GetInstanceScript();
195 }
196
198
200
202 {
203 Repair_Timer = 2000;
204 }
205
207 {
208 //react only if attacked
209 }
210
211 void EnterCombat(Unit* /*who*/) OVERRIDE { }
212
214 {
215 if (Repair_Timer <= diff)
216 {
218 {
219 if (Unit* pMekgineer = Unit::GetUnit(*me, instance->GetData64(DATA_MEKGINEER_STEAMRIGGER)))
220 {
221 if (me->IsWithinDistInMap(pMekgineer, MAX_REPAIR_RANGE))
222 {
223 //are we already channeling? Doesn't work very well, find better check?
224 if (!me->GetUInt32Value(UNIT_FIELD_CHANNEL_SPELL))
225 {
226 //me->GetMotionMaster()->MovementExpired();
227 //me->GetMotionMaster()->MoveIdle();
228
229 DoCast(me, SPELL_REPAIR, true);
230 }
231 Repair_Timer = 5000;
232 }
233 else
234 {
235 //me->GetMotionMaster()->MovementExpired();
236 //me->GetMotionMaster()->MoveFollow(pMekgineer, 0, 0);
237 }
238 }
239 } else Repair_Timer = 5000;
240 } else Repair_Timer -= diff;
241
242 if (!UpdateVictim())
243 return;
244
246 }
247 };
248};
249
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_CHANNEL_SPELL
Creatures
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
void AddSC_boss_mekgineer_steamrigger()
#define MAX_REPAIR_RANGE
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
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_MEKGINEER_STEAMRIGGER
Definition steam_vault.h:16
Creature * me
bool HealthBelowPct(uint32 pct) const
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================