TrinityCore
Loading...
Searching...
No Matches
boss_shirrak_the_dead_watcher.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
19Name: Boss_Shirrak_the_dead_watcher
20%Complete: 80
21Comment: InhibitMagic should stack slower far from the boss, proper Visual for Focus Fire, heroic implemented
22Category: Auchindoun, Auchenai Crypts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "auchenai_crypts.h"
27#include "Map.h"
28#include "ObjectAccessor.h"
29#include "Player.h"
30#include "ScriptedCreature.h"
31#include "InstanceScript.h"
32
34{
38
40
41 SPELL_FOCUS_FIRE_VISUAL = 42075 //need to find better visual
42};
43
44enum Say
45{
47};
48
50{
51 NPC_FOCUS_FIRE = 18374
52};
53
55{
60
62 {
64 Attractmagic_Timer = 28000;
66 FocusFire_Timer = 17000;
68 }
69
74
76
77 void Reset() override
78 {
79 Initialize();
80 _Reset();
81 }
82
83 void JustSummoned(Creature* summoned) override
84 {
85 if (summoned && summoned->GetEntry() == NPC_FOCUS_FIRE)
86 {
87 summoned->CastSpell(summoned, SPELL_FOCUS_FIRE_VISUAL, false);
88 summoned->SetFaction(me->GetFaction());
89 summoned->SetLevel(me->GetLevel());
91
92 if (Unit* pFocusedTarget = ObjectAccessor::GetUnit(*me, FocusedTargetGUID))
93 summoned->AI()->AttackStart(pFocusedTarget);
94 }
95 BossAI::JustSummoned(summoned);
96 }
97
98 void UpdateAI(uint32 diff) override
99 {
100 //Inhibitmagic_Timer
101 if (Inhibitmagic_Timer <= diff)
102 {
103 instance->instance->DoOnPlayers([this](Player* i_pl)
104 {
105 float dist = i_pl->GetDistance(me);
106 if (i_pl->IsAlive() && i_pl->GetDistance(me) < 45.0f)
107 {
108 i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
109 me->AddAura(SPELL_INHIBITMAGIC, i_pl);
110 if (dist < 35)
111 me->AddAura(SPELL_INHIBITMAGIC, i_pl);
112 if (dist < 25)
113 me->AddAura(SPELL_INHIBITMAGIC, i_pl);
114 if (dist < 15)
115 me->AddAura(SPELL_INHIBITMAGIC, i_pl);
116 }
117 });
118 Inhibitmagic_Timer = 3000 + (rand32() % 1000);
119 } else Inhibitmagic_Timer -= diff;
120
121 //Return since we have no target
122 if (!UpdateVictim())
123 return;
124
125 //Attractmagic_Timer
126 if (Attractmagic_Timer <= diff)
127 {
129 Attractmagic_Timer = 30000;
131 } else Attractmagic_Timer -= diff;
132
133 //Carnivorousbite_Timer
134 if (Carnivorousbite_Timer <= diff)
135 {
137 Carnivorousbite_Timer = 10000;
138 } else Carnivorousbite_Timer -= diff;
139
140 //FocusFire_Timer
141 if (FocusFire_Timer <= diff)
142 {
143 // Summon Focus Fire & Emote
145 if (target && target->GetTypeId() == TYPEID_PLAYER && target->IsAlive())
146 {
147 FocusedTargetGUID = target->GetGUID();
149 Talk(EMOTE_FOCUSED, target);
150 }
151 FocusFire_Timer = 15000 + (rand32() % 5000);
152 } else FocusFire_Timer -= diff;
153 }
154};
155
157{
158 npc_focus_fire(Creature* creature) : ScriptedAI(creature)
159 {
160 Initialize();
161 }
162
164 {
165 FieryBlast_Timer = 3000 + (rand32() % 1000);
166 fiery1 = fiery2 = true;
167 }
168
171
172 void Reset() override
173 {
174 Initialize();
175 }
176
177 void UpdateAI(uint32 diff) override
178 {
179 //Return since we have no target
180 if (!UpdateVictim())
181 return;
182
183 //FieryBlast_Timer
184 if (fiery2 && FieryBlast_Timer <= diff)
185 {
187
188 if (fiery1) fiery1 = false;
189 else if (fiery2) fiery2 = false;
190
191 FieryBlast_Timer = 1000;
192 } else FieryBlast_Timer -= diff;
193 }
194};
195
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_TIMED_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 rand32()
Definition Random.cpp:70
@ UNIT_STATE_ROOT
Definition Unit.h:271
Creatures
@ DATA_SHIRRAK_THE_DEAD_WATCHER
#define RegisterAuchenaiCryptsCreatureAI(ai_name)
void AddSC_boss_shirrak_the_dead_watcher()
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustSummoned(Creature *summon) override
bool UpdateVictim()
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Creature *const me
Definition CreatureAI.h:63
CreatureAI * AI() const
Definition Creature.h:228
InstanceMap * instance
void DoOnPlayers(T &&fn)
Definition Map.h:406
void Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
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:635
void SetFaction(uint32 faction) override
Definition Unit.h:872
bool IsAlive() const
Definition Unit.h:1185
void AddUnitState(uint32 f)
Definition Unit.h:742
uint32 GetFaction() const override
Definition Unit.h:871
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition Unit.cpp:9956
uint8 GetLevel() const
Definition Unit.h:757
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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:1398
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:432
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetPositionZ() const
Definition Position.h:89
void JustSummoned(Creature *summoned) override
void UpdateAI(uint32 diff) override
npc_focus_fire(Creature *creature)