TrinityCore
boss_lavanthor.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 "InstanceScript.h"
20#include "ScriptedCreature.h"
21#include "violet_hold.h"
22
24{
25 SPELL_CAUTERIZING_FLAMES = 59466, // Only in heroic
28 SPELL_LAVA_BURN = 54249
29};
30
31struct boss_lavanthor : public BossAI
32{
33 boss_lavanthor(Creature* creature) : BossAI(creature, DATA_LAVANTHOR) { }
34
35 void Reset() override
36 {
38 }
39
40 void JustEngagedWith(Unit* who) override
41 {
43 }
44
45 void JustReachedHome() override
46 {
49 }
50
51 void UpdateAI(uint32 diff) override
52 {
53 if (!UpdateVictim())
54 return;
55
56 scheduler.Update(diff);
57 }
58
59 void ScheduleTasks() override
60 {
61 scheduler.Schedule(Seconds(1), [this](TaskContext task)
62 {
63 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
64 DoCast(target, SPELL_FIREBOLT);
65 task.Repeat(Seconds(5), Seconds(13));
66 });
67
68 scheduler.Schedule(Seconds(5), [this](TaskContext task)
69 {
71 task.Repeat(Seconds(10), Seconds(15));
72 });
73
74 scheduler.Schedule(Seconds(10), [this](TaskContext task)
75 {
76 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f))
77 DoCast(target, SPELL_LAVA_BURN);
78 task.Repeat(Seconds(15), Seconds(23));
79 });
80
81 if (IsHeroic())
82 {
83 scheduler.Schedule(Seconds(3), [this](TaskContext task)
84 {
86 task.Repeat(Seconds(10), Seconds(16));
87 });
88 }
89 }
90};
91
93{
95}
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
Spells
Definition: PlayerAI.cpp:32
@ SPELL_FLAME_BREATH
@ SPELL_FIREBOLT
@ SPELL_LAVA_BURN
@ SPELL_CAUTERIZING_FLAMES
void AddSC_boss_lavanthor()
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
TaskScheduler scheduler
void JustReachedHome() override
void Reset() override
bool UpdateVictim()
Definition: CreatureAI.cpp:245
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
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
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
bool IsHeroic() const
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void Reset() override
void ScheduleTasks() override
void JustReachedHome() override
boss_lavanthor(Creature *creature)
@ DATA_HANDLE_CELLS
Definition: violet_hold.h:87
@ DATA_LAVANTHOR
Definition: violet_hold.h:57
#define RegisterVioletHoldCreatureAI(ai_name)
Definition: violet_hold.h:164