TrinityCore
boss_curator.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 "karazhan.h"
20#include "ScriptedCreature.h"
21
23{
29 SAY_DEATH = 5
30};
31
33{
42};
43
45{
50};
51
53{
54public:
55 boss_curator() : CreatureScript("boss_curator") { }
56
57 struct boss_curatorAI : public BossAI
58 {
59 boss_curatorAI(Creature* creature) : BossAI(creature, DATA_CURATOR), _infused(false) { }
60
61 void Reset() override
62 {
63 _Reset();
64 _infused = false;
65 }
66
67 void KilledUnit(Unit* victim) override
68 {
69 if (victim->GetTypeId() == TYPEID_PLAYER)
71 }
72
73 void JustDied(Unit* /*killer*/) override
74 {
75 _JustDied();
77 }
78
79 void JustEngagedWith(Unit* who) override
80 {
83
87 }
88
89 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
90 {
91 if (!HealthAbovePct(15) && !_infused)
92 {
93 _infused = true;
96 }
97 }
98
99 void ExecuteEvent(uint32 eventId) override
100 {
101 switch (eventId)
102 {
105 DoCast(target, SPELL_HATEFUL_BOLT);
106 events.Repeat(Seconds(7), Seconds(15));
107 break;
110 break;
112 if (roll_chance_i(50))
114
116
117 if (int32 mana = int32(me->GetMaxPower(POWER_MANA) / 10))
118 {
119 me->ModifyPower(POWER_MANA, -mana);
120
121 if (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA) < 10)
122 {
126 }
127 }
128 events.Repeat(Seconds(10));
129 break;
130 case EVENT_BERSERK:
133 break;
134 default:
135 break;
136 }
137 }
138
139 private:
141 };
142
143 CreatureAI* GetAI(Creature* creature) const override
144 {
145 return GetKarazhanAI<boss_curatorAI>(creature);
146 }
147};
148
150{
151public:
152 npc_curator_astral_flare() : CreatureScript("npc_curator_astral_flare") { }
153
155 {
157 {
159 }
160
161 void Reset() override
162 {
163 _scheduler.Schedule(Seconds(2), [this](TaskContext /*context*/)
164 {
166 me->SetUninteractible(false);
168 });
169 }
170
171 void UpdateAI(uint32 diff) override
172 {
173 _scheduler.Update(diff);
174 }
175
176 private:
178 };
179
180 CreatureAI* GetAI(Creature* creature) const override
181 {
182 return GetKarazhanAI<npc_curator_astral_flareAI>(creature);
183 }
184};
185
187{
188 new boss_curator();
190}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
bool roll_chance_i(int chance)
Definition: Random.h:59
@ POWER_MANA
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
DamageEffectType
Definition: UnitDefines.h:131
CuratorSays
@ SAY_DEATH
@ SAY_EVOCATE
@ SAY_AGGRO
@ SAY_KILL
@ SAY_ENRAGE
@ SAY_SUMMON
CuratorSpells
@ SPELL_SUMMON_ASTRAL_FLARE_SE
@ SPELL_ARCANE_INFUSION
@ SPELL_SUMMON_ASTRAL_FLARE_SW
@ SPELL_EVOCATION
@ SPELL_SUMMON_ASTRAL_FLARE_NE
@ SPELL_HATEFUL_BOLT
@ SPELL_SUMMON_ASTRAL_FLARE_NW
@ SPELL_BERSERK
CuratorEvents
@ EVENT_BERSERK
@ EVENT_ARCANE_INFUSION
@ EVENT_HATEFUL_BOLT
@ EVENT_SUMMON_ASTRAL_FLARE
void AddSC_boss_curator()
void JustEngagedWith(Unit *who) override
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 SetReactState(ReactStates st)
Definition: Creature.h:160
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
TypeID GetTypeId() const
Definition: Object.h:173
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:8280
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:9410
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
int32 GetPower(Powers power) const
Definition: Unit.cpp:9401
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_CURATOR
Definition: karazhan.h:35
bool HealthAbovePct(uint32 pct) const
boss_curatorAI(Creature *creature)
void ExecuteEvent(uint32 eventId) override
void KilledUnit(Unit *victim) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override