TrinityCore
Loading...
Searching...
No Matches
boss_falric.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 "boss_horAI.h"
20#include "halls_of_reflection.h"
21#include "InstanceScript.h"
22#include "SpellMgr.h"
23
32
42
50
52
54{
55 public:
56 boss_falric() : CreatureScript("boss_falric") { }
57
58 struct boss_falricAI : public boss_horAI
59 {
61 {
62 Initialize();
63 }
64
66 {
68 }
69
70 void Reset() override
71 {
73 Initialize();
74 }
75
86
87 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
88 {
89 if ((_hopelessnessCount < 1 && me->HealthBelowPctDamaged(66, damage))
90 || (_hopelessnessCount < 2 && me->HealthBelowPctDamaged(33, damage))
91 || (_hopelessnessCount < 3 && me->HealthBelowPctDamaged(10, damage)))
92 {
94 me->RemoveOwnedAura(sSpellMgr->GetSpellIdForDifficulty(HopelessnessHelper[_hopelessnessCount - 1], me));
97 }
98 }
99
100 void JustDied(Unit* /*killer*/) override
101 {
103 events.Reset();
105 }
106
107 void KilledUnit(Unit* who) override
108 {
109 if (who->GetTypeId() == TYPEID_PLAYER)
110 Talk(SAY_SLAY);
111 }
112
113 void UpdateAI(uint32 diff) override
114 {
115 if (!UpdateVictim())
116 return;
117
118 events.Update(diff);
119
121 return;
122
123 switch (events.ExecuteEvent())
124 {
128 break;
130 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
131 {
134 }
136 break;
140 break;
141 default:
142 break;
143 }
144
146 }
147
148 private:
150 };
151
152 CreatureAI* GetAI(Creature* creature) const override
153 {
154 return GetHallsOfReflectionAI<boss_falricAI>(creature);
155 }
156};
157
159{
160 new boss_falric();
161}
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
#define sSpellMgr
Definition SpellMgr.h:738
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
void AddSC_boss_falric()
@ SPELL_DEFILING_HORROR
@ SPELL_QUIVERING_STRIKE
@ SPELL_HOPELESSNESS_2
@ SPELL_HOPELESSNESS_3
@ SPELL_IMPENDING_DESPAIR
@ SPELL_HOPELESSNESS_1
uint32 const HopelessnessHelper[3]
@ SAY_DEATH
@ SAY_DEFILING_HORROR
@ SAY_AGGRO
@ SAY_IMPENDING_DESPAIR
@ SAY_SLAY
@ EVENT_IMPENDING_DESPAIR
@ EVENT_DEFILING_HORROR
@ EVENT_NONE
@ EVENT_QUIVERING_STRIKE
InstanceScript *const instance
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
TypeID GetTypeId() const
Definition Object.h:93
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
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
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3561
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
CreatureAI * GetAI(Creature *creature) const override
@ DATA_FALRIC
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void KilledUnit(Unit *who) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
boss_falricAI(Creature *creature)
void JustEngagedWith(Unit *) override
void Reset() override