TrinityCore
boss_kurinnaxx.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 "CreatureTextMgr.h"
20#include "InstanceScript.h"
21#include "ObjectAccessor.h"
22#include "ruins_of_ahnqiraj.h"
23#include "ScriptedCreature.h"
24
26{
29 SPELL_ENRAGE = 26527,
31 SPELL_TRASH = 3391, // Should perhaps be triggered by an aura? Couldn't find any though
32 SPELL_WIDE_SLASH = 25814
33};
34
36{
41};
42
44{
45 SAY_KURINAXX_DEATH = 5, // Yelled by Ossirian the Unscarred
46};
47
49{
50 public:
51 boss_kurinnaxx() : CreatureScript("boss_kurinnaxx") { }
52
53 struct boss_kurinnaxxAI : public BossAI
54 {
56 {
57 Initialize();
58 }
59
61 {
62 _enraged = false;
63 }
64
65 void Reset() override
66 {
67 _Reset();
68 Initialize();
73 }
74
75 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
76 {
77 if (!_enraged && HealthBelowPct(30))
78 {
80 _enraged = true;
81 }
82 }
83
84 void JustDied(Unit* /*killer*/) override
85 {
86 _JustDied();
89 }
90
91 void UpdateAI(uint32 diff) override
92 {
93 if (!UpdateVictim())
94 return;
95
96 events.Update(diff);
97
99 return;
100
101 while (uint32 eventId = events.ExecuteEvent())
102 {
103 switch (eventId)
104 {
108 break;
109 case EVENT_SANDTRAP:
110 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
111 target->CastSpell(target, SPELL_SANDTRAP, true);
112 else if (Unit* victim = me->GetVictim())
113 victim->CastSpell(victim, SPELL_SANDTRAP, true);
115 break;
116 case EVENT_WIDE_SLASH:
119 break;
120 case EVENT_TRASH:
123 break;
124 default:
125 break;
126 }
127
129 return;
130 }
131 }
132 private:
134 };
135
136 CreatureAI* GetAI(Creature* creature) const override
137 {
138 return GetAQ20AI<boss_kurinnaxxAI>(creature);
139 }
140};
141
143{
144 new boss_kurinnaxx();
145}
Texts
#define sCreatureTextMgr
@ TEXT_RANGE_ZONE
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ LANG_ADDON
@ CHAT_MSG_ADDON
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
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
InstanceScript *const instance
EventMap events
void _JustDied()
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
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
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_OSSIRIAN
@ DATA_KURINNAXX
bool HealthBelowPct(uint32 pct) const
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
boss_kurinnaxxAI(Creature *creature)