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#include "ScriptMgr.h"
19#include "mechanar.h"
20#include "ScriptedCreature.h"
21#include "SpellScript.h"
22#include "SpellInfo.h"
23#include "TemporarySummon.h"
24
34
55
66
67// 19220 - Pathaleon the Calculator
69{
71
83
84 void OnSpellCast(SpellInfo const* spell) override
85 {
86 switch (spell->Id)
87 {
90 break;
93 break;
94 case SPELL_FRENZY:
96 break;
97 default:
98 break;
99 }
100 }
101
102 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
103 {
104 if (me->HealthBelowPctDamaged(20, damage) && !me->HasAura(SPELL_FRENZY))
105 {
108 }
109 }
110
111 void KilledUnit(Unit* /*victim*/) override
112 {
113 Talk(SAY_SLAY);
114 }
115
116 void JustDied(Unit* /*killer*/) override
117 {
118 _JustDied();
120 }
121
122 void UpdateAI(uint32 diff) override
123 {
124 if (!UpdateVictim())
125 return;
126
127 events.Update(diff);
128
130 return;
131
132 while (uint32 eventId = events.ExecuteEvent())
133 {
134 switch (eventId)
135 {
136 case EVENT_SUMMON:
138 events.Repeat(30s, 45s);
139 break;
140 case EVENT_MANA_TAP:
142 events.Repeat(14s, 22s);
143 break;
146 events.Repeat(12s, 18s);
147 break;
148 case EVENT_DOMINATION:
150 events.Repeat(25s, 30s);
151 break;
154 events.Repeat(10s, 14s);
155 break;
156 case EVENT_SUICIDE:
158 break;
159 case EVENT_FRENZY:
161 break;
162 default:
163 break;
164 }
165
167 return;
168 }
169
171 }
172};
173
174// 21062 - Nether Wraith
176{
177 npc_nether_wraith(Creature* creature) : ScriptedAI(creature) { }
178
179 void Reset() override
180 {
181 me->SetCorpseDelay(15, true);
183 }
184
185 void JustEngagedWith(Unit* /*who*/) override
186 {
187 _scheduler.Schedule(0s, 10s, [this](TaskContext task)
188 {
190 DoCast(target, SPELL_ARCANE_BOLT);
191 task.Repeat(5s, 10s);
192 });
193 }
194
195 void JustDied(Unit* /*killer*/) override
196 {
198 }
199
200 void UpdateAI(uint32 diff) override
201 {
202 if (!UpdateVictim())
203 return;
204
205 _scheduler.Update(diff);
206
208 }
209
210private:
212};
213
214// 35284 - Summon Nether Wraiths
242
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
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:89
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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:769
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
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
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
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override