TrinityCore
Loading...
Searching...
No Matches
boss_skarvald_dalronn.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 */
21
22#include "ScriptMgr.h"
23#include "InstanceScript.h"
24#include "ObjectAccessor.h"
25#include "ScriptedCreature.h"
26#include "utgarde_keep.h"
27
29{
30 // Texts are common for both bosses.
32 SAY_DEATH = 1, // Said once both bosses are dead.
33 SAY_DIED_FIRST = 2, // Said by the first boss that dies.
35 SAY_DEATH_RESPONSE = 4 // Said by the boss alive after the first one dies.
36};
37
39{
40 // Skarvald the Constructor
41 SPELL_CHARGE = 43651,
43 SPELL_ENRAGE = 48193,
45
46 // Dalronn the Controller
51
52 // Ghosts
55
56 // Shared
59};
60
78
84
90
92{
93 public:
94 SkarvaldChargePredicate(Unit* unit) : _me(unit) { }
95
96 bool operator() (WorldObject* target) const
97 {
98 return target->GetDistance2d(_me) >= 5.0f && target->GetDistance2d(_me) <= 30.0f;
99 }
100
101 private:
103};
104
106{
114
115 void JustAppeared() override
116 {
117 if (!IsInGhostForm)
118 return;
119
122
124 }
125
126 void Reset() override
127 {
128 if (!IsInGhostForm)
129 {
130 _Reset();
131 OtherFeignsDeath = false;
132 IsAboutToFeignDeath = false;
135 }
136 }
137
138 void JustEngagedWith(Unit* who) override
139 {
140 if (!IsInGhostForm)
142 }
143
144 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
145 {
147 return;
148
149 if (damage >= me->GetHealth() && who != me)
150 {
151 damage = me->GetHealth() -1;
152
154 {
155 IsAboutToFeignDeath = true;
156
158 otherBoss->AI()->DoAction(ACTION_OTHER_FEIGNS_DEATH);
159
160 events.Reset();
162 }
163 }
164 }
165
166 void DoAction(int32 action) override
167 {
168 switch (action)
169 {
172 OtherFeignsDeath = true;
173 break;
178 break;
179 default:
180 break;
181 }
182 }
183
184 void KilledUnit(Unit* who) override
185 {
186 if (!IsInGhostForm && who->GetTypeId() == TYPEID_PLAYER)
187 Talk(SAY_SLAY);
188 }
189
190 void JustDied(Unit* /*killer*/) override
191 {
193 {
195 _JustDied();
196
198 otherBoss->AI()->DoAction(ACTION_CLEANUP_AND_DIE);
199 }
200 }
201
202 void ExecuteEvent(uint32 eventId) override
203 {
204 switch (eventId)
205 {
208 break;
215 break;
216 default:
217 break;
218 }
219 }
220
221protected:
226};
227
228// 24200, 27390 - Skarvald the Constructor
230{
235
247
248 void ExecuteEvent(uint32 eventId) override
249 {
250 switch (eventId)
251 {
254 DoCast(target, SPELL_CHARGE);
255 events.Repeat(5s, 10s);
256 break;
259 events.Repeat(5s, 10s);
260 break;
261 case EVENT_ENRAGE:
263 events.Repeat(20s, 30s);
264 break;
265 default:
267 break;
268 }
269 }
270};
271
272// 24201, 27389 - Dalronn the Controller
274{
279
292
293 void ExecuteEvent(uint32 eventId) override
294 {
295 switch (eventId)
296 {
298 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
299 DoCast(target, SPELL_SHADOW_BOLT);
300 events.Repeat(2s, 4s);
301 break;
302 case EVENT_DEBILITATE:
303 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
304 DoCast(target, SPELL_DEBILITATE);
305 events.Repeat(5s, 10s);
306 break;
309 events.Repeat(10s, 30s);
310 break;
313 break;
314 default:
316 break;
317 }
318 }
319};
320
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
DamageEffectType
Definition Unit.h:352
@ ACTION_OTHER_FEIGNS_DEATH
@ ACTION_CLEANUP_AND_DIE
@ NPC_SKARVALD_GHOST
@ NPC_DALRONN_GHOST
@ SPELL_GHOST_VISUAL
@ SPELL_STONE_STRIKE
@ SPELL_SHADOW_BOLT
@ SPELL_PERIODIC_HEAL
@ SPELL_SUMMON_SKELETONS
@ SPELL_SUMMON_SKARVALD_GHOST
@ SPELL_SUMMON_DALRONN_GHOST
@ SPELL_QUIET_SUICIDE
@ SPELL_PERMANENT_FEIGN_DEATH
@ EVENT_STONE_STRIKE
@ EVENT_DELAYED_AGGRO_SAY
@ EVENT_DEATH_RESPONSE
@ EVENT_SUMMON_SKELETONS
@ EVENT_SKARVALD_CHARGE
@ EVENT_FEIGN_DEATH
@ EVENT_SHADOW_BOLT
void AddSC_boss_skarvald_dalronn()
@ SAY_DEATH_RESPONSE
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual ObjectGuid GetGuidData(uint32 type) const override
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
bool operator()(WorldObject *target) const
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
uint32 GetHealth() const
Definition Unit.h:913
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1141
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void JustDied(Unit *) override
void ExecuteEvent(uint32 eventId) override
ControllerBaseAI(Creature *creature)
void JustEngagedWith(Unit *who) override
void DoAction(int32 action) override
void DamageTaken(Unit *who, uint32 &damage, DamageEffectType, SpellInfo const *) override
void KilledUnit(Unit *who) override
bool IsHeroic() const
void ExecuteEvent(uint32 eventId) override
void JustEngagedWith(Unit *who) override
boss_dalronn_the_controller(Creature *creature)
boss_skarvald_the_constructor(Creature *creature)
void ExecuteEvent(uint32 eventId) override
void JustEngagedWith(Unit *who) override
@ DATA_DALRONN
@ DATA_SKARVALD_DALRONN
@ DATA_SKARVALD
#define RegisterUtgardeKeepCreatureAI(ai_name)