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
22{
25 //YELL_RESPAWN1 = -1810010, // Missing in database
26 //YELL_RESPAWN2 = -1810011, // Missing in database
29};
30
32{
33 SPELL_AVATAR = 19135,
35 SPELL_STORMBOLT = 20685 // not sure
36};
37
38struct boss_vanndar : public ScriptedAI
39{
40 boss_vanndar(Creature* creature) : ScriptedAI(creature) { }
41
42 void Reset() override
43 {
45 }
46
47 void JustEngagedWith(Unit* /*who*/) override
48 {
50 .Schedule(3s, [this](TaskContext task)
51 {
53 task.Repeat(15s, 20s);
54 })
55 .Schedule(4s, [this](TaskContext task)
56 {
58 task.Repeat(5s, 15s);
59 })
60 .Schedule(6s, [this](TaskContext task)
61 {
63 task.Repeat(10s, 25s);
64 })
65 .Schedule(20s, 30s, [this](TaskContext task)
66 {
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 {
76 }
77 task.Repeat();
78 });
79
81 }
82
83 void UpdateAI(uint32 diff) override
84 {
85 if (!UpdateVictim())
86 return;
87
88 _scheduler.Update(diff);
89 }
90
91private:
93};
94
96{
98}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
Yells
@ YELL_RANDOM
@ YELL_EVADE
@ YELL_SPELL
@ YELL_AGGRO
void AddSC_boss_vanndar()
@ SPELL_AVATAR
@ SPELL_THUNDERCLAP
@ SPELL_STORMBOLT
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
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1096
TaskScheduler _scheduler
void Reset() override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
boss_vanndar(Creature *creature)