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/*
19 * Blade Dance implementation requires additional research
20 * Timers requires to be revisited
21 */
22
23#include "ScriptMgr.h"
24#include "Containers.h"
25#include "InstanceScript.h"
26#include "MotionMaster.h"
27#include "ObjectAccessor.h"
28#include "ScriptedCreature.h"
29#include "SpellInfo.h"
30#include "SpellScript.h"
31#include "shattered_halls.h"
32
44
46{
47 // Kargath
50
51 // Warchief's Portal
55
56 // Scripts
59};
60
69
77
78// 16808 - Warchief Kargath Bladefist
80{
82
83 void Reset() override
84 {
85 _Reset();
87 }
88
100
101 void DoAction(int32 action) override
102 {
103 if (action == ACTION_EXECUTIONER_TAUNT)
104 {
106 {
107 case ALLIANCE:
109 break;
110 case HORDE:
112 break;
113 default:
114 break;
115 }
116 }
117 }
118
119 void JustSummoned(Creature* summon) override
120 {
121 if (summon->GetEntry() == NPC_SHATTERED_ASSASSIN)
122 summon->GetMotionMaster()->MoveRandom(5.0f);
123
124 // Allow despawn but do not engage all summons (assassins shouldn't be engaged)
125 summons.Summon(summon);
126 }
127
128 void KilledUnit(Unit* /*victim*/) override
129 {
130 Talk(SAY_SLAY);
131 }
132
133 void JustDied(Unit* /*killer*/) override
134 {
135 _JustDied();
137 }
138
139 void UpdateAI(uint32 diff) override
140 {
141 if (!UpdateVictim())
142 return;
143
144 events.Update(diff);
145
146 while (uint32 eventId = events.ExecuteEvent())
147 {
148 switch (eventId)
149 {
152 {
156 }
157 else
158 {
159 if (IsHeroic())
163 }
164 break;
165 case EVENT_CHARGE_H:
167 DoCast(target, SPELL_CHARGE_H);
168 break;
171 break;
174 break;
175 case EVENT_LEASH:
176 // He CAN evade during Blade Dance on retail, however with this distance he will not
177 if (me->GetDistance(me->GetHomePosition()) > 40.0f)
178 {
181 }
182 events.Repeat(1s);
183 break;
184 default:
185 break;
186 }
187 }
188
190 }
191
192private:
194};
195
196// 17611 - Warchief's Portal
198{
199 npc_warchiefs_portal(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
200
201 void JustAppeared() override
202 {
204 .Schedule(20s, [this](TaskContext task)
205 {
207 task.Repeat(60s);
208 })
209 .Schedule(40s, [this](TaskContext task)
210 {
212 task.Repeat(60s);
213 })
214 .Schedule(60s, [this](TaskContext task)
215 {
217 task.Repeat(60s);
218 });
219 }
220
221 void JustSummoned(Creature* summon) override
222 {
223 // Not correct to despawn them after encounter is finished, originally they become passive and start path and despawn on reaching last waypoint
225 kargath->AI()->JustSummoned(summon);
226 }
227
228 void UpdateAI(uint32 diff) override
229 {
230 _scheduler.Update(diff);
231 }
232
233private:
236};
237
238// 30738 - Blade Dance Targeting
240{
242
243 bool Validate(SpellInfo const* /*spellInfo*/) override
244 {
246 }
247
248 void FilterTargets(std::list<WorldObject*>& targets)
249 {
250 if (targets.empty())
251 return;
252
254
255 _selectedTargetGuid = target->GetGUID();
256 }
257
258 void HandleDummy(SpellEffIndex /*effIndex*/)
259 {
260 Unit* target = GetHitUnit();
261 if (target->GetGUID() != _selectedTargetGuid)
262 return;
263
264 Unit* caster = GetCaster();
265 caster->CastSpell(target, SPELL_BLADE_DANCE_CHARGE);
266 caster->CastSpell(nullptr, SPELL_BLADE_DANCE);
267 }
268
274
275private:
277};
278
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_SRC_AREA_ENTRY
@ ALLIANCE
@ HORDE
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
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:304
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)
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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:783
MotionMaster * GetMotionMaster()
Definition Unit.h:1683
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1124
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2083
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_kargath_blade_dance_targeting)
void FilterTargets(std::list< WorldObject * > &targets)
@ 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 UpdateAI(uint32 diff) override
void JustSummoned(Creature *summon) override