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 = 2;
129
130 me->SetCanDualWield(true);
132 me->SetUnkillable(false);
133
135 }
136
137 void JustEngagedWith(Unit* who) override
138 {
140
142
146 }
147
148 void DamageTaken(Unit* /*done_by*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
149 {
151 {
152 me->SetUnkillable(true);
155 }
156 }
157
158 void OnHealthDepleted(Unit* /*attacker*/, bool /*isKill*/) override
159 {
161 {
164 }
165 }
166
168 {
169 switch (_transformCount)
170 {
171 case 2:
173 break;
174 case 1:
176 break;
177 default:
178 break;
179 }
180
181 if (Creature* spirit = me->FindNearestCreature(NPC_SPIRIT_LYNX, 200.0f))
182 spirit->AI()->DoAction(ACTION_INFORM_LYNX);
183
185
186 if (_transformCount)
187 {
193 }
194 else
195 {
202 }
203 }
204
205 void DoAction(int32 action) override
206 {
208 {
211 }
212 }
213
214 void OnSpellCast(SpellInfo const* spellInfo) override
215 {
216 switch (spellInfo->Id)
217 {
218 case SPELL_SABER_LASH:
220 break;
221 case SPELL_BERSERK:
223 break;
224 default:
225 break;
226 }
227 }
228
238
239 void KilledUnit(Unit* /*victim*/) override
240 {
241 Talk(SAY_SLAY);
242 }
243
244 void JustDied(Unit* /*killer*/) override
245 {
246 _JustDied();
248 }
249
250 void UpdateAI(uint32 diff) override
251 {
252 if (!UpdateVictim())
253 return;
254
255 events.Update(diff);
256
258 return;
259
260 while (uint32 eventId = events.ExecuteEvent())
261 {
262 switch (eventId)
263 {
264 // Lynx Phase & Last Phase
265 case EVENT_ENRAGE:
267 events.Repeat(15s, 25s);
268 break;
269 case EVENT_SABER_LASH:
271 events.Repeat(20s);
272 break;
273
274 // Split
275 case EVENT_SPLIT_1:
282 break;
283 case EVENT_SPLIT_2:
290 break;
291
292 // Merge
293 case EVENT_MERGE_1:
299 break;
300 case EVENT_MERGE_2:
302 me->SetUnkillable(false);
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 }
343
344private:
346};
347
348// 24143 - Spirit of the Lynx
350{
352 _instance(creature->GetInstanceScript()) { }
353
354 void JustAppeared() override
355 {
356 _scheduler.Schedule(0s, [this](TaskContext& task)
357 {
358 switch (task.GetRepeatCounter())
359 {
360 case 0:
361 DoZoneInCombat();
362 DoCastSelf(SPELL_SPIRIT_CHANNEL);
363 task.Repeat(1200ms);
364 break;
365 case 1:
366 DoCastSelf(SPELL_SPIRIT_EFFECT, true);
367 break;
368 default:
369 break;
370 }
371 });
372 }
373
374 void Reset() override
375 {
377 }
378
379 void JustEngagedWith(Unit* /*who*/) override
380 {
382 .Schedule(4s, [this](TaskContext& task)
383 {
385 task.Repeat(4s);
386 })
387 .Schedule(5s, 10s, [this](TaskContext& task)
388 {
390 task.Repeat(15s, 20s);
391 });
392 }
393
394 void OnHealthDepleted(Unit* /*killer*/, bool /*isKill*/) override
395 {
397 halazzi->AI()->DoAction(ACTION_BEGIN_MERGE);
398
402 }
403
404 void DoAction(int32 action) override
405 {
406 if (action == ACTION_INFORM_LYNX)
407 {
410 }
411 }
412
413 void UpdateAI(uint32 diff) override
414 {
415 _scheduler.Update(diff);
416
417 UpdateVictim();
418 }
419
420private:
423};
424
425// 24224 - Corrupted Lightning Totem
427{
429
430 void InitializeAI() override
431 {
433 }
434
435 void JustAppeared() override
436 {
438
439 _scheduler.Schedule(2400ms, [this](TaskContext& task)
440 {
441 std::vector<Player*> playerList;
442 GetPlayerListInGrid(playerList, me, 30.0f);
443
445
446 for (Player* player : playerList)
447 DoCast(player, SPELL_LIGHTNING);
448
449 task.Repeat(2400ms);
450 });
451 }
452
453 void Reset() override
454 {
456 }
457
458 void UpdateAI(uint32 diff) override
459 {
460 UpdateVictim();
461
462 _scheduler.Update(diff);
463 }
464
465private:
467};
468
469// 43536 - Set Health
470// 43537 - Set Health
471// 43538 - Set Health
473{
474 void HandleScript(SpellEffIndex /*effIndex*/)
475 {
476 GetCaster()->SetHealth(GetCaster()->CountPctFromMaxHealth(GetEffectValue()));
477 }
478
483};
484
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
void GetPlayerListInGrid(Container &container, WorldObject *source, float maxSearchRange, bool alive=true)
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
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_TRANSFORM_60_HEALTH
@ SPELL_LIGHTNING
@ SPELL_SUMMON_SPIRIT_LYNX
@ SPELL_TRANSFORM_30_HEALTH
@ SPELL_BERSERK
@ SPELL_TRANSFORM_25_HEALTH
@ SPELL_SPIRIT_EFFECT
@ SPELL_EARTH_SHOCK
@ SPELL_LIGHTNING_TOTEM
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()
Definition CreatureAI.h:169
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetUnkillable(bool unkillable)
Definition Creature.h:195
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:591
void SetCanDualWield(bool value) override
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:246
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:56
void CancelEvent(EventId eventId)
Definition EventMap.cpp:156
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:32
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
uint32 GetEntry() const
Definition Object.h:89
uint32 const Id
Definition SpellInfo.h:328
Unit * GetCaster() const
SpellEffectValue GetEffectValue() const
HookList< EffectHandler > OnEffectHit
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void SetHealth(uint64 val)
Definition Unit.cpp:10041
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1522
void HandleScript(SpellEffIndex)
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:67
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
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
void OnHealthDepleted(Unit *, bool) 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
void OnHealthDepleted(Unit *, bool) override
InstanceScript * _instance
void UpdateAI(uint32 diff) override
npc_spirit_of_the_lynx(Creature *creature)
@ BOSS_HALAZZI
Definition zulaman.h:31
#define RegisterZulAmanCreatureAI(ai_name)
Definition zulaman.h:114