TrinityCore
boss_zum_rah.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/*
19Name: Boss_Zum_Rah
20Category: Tanaris, ZulFarrak
21*/
22
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "zulfarrak.h"
26
27enum Says
28{
31 SAY_KILL = 2
32};
33
35{
39 SPELL_HEALING_WAVE = 12491
40};
41
43{
48};
49
51{
52public:
53 boss_zum_rah() : CreatureScript("boss_zum_rah") { }
54
55 struct boss_zum_rahAI : public BossAI
56 {
58 {
59 Initialize();
60 }
61
63 {
64 _ward80 = false;
65 _ward40 = false;
66 _heal30 = false;
67 }
68
69 void Reset() override
70 {
71 _Reset();
72 me->SetFaction(FACTION_FRIENDLY); // areatrigger sets faction to enemy
73 Initialize();
74 }
75
76 void JustEngagedWith(Unit* who) override
77 {
82 }
83
84 void KilledUnit(Unit* /*victim*/) override
85 {
87 }
88
89 void UpdateAI(uint32 diff) override
90 {
91 if (!UpdateVictim())
92 return;
93
94 events.Update(diff);
95
96 while (uint32 eventId = events.ExecuteEvent())
97 {
98 switch (eventId)
99 {
103 break;
106 break;
109 break;
114 break;
115 default:
116 break;
117 }
118 }
119
120 if (!_ward80 && HealthBelowPct(80))
121 {
122 _ward80 = true;
123 Talk(SAY_WARD);
125 }
126
127 if (!_ward40 && HealthBelowPct(40))
128 {
129 _ward40 = true;
130 Talk(SAY_WARD);
132 }
133
134 if (!_heal30 && HealthBelowPct(30))
135 {
136 _heal30 = true;
138 }
139 }
140
141 private:
145
146 };
147
148 CreatureAI* GetAI(Creature* creature) const override
149 {
150 return GetZulFarrakAI<boss_zum_rahAI>(creature);
151 }
152};
153
155{
156 new boss_zum_rah();
157}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ FACTION_FRIENDLY
Says
@ SAY_KILL
@ SAY_WARD
@ SAY_SANCT_INVADE
@ SPELL_SHADOW_BOLT
@ SPELL_SHADOWBOLT_VOLLEY
@ SPELL_WARD_OF_ZUM_RAH
@ SPELL_HEALING_WAVE
void AddSC_boss_zum_rah()
@ EVENT_SHADOWBOLT_VOLLEY
@ EVENT_WARD_OF_ZUM_RAH
@ EVENT_HEALING_WAVE
@ EVENT_SHADOW_BOLT
void _JustEngagedWith(Unit *who)
EventMap events
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
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 DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetFaction(uint32 faction) override
Definition: Unit.h:859
CreatureAI * GetAI(Creature *creature) const override
bool HealthBelowPct(uint32 pct) const
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
boss_zum_rahAI(Creature *creature)
@ BOSS_WITCH_DOCTOR_ZUM_RAH
Definition: zulfarrak.h:32