TrinityCore
Loading...
Searching...
No Matches
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
31// 29312 - Lavanthor
32// 32237 - Lava Hound
33struct boss_lavanthor : public BossAI
34{
35 boss_lavanthor(Creature* creature) : BossAI(creature, DATA_LAVANTHOR) { }
36
37 void Reset() override
38 {
40 }
41
42 void JustEngagedWith(Unit* who) override
43 {
45 }
46
52
53 void UpdateAI(uint32 diff) override
54 {
55 if (!UpdateVictim())
56 return;
57
58 scheduler.Update(diff,
59 std::bind(&BossAI::DoMeleeAttackIfReady, this));
60 }
61
62 void ScheduleTasks() override
63 {
64 scheduler.Schedule(1s, [this](TaskContext task)
65 {
66 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
67 DoCast(target, SPELL_FIREBOLT);
68 task.Repeat(5s, 13s);
69 });
70
71 scheduler.Schedule(5s, [this](TaskContext task)
72 {
74 task.Repeat(10s, 15s);
75 });
76
77 scheduler.Schedule(10s, [this](TaskContext task)
78 {
79 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f))
80 DoCast(target, SPELL_LAVA_BURN);
81 task.Repeat(15s, 23s);
82 });
83
84 if (IsHeroic())
85 {
86 scheduler.Schedule(Seconds(3), [this](TaskContext task)
87 {
89 task.Repeat(10s, 16s);
90 });
91 }
92 }
93};
94
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
LavanthorSpells
@ 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()
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
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:86
@ DATA_LAVANTHOR
Definition violet_hold.h:56
#define RegisterVioletHoldCreatureAI(ai_name)