TrinityCore
boss_drekthar.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
22{
27 SPELL_SWEEPING_STRIKES = 18765, // not sure
28 SPELL_CLEAVE = 20677, // not sure
29 SPELL_WINDFURY = 35886, // not sure
30 SPELL_STORMPIKE = 51876 // not sure
31};
32
34{
38 SAY_RANDOM = 3
39};
40
42{
48};
49
51{
52 boss_drekthar(Creature* creature) : ScriptedAI(creature) { }
53
54 void Reset() override
55 {
56 events.Reset();
57 }
58
59 void JustEngagedWith(Unit* /*who*/) override
60 {
67 }
68
69 void JustAppeared() override
70 {
71 Reset();
73 }
74
75 bool CheckInRoom() override
76 {
77 if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
78 {
81 return false;
82 }
83
84 return true;
85 }
86
87 void UpdateAI(uint32 diff) override
88 {
89 if (!UpdateVictim() || !CheckInRoom())
90 return;
91
92 events.Update(diff);
93
95 return;
96
97 while (uint32 eventId = events.ExecuteEvent())
98 {
99 switch (eventId)
100 {
101 case EVENT_WHIRLWIND:
104 break;
105 case EVENT_WHIRLWIND2:
108 break;
109 case EVENT_KNOCKDOWN:
112 break;
113 case EVENT_FRENZY:
116 break;
120 break;
121 default:
122 break;
123 }
124
126 return;
127 }
128 }
129
130 private:
132};
133
135{
137}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_drekthar()
@ SPELL_WINDFURY
@ SPELL_CLEAVE
@ SPELL_STORMPIKE
@ SPELL_WHIRLWIND2
@ SPELL_FRENZY
@ SPELL_SWEEPING_STRIKES
@ SPELL_KNOCKDOWN
@ SPELL_WHIRLWIND
@ SAY_RESPAWN
@ SAY_AGGRO
@ SAY_EVADE
@ SAY_RANDOM
@ EVENT_WHIRLWIND
@ EVENT_WHIRLWIND2
@ EVENT_KNOCKDOWN
@ EVENT_RANDOM_YELL
@ EVENT_FRENZY
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:373
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1096
bool CheckInRoom() override
void UpdateAI(uint32 diff) override
void JustAppeared() override
void JustEngagedWith(Unit *) override
boss_drekthar(Creature *creature)
void Reset() override