TrinityCore
boss_vanndar.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
21
enum
Yells
22
{
23
YELL_AGGRO
= 0,
24
YELL_EVADE
= 1,
25
//YELL_RESPAWN1 = -1810010, // Missing in database
26
//YELL_RESPAWN2 = -1810011, // Missing in database
27
YELL_RANDOM
= 2,
28
YELL_SPELL
= 3,
29
};
30
31
enum
Spells
32
{
33
SPELL_AVATAR
= 19135,
34
SPELL_THUNDERCLAP
= 15588,
35
SPELL_STORMBOLT
= 20685
// not sure
36
};
37
38
struct
boss_vanndar
:
public
ScriptedAI
39
{
40
boss_vanndar
(
Creature
* creature) :
ScriptedAI
(creature) { }
41
42
void
Reset
()
override
43
{
44
_scheduler
.
CancelAll
();
45
}
46
47
void
JustEngagedWith
(
Unit
*
/*who*/
)
override
48
{
49
_scheduler
50
.
Schedule
(3s, [
this
](
TaskContext
task)
51
{
52
DoCastVictim
(
SPELL_AVATAR
);
53
task.
Repeat
(15s, 20s);
54
})
55
.Schedule(4s, [
this
](
TaskContext
task)
56
{
57
DoCastVictim
(
SPELL_THUNDERCLAP
);
58
task.
Repeat
(5s, 15s);
59
})
60
.Schedule(6s, [
this
](
TaskContext
task)
61
{
62
DoCastVictim
(
SPELL_STORMBOLT
);
63
task.
Repeat
(10s, 25s);
64
})
65
.Schedule(20s, 30s, [
this
](
TaskContext
task)
66
{
67
Talk
(
YELL_RANDOM
);
68
task.
Repeat
(20s, 30s);
69
})
70
.Schedule(5s, [
this
](
TaskContext
task)
71
{
72
if
(
me
->
GetDistance2d
(
me
->
GetHomePosition
().GetPositionX(),
me
->
GetHomePosition
().GetPositionY()) > 50)
73
{
74
EnterEvadeMode
();
75
Talk
(
YELL_EVADE
);
76
}
77
task.
Repeat
();
78
});
79
80
Talk
(
YELL_AGGRO
);
81
}
82
83
void
UpdateAI
(
uint32
diff)
override
84
{
85
if
(!
UpdateVictim
())
86
return
;
87
88
_scheduler
.
Update
(diff);
89
}
90
91
private
:
92
TaskScheduler
_scheduler
;
93
};
94
95
void
AddSC_boss_vanndar
()
96
{
97
RegisterCreatureAI
(
boss_vanndar
);
98
}
uint32
uint32_t uint32
Definition:
Define.h:142
Spells
Spells
Definition:
PlayerAI.cpp:32
ScriptMgr.h
RegisterCreatureAI
#define RegisterCreatureAI(ai_name)
Definition:
ScriptMgr.h:1380
ScriptedCreature.h
Yells
Yells
Definition:
boss_vanndar.cpp:22
YELL_RANDOM
@ YELL_RANDOM
Definition:
boss_vanndar.cpp:27
YELL_EVADE
@ YELL_EVADE
Definition:
boss_vanndar.cpp:24
YELL_SPELL
@ YELL_SPELL
Definition:
boss_vanndar.cpp:28
YELL_AGGRO
@ YELL_AGGRO
Definition:
boss_vanndar.cpp:23
AddSC_boss_vanndar
void AddSC_boss_vanndar()
Definition:
boss_vanndar.cpp:95
SPELL_AVATAR
@ SPELL_AVATAR
Definition:
boss_vanndar.cpp:33
SPELL_THUNDERCLAP
@ SPELL_THUNDERCLAP
Definition:
boss_vanndar.cpp:34
SPELL_STORMBOLT
@ SPELL_STORMBOLT
Definition:
boss_vanndar.cpp:35
CreatureAI::EnterEvadeMode
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition:
CreatureAI.cpp:219
CreatureAI::Talk
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition:
CreatureAI.cpp:56
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition:
CreatureAI.cpp:245
CreatureAI::me
Creature *const me
Definition:
CreatureAI.h:61
Creature
Definition:
Creature.h:70
Creature::GetHomePosition
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition:
Creature.h:373
TaskContext
Definition:
TaskScheduler.h:392
TaskContext::Repeat
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
Definition:
TaskScheduler.h:470
TaskScheduler
Definition:
TaskScheduler.h:48
TaskScheduler::CancelAll
TaskScheduler & CancelAll()
Definition:
TaskScheduler.cpp:45
TaskScheduler::Schedule
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
Definition:
TaskScheduler.h:225
TaskScheduler::Update
TaskScheduler & Update(success_t const &callback=nullptr)
Definition:
TaskScheduler.cpp:27
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition:
UnitAI.cpp:180
Unit
Definition:
Unit.h:627
WorldObject::GetDistance2d
float GetDistance2d(WorldObject const *obj) const
Definition:
Object.cpp:1096
ScriptedAI
Definition:
ScriptedCreature.h:134
boss_vanndar
Definition:
boss_vanndar.cpp:39
boss_vanndar::_scheduler
TaskScheduler _scheduler
Definition:
boss_vanndar.cpp:92
boss_vanndar::Reset
void Reset() override
Definition:
boss_vanndar.cpp:42
boss_vanndar::JustEngagedWith
void JustEngagedWith(Unit *) override
Definition:
boss_vanndar.cpp:47
boss_vanndar::UpdateAI
void UpdateAI(uint32 diff) override
Definition:
boss_vanndar.cpp:83
boss_vanndar::boss_vanndar
boss_vanndar(Creature *creature)
Definition:
boss_vanndar.cpp:40
server
scripts
EasternKingdoms
AlteracValley
boss_vanndar.cpp
Generated on Thu Mar 14 2024 23:39:26 for TrinityCore by
1.9.4