TrinityCore
Loading...
Searching...
No Matches
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 "Player.h"
21#include "ScriptedCreature.h"
22#include "SpellInfo.h"
23#include "SpellScript.h"
24#include "ruins_of_ahnqiraj.h"
25
32
53
61
63{
65};
66
67// 15340 - Moam
68struct boss_moam : public BossAI
69{
70 boss_moam(Creature* creature) : BossAI(creature, DATA_MOAM), _deadManaFiendCount(0) { }
71
72 void JustAppeared() override
73 {
75 }
76
77 void Reset() override
78 {
79 _Reset();
81 }
82
94
95 void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) override
96 {
98
100 {
103 }
104 }
105
106 void OnSpellCast(SpellInfo const* spell) override
107 {
108 switch (spell->Id)
109 {
111 // Is there a spell for that? Maybe Zero Mana/Full Health but with a check to prevent setting full health if creature is in combat?
114 break;
118 break;
119 default:
120 break;
121 }
122 }
123
129
130 void JustDied(Unit* /*killer*/) override
131 {
132 _JustDied();
134 }
135
136 void UpdateAI(uint32 diff) override
137 {
138 if (!UpdateVictim())
139 return;
140
141 events.Update(diff);
142
144 return;
145
146 while (uint32 eventId = events.ExecuteEvent())
147 {
148 switch (eventId)
149 {
150 case EVENT_TRAMPLE:
152 events.Repeat(10s, 15s);
153 break;
154 case EVENT_DRAIN_MANA:
156 events.Repeat(6s);
157 break;
161 events.Repeat(130s);
162 break;
166 events.Repeat(1s);
167 break;
168 default:
169 break;
170 }
171
173 return;
174 }
175
177 }
178
179private:
181};
182
183// 25684 - Summon Mana Fiends
185{
187
188 bool Validate(SpellInfo const* /*spellInfo*/) override
189 {
190 return ValidateSpellInfo(
191 {
195 });
196 }
197
198 void HandleScript(SpellEffIndex /*effIndex*/)
199 {
200 Unit* caster = GetCaster();
201 caster->CastSpell(caster, SPELL_SUMMON_MANA_FIEND_1, true);
202 caster->CastSpell(caster, SPELL_SUMMON_MANA_FIEND_2, true);
203 caster->CastSpell(caster, SPELL_SUMMON_MANA_FIEND_3, true);
204 }
205
210};
211
212// 25685 - Energize
214{
216
217 void OnPeriodic(AuraEffect const* /*aurEff*/)
218 {
219 if (GetTarget()->GetPower(POWER_MANA) == GetTarget()->GetMaxPower(POWER_MANA))
220 Remove();
221 }
222
227};
228
229// 25676 - Drain Mana
231{
233
234 bool Validate(SpellInfo const* /*spellInfo*/) override
235 {
237 }
238
239 void FilterTargets(std::list<WorldObject*>& targets)
240 {
242 {
243 return target->IsPlayer() && target->ToPlayer()->GetPowerType() == POWER_MANA;
244 }, 6);
245 }
246
247 void HandleScript(SpellEffIndex /*effIndex*/)
248 {
250 }
251
257};
258
259// 25671 - Drain Mana
260// 25755 - Drain Mana
280
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
@ POWER_MANA
@ SPELL_AURA_PERIODIC_ENERGIZE
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
MoamTexts
Definition boss_moam.cpp:27
@ EMOTE_AGGRO
Definition boss_moam.cpp:28
@ EMOTE_MANA_FULL
Definition boss_moam.cpp:29
@ EMOTE_ENERGIZE
Definition boss_moam.cpp:30
MoamMisc
Definition boss_moam.cpp:63
@ MAX_MANA_FIENDS
Definition boss_moam.cpp:64
void AddSC_boss_moam()
MoamSpells
Definition boss_moam.cpp:34
@ SPELL_SUMMON_MANA_FIENDS
Definition boss_moam.cpp:39
@ SPELL_TRAMPLE
Definition boss_moam.cpp:36
@ SPELL_DRAIN_MANA_VISUAL
Definition boss_moam.cpp:51
@ SPELL_ARCANE_ERUPTION
Definition boss_moam.cpp:38
@ SPELL_SUMMON_MANA_FIEND_3
Definition boss_moam.cpp:49
@ SPELL_ZERO_MANA_FULL_HEALTH
Definition boss_moam.cpp:43
@ SPELL_ENERGIZE
Definition boss_moam.cpp:40
@ SPELL_DROP_OBSIDIAN
Definition boss_moam.cpp:44
@ SPELL_DRAIN_MANA
Definition boss_moam.cpp:37
@ SPELL_DRAIN_MANA_EFFECT
Definition boss_moam.cpp:50
@ SPELL_SUMMON_MANA_FIEND_2
Definition boss_moam.cpp:48
@ SPELL_SUMMON_MANA_FIEND_1
Definition boss_moam.cpp:47
MoamEvents
Definition boss_moam.cpp:55
@ EVENT_STONE_PHASE
Definition boss_moam.cpp:58
@ EVENT_DRAIN_MANA
Definition boss_moam.cpp:57
@ EVENT_ARCANE_ERUPTION
Definition boss_moam.cpp:59
@ EVENT_TRAMPLE
Definition boss_moam.cpp:56
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
bool IsPlayer() const
Definition Object.h:179
static Player * ToPlayer(Object *o)
Definition Object.h:180
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Definition Unit.h:769
Powers GetPowerType() const
Definition Unit.h:931
uint32 GetMaxPower(Powers power) const
Definition Unit.h:936
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool force=false)
Definition Unit.cpp:9421
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
uint32 GetPower(Powers power) const
Definition Unit.h:934
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_moam_drain_mana_effect)
bool Validate(SpellInfo const *) override
void HandleScript(SpellEffIndex)
void Register() override
PrepareSpellScript(spell_moam_drain_mana)
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
void OnPeriodic(AuraEffect const *)
PrepareAuraScript(spell_moam_energize)
void Register() override
void HandleScript(SpellEffIndex)
PrepareSpellScript(spell_moam_summon_mana_fiends)
bool Validate(SpellInfo const *) override
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:66
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_MOAM
void JustDied(Unit *) override
void JustReachedHome() override
void Reset() override
Definition boss_moam.cpp:77
void OnSpellCast(SpellInfo const *spell) override
void SummonedCreatureDies(Creature *, Unit *) override
Definition boss_moam.cpp:95
boss_moam(Creature *creature)
Definition boss_moam.cpp:70
void UpdateAI(uint32 diff) override
uint8 _deadManaFiendCount
void JustAppeared() override
Definition boss_moam.cpp:72
void JustEngagedWith(Unit *who) override
Definition boss_moam.cpp:83