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 "SpellInfo.h"
31#include "SpellMgr.h"
32#include "SpellScript.h"
33#include "utgarde_keep.h"
34
36{
37 // Ingvar (Human / Undead)
42
43 // Annhylde The Caller
45};
46
48{
49 // Human Form
50 SPELL_CLEAVE = 42724,
51 SPELL_SMASH = 42669,
53 SPELL_ENRAGE = 42705,
54
55 // Undead Form
60
61 // Feign Death & Resurrection
69
70 // Ingvar Throw Dummy
72
73 // Scripts
75};
76
102
108
116
122
123// 23954 - Ingvar the Plunderer
125{
127
128 void Reset() override
129 {
130 if (me->GetEntry() != NPC_INGVAR)
132 me->SetUninteractible(false);
134
135 _Reset();
136
137 _isUnkillable = true;
138 _isInTransition = false;
139 }
140
141 void JustEngagedWith(Unit* who) override
142 {
144
146
151 }
152
153 void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
154 {
155 if (damage >= me->GetHealth() && _isUnkillable)
156 {
157 damage = me->GetHealth() - 1;
158
159 if (_isInTransition)
160 return;
161
162 _isInTransition = true;
171 me->SetUninteractible(true);
173
174 events.Reset();
176 }
177 }
178
179 void OnSpellStart(SpellInfo const* spell) override
180 {
181 if (spell->Id == SPELL_STAGGERING_ROAR ||
182 spell->Id == SPELL_DREADFUL_ROAR)
184 }
185
186 void OnSpellCast(SpellInfo const* spell) override
187 {
188 if (spell->Id == SPELL_SHADOW_AXE)
190 }
191
192 void DoAction(int32 action) override
193 {
194 switch (action)
195 {
198 me->SetUninteractible(false);
202
203 _isUnkillable = false;
204
209 break;
211 me->LoadEquipment(1, true);
212 break;
213 default:
214 break;
215 }
216 }
217
218 void KilledUnit(Unit* /*who*/) override
219 {
220 Talk(SAY_SLAY);
221 }
222
223 void JustDied(Unit* /*killer*/) override
224 {
225 _JustDied();
227 }
228
229 void UpdateAI(uint32 diff) override
230 {
231 if (!UpdateVictim())
232 return;
233
234 events.Update(diff);
235
237 return;
238
239 while (uint32 eventId = events.ExecuteEvent())
240 {
241 switch (eventId)
242 {
243 // Human Phase
244 case EVENT_CLEAVE:
246 events.Repeat(6s, 12s);
247 break;
248 case EVENT_SMASH:
250 events.Repeat(12s, 16s);
251 break;
254 events.Repeat(18s, 22s);
255 break;
256 case EVENT_ENRAGE:
258 events.Repeat(7s, 14s);
259 break;
260
261 // Transition Phase
264 break;
265
266 // Undead Phase
267 case EVENT_DARK_SMASH:
269 events.Repeat(12s, 16s);
270 break;
273 events.Repeat(18s, 22s);
274 break;
275 case EVENT_WOE_STRIKE:
277 events.Repeat(10s, 14s);
278 break;
279 case EVENT_SHADOW_AXE:
280 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
281 DoCast(target, SPELL_SHADOW_AXE);
282 events.Repeat(30s);
283 break;
284 default:
285 break;
286 }
287
289 return;
290 }
291 }
292
293private:
296};
297
298// 24068 - Annhylde the Caller
300{
301 npc_annhylde_the_caller(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
302
303 void JustAppeared() override
304 {
306 }
307
308 void MovementInform(uint32 type, uint32 id) override
309 {
310 if (type != POINT_MOTION_TYPE)
311 return;
312
313 switch (id)
314 {
317 break;
318 case POINT_CALLER_UP:
320 break;
321 default:
322 break;
323 }
324 }
325
326 void UpdateAI(uint32 diff) override
327 {
328 _events.Update(diff);
329
330 while (uint32 eventId = _events.ExecuteEvent())
331 {
332 switch (eventId)
333 {
337 break;
340 break;
344 break;
347 ingvar->RemoveAurasDueToSpell(SPELL_SUMMON_BANSHEE);
349 break;
353 break;
356 ingvar->CastSpell(ingvar, SPELL_SCOURGE_RESURRECTION_VISUAL);
358 break;
361 {
362 ingvar->RemoveAurasDueToSpell(SPELL_INGVAR_FEIGN_DEATH);
364 ingvar->SetReactState(REACT_PASSIVE);
365 ingvar->CastSpell(ingvar, SPELL_SCOURGE_RESURRECTION_HEAL);
366 }
368 break;
371 ingvar->AI()->DoAction(ACTION_START_UNDEAD_PHASE);
373 break;
376 break;
379 break;
380 default:
381 break;
382 }
383 }
384 }
385
386private:
389};
390
391// 23997 - Ingvar Throw Dummy
393{
394 npc_ingvar_throw_dummy(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
395
396 void JustAppeared() override
397 {
399
400 _scheduler.Schedule(1s, [this](TaskContext const& /*task*/)
401 {
402 if (Creature* target = me->FindNearestCreature(NPC_THROW_TARGET, 200.0f))
403 me->GetMotionMaster()->MovePoint(POINT_AXE_TO_TARGET, target->GetPosition());
404 });
405
406 _scheduler.Schedule(6s, 10s, [this](TaskContext const& /*task*/)
407 {
409 me->GetMotionMaster()->MovePoint(POINT_AXE_TO_OWNER, ingvar->GetPosition());
410 });
411 }
412
413 void MovementInform(uint32 type, uint32 id) override
414 {
415 if (type == POINT_MOTION_TYPE && id == POINT_AXE_TO_OWNER)
416 {
418 ingvar->AI()->DoAction(ACTION_AXE_RETURNS);
419
420 _scheduler.Schedule(1s, [this](TaskContext const& /*task*/)
421 {
424 });
425 }
426 }
427
428 void UpdateAI(uint32 diff) override
429 {
430 _scheduler.Update(diff);
431 }
432
433private:
436};
437
438// 42912 - Summon Banshee
451
452// 42730, 59735 - Woe Strike
454{
455 bool Validate(SpellInfo const* /*spellInfo*/) override
456 {
458 }
459
460 bool CheckProc(ProcEventInfo& eventInfo)
461 {
462 HealInfo* healInfo = eventInfo.GetHealInfo();
463 if (!healInfo || !healInfo->GetHeal())
464 return false;
465
466 return true;
467 }
468
469 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
470 {
472 GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, aurEff);
473 }
474
480};
481
@ EQUIP_UNEQUIP
Definition CreatureAI.h:57
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_1
@ EFFECT_0
@ TARGET_DEST_CASTER_BACK
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define AuraEffectProcFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraCheckProcFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ 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()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void LoadEquipment(int8 id=1, bool force=false)
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:591
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
uint32 GetHeal() const
Definition Unit.h:496
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
uint32 GetEntry() const
Definition Object.h:89
HealInfo * GetHealInfo() const
Definition Unit.h:525
Unit * GetActor() const
Definition Unit.h:513
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
void SetUninteractible(bool apply)
Definition Unit.cpp:8583
uint64 GetHealth() const
Definition Unit.h:800
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void RemoveAllAuras()
Definition Unit.cpp:4400
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1522
void SetDest(SpellDestination &dest)
void HandleProc(AuraEffect *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:61
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:90
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