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 }
151};
152
153// 17864 - Lesser Doomguard
155{
156 npc_lesser_doomguard(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
157
158 void JustAppeared() override
159 {
161
163 azgalor->AI()->JustSummoned(me);
164 }
165
166 void Reset() override
167 {
170 }
171
172 void JustEngagedWith(Unit* /*who*/) override
173 {
175 .Schedule(4s, 10s, [this](TaskContext& task)
176 {
178 DoCast(target, SPELL_CRIPPLE);
179 task.Repeat(10s, 15s);
180 })
181 .Schedule(10s, 15s, [this](TaskContext& task)
182 {
184 task.Repeat(10s, 15s);
185 });
186 }
187
188 void UpdateAI(uint32 diff) override
189 {
190 if (!UpdateVictim())
191 return;
192
193 _scheduler.Update(diff);
194 }
195
196private:
199};
200
201// 31347 - Doom
203{
204 bool Load() override
205 {
206 return GetCaster()->IsUnit();
207 }
208
209 void FilterTargets(std::list<WorldObject*>& targets)
210 {
211 targets.remove(GetCaster()->GetVictim());
213 }
214
219};
220
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:290
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
bool IsUnit() const
Definition BaseEntity.h:171
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
uint32 const Id
Definition SpellInfo.h:328
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void Register() override
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:67
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