TrinityCore
boss_moam.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 "Containers.h"
20#include "ruins_of_ahnqiraj.h"
21#include "ScriptedCreature.h"
22
24{
27};
28
30{
34 SPELL_SUMMON_MANA_FIEND_1 = 25681, // TARGET_DEST_CASTER_FRONT
35 SPELL_SUMMON_MANA_FIEND_2 = 25682, // TARGET_DEST_CASTER_LEFT
36 SPELL_SUMMON_MANA_FIEND_3 = 25683, // TARGET_DEST_CASTER_RIGHT
37 SPELL_ENERGIZE = 25685
38};
39
41{
47};
48
50{
53};
54
56{
57 public:
58 boss_moam() : CreatureScript("boss_moam") { }
59
60 struct boss_moamAI : public BossAI
61 {
62 boss_moamAI(Creature* creature) : BossAI(creature, DATA_MOAM)
63 {
64 Initialize();
65 }
66
68 {
69 _isStonePhase = false;
70 }
71
72 void Reset() override
73 {
74 _Reset();
76 Initialize();
78 //events.ScheduleEvent(EVENT_WIDE_SLASH, 11s);
79 }
80
81 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
82 {
83 if (!_isStonePhase && HealthBelowPct(45))
84 {
85 _isStonePhase = true;
87 }
88 }
89
90 void DoAction(int32 action) override
91 {
92 switch (action)
93 {
95 {
98 _isStonePhase = false;
99 break;
100 }
102 {
108 break;
109 }
110 default:
111 break;
112 }
113 }
114
115 void UpdateAI(uint32 diff) override
116 {
117 if (!UpdateVictim())
118 return;
119
120 events.Update(diff);
121
123 {
124 if (_isStonePhase)
128 }
129
130 if (_isStonePhase)
131 {
134 return;
135 }
136
137 // Messing up mana-drain channel
138 //if (me->HasUnitState(UNIT_STATE_CASTING))
139 // return;
140
141 while (uint32 eventId = events.ExecuteEvent())
142 {
143 switch (eventId)
144 {
147 break;
148 case EVENT_DRAIN_MANA:
149 {
150 std::list<Unit*> targetList;
151 {
153 if (ref->GetVictim()->GetTypeId() == TYPEID_PLAYER && ref->GetVictim()->GetPowerType() == POWER_MANA)
154 targetList.push_back(ref->GetVictim());
155 }
156
158
159 for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
161
163 break;
164 }/*
165 case EVENT_WIDE_SLASH:
166 DoCast(me, SPELL_WIDE_SLASH);
167 events.ScheduleEvent(EVENT_WIDE_SLASH, 11s);
168 break;
169 case EVENT_TRASH:
170 DoCast(me, SPELL_TRASH);
171 events.ScheduleEvent(EVENT_WIDE_SLASH, 15s);
172 break;*/
173 default:
174 break;
175 }
176 }
177 }
178 private:
180 };
181
182 CreatureAI* GetAI(Creature* creature) const override
183 {
184 return GetAQ20AI<boss_moamAI>(creature);
185 }
186};
187
189{
190 new boss_moam();
191}
Texts
Actions
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
@ POWER_MANA
DamageEffectType
Definition: UnitDefines.h:131
@ ACTION_STONE_PHASE_START
Definition: boss_moam.cpp:51
@ ACTION_STONE_PHASE_END
Definition: boss_moam.cpp:52
@ SPELL_TRAMPLE
Definition: boss_moam.cpp:31
@ SPELL_ARCANE_ERUPTION
Definition: boss_moam.cpp:33
@ SPELL_SUMMON_MANA_FIEND_3
Definition: boss_moam.cpp:36
@ SPELL_ENERGIZE
Definition: boss_moam.cpp:37
@ SPELL_DRAIN_MANA
Definition: boss_moam.cpp:32
@ SPELL_SUMMON_MANA_FIEND_2
Definition: boss_moam.cpp:35
@ SPELL_SUMMON_MANA_FIEND_1
Definition: boss_moam.cpp:34
void AddSC_boss_moam()
Definition: boss_moam.cpp:188
@ EMOTE_AGGRO
Definition: boss_moam.cpp:25
@ EMOTE_MANA_FULL
Definition: boss_moam.cpp:26
@ EVENT_STONE_PHASE_END
Definition: boss_moam.cpp:45
@ EVENT_STONE_PHASE
Definition: boss_moam.cpp:44
@ EVENT_DRAIN_MANA
Definition: boss_moam.cpp:43
@ EVENT_WIDE_SLASH
Definition: boss_moam.cpp:46
@ EVENT_TRAMPLE
Definition: boss_moam.cpp:42
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 ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
Trinity::IteratorPair< ThreatListIterator, std::nullptr_t > GetUnsortedThreatList() const
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:9419
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:9410
int32 GetPower(Powers power) const
Definition: Unit.cpp:9401
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
CreatureAI * GetAI(Creature *creature) const override
Definition: boss_moam.cpp:182
void RandomResize(C &container, std::size_t requestedSize)
Definition: Containers.h:67
@ DATA_MOAM
bool HealthBelowPct(uint32 pct) const
void DoAction(int32 action) override
Definition: boss_moam.cpp:90
void UpdateAI(uint32 diff) override
Definition: boss_moam.cpp:115
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
Definition: boss_moam.cpp:81
void Reset() override
Definition: boss_moam.cpp:72
boss_moamAI(Creature *creature)
Definition: boss_moam.cpp:62