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 }
170};
171
172// 21062 - Nether Wraith
174{
175 npc_nether_wraith(Creature* creature) : ScriptedAI(creature) { }
176
177 void Reset() override
178 {
179 me->SetCorpseDelay(15, true);
181 }
182
183 void JustEngagedWith(Unit* /*who*/) override
184 {
185 _scheduler.Schedule(0s, 10s, [this](TaskContext& task)
186 {
188 DoCast(target, SPELL_ARCANE_BOLT);
189 task.Repeat(5s, 10s);
190 });
191 }
192
193 void JustDied(Unit* /*killer*/) override
194 {
196 }
197
198 void UpdateAI(uint32 diff) override
199 {
200 if (!UpdateVictim())
201 return;
202
203 _scheduler.Update(diff);
204 }
205
206private:
208};
209
210// 35284 - Summon Nether Wraiths
236
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
void AddSC_boss_pathaleon_the_calculator()
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:118
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
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
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
@ 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