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 "ScriptedCreature.h"
21#include "SpellInfo.h"
22#include "SpellScript.h"
23
32
54
64
65// 19219 - Mechano-Lord Capacitus
67{
69
82
83 void KilledUnit(Unit* /*victim*/) override
84 {
86 }
87
88 void JustDied(Unit* /*killer*/) override
89 {
90 _JustDied();
92 }
93
94 void UpdateAI(uint32 diff) override
95 {
96 if (!UpdateVictim())
97 return;
98
99 events.Update(diff);
100
102 return;
103
104 while (uint32 eventId = events.ExecuteEvent())
105 {
106 switch (eventId)
107 {
108 case EVENT_HEADCRACK:
110 events.Repeat(10s);
111 break;
115 events.Repeat(30s);
116 break;
120 events.Repeat(30s);
121 break;
124 events.Repeat(45s, 60s);
125 break;
127 {
132 Milliseconds netherChargeTimer = DUNGEON_MODE(randtime(9s, 11s), randtime(2s, 5s));
133 DoCastSelf(spellId);
134 events.Repeat(netherChargeTimer);
135 break;
136 }
137 case EVENT_BERSERK:
139 break;
140 default:
141 break;
142 }
143
145 return;
146 }
147 }
148};
149
150// 39090 - Positive Charge
151// 39093 - Negative Charge
153{
154 bool Validate(SpellInfo const* /*spell*/) override
155 {
156 return ValidateSpellInfo(
157 {
162 });
163 }
164
165 void HandleTargets(std::list<WorldObject*>& targetList)
166 {
167 uint8 count = 0;
168 for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
169 if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
170 if (Unit* target = (*ihit)->ToUnit())
171 if (target->HasAura(GetTriggeringSpell()->Id))
172 ++count;
173
174 if (count)
175 {
176 uint32 spellId = 0;
177
180 else // if (GetSpellInfo()->Id == SPELL_NEGATIVE_CHARGE)
182
183 GetCaster()->SetAuraStack(spellId, GetCaster(), count);
184 }
185 }
186
187 void HandleDamage(SpellEffIndex /*effIndex*/)
188 {
189 if (!GetTriggeringSpell())
190 return;
191
192 Unit* target = GetHitUnit();
193
194 if (target->HasAura(GetTriggeringSpell()->Id))
196 }
197
203};
204
205// 39096 - Polarity Shift
227
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
Milliseconds randtime(Milliseconds min, Milliseconds max)
Definition Random.cpp:63
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCHOOL_DAMAGE
@ TARGET_UNIT_SRC_AREA_ALLY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ 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()
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
Unit * ToUnit()
Definition Object.h:116
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
void PreventHitDamage()
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellInfo const * GetSpellInfo() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:647
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition Unit.cpp:12391
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
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
CastSpellExtraArgs & SetOriginalCaster(ObjectGuid const &guid)
bool IsHeroic() const
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const