TrinityCore
Loading...
Searching...
No Matches
boss_rokmar_the_crackler.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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "the_slave_pens.h"
25
33
41
42// 17991 - Rokmar the Crackler
44{
46
47 void Reset() override
48 {
49 _Reset();
50 _frenzied = false;
51 }
52
61
62 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
63 {
64 if (!_frenzied && me->HealthBelowPctDamaged(20, damage))
65 {
66 _frenzied = true;
68 }
69 }
70
71 void UpdateAI(uint32 diff) override
72 {
73 if (!UpdateVictim())
74 return;
75
76 events.Update(diff);
77
79 return;
80
81 while (uint32 eventId = events.ExecuteEvent())
82 {
83 switch (eventId)
84 {
87 events.Repeat(20s, 30s);
88 break;
90 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30.0f))
92 events.Repeat(20s, 30s);
93 break;
96 events.Repeat(10s, 25s);
97 break;
98 case EVENT_FRENZY:
100 break;
101 default:
102 break;
103 }
104
106 return;
107 }
108 }
109
110private:
112};
113
uint32_t uint32
Definition Define.h:154
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
void AddSC_boss_rokmar_the_crackler()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void UpdateAI(uint32 diff) override
boss_rokmar_the_crackler(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *who) override
@ DATA_ROKMAR_THE_CRACKLER
#define RegisterSlavePensCreatureAI(ai_name)