TrinityCore
Loading...
Searching...
No Matches
boss_warchief_kargath_bladefist.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/* Blade Dance implementation requires recheck. Apparently SPELL_BLADE_DANCE_CHARGE can miss, as result handling half of Blade Dance sequence
19 in SpellHitTarget will stop sequence */
20
21#include "ScriptMgr.h"
22#include "Containers.h"
23#include "InstanceScript.h"
24#include "MotionMaster.h"
25#include "ObjectAccessor.h"
26#include "ScriptedCreature.h"
27#include "SpellInfo.h"
28#include "shattered_halls.h"
29
41
43{
44 // Kargath
49
50 // Warchief's Portal
54};
55
64
72
73// 16808 - Warchief Kargath Bladefist
75{
77
78 void Reset() override
79 {
80 _Reset();
81 _bladeDanceTargets.clear();
84 }
85
95
96 void DoAction(int32 action) override
97 {
98 if (action == ACTION_EXECUTIONER_TAUNT)
99 {
101 {
102 case ALLIANCE:
104 break;
105 case HORDE:
107 break;
108 default:
109 break;
110 }
111 }
112 }
113
114 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
115 {
116 if (spellInfo->Id == SPELL_BLADE_DANCE_TARGETING)
117 _bladeDanceTargets.push_back(target->GetGUID());
118 }
119
120 void JustSummoned(Creature* summon) override
121 {
122 if (summon->GetEntry() == NPC_SHATTERED_ASSASSIN)
123 summon->GetMotionMaster()->MoveRandom(5.0f);
124
125 // Allow despawn but do not engage all summons (assassins shouldn't be engaged)
126 summons.Summon(summon);
127 }
128
129 void KilledUnit(Unit* victim) override
130 {
131 if (victim->GetTypeId() == TYPEID_PLAYER)
132 Talk(SAY_SLAY);
133 }
134
135 void JustDied(Unit* /*killer*/) override
136 {
137 _JustDied();
139 }
140
141 void UpdateAI(uint32 diff) override
142 {
143 if (!UpdateVictim())
144 return;
145
146 events.Update(diff);
147
148 while (uint32 eventId = events.ExecuteEvent())
149 {
150 switch (eventId)
151 {
153 {
155 {
156 _bladeDanceTargets.clear();
157
159
160 if (!_bladeDanceTargets.empty())
161 {
163
165
167 if (target)
169
171 }
172
175 }
176 else
177 {
178 if (IsHeroic())
182 }
183 break;
184 }
185 case EVENT_CHARGE_H:
187 DoCast(target, SPELL_CHARGE_H);
188 break;
191 break;
194 break;
195 case EVENT_LEASH:
196 // He CAN evade during Blade Dance on retail, however with this distance he will not
197 if (me->GetDistance(me->GetHomePosition()) > 40.0f)
198 {
201 }
202 events.Repeat(1s);
203 break;
204 default:
205 break;
206 }
207 }
208
210 }
211
212private:
216};
217
218// 17611 - Warchief's Portal
220{
221 npc_warchiefs_portal(Creature* creature) : ScriptedAI(creature), _summonCount(0), _instance(creature->GetInstanceScript()) { }
222
223 void JustAppeared() override
224 {
225 _summonCount = 1;
226
227 _scheduler.Schedule(20s, [this](TaskContext task)
228 {
229 switch (_summonCount)
230 {
231 // In this exact order and repeat again
232 case 1: DoCastSelf(SPELL_SUMMON_HEATHEN); break;
233 case 2: DoCastSelf(SPELL_SUMMON_REAVER); break;
235 default: break;
236 }
237
238 if (_summonCount >= 3)
239 _summonCount = 1;
240 else
241 ++_summonCount;
242
243 task.Repeat(20s);
244 });
245 }
246
247 void JustSummoned(Creature* summon) override
248 {
249 // Not correct to despawn them after encounter is finished, originally they become passive and start path and despawn on reaching last waypoint
251 kargath->AI()->JustSummoned(summon);
252 }
253
254 void UpdateAI(uint32 diff) override
255 {
256 _scheduler.Update(diff);
257 }
258
259private:
263};
264
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::list< ObjectGuid > GuidList
Definition ObjectGuid.h:261
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ ALLIANCE
@ HORDE
void AddSC_boss_warchief_kargath_bladefist()
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
@ EVADE_REASON_BOUNDARY
Definition CreatureAI.h:95
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:295
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveRandom(float wanderDistance=0.0f)
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 Id
Definition SpellInfo.h:289
void Summon(Creature const *summon)
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
@ DATA_TEAM_IN_INSTANCE
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
@ DATA_KARGATH
@ ACTION_EXECUTIONER_TAUNT
@ NPC_KARGATH_BLADEFIST
#define RegisterShatteredHallsCreatureAI(ai_name)
bool IsHeroic() const
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summon) override