TrinityCore
boss_kelris.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 "blackfathom_deeps.h"
20#include "ScriptedCreature.h"
21
23{
27};
28
30{
33 SAY_DEATH = 2
34};
35
37{
40};
41
42struct boss_kelris : public BossAI
43{
44 boss_kelris(Creature* creature) : BossAI(creature, DATA_KELRIS) { }
45
46 void Reset() override
47 {
48 _Reset();
50 }
51
52 void JustReachedHome() override
53 {
56 }
57
58 void JustEngagedWith(Unit* who) override
59 {
65 }
66
67 void JustDied(Unit* /*killer*/) override
68 {
70 _JustDied();
71 }
72
73 void UpdateAI(uint32 diff) override
74 {
75 if (!UpdateVictim())
76 return;
77
78 events.Update(diff);
79
81 return;
82
83 while (uint32 eventId = events.ExecuteEvent())
84 {
85 switch (eventId)
86 {
90 break;
91 case EVENT_SLEEP:
92 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
93 {
95 DoCast(target, SPELL_SLEEP);
96 }
98 break;
99 default:
100 break;
101 }
102
104 return;
105 }
106 }
107};
108
110{
112}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackfathomDeepsCreatureAI(ai_name)
@ DATA_KELRIS
@ SPELL_BLACKFATHOM_CHANNELING
Definition: boss_kelris.cpp:26
@ SPELL_SLEEP
Definition: boss_kelris.cpp:25
@ SPELL_MIND_BLAST
Definition: boss_kelris.cpp:24
void AddSC_boss_kelris()
@ SAY_DEATH
Definition: boss_kelris.cpp:33
@ SAY_AGGRO
Definition: boss_kelris.cpp:31
@ SAY_SLEEP
Definition: boss_kelris.cpp:32
@ EVENT_MIND_BLAST
Definition: boss_kelris.cpp:38
@ EVENT_SLEEP
Definition: boss_kelris.cpp:39
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
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
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
void UpdateAI(uint32 diff) override
Definition: boss_kelris.cpp:73
void JustDied(Unit *) override
Definition: boss_kelris.cpp:67
void JustEngagedWith(Unit *who) override
Definition: boss_kelris.cpp:58
void JustReachedHome() override
Definition: boss_kelris.cpp:52
boss_kelris(Creature *creature)
Definition: boss_kelris.cpp:44
void Reset() override
Definition: boss_kelris.cpp:46