Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_kurinnaxx.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#include "ObjectMgr.h"
7#include "ScriptMgr.h"
8#include "ScriptedCreature.h"
9#include "ruins_of_ahnqiraj.h"
10#include "CreatureTextMgr.h"
11
13{
16 SPELL_ENRAGE = 26527,
18 SPELL_TRASH = 3391, // Should perhaps be triggered by an aura? Couldn't find any though
20};
21
29
31{
32 SAY_KURINAXX_DEATH = 5, // Yelled by Ossirian the Unscarred
33};
34
36{
37 public:
38 boss_kurinnaxx() : CreatureScript("boss_kurinnaxx") { }
39
40 struct boss_kurinnaxxAI : public BossAI
41 {
43 {
44 }
45
47 {
48 _Reset();
49 _enraged = false;
50 events.ScheduleEvent(EVENT_MORTAL_WOUND, 8000);
51 events.ScheduleEvent(EVENT_SANDTRAP, std::rand() % 15000 + 5000);
52 events.ScheduleEvent(EVENT_TRASH, 1000);
53 events.ScheduleEvent(EVENT_WIDE_SLASH, 11000);
54 }
55
56 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
57 {
58 if (!_enraged && HealthBelowPct(30))
59 {
61 _enraged = true;
62 }
63 }
64
65 void JustDied(Unit* /*killer*/) OVERRIDE
66 {
67 _JustDied();
68 if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetData64(DATA_OSSIRIAN)))
70 }
71
73 {
74 if (!UpdateVictim())
75 return;
76
77 events.Update(diff);
78
79 if (me->HasUnitState(UNIT_STATE_CASTING))
80 return;
81
82 while (uint32 eventId = events.ExecuteEvent())
83 {
84 switch (eventId)
85 {
88 events.ScheduleEvent(EVENT_MORTAL_WOUND, 8000);
89 break;
90 case EVENT_SANDTRAP:
91 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
92 target->CastSpell(target, SPELL_SANDTRAP, true);
93 else if (Unit* victim = me->GetVictim())
94 victim->CastSpell(victim, SPELL_SANDTRAP, true);
95 events.ScheduleEvent(EVENT_SANDTRAP, std::rand() % 15000 + 5000);
96 break;
99 events.ScheduleEvent(EVENT_WIDE_SLASH, 11000);
100 break;
101 case EVENT_TRASH:
103 events.ScheduleEvent(EVENT_WIDE_SLASH, 16000);
104 break;
105 default:
106 break;
107 }
108 }
109
111 }
112 private:
114 };
115
117 {
118 return new boss_kurinnaxxAI(creature);
119 }
120};
121
123{
124 new boss_kurinnaxx();
125}
#define sCreatureTextMgr
@ TEXT_RANGE_ZONE
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ SPELL_TRASH
@ EVENT_TRASH
void AddSC_boss_kurinnaxx()
@ SPELL_ENRAGE
@ SPELL_SUMMON_PLAYER
@ SPELL_WIDE_SLASH
@ SPELL_MORTALWOUND
@ SPELL_SANDTRAP
@ SPELL_TRASH
@ SAY_KURINAXX_DEATH
@ EVENT_TRASH
@ EVENT_MORTAL_WOUND
@ EVENT_SANDTRAP
@ EVENT_WIDE_SLASH
@ EVENT_MORTAL_WOUND
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
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
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_OSSIRIAN
@ DATA_KURINNAXX
Creature * me
bool HealthBelowPct(uint32 pct) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void DamageTaken(Unit *, uint32 &) OVERRIDE