TrinityCore
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/* ScriptData
19SDName: Boss_Skarvald_Dalronn
20SD%Complete: 95
21SDComment: Needs adjustments to blizzlike timers
22SDCategory: Utgarde Keep
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ObjectAccessor.h"
28#include "ScriptedCreature.h"
29#include "utgarde_keep.h"
30
32{
33 // Texts are common for both bosses and their ghosts.
35 SAY_DEATH = 1, // Said once both bosses are dead.
36 SAY_DIED_FIRST = 2, // Said by the first boss that dies.
38 SAY_DEATH_RESPONSE = 4 // Said by the boss alive after the first one dies.
39
40};
41
43{
44 // Spells of Skarvald and his Ghost
45 SPELL_CHARGE = 43651,
47 SPELL_ENRAGE = 48193,
49
50 // Spells of Dalronn and his Ghost
55};
56
58{
59 // Skarvald the Constructor
62
63 // Dalronn the Controller
67 EVENT_DELAYED_AGGRO_SAY, // Dalronn's SAY_AGGRO is delayed so it doesn't overlap Skarvald's one.
68
69 // Common event to both bosses.
70 // Delays SAY_DEATH_RESPONSE so it doesn't overlap with the SAY_DIED_FIRST from the boss that has just died.
72};
73
75{
77 ACTION_DESPAWN_SUMMONS = 2 // Only needed to clear off the ghosts when the second boss dies.
78};
79
81{
82 public:
83 SkarvaldChargePredicate(Unit* unit) : _me(unit) { }
84
85 bool operator() (WorldObject* target) const
86 {
87 return target->GetDistance2d(_me) >= 5.0f && target->GetDistance2d(_me) <= 30.0f;
88 }
89
90 private:
92};
93
95{
97 {
98 OtherBossData = 0;
100 }
101
102 void Reset() override
103 {
104 if (IsInGhostForm)
105 {
106 // Call this here since ghosts aren't set in combat as they spawn.
108 }
109 else
110 _Reset();
111 }
112
113 void JustEngagedWith(Unit* who) override
114 {
115 if (!IsInGhostForm)
117 }
118
119 void JustDied(Unit* /*killer*/) override
120 {
122 {
123 if (otherBoss->IsAlive())
124 {
127 otherBoss->AI()->DoAction(ACTION_OTHER_JUST_DIED);
129 }
130 else
131 {
133 otherBoss->AI()->DoAction(ACTION_DESPAWN_SUMMONS);
134 _JustDied();
135 }
136 }
137 }
138
139 void DoAction(int32 actionId) override
140 {
141 switch (actionId)
142 {
145 break;
148 break;
149 default:
150 break;
151 }
152 }
153
154 void ExecuteEvent(uint32 eventId) override
155 {
156 if (eventId == EVENT_DEATH_RESPONSE)
158 }
159
160 void KilledUnit(Unit* who) override
161 {
162 if (!IsInGhostForm && who->GetTypeId() == TYPEID_PLAYER)
163 Talk(SAY_KILL);
164 }
165
166 protected:
169};
170
172{
174 {
176 Enraged = false;
177 }
178
179 void Reset() override
180 {
181 Enraged = false;
183 }
184
185 void JustEngagedWith(Unit* who) override
186 {
188
189 if (!IsInGhostForm)
191
194 }
195
196 void ExecuteEvent(uint32 eventId) override
197 {
198 switch (eventId)
199 {
202 DoCast(target, SPELL_CHARGE);
204 break;
208 break;
209 default:
211 break;
212 }
213 }
214
215 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
216 {
217 if (!Enraged && !IsInGhostForm && me->HealthBelowPctDamaged(15, damage))
218 {
219 Enraged = true;
221 }
222 }
223 private:
225};
226
228{
230 {
232 }
233
234 void JustEngagedWith(Unit* who) override
235 {
237
240
241 if (!IsInGhostForm)
243
244 if (IsHeroic())
246 }
247
248 void ExecuteEvent(uint32 eventId) override
249 {
250 switch (eventId)
251 {
253 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
254 DoCast(target, SPELL_SHADOW_BOLT);
255 events.ScheduleEvent(EVENT_SHADOW_BOLT, 2100ms); //give a 100ms pause to try cast other spells
256 break;
257 case EVENT_DEBILITATE:
258 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
259 DoCast(target, SPELL_DEBILITATE);
261 break;
265 break;
268 break;
269 default:
271 break;
272 }
273 }
274};
275
277{
280}
Texts
Actions
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
@ EVENT_CHARGE
@ UNIT_DYNFLAG_LOOTABLE
DamageEffectType
Definition: UnitDefines.h:131
@ ACTION_OTHER_JUST_DIED
@ ACTION_DESPAWN_SUMMONS
@ SPELL_STONE_STRIKE
@ SPELL_SHADOW_BOLT
@ SPELL_SUMMON_SKELETONS
@ SPELL_SUMMON_SKARVALD_GHOST
@ SPELL_SUMMON_DALRONN_GHOST
@ SPELL_DEBILITATE
void AddSC_boss_skarvald_dalronn()
@ SAY_DIED_FIRST
@ SAY_DEATH_RESPONSE
@ EVENT_STONE_STRIKE
@ EVENT_DELAYED_AGGRO_SAY
@ EVENT_DEATH_RESPONSE
@ EVENT_SUMMON_SKELETONS
@ EVENT_SKARVALD_CHARGE
@ EVENT_DEBILITATE
@ EVENT_SHADOW_BOLT
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:170
bool operator()(WorldObject *target) const
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 DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1096
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
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
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void DoAction(int32 actionId) override
generic_boss_controllerAI(Creature *creature)
void KilledUnit(Unit *who) override
void ExecuteEvent(uint32 eventId) override
void JustEngagedWith(Unit *who) override
@ DATA_DALRONN
Definition: utgarde_keep.h:37
@ DATA_SKARVALD_DALRONN
Definition: utgarde_keep.h:32
@ DATA_SKARVALD
Definition: utgarde_keep.h:36
#define RegisterUtgardeKeepCreatureAI(ai_name)
Definition: utgarde_keep.h:96
@ NPC_SKARVALD_GHOST
Definition: utgarde_keep.h:53
@ NPC_DALRONN_GHOST
Definition: utgarde_keep.h:52