TrinityCore
boss_nerubenkan.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_Nerubenkan
20SD%Complete: 70
21SDComment:
22SDCategory: Stratholme
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "stratholme.h"
28
30{
35};
36
38{
39public:
40 boss_nerubenkan() : CreatureScript("boss_nerubenkan") { }
41
42 CreatureAI* GetAI(Creature* creature) const override
43 {
44 return GetStratholmeAI<boss_nerubenkanAI>(creature);
45 }
46
47 struct boss_nerubenkanAI : public BossAI
48 {
50 {
51 Initialize();
52 }
53
55 {
56 CryptScarabs_Timer = 3000;
57 EncasingWebs_Timer = 7000;
58 PierceArmor_Timer = 19000;
60 }
61
66
67 void Reset() override
68 {
69 _Reset();
70 Initialize();
71 }
72
73 void RaiseUndeadScarab(Unit* victim)
74 {
75 if (Creature* pUndeadScarab = DoSpawnCreature(10876, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180s))
76 if (pUndeadScarab->AI())
77 pUndeadScarab->AI()->AttackStart(victim);
78 }
79
80 void UpdateAI(uint32 diff) override
81 {
82 if (!UpdateVictim())
83 return;
84
85 //EncasingWebs
86 if (EncasingWebs_Timer <= diff)
87 {
89 EncasingWebs_Timer = 30000;
90 } else EncasingWebs_Timer -= diff;
91
92 //PierceArmor
93 if (PierceArmor_Timer <= diff)
94 {
95 if (urand(0, 3) < 2)
97 PierceArmor_Timer = 35000;
98 } else PierceArmor_Timer -= diff;
99
100 //CryptScarabs_Timer
101 if (CryptScarabs_Timer <= diff)
102 {
104 CryptScarabs_Timer = 20000;
105 } else CryptScarabs_Timer -= diff;
106
107 //RaiseUndeadScarab
108 if (RaiseUndeadScarab_Timer <= diff)
109 {
112 } else RaiseUndeadScarab_Timer -= diff;
113 }
114 };
115
116};
117
119{
120 new boss_nerubenkan();
121}
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
Spells
Definition: PlayerAI.cpp:32
int32 irand(int32 min, int32 max)
Definition: Random.cpp:35
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ SPELL_PIERCEARMOR
@ SPELL_CRYPT_SCARABS
@ SPELL_ENCASINGWEBS
@ SPELL_RAISEUNDEADSCARAB
void AddSC_boss_nerubenkan()
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
CreatureAI * GetAI(Creature *creature) const override
@ BOSS_NERUB_ENKAN
Definition: stratholme.h:36
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, Milliseconds despawntime)
void UpdateAI(uint32 diff) override