TrinityCore
boss_omor_the_unscarred.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_Omar_The_Unscarred
20SD%Complete: 90
21SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core support before making it more proper.
22SDCategory: Hellfire Citadel, Hellfire Ramparts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "hellfire_ramparts.h"
27#include "ObjectAccessor.h"
28#include "Player.h"
29#include "ScriptedCreature.h"
30
31enum Says
32{
38 SAY_WIPE = 5
39};
40
42{
51};
52
54{
55 public:
56
57 boss_omor_the_unscarred() : CreatureScript("boss_omor_the_unscarred") { }
58
60 {
62 {
63 Initialize();
64 SetCombatMovement(false);
65 }
66
68 {
69 OrbitalStrike_Timer = 25000;
70 ShadowWhip_Timer = 2000;
71 Aura_Timer = 10000;
73 Shadowbolt_Timer = 2000;
74 Summon_Timer = 10000;
75 SummonedCount = 0;
77 CanPullBack = false;
78 }
79
80 void Reset() override
81 {
83
84 Initialize();
85
86 _Reset();
87 }
88
89 void JustEngagedWith(Unit* who) override
90 {
93 }
94
95 void KilledUnit(Unit* /*victim*/) override
96 {
97 if (rand32() % 2)
98 return;
99
101 }
102
103 void JustSummoned(Creature* summoned) override
104 {
106
108 summoned->AI()->AttackStart(random);
109
111 }
112
113 void JustDied(Unit* /*killer*/) override
114 {
115 Talk(SAY_DIE);
116 _JustDied();
117 }
118
119 void UpdateAI(uint32 diff) override
120 {
121 if (!UpdateVictim())
122 return;
123
124 //only two may be wrong, perhaps increase timer and spawn periodically instead.
125 if (SummonedCount < 2)
126 {
127 if (Summon_Timer <= diff)
128 {
131 Summon_Timer = 15000 + rand32() % 15000;
132 }
133 else
134 Summon_Timer -= diff;
135 }
136
137 if (CanPullBack)
138 {
139 if (ShadowWhip_Timer <= diff)
140 {
142 {
143 //if unit dosen't have this flag, then no pulling back (script will attempt cast, even if orbital strike was resisted)
144 if (temp->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))
145 {
148 }
149 }
151 ShadowWhip_Timer = 2000;
152 CanPullBack = false;
153 }
154 else
155 ShadowWhip_Timer -= diff;
156 }
157 else
158 if (OrbitalStrike_Timer <= diff)
159 {
160 Unit* temp = nullptr;
162 temp = me->GetVictim();
164
165 if (temp && temp->GetTypeId() == TYPEID_PLAYER)
166 {
168 OrbitalStrike_Timer = 14000 + rand32() % 2000;
169 PlayerGUID = temp->GetGUID();
170
171 if (!PlayerGUID.IsEmpty())
172 CanPullBack = true;
173 }
174 }
175 else
176 OrbitalStrike_Timer -= diff;
177
178 if (HealthBelowPct(20))
179 {
180 if (DemonicShield_Timer <= diff)
181 {
183 DemonicShield_Timer = 15000;
184 }
185 else
186 DemonicShield_Timer -= diff;
187 }
188
189 if (Aura_Timer <= diff)
190 {
192
194 {
196 Aura_Timer = 8000 + rand32() % 8000;
197 }
198 }
199 else
200 Aura_Timer -= diff;
201
202 if (Shadowbolt_Timer <= diff)
203 {
205 {
206 target = me->GetVictim();
207
208 DoCast(target, SPELL_SHADOW_BOLT);
209 Shadowbolt_Timer = 4000 + rand32() % 2500;
210 }
211 }
212 else
213 Shadowbolt_Timer -= diff;
214 }
215
216 private:
226 };
227
228 CreatureAI* GetAI(Creature* creature) const override
229 {
230 return GetHellfireRampartsAI<boss_omor_the_unscarredAI>(creature);
231 }
232};
233
235{
237}
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 rand32()
Definition: Random.cpp:70
@ MOVEMENTFLAG_FALLING_FAR
Definition: UnitDefines.h:370
Says
@ H_SPELL_SHADOW_BOLT
@ SPELL_TREACHEROUS_AURA
@ SPELL_ORBITAL_STRIKE
@ H_SPELL_BANE_OF_TREACHERY
@ SPELL_SUMMON_FIENDISH_HOUND
@ SPELL_DEMONIC_SHIELD
void AddSC_boss_omor_the_unscarred()
void JustEngagedWith(Unit *who) override
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
CreatureAI * AI() const
Definition: Creature.h:214
bool IsEmpty() const
Definition: ObjectGuid.h:319
void Clear()
Definition: ObjectGuid.h:286
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
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 IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:699
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
Unit * GetVictim() const
Definition: Unit.h:715
CreatureAI * GetAI(Creature *creature) const override
@ DATA_OMOR_THE_UNSCARRED
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
void SetCombatMovement(bool allowMovement)
bool HealthBelowPct(uint32 pct) const