TrinityCore
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/* ScriptData
19SDName: Boss Pathaleon the Calculator
20SD%Complete: 50
21SDComment: Event missing. Script for himself 99% blizzlike.
22SDCategory: Tempest Keep, The Mechanar
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "mechanar.h"
27#include "ScriptedCreature.h"
28#include "TemporarySummon.h"
29
30enum Says
31{
37 SAY_DEATH = 5
38};
39
41{
46 SPELL_FRENZY = 36992,
47 SPELL_SUMMON_NETHER_WRAITH_1 = 35285, // Not scripted
48 SPELL_SUMMON_NETHER_WRAITH_2 = 35286, // Not scripted
49 SPELL_SUMMON_NETHER_WRAITH_3 = 35287, // Not scripted
50 SPELL_SUMMON_NETHER_WRAITH_4 = 35288, // Not scripted
51 SPELL_DETONATION = 35058, // Used by Nether Wraith
52 SPELL_ARCANE_MISSILES = 35034 // Used by Nether Wraith
53};
54
56{
62};
63
65{
66 NPC_NETHER_WRAITH = 21062
67};
68
70{
72
73 void JustEngagedWith(Unit* who) override
74 {
82 }
83
84 void KilledUnit(Unit* /*victim*/) override
85 {
87 }
88
89 void JustDied(Unit* /*killer*/) override
90 {
91 _JustDied();
93 }
94
95 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
96 {
97 if (me->HealthBelowPctDamaged(20, damage) && !me->HasAura(SPELL_FRENZY))
98 {
101 }
102 }
103
104 void UpdateAI(uint32 diff) override
105 {
106 if (!UpdateVictim())
107 return;
108
109 events.Update(diff);
110
112 return;
113
114 while (uint32 eventId = events.ExecuteEvent())
115 {
116 switch (eventId)
117 {
118 case EVENT_SUMMON:
119 for (uint8 i = 0; i < 3; ++i)
120 {
122 {
124 Wraith->AI()->AttackStart(target);
125 }
126 }
129 break;
130 case EVENT_MANA_TAP:
133 break;
137 break;
138 case EVENT_DOMINATION:
142 break;
143 case EVENT_ARCANE_EXPLOSION: // Heroic only
146 break;
147 default:
148 break;
149 }
150
152 return;
153 }
154 }
155};
156
158{
159 npc_nether_wraith(Creature* creature) : ScriptedAI(creature)
160 {
161 Initialize();
162 }
163
165 {
166 ArcaneMissiles_Timer = urand(1000, 4000);
167 Detonation_Timer = 20000;
168 Die_Timer = 2200;
169 Detonation = false;
170 }
171
176
177 void Reset() override
178 {
179 Initialize();
180 }
181
182 void JustEngagedWith(Unit* /*who*/) override { }
183
184 void UpdateAI(uint32 diff) override
185 {
186 if (!UpdateVictim())
187 return;
188
189 if (ArcaneMissiles_Timer <= diff)
190 {
193 else
195 ArcaneMissiles_Timer = urand(5000, 10000);
196 }
197 else
199
200 if (!Detonation)
201 {
202 if (Detonation_Timer <= diff)
203 {
205 Detonation = true;
206 }
207 else
208 Detonation_Timer -= diff;
209 }
210
211 if (Detonation)
212 {
213 if (Die_Timer <= diff)
214 {
216 return;
217 }
218 else
219 Die_Timer -= diff;
220 }
221 }
222};
223
225{
228}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
Says
void AddSC_boss_pathaleon_the_calculator()
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
@ DATA_PATHALEON_THE_CALCULATOR
Definition: mechanar.h:34
#define RegisterMechanarCreatureAI(ai_name)
Definition: mechanar.h:50
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void JustEngagedWith(Unit *) override
npc_nether_wraith(Creature *creature)
void UpdateAI(uint32 diff) override