TrinityCore
Loading...
Searching...
No Matches
boss_faerlina.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#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "naxxramas.h"
21#include "ObjectAccessor.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "SpellAuras.h"
25
37
39{
42 SPELL_FRENZY = 28798,
44
45 SPELL_ADD_FIREBALL = 54095 // 25-man: 54096
46};
47
48#define SPELL_WIDOWS_EMBRACE_HELPER RAID_MODE<uint32>(28732, 54097)
49
56
62
63enum Misc
64{
66};
67
68struct boss_faerlina : public BossAI
69{
71
78
79 void InitializeAI() override
80 {
82 {
83 Reset();
84 SummonAdds();
85 }
86 }
87
88 void JustReachedHome() override
89 {
91 SummonAdds();
92 }
93
103
104 void Reset() override
105 {
106 _Reset();
107 _frenzyDispels = 0;
108 }
109
110 void KilledUnit(Unit* victim) override
111 {
112 if (victim->GetTypeId() == TYPEID_PLAYER)
113 Talk(SAY_SLAY);
114 }
115
116 void JustDied(Unit* /*killer*/) override
117 {
118 _JustDied();
120 }
121
122 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
123 {
124 Unit* unitCaster = caster->ToUnit();
125 if (!unitCaster)
126 return;
127
128 if (spellInfo->Id == SPELL_WIDOWS_EMBRACE_HELPER)
129 {
131 Talk(EMOTE_WIDOW_EMBRACE, caster);
132 Unit::Kill(me, unitCaster);
133 }
134 }
135
136 uint32 GetData(uint32 type) const override
137 {
138 if (type == DATA_FRENZY_DISPELS)
139 return _frenzyDispels;
140
141 return 0;
142 }
143
144 void UpdateAI(uint32 diff) override
145 {
146 if (!UpdateVictim())
147 return;
148
149 events.Update(diff);
150
152 return;
153
154 while (uint32 eventId = events.ExecuteEvent())
155 {
156 switch (eventId)
157 {
158 case EVENT_POISON:
162 break;
163 case EVENT_FIRE:
165 DoCast(target, SPELL_RAIN_OF_FIRE);
167 break;
168 case EVENT_FRENZY:
169 if (Aura* widowsEmbrace = me->GetAura(SPELL_WIDOWS_EMBRACE_HELPER))
170 events.ScheduleEvent(EVENT_FRENZY, Milliseconds(widowsEmbrace->GetDuration()+1));
171 else
172 {
175 events.Repeat(Minutes(1) + randtime(0s, Seconds(20)));
176 }
177 break;
178 }
179
181 return;
182 }
183
185 }
186
187private:
189};
190
192{
193 npc_faerlina_add(Creature* creature) : ScriptedAI(creature),
194 _instance(creature->GetInstanceScript())
195 {
196 }
197
198 void Reset() override
199 {
200 if (!Is25ManRaid()) {
203 }
204 }
205
206 void JustEngagedWith(Unit* /*who*/) override
207 {
209 faerlina->AI()->DoZoneInCombat();
210 }
211
212 void JustDied(Unit* /*killer*/) override
213 {
214 if (!Is25ManRaid())
216 DoCast(faerlina, SPELL_WIDOWS_EMBRACE);
217 }
218
219 void UpdateAI(uint32 /*diff*/) override
220 {
221 if (!UpdateVictim())
222 return;
224 return;
225
227 DoMeleeAttackIfReady(); // this will only happen if the fireball cast fails for some reason
228 }
229
230private:
232};
233
235{
236 public:
237 achievement_momma_said_knock_you_out() : AchievementCriteriaScript("achievement_momma_said_knock_you_out") { }
238
239 bool OnCheck(Player* /*source*/, Unit* target) override
240 {
241 return target && !target->GetAI()->GetData(DATA_FRENZY_DISPELS);
242 }
243};
244
246{
247 public:
248 at_faerlina_entrance() : OnlyOnceAreaTriggerScript("at_faerlina_entrance") { }
249
250 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
251 {
252 InstanceScript* instance = player->GetInstanceScript();
253 if (!instance || instance->GetBossState(BOSS_FAERLINA) != NOT_STARTED)
254 return true;
255
256 if (Creature* faerlina = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_FAERLINA)))
257 faerlina->AI()->Talk(SAY_GREET);
258
259 return true;
260 }
261};
262
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::minutes Minutes
Minutes shorthand typedef.
Definition Duration.h:30
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
Milliseconds randtime(Milliseconds min, Milliseconds max)
Definition Random.cpp:62
@ SPELL_EFFECT_BIND
@ MECHANIC_CHARM
@ IMMUNITY_EFFECT
@ IMMUNITY_MECHANIC
@ UNIT_STATE_CASTING
Definition Unit.h:235
SummonGroups
@ SUMMON_GROUP_FOLLOWERS
@ SUMMON_GROUP_WORSHIPPERS
@ DATA_FRENZY_DISPELS
@ SAY_DEATH
@ EMOTE_WIDOW_EMBRACE
@ SAY_AGGRO
@ EMOTE_FRENZY
@ SAY_GREET
@ SAY_SLAY
void AddSC_boss_faerlina()
@ SPELL_ADD_FIREBALL
@ SPELL_RAIN_OF_FIRE
@ SPELL_FRENZY
@ SPELL_WIDOWS_EMBRACE
@ SPELL_POISON_BOLT_VOLLEY
#define SPELL_WIDOWS_EMBRACE_HELPER
@ EVENT_FIRE
@ EVENT_FRENZY
@ EVENT_POISON
Yells
InstanceScript *const instance
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
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
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
static Unit * ToUnit(Object *o)
Definition Object.h:192
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
void DoZoneInCombat(uint32 entry=0)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
virtual uint32 GetData(uint32) const
Definition UnitAI.h:155
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4439
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
UnitAI * GetAI() const
Definition Unit.h:800
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true)
Definition Unit.cpp:10930
bool isDead() const
Definition Unit.h:1236
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
bool OnCheck(Player *, Unit *target) override
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ BOSS_FAERLINA
Definition naxxramas.h:31
@ DATA_FAERLINA
Definition naxxramas.h:64
#define RegisterNaxxramasCreatureAI(ai_name)
Definition naxxramas.h:221
bool Is25ManRaid() const
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
boss_faerlina(Creature *creature)
void InitializeAI() override
void KilledUnit(Unit *victim) override
void JustReachedHome() override
void JustDied(Unit *) override
void Reset() override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
uint32 GetData(uint32 type) const override
npc_faerlina_add(Creature *creature)
void JustDied(Unit *) override
InstanceScript *const _instance
void JustEngagedWith(Unit *) override
void UpdateAI(uint32) override
void Reset() override