TrinityCore
Loading...
Searching...
No Matches
boss_azshir_the_sleepless.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 "scarlet_monastery.h"
19#include "ScriptedCreature.h"
20#include "ScriptMgr.h"
21
28
35
37{
39 {
40 _siphon = false;
41 }
42
43 void Reset() override
44 {
45 _Reset();
46 _siphon = false;
47 }
48
55
56 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
57 {
58 if (!_siphon && me->HealthBelowPctDamaged(50, damage))
59 {
62 _siphon = true;
63 }
64 }
65
66 void UpdateAI(uint32 diff) override
67 {
68 if (!UpdateVictim())
69 return;
70
71 events.Update(diff);
72
74 return;
75
76 while (uint32 eventId = events.ExecuteEvent())
77 {
78 switch (eventId)
79 {
82 events.Repeat(30s);
83 break;
84 case EVENT_TERRIFY:
86 events.Repeat(20s);
87 break;
90 events.Repeat(20s);
91 break;
92 default:
93 break;
94 }
95
97 return;
98 }
99 }
100
101private:
103};
104
uint32_t uint32
Definition Define.h:154
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_azshir_the_sleepless()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
@ DATA_AZSHIR
#define RegisterScarletMonasteryCreatureAI(ai)
void JustEngagedWith(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
boss_azshir_the_sleepless(Creature *creature)