TrinityCore
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
24{
30};
31
33{
40};
41
43{
48};
49
51
53{
54 public:
55 boss_falric() : CreatureScript("boss_falric") { }
56
57 struct boss_falricAI : public boss_horAI
58 {
60 {
61 Initialize();
62 }
63
65 {
67 }
68
69 void Reset() override
70 {
72 Initialize();
73 }
74
75 void JustEngagedWith(Unit* /*who*/) override
76 {
80
84 }
85
86 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
87 {
88 if ((_hopelessnessCount < 1 && me->HealthBelowPctDamaged(66, damage))
89 || (_hopelessnessCount < 2 && me->HealthBelowPctDamaged(33, damage))
90 || (_hopelessnessCount < 3 && me->HealthBelowPctDamaged(10, damage)))
91 {
96 }
97 }
98
99 void JustDied(Unit* /*killer*/) override
100 {
102 events.Reset();
104 }
105
106 void KilledUnit(Unit* who) override
107 {
108 if (who->GetTypeId() == TYPEID_PLAYER)
109 Talk(SAY_SLAY);
110 }
111
112 void UpdateAI(uint32 diff) override
113 {
114 if (!UpdateVictim())
115 return;
116
117 events.Update(diff);
118
120 return;
121
122 switch (events.ExecuteEvent())
123 {
127 break;
129 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true))
130 {
133 }
135 break;
139 break;
140 default:
141 break;
142 }
143 }
144
145 private:
147 };
148
149 CreatureAI* GetAI(Creature* creature) const override
150 {
151 return GetHallsOfReflectionAI<boss_falricAI>(creature);
152 }
153};
154
156{
157 new boss_falric();
158}
Texts
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_falric()
@ SPELL_DEFILING_HORROR
Definition: boss_falric.cpp:36
@ SPELL_QUIVERING_STRIKE
Definition: boss_falric.cpp:34
@ SPELL_HOPELESSNESS_2
Definition: boss_falric.cpp:38
@ SPELL_HOPELESSNESS_3
Definition: boss_falric.cpp:39
@ SPELL_IMPENDING_DESPAIR
Definition: boss_falric.cpp:35
@ SPELL_HOPELESSNESS_1
Definition: boss_falric.cpp:37
uint32 const HopelessnessHelper[3]
Definition: boss_falric.cpp:50
@ SAY_DEATH
Definition: boss_falric.cpp:27
@ SAY_DEFILING_HORROR
Definition: boss_falric.cpp:29
@ SAY_AGGRO
Definition: boss_falric.cpp:25
@ SAY_IMPENDING_DESPAIR
Definition: boss_falric.cpp:28
@ SAY_SLAY
Definition: boss_falric.cpp:26
@ EVENT_IMPENDING_DESPAIR
Definition: boss_falric.cpp:46
@ EVENT_DEFILING_HORROR
Definition: boss_falric.cpp:47
@ EVENT_NONE
Definition: boss_falric.cpp:44
@ EVENT_QUIVERING_STRIKE
Definition: boss_falric.cpp:45
InstanceScript *const instance
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
TypeID GetTypeId() const
Definition: Object.h:173
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3608
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
CreatureAI * GetAI(Creature *creature) const override
@ DATA_FALRIC
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
Definition: boss_falric.cpp:86
void KilledUnit(Unit *who) override
void JustDied(Unit *) override
Definition: boss_falric.cpp:99
void UpdateAI(uint32 diff) override
boss_falricAI(Creature *creature)
Definition: boss_falric.cpp:59
void JustEngagedWith(Unit *) override
Definition: boss_falric.cpp:75
void Reset() override
Definition: boss_horAI.cpp:26