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/*
19 * Combat timers requires to be revisited
20 * SAY_EVENT is NYI
21 */
22
23#include "ScriptMgr.h"
24#include "Containers.h"
25#include "InstanceScript.h"
26#include "Player.h"
27#include "ScriptedCreature.h"
28#include "SpellInfo.h"
29#include "SpellScript.h"
30#include "zulaman.h"
31
43
45{
46 // Halazzi - Combat - Lynx Phase & Last Phase
47 SPELL_ENRAGE = 43139,
49
50 // Halazzi - Combat - Split
53
54 // Halazzi - Combat - Merge
58
59 // Halazzi - Combat - Spirit Phase & Last Phase
63
64 // Halazzi - Combat - All Phases
66
67 // Halazzi - Combat - Misc
69
70 // Spirit of the Lynx
75
76 // Corrupted Lightning Totem
77 SPELL_LIGHTNING = 43301
78};
79
81{
82 // Lynx Phase & Last Phase
85
86 // Split
89
90 // Merge
93
94 // Spirit Phase & Last Phase
98
99 // All Phases
102
109
118
119// 23577 - Halazzi
120struct boss_halazzi : public BossAI
121{
123
124 void Reset() override
125 {
126 _Reset();
127
128 _transformCount = 3;
129
130 me->SetCanDualWield(true);
132
134 }
135
136 void JustEngagedWith(Unit* who) override
137 {
139
141
145 }
146
147 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
148 {
149 if (me->GetEntry() == NPC_HALAZZI_TROLL && damage >= me->GetHealth())
150 damage = me->GetHealth() - 1;
151
153 {
156 }
157
159 {
162 }
163 }
164
166 {
167 switch (_transformCount)
168 {
169 case 3:
171 break;
172 case 2:
174 break;
175 case 1:
177 break;
178 default:
179 break;
180 }
181
182 if (Creature* spirit = me->FindNearestCreature(NPC_SPIRIT_LYNX, 200.0f))
183 spirit->AI()->DoAction(ACTION_INFORM_LYNX);
184
186
187 if (_transformCount)
188 {
194 }
195 else
196 {
203 }
204 }
205
206 void DoAction(int32 action) override
207 {
209 {
212 }
213 }
214
215 void OnSpellCast(SpellInfo const* spellInfo) override
216 {
217 switch (spellInfo->Id)
218 {
219 case SPELL_SABER_LASH:
221 break;
222 case SPELL_BERSERK:
224 break;
225 default:
226 break;
227 }
228 }
229
239
240 void KilledUnit(Unit* /*victim*/) override
241 {
242 Talk(SAY_SLAY);
243 }
244
245 void JustDied(Unit* /*killer*/) override
246 {
247 _JustDied();
249 }
250
251 void UpdateAI(uint32 diff) override
252 {
253 if (!UpdateVictim())
254 return;
255
256 events.Update(diff);
257
259 return;
260
261 while (uint32 eventId = events.ExecuteEvent())
262 {
263 switch (eventId)
264 {
265 // Lynx Phase & Last Phase
266 case EVENT_ENRAGE:
268 events.Repeat(15s, 25s);
269 break;
270 case EVENT_SABER_LASH:
272 events.Repeat(20s);
273 break;
274
275 // Split
276 case EVENT_SPLIT_1:
283 break;
284 case EVENT_SPLIT_2:
291 break;
292
293 // Merge
294 case EVENT_MERGE_1:
300 break;
301 case EVENT_MERGE_2:
303 break;
304
305 // Spirit Phase & Last Phase
308 events.Repeat(10s, 25s);
309 break;
312 DoCast(target, SPELL_FLAME_SHOCK);
313 events.Repeat(20s, 30s);
314 break;
316 {
317 std::vector<Player*> playerList;
318 GetPlayerListInGrid(playerList, me, 30.0f);
319 for (Player* player : playerList)
320 {
321 if (player->IsNonMeleeSpellCast(false))
322 {
323 DoCast(player, SPELL_EARTH_SHOCK);
324 break;
325 }
326 }
327 events.Repeat(10s, 20s);
328 break;
329 }
330
331 // All Phases
332 case EVENT_BERSERK:
334 break;
335 default:
336 break;
337 }
338
340 return;
341 }
342
344 }
345
346private:
348};
349
350// 24143 - Spirit of the Lynx
352{
354 _instance(creature->GetInstanceScript()), _hasReachedLowHealth(false) { }
355
356 void JustAppeared() override
357 {
358 _scheduler.Schedule(0s, [this](TaskContext task)
359 {
360 switch (task.GetRepeatCounter())
361 {
362 case 0:
363 DoZoneInCombat();
364 DoCastSelf(SPELL_SPIRIT_CHANNEL);
365 task.Repeat(1200ms);
366 break;
367 case 1:
368 DoCastSelf(SPELL_SPIRIT_EFFECT, true);
369 break;
370 default:
371 break;
372 }
373 });
374 }
375
376 void Reset() override
377 {
379 }
380
381 void JustEngagedWith(Unit* /*who*/) override
382 {
384 .Schedule(4s, [this](TaskContext task)
385 {
387 task.Repeat(4s);
388 })
389 .Schedule(5s, 10s, [this](TaskContext task)
390 {
392 task.Repeat(15s, 20s);
393 });
394 }
395
396 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
397 {
398 if (damage >= me->GetHealth())
399 damage = me->GetHealth() - 1;
400
401 if (!_hasReachedLowHealth && me->HealthBelowPctDamaged(20, damage))
402 {
404
406 halazzi->AI()->DoAction(ACTION_BEGIN_MERGE);
407
411 }
412 }
413
414 void DoAction(int32 action) override
415 {
416 if (action == ACTION_INFORM_LYNX)
417 {
420 }
421 }
422
423 void UpdateAI(uint32 diff) override
424 {
425 _scheduler.Update(diff);
426
427 if (UpdateVictim())
429 }
430
431private:
435};
436
437// 24224 - Corrupted Lightning Totem
439{
441
442 void InitializeAI() override
443 {
445 }
446
447 void JustAppeared() override
448 {
450
451 _scheduler.Schedule(2400ms, [this](TaskContext task)
452 {
453 std::vector<Player*> playerList;
454 GetPlayerListInGrid(playerList, me, 30.0f);
455
457
458 for (Player* player : playerList)
459 DoCast(player, SPELL_LIGHTNING);
460
461 task.Repeat(2400ms);
462 });
463 }
464
465 void Reset() override
466 {
468 }
469
470 void UpdateAI(uint32 diff) override
471 {
472 UpdateVictim();
473
474 _scheduler.Update(diff);
475 }
476
477private:
479};
480
481// 43536 - Set Health
482// 43537 - Set Health
483// 43538 - Set Health
498
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
void GetPlayerListInGrid(Container &container, WorldObject *source, float maxSearchRange, bool alive=true)
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
void AddSC_boss_halazzi()
HalazziEvents
@ EVENT_LIGHTNING_TOTEM
@ EVENT_MERGE_2
@ EVENT_ENRAGE
@ EVENT_SABER_LASH
@ EVENT_SPLIT_2
@ EVENT_SPLIT_1
@ EVENT_EARTH_SHOCK
@ EVENT_FLAME_SHOCK
@ EVENT_BERSERK
@ EVENT_MERGE_1
HalazziMisc
@ NPC_SPIRIT_LYNX
@ NPC_HALAZZI_LYNX
@ ACTION_INFORM_LYNX
@ ACTION_BEGIN_MERGE
@ NPC_HALAZZI_TROLL
HalazziPhases
@ PHASE_FINAL
@ PHASE_LYNX
@ PHASE_SPIRIT
HalazziSpells
@ SPELL_SABER_LASH
@ SPELL_TRANSFIGURE
@ SPELL_LYNX_FLURRY
@ SPELL_ENRAGE
@ SPELL_SPIRIT_CHANNEL
@ SPELL_SHRED_ARMOR
@ SPELL_FLAME_SHOCK
@ SPELL_TRANSFORM_MAX_HEALTH
@ SPELL_LIGHTNING
@ SPELL_SUMMON_SPIRIT_LYNX
@ SPELL_BERSERK
@ SPELL_TRANSFORM_25_HEALTH
@ SPELL_SPIRIT_EFFECT
@ SPELL_TRANSFORM_75_HEALTH
@ SPELL_EARTH_SHOCK
@ SPELL_LIGHTNING_TOTEM
@ SPELL_TRANSFORM_50_HEALTH
HalazziTexts
@ SAY_DEATH
@ SAY_MELEE
@ SAY_AGGRO
@ SAY_SPLIT
@ SAY_MERGE
@ SAY_SLAY
@ SAY_BERSERK
@ SAY_EVENT
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetReactState(ReactStates st)
Definition Creature.h:128
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:541
void SetCanDualWield(bool value) override
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
int32 GetEffectValue() const
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
void SetHealth(uint32 val)
Definition Unit.cpp:9338
uint32 GetHealth() const
Definition Unit.h:927
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2100
PrepareSpellScript(spell_halazzi_set_health)
void HandleScript(SpellEffIndex)
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:66
ScriptedAI(Creature *creature)
void DoAction(int32 action) override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void PerformAdditionalEvents()
void Reset() override
void EnterEvadeMode(EvadeReason why) override
void KilledUnit(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
boss_halazzi(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void JustAppeared() override
void DoAction(int32 action) override
InstanceScript * _instance
void UpdateAI(uint32 diff) override
npc_spirit_of_the_lynx(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
@ BOSS_HALAZZI
Definition zulaman.h:31
#define RegisterZulAmanCreatureAI(ai_name)
Definition zulaman.h:94