TrinityCore
boss_corla.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 "ScriptedCreature.h"
20#include "blackrock_caverns.h"
21
22enum Text
23{
29};
30
32{
37};
38
40{
41 // Out of combat events
45 // Combat events
46};
47
49{
50 public:
51 boss_corla(): CreatureScript("boss_corla") { }
52
53 struct boss_corlaAI : public BossAI
54 {
55 boss_corlaAI(Creature* creature) : BossAI(creature, DATA_CORLA) { }
56
57 void Reset() override
58 {
59 _Reset();
60 combatPhase = false;
62 }
63
64 void JustEngagedWith(Unit* who) override
65 {
68 events.Reset();
69 combatPhase = true;
70 }
71
72 void KilledUnit(Unit* who) override
73 {
74 if (who->GetTypeId() == TYPEID_PLAYER)
76 }
77
78 void JustDied(Unit* /*killer*/) override
79 {
80 _JustDied();
82 }
83
84 void UpdateAI(uint32 diff) override
85 {
86 events.Update(diff);
87
88 if (!combatPhase)
89 {
90 while (uint32 eventId = events.ExecuteEvent())
91 {
92 switch (eventId)
93 {
97 break;
101 break;
102 case EVENT_EVOLUTION:
105 break;
106 default:
107 break;
108 }
109 }
110 return;
111 }
112 }
113
114 private:
115 bool combatPhase = false;
116 };
117
118 CreatureAI* GetAI(Creature* creature) const override
119 {
120 return GetBlackrockCavernsAI<boss_corlaAI>(creature);
121 }
122};
123
125{
126 new boss_corla();
127}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:591
@ DATA_CORLA
@ H_SPELL_SHADOW_POWER
Definition: boss_corla.cpp:36
@ SPELL_EVOLUTION
Definition: boss_corla.cpp:33
@ SPELL_SHADOW_POWER
Definition: boss_corla.cpp:35
@ SPELL_DRAIN_ESSENSE
Definition: boss_corla.cpp:34
void AddSC_boss_corla()
Definition: boss_corla.cpp:124
@ YELL_AGGRO
Definition: boss_corla.cpp:24
@ EMOTE_EVOLVED_ZEALOT
Definition: boss_corla.cpp:28
@ YELL_EVOLVED_ZEALOT
Definition: boss_corla.cpp:26
@ YELL_KILL
Definition: boss_corla.cpp:25
@ YELL_DEATH
Definition: boss_corla.cpp:27
@ EVENT_STOP_DRAIN_ESSENSE
Definition: boss_corla.cpp:43
@ EVENT_DRAIN_ESSENSE
Definition: boss_corla.cpp:42
@ EVENT_EVOLUTION
Definition: boss_corla.cpp:44
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
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
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
CreatureAI * GetAI(Creature *creature) const override
Definition: boss_corla.cpp:118
void JustDied(Unit *) override
Definition: boss_corla.cpp:78
void JustEngagedWith(Unit *who) override
Definition: boss_corla.cpp:64
void Reset() override
Definition: boss_corla.cpp:57
void KilledUnit(Unit *who) override
Definition: boss_corla.cpp:72
boss_corlaAI(Creature *creature)
Definition: boss_corla.cpp:55
void UpdateAI(uint32 diff) override
Definition: boss_corla.cpp:84