TrinityCore
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
23{
27};
28
30{
34};
35
37{
39 {
40 _siphon = false;
41 }
42
43 void Reset() override
44 {
45 _Reset();
46 _siphon = false;
47 }
48
49 void JustEngagedWith(Unit* who) override
50 {
54 }
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
106{
108}
uint32_t uint32
Definition: Define.h:142
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_CALL_OF_THE_GRAVE
void AddSC_boss_azshir_the_sleepless()
void JustEngagedWith(Unit *who) override
EventMap events
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 Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
@ 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)