TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "Containers.h"
24#include "InstanceScript.h"
25#include "ruins_of_ahnqiraj.h"
26#include "ScriptedCreature.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
35
47
57
58// 15348 - Kurinnaxx
59struct boss_kurinnaxx : public BossAI
60{
61 boss_kurinnaxx(Creature* creature) : BossAI(creature, DATA_KURINNAXX), _frenzied(false) { }
62
63 void Reset() override
64 {
65 _Reset();
66 _frenzied = false;
67 }
68
79
80 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
81 {
82 if (!_frenzied && me->HealthBelowPctDamaged(30, damage))
83 {
84 _frenzied = true;
86 }
87 }
88
89 void OnSpellCast(SpellInfo const* spell) override
90 {
91 if (spell->Id == SPELL_FRENZY)
93 }
94
95 void UpdateAI(uint32 diff) override
96 {
97 if (!UpdateVictim())
98 return;
99
100 events.Update(diff);
101
103 return;
104
105 while (uint32 eventId = events.ExecuteEvent())
106 {
107 switch (eventId)
108 {
111 events.Repeat(4s, 12s);
112 break;
113 case EVENT_SAND_TRAP:
115 events.Repeat(5s, 15s);
116 break;
117 case EVENT_THRASH:
119 events.Repeat(10s, 20s);
120 break;
121 case EVENT_WIDE_SLASH:
123 events.Repeat(10s, 15s);
124 break;
125 case EVENT_FRENZY:
127 break;
129 if (me->GetDistance(me->GetVictim()) > 10.0f)
131 events.Repeat(5s);
132 break;
133 default:
134 break;
135 }
136
138 return;
139 }
140
142 }
143
144private:
146};
147
148// 26524 - Sand Trap
150{
152
153 bool Validate(SpellInfo const* /*spellInfo*/) override
154 {
156 }
157
158 void FilterTargets(std::list<WorldObject*>& targets)
159 {
160 if (targets.empty())
161 return;
162
164 targets.clear();
165 targets.push_back(target);
166 }
167
168 void HandleScript(SpellEffIndex /*effIndex*/)
169 {
171 }
172
178};
179
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
KurinnaxxEvents
@ EVENT_MORTAL_WOUND
@ EVENT_SUMMON_PLAYER
@ EVENT_SAND_TRAP
@ EVENT_WIDE_SLASH
@ EVENT_FRENZY
@ EVENT_THRASH
void AddSC_boss_kurinnaxx()
KurinnaxxSpells
@ SPELL_SAND_TRAP_EFFECT
@ SPELL_SUMMON_PLAYER
@ SPELL_WIDE_SLASH
@ SPELL_SAND_TRAP_TRIGGER
@ SPELL_THRASH
@ SPELL_FRENZY
@ SPELL_MORTAL_WOUND
KurinnaxxTexts
@ SAY_KURINAXX_DEATH
@ EMOTE_FRENZY
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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
Definition Unit.h:769
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_kurinnaxx_sand_trap)
void HandleScript(SpellEffIndex)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_KURINNAXX
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
boss_kurinnaxx(Creature *creature)
void OnSpellCast(SpellInfo const *spell) override
void Reset() override