TrinityCore
boss_huhuran.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_Huhuran
20SD%Complete: 100
21SDComment:
22SDCategory: Temple of Ahn'Qiraj
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "temple_of_ahnqiraj.h"
28
30{
33
34 SPELL_FRENZY = 26051,
39 SPELL_ACIDSPIT = 26050
40};
41
43{
44public:
45 boss_huhuran() : CreatureScript("boss_huhuran") { }
46
47 CreatureAI* GetAI(Creature* creature) const override
48 {
49 return GetAQ40AI<boss_huhuranAI>(creature);
50 }
51
52 struct boss_huhuranAI : public BossAI
53 {
55 {
56 Initialize();
57 }
58
60 {
61 Frenzy_Timer = urand(25000, 35000);
62 Wyvern_Timer = urand(18000, 28000);
63 Spit_Timer = 8000;
64 PoisonBolt_Timer = 4000;
65 NoxiousPoison_Timer = urand(10000, 20000);
66 FrenzyBack_Timer = 15000;
67
68 Frenzy = false;
69 Berserk = false;
70 }
71
78
79 bool Frenzy;
80 bool Berserk;
81
82 void Reset() override
83 {
84 Initialize();
85 _Reset();
86 }
87
88 void UpdateAI(uint32 diff) override
89 {
90 //Return since we have no target
91 if (!UpdateVictim())
92 return;
93
94 //Frenzy_Timer
95 if (!Frenzy && Frenzy_Timer <= diff)
96 {
99 Frenzy = true;
100 PoisonBolt_Timer = 3000;
101 Frenzy_Timer = urand(25000, 35000);
102 } else Frenzy_Timer -= diff;
103
104 // Wyvern Timer
105 if (Wyvern_Timer <= diff)
106 {
108 DoCast(target, SPELL_WYVERNSTING);
109 Wyvern_Timer = urand(15000, 32000);
110 } else Wyvern_Timer -= diff;
111
112 //Spit Timer
113 if (Spit_Timer <= diff)
114 {
116 Spit_Timer = urand(5000, 10000);
117 } else Spit_Timer -= diff;
118
119 //NoxiousPoison_Timer
120 if (NoxiousPoison_Timer <= diff)
121 {
123 NoxiousPoison_Timer = urand(12000, 24000);
124 } else NoxiousPoison_Timer -= diff;
125
126 //PoisonBolt only if frenzy or berserk
127 if (Frenzy || Berserk)
128 {
129 if (PoisonBolt_Timer <= diff)
130 {
132 PoisonBolt_Timer = 3000;
133 } else PoisonBolt_Timer -= diff;
134 }
135
136 //FrenzyBack_Timer
137 if (Frenzy && FrenzyBack_Timer <= diff)
138 {
140 Frenzy = false;
141 FrenzyBack_Timer = 15000;
142 } else FrenzyBack_Timer -= diff;
143
144 if (!Berserk && HealthBelowPct(31))
145 {
149 Berserk = true;
150 }
151 }
152 };
153
154};
155
157{
158 new boss_huhuran();
159}
uint32_t uint32
Definition: Define.h:142
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
void AddSC_boss_huhuran()
Huhuran
@ SPELL_ACIDSPIT
@ SPELL_WYVERNSTING
@ SPELL_NOXIOUSPOISON
@ SPELL_FRENZY
@ EMOTE_BERSERK
@ SPELL_BERSERK
@ SPELL_POISONBOLT
@ EMOTE_FRENZY_KILL
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
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
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
CreatureAI * GetAI(Creature *creature) const override
bool HealthBelowPct(uint32 pct) const
boss_huhuranAI(Creature *creature)
void UpdateAI(uint32 diff) override
@ DATA_HUHURAN