TrinityCore
boss_mechano_lord_capacitus.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 "mechanar.h"
20#include "ScriptedCreature.h"
21#include "SpellInfo.h"
22#include "SpellScript.h"
23
25{
33
38
42
46};
47
49{
54 YELL_DEATH = 4
55};
56
58{
59 NPC_NETHER_CHARGE = 20405
60};
61
63{
65
72};
73
75{
77
78 void JustEngagedWith(Unit* who) override
79 {
86
87 if (IsHeroic())
89 }
90
91 void KilledUnit(Unit* /*victim*/) override
92 {
94 }
95
96 void JustDied(Unit* /*killer*/) override
97 {
98 _JustDied();
100 }
101
102 void UpdateAI(uint32 diff) override
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
110 return;
111
112 while (uint32 eventId = events.ExecuteEvent())
113 {
114 switch (eventId)
115 {
116 case EVENT_HEADCRACK:
119 break;
124 break;
129 break;
133 break;
135 {
140 Milliseconds netherChargeTimer = DUNGEON_MODE(randtime(9s, 11s), randtime(2s, 5s));
141 DoCastSelf(spellId);
143 break;
144 }
145 case EVENT_BERSERK:
147 break;
148 default:
149 break;
150 }
151
153 return;
154 }
155 }
156};
157
158// 39090 - Positive Charge
159// 39093 - Negative Charge
161{
162 bool Validate(SpellInfo const* /*spell*/) override
163 {
164 return ValidateSpellInfo(
165 {
170 });
171 }
172
173 void HandleTargets(std::list<WorldObject*>& targetList)
174 {
175 uint8 count = 0;
176 for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
177 if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
178 if (Unit* target = (*ihit)->ToUnit())
179 if (target->HasAura(GetTriggeringSpell()->Id))
180 ++count;
181
182 if (count)
183 {
184 uint32 spellId = 0;
185
188 else // if (GetSpellInfo()->Id == SPELL_NEGATIVE_CHARGE)
190
191 GetCaster()->SetAuraStack(spellId, GetCaster(), count);
192 }
193 }
194
195 void HandleDamage(SpellEffIndex /*effIndex*/)
196 {
197 if (!GetTriggeringSpell())
198 return;
199
200 Unit* target = GetHitUnit();
201
202 if (target->HasAura(GetTriggeringSpell()->Id))
204 }
205
206 void Register() override
207 {
210 }
211};
212
213// 39096 - Polarity Shift
215{
216 bool Validate(SpellInfo const* /*spell*/) override
217 {
219 }
220
221 void HandleDummy(SpellEffIndex /* effIndex */)
222 {
223 Unit* target = GetHitUnit();
224 Unit* caster = GetCaster();
225
227 .SetOriginalCaster(caster->GetGUID()));
228 }
229
230 void Register() override
231 {
233 }
234};
235
237{
241}
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
Spells
Definition: PlayerAI.cpp:32
Milliseconds randtime(Milliseconds min, Milliseconds max)
Definition: Random.cpp:62
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ALLY
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ YELL_REFLECTIVE_MAGIC_SHIELD
@ YELL_REFLECTIVE_DAMAGE_SHIELD
@ SPELL_SUMMON_NETHER_CHARGE_NE
@ SPELL_SUMMON_NETHER_CHARGE_SE
@ SPELL_REFLECTIVE_MAGIC_SHIELD
@ SPELL_SUMMON_NETHER_CHARGE_SW
@ SPELL_NETHER_CHARGE_PASSIVE
@ SPELL_SUMMON_NETHER_CHARGE_NW
@ SPELL_REFLECTIVE_DAMAGE_SHIELD
@ SPELL_POSITIVE_CHARGE_STACK
@ SPELL_NEGATIVE_CHARGE_STACK
void AddSC_boss_mechano_lord_capacitus()
@ EVENT_REFLECTIVE_DAMAGE_SHIELD
@ EVENT_SUMMON_NETHER_CHARGE
@ EVENT_REFLECTIVE_MAGIE_SHIELD
Yells
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
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
static Unit * ToUnit(Object *o)
Definition: Object.h:225
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
void PreventHitDamage()
Definition: SpellScript.h:979
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition: Unit.cpp:11665
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool Validate(SpellInfo const *) override
void HandleTargets(std::list< WorldObject * > &targetList)
bool Validate(SpellInfo const *) override
@ DATA_MECHANOLORD_CAPACITUS
Definition: mechanar.h:32
#define RegisterMechanarCreatureAI(ai_name)
Definition: mechanar.h:50
bool IsHeroic() const
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
void JustEngagedWith(Unit *who) override