TrinityCore
Loading...
Searching...
No Matches
boss_ingvar_the_plunderer.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 * Combat timers requires to be revisited
20 * Everything related to Ingvar Throw Dummy requires additional research and checks
21 since it may be handled wrongly or something may be missing
22 * Out of Combat events are NYI, should be handled from Proto-Drake Rider's script (DB issue)
23 */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "MotionMaster.h"
28#include "ObjectAccessor.h"
29#include "ScriptedCreature.h"
30#include "Spell.h"
31#include "SpellInfo.h"
32#include "SpellMgr.h"
33#include "SpellScript.h"
34#include "utgarde_keep.h"
35
37{
38 // Ingvar (Human / Undead)
43
44 // Annhylde The Caller
46};
47
49{
50 // Human Form
51 SPELL_CLEAVE = 42724,
52 SPELL_SMASH = 42669,
54 SPELL_ENRAGE = 42705,
55
56 // Undead Form
61
62 // Feign Death & Resurrection
70
71 // Ingvar Throw Dummy
73
74 // Scripts
76};
77
103
109
117
123
124// 23954 - Ingvar the Plunderer
126{
128
129 void Reset() override
130 {
131 if (me->GetEntry() != NPC_INGVAR)
135
136 _Reset();
137
138 _isUnkillable = true;
139 _isInTransition = false;
140 }
141
142 void JustEngagedWith(Unit* who) override
143 {
145
147
152 }
153
154 void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
155 {
156 if (damage >= me->GetHealth() && _isUnkillable)
157 {
158 damage = me->GetHealth() - 1;
159
160 if (_isInTransition)
161 return;
162
163 _isInTransition = true;
174
175 events.Reset();
177 }
178 }
179
180 void OnSpellStart(SpellInfo const* spell) override
181 {
182 if (spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_STAGGERING_ROAR, me) ||
183 spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_DREADFUL_ROAR, me))
185 }
186
187 void OnSpellCast(SpellInfo const* spell) override
188 {
189 if (spell->Id == SPELL_SHADOW_AXE)
191 }
192
193 void DoAction(int32 action) override
194 {
195 switch (action)
196 {
203
204 _isUnkillable = false;
205
210 break;
212 me->LoadEquipment(1, true);
213 break;
214 default:
215 break;
216 }
217 }
218
219 void KilledUnit(Unit* /*who*/) override
220 {
221 Talk(SAY_SLAY);
222 }
223
224 void JustDied(Unit* /*killer*/) override
225 {
226 _JustDied();
228 }
229
230 void UpdateAI(uint32 diff) override
231 {
232 if (!UpdateVictim())
233 return;
234
235 events.Update(diff);
236
238 return;
239
240 while (uint32 eventId = events.ExecuteEvent())
241 {
242 switch (eventId)
243 {
244 // Human Phase
245 case EVENT_CLEAVE:
247 events.Repeat(6s, 12s);
248 break;
249 case EVENT_SMASH:
251 events.Repeat(12s, 16s);
252 break;
255 events.Repeat(18s, 22s);
256 break;
257 case EVENT_ENRAGE:
259 events.Repeat(7s, 14s);
260 break;
261
262 // Transition Phase
265 break;
266
267 // Undead Phase
268 case EVENT_DARK_SMASH:
270 events.Repeat(12s, 16s);
271 break;
274 events.Repeat(18s, 22s);
275 break;
276 case EVENT_WOE_STRIKE:
278 events.Repeat(10s, 14s);
279 break;
280 case EVENT_SHADOW_AXE:
281 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
282 DoCast(target, SPELL_SHADOW_AXE);
283 events.Repeat(30s);
284 break;
285 default:
286 break;
287 }
288
290 return;
291 }
292
294 }
295
296private:
299};
300
301// 24068 - Annhylde the Caller
303{
304 npc_annhylde_the_caller(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
305
306 void JustAppeared() override
307 {
309 }
310
311 void MovementInform(uint32 type, uint32 id) override
312 {
313 if (type != POINT_MOTION_TYPE)
314 return;
315
316 switch (id)
317 {
320 break;
321 case POINT_CALLER_UP:
323 break;
324 default:
325 break;
326 }
327 }
328
329 void UpdateAI(uint32 diff) override
330 {
331 _events.Update(diff);
332
333 while (uint32 eventId = _events.ExecuteEvent())
334 {
335 switch (eventId)
336 {
340 break;
343 break;
347 break;
350 ingvar->RemoveAurasDueToSpell(SPELL_SUMMON_BANSHEE);
352 break;
356 break;
359 ingvar->CastSpell(ingvar, SPELL_SCOURGE_RESURRECTION_VISUAL);
361 break;
364 {
365 ingvar->RemoveAurasDueToSpell(SPELL_INGVAR_FEIGN_DEATH);
367 ingvar->SetReactState(REACT_PASSIVE);
368 ingvar->CastSpell(ingvar, SPELL_SCOURGE_RESURRECTION_HEAL);
369 }
371 break;
374 ingvar->AI()->DoAction(ACTION_START_UNDEAD_PHASE);
376 break;
379 break;
382 break;
383 default:
384 break;
385 }
386 }
387 }
388
389private:
392};
393
394// 23997 - Ingvar Throw Dummy
396{
397 npc_ingvar_throw_dummy(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
398
399 void JustAppeared() override
400 {
402
403 _scheduler.Schedule(1s, [this](TaskContext /*task*/)
404 {
405 if (Creature* target = me->FindNearestCreature(NPC_THROW_TARGET, 200.0f))
406 me->GetMotionMaster()->MovePoint(POINT_AXE_TO_TARGET, target->GetPosition());
407 });
408
409 _scheduler.Schedule(6s, 10s, [this](TaskContext /*task*/)
410 {
412 me->GetMotionMaster()->MovePoint(POINT_AXE_TO_OWNER, ingvar->GetPosition());
413 });
414 }
415
416 void MovementInform(uint32 type, uint32 id) override
417 {
418 if (type == POINT_MOTION_TYPE && id == POINT_AXE_TO_OWNER)
419 {
421 ingvar->AI()->DoAction(ACTION_AXE_RETURNS);
422
423 _scheduler.Schedule(1s, [this](TaskContext /*task*/)
424 {
427 });
428 }
429 }
430
431 void UpdateAI(uint32 diff) override
432 {
433 _scheduler.Update(diff);
434 }
435
436private:
439};
440
441// 42912 - Summon Banshee
456
457// 42730, 59735 - Woe Strike
459{
461
462 bool Validate(SpellInfo const* /*spellInfo*/) override
463 {
465 }
466
467 bool CheckProc(ProcEventInfo& eventInfo)
468 {
469 HealInfo* healInfo = eventInfo.GetHealInfo();
470 if (!healInfo || !healInfo->GetHeal())
471 return false;
472
473 return true;
474 }
475
476 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
477 {
479 GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, aurEff);
480 }
481
487};
488
@ EQUIP_UNEQUIP
Definition CreatureAI.h:76
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_1
@ EFFECT_0
@ TARGET_DEST_CASTER_BACK
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define sSpellMgr
Definition SpellMgr.h:738
#define AuraEffectProcFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraCheckProcFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ SPELL_SCOURGE_RESURRECTION_CHANNEL
@ SPELL_SCOURGE_RESURRECTION_VISUAL
@ SPELL_SCOURGE_RESURRECTION_HEAL
void AddSC_boss_ingvar_the_plunderer()
void PreventDefaultAction()
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
HookList< EffectProcHandler > OnEffectProc
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void LoadEquipment(int8 id=1, bool force=false)
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:540
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
void Reset()
Definition EventMap.cpp:21
uint32 GetHeal() const
Definition Unit.h:492
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
uint32 GetEntry() const
Definition Object.h:81
HealInfo * GetHealInfo() const
Definition Unit.h:520
Unit * GetActor()
Definition Unit.h:508
uint32 Id
Definition SpellInfo.h:289
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
uint32 GetHealth() const
Definition Unit.h:913
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void RemoveAllAuras()
Definition Unit.cpp:4157
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void SetDest(SpellDestination &dest)
PrepareSpellScript(spell_ingvar_summon_banshee)
PrepareAuraScript(spell_ingvar_woe_strike)
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
bool Validate(SpellInfo const *) override
bool CheckProc(ProcEventInfo &eventInfo)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Position GetPositionWithOffset(Position const &offset) const
Definition Position.cpp:60
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void RelocateOffset(Position const &offset)
Definition Spell.cpp:110
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void OnSpellStart(SpellInfo const *spell) override
void UpdateAI(uint32 diff) override
void OnSpellCast(SpellInfo const *spell) override
void JustEngagedWith(Unit *who) override
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
npc_annhylde_the_caller(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
npc_ingvar_throw_dummy(Creature *creature)
void UpdateAI(uint32 diff) override
void MovementInform(uint32 type, uint32 id) override
@ DATA_INGVAR
#define RegisterUtgardeKeepCreatureAI(ai_name)
@ NPC_INGVAR