TrinityCore
Loading...
Searching...
No Matches
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 "Player.h"
21#include "ScriptedCreature.h"
22#include "SpellInfo.h"
23#include "SpellScript.h"
24
33
55
65
66// 19219 - Mechano-Lord Capacitus
68{
70
83
84 void KilledUnit(Unit* /*victim*/) override
85 {
87 }
88
89 void JustDied(Unit* /*killer*/) override
90 {
91 _JustDied();
93 }
94
95 void UpdateAI(uint32 diff) override
96 {
97 if (!UpdateVictim())
98 return;
99
100 events.Update(diff);
101
103 return;
104
105 while (uint32 eventId = events.ExecuteEvent())
106 {
107 switch (eventId)
108 {
109 case EVENT_HEADCRACK:
111 events.Repeat(10s);
112 break;
116 events.Repeat(30s);
117 break;
121 events.Repeat(30s);
122 break;
125 events.Repeat(45s, 60s);
126 break;
128 {
133 Milliseconds netherChargeTimer = DUNGEON_MODE(randtime(9s, 11s), randtime(2s, 5s));
134 DoCastSelf(spellId);
135 events.Repeat(netherChargeTimer);
136 break;
137 }
138 case EVENT_BERSERK:
140 break;
141 default:
142 break;
143 }
144
146 return;
147 }
148
150 }
151};
152
153// 39090 - Positive Charge
154// 39093 - Negative Charge
156{
158
159 bool Validate(SpellInfo const* /*spell*/) override
160 {
161 return ValidateSpellInfo(
162 {
167 });
168 }
169
170 void HandleTargets(std::list<WorldObject*>& targetList)
171 {
172 uint8 count = 0;
173 for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
174 if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
175 if (Player* target = (*ihit)->ToPlayer())
176 if (target->HasAura(GetTriggeringSpell()->Id))
177 ++count;
178
179 if (count)
180 {
181 uint32 spellId = 0;
182
185 else // if (GetSpellInfo()->Id == SPELL_NEGATIVE_CHARGE)
187
188 GetCaster()->SetAuraStack(spellId, GetCaster(), count);
189 }
190 }
191
192 void HandleDamage(SpellEffIndex /*effIndex*/)
193 {
194 if (!GetTriggeringSpell())
195 return;
196
197 Unit* target = GetHitUnit();
198
199 if (target->HasAura(GetTriggeringSpell()->Id))
201 }
202
208};
209
210// 39096 - Polarity Shift
233
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
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:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ TARGET_UNIT_SRC_AREA_ALLY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ EVENT_REFLECTIVE_DAMAGE_SHIELD
@ EVENT_REFLECTIVE_MAGIE_SHIELD
@ SPELL_SUMMON_NETHER_CHARGE_NE
@ SPELL_SUMMON_NETHER_CHARGE_SE
@ SPELL_REFLECTIVE_MAGIC_SHIELD
@ SPELL_SUMMON_NETHER_CHARGE_SW
@ SPELL_SUMMON_NETHER_CHARGE_NW
@ SPELL_REFLECTIVE_DAMAGE_SHIELD
void AddSC_boss_mechano_lord_capacitus()
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
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
static Player * ToPlayer(Object *o)
Definition Object.h:180
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
void PreventHitDamage()
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition Unit.cpp:12010
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_capacitus_polarity_charge)
bool Validate(SpellInfo const *) override
void HandleTargets(std::list< WorldObject * > &targetList)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_capacitus_polarity_shift)
@ 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