Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_pathaleon_the_calculator.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Boss Pathaleon the Calculator
8SD%Complete: 50
9SDComment: Event missing. Script for himself 99% blizzlike.
10SDCategory: Tempest Keep, The Mechanar
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15#include "mechanar.h"
16
26
28{
33 SPELL_FRENZY = 36992,
34 SPELL_SUMMON_NETHER_WRAITH_1 = 35285, // Not scripted
35 SPELL_SUMMON_NETHER_WRAITH_2 = 35286, // Not scripted
36 SPELL_SUMMON_NETHER_WRAITH_3 = 35287, // Not scripted
37 SPELL_SUMMON_NETHER_WRAITH_4 = 35288, // Not scripted
38 SPELL_DETONATION = 35058, // Used by Nether Wraith
39 SPELL_ARCANE_MISSILES = 35034 // Used by Nether Wraith
40};
41
50
52{
54};
55
57{
58 public:
59 boss_pathaleon_the_calculator(): CreatureScript("boss_pathaleon_the_calculator") { }
60
62 {
64
65 void EnterCombat(Unit* /*who*/) OVERRIDE
66 {
68 events.ScheduleEvent(EVENT_SUMMON, 30000);
69 events.ScheduleEvent(EVENT_MANA_TAP, std::rand() % 20000 + 12000);
70 events.ScheduleEvent(EVENT_ARCANE_TORRENT, std::rand() % 25000 + 16000);
71 events.ScheduleEvent(EVENT_DOMINATION, std::rand() % 40000 + 25000);
72 events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, std::rand() % 13000 + 8000);
74 }
75
76 void KilledUnit(Unit* /*victim*/) OVERRIDE
77 {
79 }
80
81 void JustDied(Unit* /*killer*/) OVERRIDE
82 {
83 _JustDied();
85 }
86
87 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
88 {
89 if (me->HealthBelowPctDamaged(20, damage) && !me->HasAura(SPELL_FRENZY))
90 {
93 }
94 }
95
97 {
98 if (!UpdateVictim())
99 return;
100
101 events.Update(diff);
102
103 if (me->HasUnitState(UNIT_STATE_CASTING))
104 return;
105
106 while (uint32 eventId = events.ExecuteEvent())
107 {
108 switch (eventId)
109 {
110 case EVENT_SUMMON:
111 for (uint8 i = 0; i < 3; ++i)
112 {
113 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
114 {
115 if (Creature* Wraith = me->SummonCreature(NPC_NETHER_WRAITH, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000))
116 Wraith->AI()->AttackStart(target);
117 }
118 }
120 events.ScheduleEvent(EVENT_SUMMON, std::rand() % 45000 + 30000);
121 break;
122 case EVENT_MANA_TAP:
124 events.ScheduleEvent(EVENT_MANA_TAP, std::rand() % 22000 + 14000);
125 break;
128 events.ScheduleEvent(EVENT_ARCANE_TORRENT, std::rand() % 18000 + 12000);
129 break;
130 case EVENT_DOMINATION:
133 events.ScheduleEvent(EVENT_DOMINATION, std::rand() % 30000 + 25000);
134 break;
135 case EVENT_ARCANE_EXPLOSION: // Heroic only
137 events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, std::rand() % 14000 + 10000);
138 break;
139 default:
140 break;
141 }
142 }
143
145 }
146 };
147
149 {
150 return new boss_pathaleon_the_calculatorAI(creature);
151 }
152};
153
155{
156 public:
157 npc_nether_wraith() : CreatureScript("npc_nether_wraith") { }
158
160 {
161 npc_nether_wraithAI(Creature* creature) : ScriptedAI(creature) { }
162
167
169 {
170 ArcaneMissiles_Timer = std::rand() % 4000 + 1000;
171 Detonation_Timer = 20000;
172 Die_Timer = 2200;
173 Detonation = false;
174 }
175
176 void EnterCombat(Unit* /*who*/) OVERRIDE { }
177
179 {
180 if (!UpdateVictim())
181 return;
182
183 if (ArcaneMissiles_Timer <= diff)
184 {
185 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
187 else
189 ArcaneMissiles_Timer = std::rand() % 10000 + 5000;
190 }
191 else
193
194 if (!Detonation)
195 {
196 if (Detonation_Timer <= diff)
197 {
199 Detonation = true;
200 }
201 else
202 Detonation_Timer -= diff;
203 }
204
205 if (Detonation)
206 {
207 if (Die_Timer <= diff)
208 {
209 me->setDeathState(DeathState::JUST_DIED);
210 me->RemoveCorpse();
211 }
212 else
213 Die_Timer -= diff;
214 }
216 }
217 };
218
220 {
221 return new npc_nether_wraithAI(creature);
222 }
223};
224
230
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ JUST_DIED
Definition Unit.h:504
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
Creatures
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SAY_ENRAGE
@ SPELL_FRENZY
@ EVENT_SUMMON
@ SPELL_ARCANE_MISSILES
void AddSC_boss_pathaleon_the_calculator()
@ EVENT_ARCANE_EXPLOSION
@ SPELL_DOMINATION
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_PATHALEON_THE_CALCULATOR
Definition mechanar.h:17
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
@ H_SPELL_ARCANE_EXPLOSION