TrinityCore
boss_mekgineer_steamrigger.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Boss_Mekgineer_Steamrigger
20SD%Complete: 60
21SDComment: 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.
22SDCategory: Coilfang Resevoir, The Steamvault
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ScriptedCreature.h"
28#include "steam_vault.h"
29
31{
35 SAY_DEATH = 3
36};
37
39{
43
45 SPELL_REPAIR = 31532,
46 H_SPELL_REPAIR = 37936
47};
48
50{
52};
53
55{
56public:
57 boss_mekgineer_steamrigger() : CreatureScript("boss_mekgineer_steamrigger") { }
58
59 CreatureAI* GetAI(Creature* creature) const override
60 {
61 return GetSteamVaultAI<boss_mekgineer_steamriggerAI>(creature);
62 }
63
65 {
67 {
68 Initialize();
69 instance = creature->GetInstanceScript();
70 }
71
73 {
74 Shrink_Timer = 20000;
75 Saw_Blade_Timer = 15000;
77
78 Summon75 = false;
79 Summon50 = false;
80 Summon25 = false;
81 }
82
84
91
92 void Reset() override
93 {
94 Initialize();
95
97 }
98
99 void JustDied(Unit* /*killer*/) override
100 {
102
104 }
105
106 void KilledUnit(Unit* /*victim*/) override
107 {
108 Talk(SAY_SLAY);
109 }
110
111 void JustEngagedWith(Unit* /*who*/) override
112 {
114
116 }
117
118 //no known summon spells exist
120 {
122
126
127 if (rand32() % 2)
129 if (rand32() % 2)
131 }
132
133 void UpdateAI(uint32 diff) override
134 {
135 if (!UpdateVictim())
136 return;
137
138 if (Shrink_Timer <= diff)
139 {
141 Shrink_Timer = 20000;
142 } else Shrink_Timer -= diff;
143
144 if (Saw_Blade_Timer <= diff)
145 {
147 DoCast(target, SPELL_SAW_BLADE);
148 else
150
151 Saw_Blade_Timer = 15000;
152 } else Saw_Blade_Timer -= diff;
153
154 if (Electrified_Net_Timer <= diff)
155 {
157 Electrified_Net_Timer = 10000;
158 }
159 else Electrified_Net_Timer -= diff;
160
161 if (!Summon75)
162 {
163 if (HealthBelowPct(75))
164 {
166 Summon75 = true;
167 }
168 }
169
170 if (!Summon50)
171 {
172 if (HealthBelowPct(50))
173 {
175 Summon50 = true;
176 }
177 }
178
179 if (!Summon25)
180 {
181 if (HealthBelowPct(25))
182 {
184 Summon25 = true;
185 }
186 }
187 }
188 };
189
190};
191
192#define MAX_REPAIR_RANGE (13.0f) //we should be at least at this range for repair
193#define MIN_REPAIR_RANGE (7.0f) //we can stop movement at this range to repair but not required
194
196{
197public:
198 npc_steamrigger_mechanic() : CreatureScript("npc_steamrigger_mechanic") { }
199
200 CreatureAI* GetAI(Creature* creature) const override
201 {
202 return GetSteamVaultAI<npc_steamrigger_mechanicAI>(creature);
203 }
204
206 {
208 {
209 Initialize();
210 instance = creature->GetInstanceScript();
211 }
212
214 {
215 Repair_Timer = 2000;
216 }
217
219
221
222 void Reset() override
223 {
224 Initialize();
225 }
226
227 void MoveInLineOfSight(Unit* /*who*/) override
228 {
229 //react only if attacked
230 }
231
232 void JustEngagedWith(Unit* /*who*/) override { }
233
234 void UpdateAI(uint32 diff) override
235 {
236 if (Repair_Timer <= diff)
237 {
239 {
241 {
242 if (me->IsWithinDistInMap(mekgineer, MAX_REPAIR_RANGE))
243 {
244 //are we already channeling? Doesn't work very well, find better check?
245 if (!me->GetChannelSpellId())
246 {
247 //me->GetMotionMaster()->MovementExpired();
248 //me->GetMotionMaster()->MoveIdle();
249
250 DoCast(me, SPELL_REPAIR, true);
251 }
252 Repair_Timer = 5000;
253 }
254 else
255 {
256 //me->GetMotionMaster()->MovementExpired();
257 //me->GetMotionMaster()->MoveFollow(pMekgineer, 0, 0);
258 }
259 }
260 } else Repair_Timer = 5000;
261 } else Repair_Timer -= diff;
262
263 if (!UpdateVictim())
264 return;
265 }
266 };
267
268};
269
271{
274}
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ NPC_STREAMRIGGER_MECHANIC
void AddSC_boss_mekgineer_steamrigger()
#define MAX_REPAIR_RANGE
Yells
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
uint32 GetChannelSpellId() const
Definition: Unit.h:1402
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_MEKGINEER_STEAMRIGGER
Definition: steam_vault.h:31
bool HealthBelowPct(uint32 pct) const
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)