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/* 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{
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{
178
179 void Reset() override
180 {
181 Enraged = false;
183 }
184
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{
233
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
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
@ EVENT_CHARGE
@ UNIT_DYNFLAG_LOOTABLE
DamageEffectType
@ ACTION_OTHER_JUST_DIED
@ ACTION_DESPAWN_SUMMONS
@ SPELL_STONE_STRIKE
@ SPELL_SHADOW_BOLT
@ SPELL_SUMMON_SKELETONS
@ SPELL_SUMMON_SKARVALD_GHOST
@ SPELL_SUMMON_DALRONN_GHOST
void AddSC_boss_skarvald_dalronn()
@ SAY_DEATH_RESPONSE
@ EVENT_STONE_STRIKE
@ EVENT_DELAYED_AGGRO_SAY
@ EVENT_DEATH_RESPONSE
@ EVENT_SUMMON_SKELETONS
@ EVENT_SKARVALD_CHARGE
@ EVENT_SHADOW_BOLT
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
Creature *const me
Definition CreatureAI.h:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
uint32 GetEntry() const
Definition Object.h:89
void RemoveDynamicFlag(uint32 flag)
Definition Object.h:98
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:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:450
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
@ DATA_SKARVALD_DALRONN
@ DATA_SKARVALD
#define RegisterUtgardeKeepCreatureAI(ai_name)
@ NPC_SKARVALD_GHOST
@ NPC_DALRONN_GHOST