TrinityCore
Loading...
Searching...
No Matches
boss_halazzi.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#include "ScriptMgr.h"
19#include "MotionMaster.h"
20#include "ObjectAccessor.h"
21#include "ScriptedCreature.h"
22#include "SpellInfo.h"
23#include "zulaman.h"
24
26{
29 SPELL_FRENZY = 43139,
38 SPELL_LYNX_FRENZY = 43290, // Used by Spirit Lynx
39 SPELL_SHRED_ARMOR = 43243 // Used by Spirit Lynx
40};
41
43{
45 NPC_TOTEM = 24224
46};
47
57
68
70{
71 public:
72 boss_halazzi() : CreatureScript("boss_halazzi") { }
73
74 struct boss_halazziAI : public BossAI
75 {
77 {
78 Initialize();
80 FrenzyTimer = 0;
82 ShockTimer = 0;
83 TotemTimer = 0;
84 }
85
87 {
90 BerserkTimer = 600000;
91 CheckTimer = 1000;
92 }
93
95
103
105
106 void Reset() override
107 {
108 _Reset();
109 Initialize();
110
111 DoCast(me, SPELL_DUAL_WIELD, true);
112
115 }
116
117 void JustEngagedWith(Unit* who) override
118 {
122 }
123
124 void JustSummoned(Creature* summon) override
125 {
126 summon->AI()->AttackStart(me->GetVictim());
127 if (summon->GetEntry() == NPC_SPIRIT_LYNX)
128 LynxGUID = summon->GetGUID();
129 summons.Summon(summon);
130 }
131
132 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
133 {
134 if (damage >= me->GetHealth() && Phase != PHASE_ENRAGE)
135 damage = 0;
136 }
137
138 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
139 {
140 if (spellInfo->Id == SPELL_TRANSFORM_SPLIT2)
142 }
143
144 void AttackStart(Unit* who) override
145 {
146 if (Phase != PHASE_MERGE)
148 }
149
150 void EnterPhase(PhaseHalazzi NextPhase)
151 {
152 switch (NextPhase)
153 {
154 case PHASE_LYNX:
155 case PHASE_ENRAGE:
156 if (Phase == PHASE_MERGE)
157 {
159 me->Attack(me->GetVictim(), true);
161 }
163 Lynx->DisappearAndDie();
164 me->SetMaxHealth(600000);
165 me->SetHealth(600000 - 150000 * TransformCount);
166 FrenzyTimer = 16000;
167 SaberlashTimer = 20000;
168 ShockTimer = 10000;
169 TotemTimer = 12000;
170 break;
171 case PHASE_SPLIT:
174 break;
175 case PHASE_HUMAN:
176 //DoCast(me, SPELL_SUMMON_LYNX, true);
178 me->SetMaxHealth(400000);
179 me->SetHealth(400000);
180 ShockTimer = 10000;
181 TotemTimer = 12000;
182 break;
183 case PHASE_MERGE:
184 if (Unit* pLynx = ObjectAccessor::GetUnit(*me, LynxGUID))
185 {
187 pLynx->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
188 pLynx->GetMotionMaster()->Clear();
189 pLynx->GetMotionMaster()->MoveFollow(me, 0, 0);
191 me->GetMotionMaster()->MoveFollow(pLynx, 0, 0);
193 }
194 break;
195 default:
196 break;
197 }
198 Phase = NextPhase;
199 }
200
201 void UpdateAI(uint32 diff) override
202 {
203 if (!UpdateVictim())
204 return;
205
206 if (BerserkTimer <= diff)
207 {
209 DoCast(me, SPELL_BERSERK, true);
210 BerserkTimer = 60000;
211 }
212 else
213 BerserkTimer -= diff;
214
215 if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE)
216 {
217 if (SaberlashTimer <= diff)
218 {
219 // A tank with more than 490 defense skills should receive no critical hit
220 //DoCast(me, 41296, true);
222 //me->RemoveAurasDueToSpell(41296);
223 SaberlashTimer = 30000;
224 }
225 else
226 SaberlashTimer -= diff;
227
228 if (FrenzyTimer <= diff)
229 {
231 FrenzyTimer = urand(10000, 15000);
232 }
233 else
234 FrenzyTimer -= diff;
235
236 if (Phase == PHASE_LYNX)
237 {
238 if (CheckTimer <= diff)
239 {
240 if (HealthBelowPct(25 * (3 - TransformCount)))
242 CheckTimer = 1000;
243 }
244 else
245 CheckTimer -= diff;
246 }
247 }
248
249 if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE)
250 {
251 if (TotemTimer <= diff)
252 {
254 TotemTimer = 20000;
255 }
256 else
257 TotemTimer -= diff;
258
259 if (ShockTimer <= diff)
260 {
262 {
263 if (target->IsNonMeleeSpellCast(false))
264 DoCast(target, SPELL_EARTHSHOCK);
265 else
266 DoCast(target, SPELL_FLAMESHOCK);
267 ShockTimer = urand(10000, 15000);
268 }
269 }
270 else
271 ShockTimer -= diff;
272
273 if (Phase == PHASE_HUMAN)
274 {
275 if (CheckTimer <= diff)
276 {
277 if (!HealthAbovePct(20) /*HealthBelowPct(10)*/)
279 else
280 {
282 if (Lynx && !Lynx->HealthAbovePct(20) /*Lynx->HealthBelowPct(10)*/)
284 }
285 CheckTimer = 1000;
286 }
287 else
288 CheckTimer -= diff;
289 }
290 }
291
292 if (Phase == PHASE_MERGE)
293 {
294 if (CheckTimer <= diff)
295 {
297 if (Lynx)
298 {
299 Lynx->GetMotionMaster()->MoveFollow(me, 0, 0);
300 me->GetMotionMaster()->MoveFollow(Lynx, 0, 0);
301 if (me->IsWithinDistInMap(Lynx, 6.0f))
302 {
303 if (TransformCount < 3)
305 else
307 }
308 }
309 CheckTimer = 1000;
310 }
311 else
312 CheckTimer -= diff;
313 }
314
316 }
317
318 void KilledUnit(Unit* victim) override
319 {
320 if (victim->GetTypeId() != TYPEID_PLAYER)
321 return;
322
323 Talk(SAY_KILL);
324 }
325
326 void JustDied(Unit* /*killer*/) override
327 {
328 _JustDied();
330 }
331 };
332
333 CreatureAI* GetAI(Creature* creature) const override
334 {
335 return GetZulAmanAI<boss_halazziAI>(creature);
336 }
337};
338
339// Spirits Lynx AI
341{
342 public:
343 npc_halazzi_lynx() : CreatureScript("npc_halazzi_lynx") { }
344
346 {
348 {
349 Initialize();
350 }
351
353 {
354 FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds
355 shredder_timer = 4000;
356 }
357
360
361 void Reset() override
362 {
363 Initialize();
364 }
365
366 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
367 {
368 if (damage >= me->GetHealth())
369 damage = 0;
370 }
371
372 void AttackStart(Unit* who) override
373 {
376 }
377
378 void JustEngagedWith(Unit* /*who*/) override {/*DoZoneInCombat();*/ }
379
380 void UpdateAI(uint32 diff) override
381 {
382 if (!UpdateVictim())
383 return;
384
385 if (FrenzyTimer <= diff)
386 {
388 FrenzyTimer = urand(30000, 50000); //frenzy every 30-50 seconds
389 } else FrenzyTimer -= diff;
390
391 if (shredder_timer <= diff)
392 {
394 shredder_timer = 4000;
395 } else shredder_timer -= diff;
396
398 }
399
400 };
401
402 CreatureAI* GetAI(Creature* creature) const override
403 {
404 return GetZulAmanAI<npc_halazzi_lynxAI>(creature);
405 }
406};
407
409{
410 new boss_halazzi();
411 new npc_halazzi_lynx();
412}
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_CORPSE_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ UNIT_FLAG_NON_ATTACKABLE
DamageEffectType
Definition Unit.h:352
void AddSC_boss_halazzi()
@ SAY_DEATH
@ SAY_SABER
@ SAY_AGGRO
@ SAY_SPLIT
@ SAY_MERGE
@ SAY_KILL
@ SAY_BERSERK
@ SPELL_SABER_LASH
@ SPELL_TRANSFORM_SPLIT2
@ SPELL_TRANSFORM_SPLIT
@ SPELL_DUAL_WIELD
@ SPELL_LYNX_FRENZY
@ SPELL_SHRED_ARMOR
@ SPELL_SUMMON_TOTEM
@ SPELL_TRANSFORM_MERGE
@ SPELL_SUMMON_LYNX
@ SPELL_FRENZY
@ SPELL_EARTHSHOCK
@ SPELL_FLAMESHOCK
@ SPELL_BERSERK
Hal_CreatureIds
@ NPC_TOTEM
@ NPC_SPIRIT_LYNX
PhaseHalazzi
@ PHASE_SPLIT
@ PHASE_NONE
@ PHASE_ENRAGE
@ PHASE_MERGE
@ PHASE_HUMAN
@ PHASE_LYNX
Yells
void JustEngagedWith(Unit *who) override
SummonList summons
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
CreatureAI * AI() const
Definition Creature.h:154
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 Id
Definition SpellInfo.h:289
void Summon(Creature const *summon)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HealthAbovePct(int32 pct) const
Definition Unit.h:919
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:953
void SetHealth(uint32 val)
Definition Unit.cpp:9361
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:5535
uint32 GetHealth() const
Definition Unit.h:913
Unit * GetVictim() const
Definition Unit.h:859
void SetMaxHealth(uint32 val)
Definition Unit.cpp:9393
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void AttackStart(Unit *) override
bool HealthAbovePct(uint32 pct) const
bool HealthBelowPct(uint32 pct) const
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
void AttackStart(Unit *who) override
void JustSummoned(Creature *summon) override
void JustEngagedWith(Unit *who) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void EnterPhase(PhaseHalazzi NextPhase)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *victim) override
boss_halazziAI(Creature *creature)
void AttackStart(Unit *who) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
@ BOSS_HALAZZI
Definition zulaman.h:31