TrinityCore
Loading...
Searching...
No Matches
boss_pathaleon_the_calculator.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/*
19 * Timers requires to be revisited
20 * Bridge event is NYI
21 */
22
23#include "ScriptMgr.h"
24#include "mechanar.h"
25#include "ScriptedCreature.h"
26#include "SpellScript.h"
27#include "SpellInfo.h"
28
39
41{
42 // Pathaleon - Initial
44
45 // Pathaleon - Combat
51
53 SPELL_FRENZY = 36992,
54
55 // Nether Wraith
58
59 // Scripts
63};
64
75
76// 19220 - Pathaleon the Calculator
78{
80
87
88 void Reset() override
89 {
90 _Reset();
91 _frenzied = false;
92 }
93
107
108 void OnSpellCast(SpellInfo const* spellInfo) override
109 {
110 switch (spellInfo->Id)
111 {
114 break;
115 case SPELL_DOMINATION:
117 break;
118 case SPELL_FRENZY:
120 break;
121 default:
122 break;
123 }
124 }
125
126 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
127 {
128 if (!_frenzied && me->HealthBelowPctDamaged(20, damage))
129 {
130 _frenzied = true;
133 }
134 }
135
136 void KilledUnit(Unit* /*victim*/) override
137 {
138 Talk(SAY_SLAY);
139 }
140
141 void JustDied(Unit* /*killer*/) override
142 {
143 _JustDied();
145 }
146
147 void UpdateAI(uint32 diff) override
148 {
149 if (!UpdateVictim())
150 return;
151
152 events.Update(diff);
153
155 return;
156
157 while (uint32 eventId = events.ExecuteEvent())
158 {
159 switch (eventId)
160 {
161 case EVENT_SUMMON:
163 events.Repeat(50s);
164 break;
165 case EVENT_MANA_TAP:
166 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* unit) { return unit && unit->GetPowerType() == POWER_MANA; }))
167 DoCast(target, SPELL_MANA_TAP);
168 events.Repeat(20s, 30s);
169 break;
172 events.Repeat(40s, 50s);
173 break;
174 case EVENT_DOMINATION:
175 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
176 DoCast(target, SPELL_DOMINATION);
177 events.Repeat(30s, 50s);
178 break;
181 events.Repeat(10s, 25s);
182 break;
183 case EVENT_SUICIDE:
185 break;
186 case EVENT_FRENZY:
188 break;
189 default:
190 break;
191 }
192
194 return;
195 }
196
198 }
199
200private:
202};
203
204// 21062 - Nether Wraith
206{
208
209 void InitializeAI() override
210 {
211 me->SetCorpseDelay(15, true);
213 }
214
215 void Reset() override
216 {
218 }
219
220 void JustEngagedWith(Unit* /*who*/) override
221 {
222 _scheduler.Schedule(0s, 10s, [this](TaskContext task)
223 {
225 DoCast(target, SPELL_ARCANE_BOLT);
226 task.Repeat(5s, 10s);
227 });
228 }
229
230 void JustDied(Unit* /*killer*/) override
231 {
233 }
234
235 void UpdateAI(uint32 diff) override
236 {
237 if (!UpdateVictim())
238 return;
239
240 _scheduler.Update(diff);
241
243 }
244
245private:
247};
248
249// 35284 - Summon Nether Wraiths
277
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ EMOTE_STATE_READY1H
@ POWER_MANA
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
void AddSC_boss_pathaleon_the_calculator()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
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
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual void InitializeAI()
Definition UnitAI.cpp:36
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:783
Powers GetPowerType() const
Definition Unit.h:945
void SetEmoteState(Emote emote)
Definition Unit.h:981
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_pathaleon_summon_nether_wraiths)
@ DATA_PATHALEON_THE_CALCULATOR
Definition mechanar.h:34
#define RegisterMechanarCreatureAI(ai_name)
Definition mechanar.h:50
bool IsHeroic() const
ScriptedAI(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override