TrinityCore
Loading...
Searching...
No Matches
boss_azgalor.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/*
19 * Combat timers requires to be revisited
20 * The way he casts Doom is quite tricky, currently he casts it in solo, it's wrong
21 1. In case of player with pet if player is not current victim he will cast spell even if player is not in spell range
22 2. In case of solo if player is current victim he doesn't cast spell even if is attacked also by creatures
23 */
24
25#include "ScriptMgr.h"
26#include "Containers.h"
27#include "hyjal.h"
28#include "InstanceScript.h"
29#include "MotionMaster.h"
30#include "ScriptedCreature.h"
31#include "SpellInfo.h"
32#include "SpellScript.h"
33
41
43{
44 // Azgalor
47 SPELL_CLEAVE = 31345,
48 SPELL_DOOM = 31347,
50
51 // Lesser Doomguard
52 SPELL_THRASH = 12787,
54 SPELL_WAR_STOMP = 31408
55};
56
65
66// 17842 - Azgalor
67struct boss_azgalor : public BossAI
68{
69 boss_azgalor(Creature* creature) : BossAI(creature, DATA_AZGALOR) { }
70
71 void JustAppeared() override
72 {
75 }
76
87
88 void OnSpellCast(SpellInfo const* spellInfo) override
89 {
90 if (spellInfo->Id == SPELL_DOOM)
92 }
93
94 // Do not reset SetActive, we want boss to be active all the time
95 void JustReachedHome() override { }
96
97 void KilledUnit(Unit* victim) override
98 {
99 if (victim->GetTypeId() == TYPEID_PLAYER)
100 Talk(SAY_SLAY);
101 }
102
103 void JustDied(Unit* /*killer*/) override
104 {
105 _JustDied();
107 }
108
109 void UpdateAI(uint32 diff) override
110 {
111 if (!UpdateVictim())
112 return;
113
114 events.Update(diff);
115
117 return;
118
119 while (uint32 eventId = events.ExecuteEvent())
120 {
121 switch (eventId)
122 {
124 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
125 DoCast(target, SPELL_RAIN_OF_FIRE);
126 events.Repeat(15s, 30s);
127 break;
130 events.Repeat(25s, 35s);
131 break;
132 case EVENT_CLEAVE:
134 events.Repeat(8s, 15s);
135 break;
136 case EVENT_DOOM:
138 events.Repeat(45s, 60s);
139 break;
140 case EVENT_BERSERK:
142 break;
143 default:
144 break;
145 }
146
148 return;
149 }
150
152 }
153};
154
155// 17864 - Lesser Doomguard
157{
158 npc_lesser_doomguard(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
159
160 void JustAppeared() override
161 {
163
165 azgalor->AI()->JustSummoned(me);
166 }
167
168 void Reset() override
169 {
172 }
173
174 void JustEngagedWith(Unit* /*who*/) override
175 {
177 .Schedule(4s, 10s, [this](TaskContext task)
178 {
180 DoCast(target, SPELL_CRIPPLE);
181 task.Repeat(10s, 15s);
182 })
183 .Schedule(10s, 15s, [this](TaskContext task)
184 {
186 task.Repeat(10s, 15s);
187 });
188 }
189
190 void UpdateAI(uint32 diff) override
191 {
192 if (!UpdateVictim())
193 return;
194
195 _scheduler.Update(diff, [this]
196 {
198 });
199 }
200
201private:
204};
205
206// 31347 - Doom
208{
210
211 bool Load() override
212 {
213 return GetCaster()->IsUnit();
214 }
215
216 void FilterTargets(std::list<WorldObject*>& targets)
217 {
218 targets.remove(GetCaster()->GetVictim());
220 }
221
226};
227
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
AzgalorSpells
@ SPELL_CLEAVE
@ SPELL_CRIPPLE
@ SPELL_RAIN_OF_FIRE
@ SPELL_DOOM
@ SPELL_HOWL_OF_AZGALOR
@ SPELL_THRASH
@ SPELL_WAR_STOMP
@ SPELL_BERSERK
AzgalorEvents
@ EVENT_HOWL_OF_AZGALOR
@ EVENT_RAIN_OF_FIRE
@ EVENT_BERSERK
@ EVENT_CLEAVE
@ EVENT_DOOM
void AddSC_boss_azgalor()
AzgalorTexts
@ SAY_DEATH
@ SAY_SLAY
@ SAY_DOOM
@ SAY_INTRO
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
void MovePath(uint32 pathId, bool repeatable)
bool IsUnit() const
Definition Object.h:191
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
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 DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void Register() override
PrepareSpellScript(spell_azgalor_doom)
void FilterTargets(std::list< WorldObject * > &targets)
bool Load() override
@ PATH_HORDE_BOSS
Definition hyjal.h:115
@ DATA_AZGALOR
Definition hyjal.h:33
#define RegisterHyjalCreatureAI(ai_name)
Definition hyjal.h:126
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:66
void KilledUnit(Unit *victim) override
void OnSpellCast(SpellInfo const *spellInfo) override
void JustReachedHome() override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustAppeared() override
boss_azgalor(Creature *creature)
TaskScheduler _scheduler
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
InstanceScript * _instance
npc_lesser_doomguard(Creature *creature)
void JustAppeared() override
void Reset() override