TrinityCore
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/* ScriptData
19SDName: Boss_Ingvar_The_Plunderer
20SD%Complete: 95
21SDComment: Blizzlike Timers (just shadow axe summon needs a new timer)
22SDCategory: Utgarde Keep
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "MotionMaster.h"
28#include "ObjectAccessor.h"
29#include "ScriptedCreature.h"
30#include "SpellScript.h"
31#include "utgarde_keep.h"
32
34{
35 // Ingvar (Human/Undead)
39
40 // Annhylde The Caller
42};
43
45{
50
57
60};
61
63{
67};
68
70{
71 // Ingvar Spells human form
72 SPELL_CLEAVE = 42724,
73 SPELL_SMASH = 42669,
75 SPELL_ENRAGE = 42705,
76
79 SPELL_SCOURG_RESURRECTION = 42863, // Spawn resurrect effect around Ingvar
80
81 // Ingvar Spells undead form
86
89
90 // Spells for Annhylde
91 SPELL_SCOURG_RESURRECTION_HEAL = 42704, // Heal Max + DummyAura
92 SPELL_SCOURG_RESURRECTION_BEAM = 42857, // Channeling Beam of Annhylde
93 SPELL_SCOURG_RESURRECTION_DUMMY = 42862, // Some Emote Dummy?
95};
96
97enum Misc
98{
101
103{
105
106 void Reset() override
107 {
108 if (me->GetEntry() != NPC_INGVAR)
111 me->SetImmuneToPC(false);
112 me->SetUninteractible(false);
113
114 _Reset();
115 }
116
117 void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
118 {
119 if (damage >= me->GetHealth() && events.IsInPhase(PHASE_HUMAN))
120 {
123
125 me->StopMoving();
127
129 me->SetImmuneToPC(true, true);
130 me->SetUninteractible(true);
131
133 }
134
136 damage = 0;
137 }
138
139 void DoAction(int32 actionId) override
140 {
141 if (actionId == ACTION_START_PHASE_2)
143 }
144
146 {
151 }
152
153 void JustEngagedWith(Unit* who) override
154 {
155 if (events.IsInPhase(PHASE_EVENT) || events.IsInPhase(PHASE_UNDEAD)) // ingvar gets multiple JustEngagedWith calls
156 return;
158
165 }
166
167 void AttackStart(Unit* who) override
168 {
169 if (events.IsInPhase(PHASE_EVENT)) // prevent ingvar from beginning to attack/chase during transition
170 return;
172 }
173
174 void JustDied(Unit* /*killer*/) override
175 {
176 _JustDied();
178 }
179
181 {
187 }
188
189 void KilledUnit(Unit* who) override
190 {
191 if (who->GetTypeId() == TYPEID_PLAYER)
192 Talk(SAY_SLAY);
193 }
194
195 void UpdateAI(uint32 diff) override
196 {
198 return;
199
200 events.Update(diff);
201
203 return;
204
205 while (uint32 eventId = events.ExecuteEvent())
206 {
207 switch (eventId)
208 {
209 // PHASE ONE
210 case EVENT_CLEAVE:
213 break;
217 break;
218 case EVENT_ENRAGE:
221 break;
222 case EVENT_SMASH:
225 break;
228 me->SetImmuneToPC(false);
229 me->SetUninteractible(false);
233 return;
236 return;
237 // PHASE TWO
238 case EVENT_DARK_SMASH:
241 break;
245 break;
246 case EVENT_WOE_STRIKE:
249 break;
250 case EVENT_SHADOW_AXE:
251 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
254 break;
255 default:
256 break;
257 }
258
260 return;
261 }
262 }
263};
264
266{
268 {
269 x = 0.f;
270 y = 0.f;
271 z = 0.f;
272 _instance = creature->GetInstanceScript();
273 }
274
275 void Reset() override
276 {
277 _events.Reset();
278
279 me->GetPosition(x, y, z);
280 me->GetMotionMaster()->MovePoint(1, x, y, z - 15.0f);
281 }
282
283 void MovementInform(uint32 type, uint32 id) override
284 {
285 if (type != POINT_MOTION_TYPE)
286 return;
287
288 switch (id)
289 {
290 case 1:
293 {
294 ingvar->RemoveAura(SPELL_SUMMON_BANSHEE);
295 ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true);
297 }
299 break;
300 case 2:
302 break;
303 default:
304 break;
305 }
306 }
307
308 void AttackStart(Unit* /*who*/) override { }
309 void MoveInLineOfSight(Unit* /*who*/) override { }
310 void JustEngagedWith(Unit* /*who*/) override { }
311
312 void UpdateAI(uint32 diff) override
313 {
314 _events.Update(diff);
315
316 while (uint32 eventId = _events.ExecuteEvent())
317 {
318 switch (eventId)
319 {
322 {
323 ingvar->RemoveAura(SPELL_INGVAR_FEIGN_DEATH);
324 ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false);
325 }
327 break;
330 {
331 ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY);
332 ingvar->AI()->DoAction(ACTION_START_PHASE_2);
333 }
334
335 me->GetMotionMaster()->MovePoint(2, x, y, z + 15.0f);
336 break;
337 default:
338 break;
339 }
340 }
341 }
342
343private:
346 float x, y, z;
347};
348
350{
351 npc_ingvar_throw_dummy(Creature* creature) : ScriptedAI(creature) { }
352
353 void Reset() override
354 {
355 if (Creature* target = me->FindNearestCreature(NPC_THROW_TARGET, 200.0f))
356 {
357 float x, y, z;
358 target->GetPosition(x, y, z);
359 me->GetMotionMaster()->MoveCharge(x, y, z);
360 target->DespawnOrUnsummon();
361 }
362 else
364 }
365
366 void MovementInform(uint32 type, uint32 id) override
367 {
368 if (type == EFFECT_MOTION_TYPE && id == EVENT_CHARGE)
369 {
371 me->DespawnOrUnsummon(10s);
372 }
373 }
374};
375
376// 42912 - Summon Banshee
378{
380 {
381 dest.RelocateOffset({ 0.0f, 0.0f, 30.0f, 0.0f });
382 }
383
384 void Register() override
385 {
387 }
388};
389
390// 42730, 59735 - Woe Strike
392{
393 bool Validate(SpellInfo const* /*spellInfo*/) override
394 {
396 }
397
398 bool CheckProc(ProcEventInfo& eventInfo)
399 {
400 HealInfo* healInfo = eventInfo.GetHealInfo();
401 if (!healInfo || !healInfo->GetHeal())
402 return false;
403
404 return true;
405 }
406
407 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
408 {
410 GetTarget()->CastSpell(eventInfo.GetActor(), SPELL_WOE_STRIKE_EFFECT, aurEff);
411 }
412
413 void Register() override
414 {
417 }
418};
419
421{
427}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_DEST_CASTER_BACK
@ EVENT_CHARGE
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
#define SpellDestinationTargetSelectFn(F, I, N)
Definition: SpellScript.h:874
#define AuraCheckProcFn(F)
Definition: SpellScript.h:2130
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_SCOURG_RESURRECTION_BEAM
@ SPELL_SHADOW_AXE_SUMMON
@ SPELL_INGVAR_FEIGN_DEATH
@ SPELL_INGVAR_TRANSFORM
@ SPELL_WOE_STRIKE_EFFECT
@ SPELL_SCOURG_RESURRECTION
@ SPELL_SCOURG_RESURRECTION_DUMMY
@ SPELL_SHADOW_AXE_PERIODIC_DAMAGE
@ SPELL_SCOURG_RESURRECTION_HEAL
void AddSC_boss_ingvar_the_plunderer()
@ EVENT_JUST_TRANSFORMED
Yells
void PreventDefaultAction()
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:2129
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition: Creature.cpp:577
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void Reset()
Definition: EventMap.cpp:21
Definition: Unit.h:456
uint32 GetHeal() const
Definition: Unit.h:476
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={})
void MoveCharge(float x, float y, float z, float speed=SPEED_CHARGE, uint32 id=EVENT_CHARGE, bool generatePath=false, Unit const *target=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
HealInfo * GetHealInfo() const
Definition: Unit.h:506
Unit * GetActor() const
Definition: Unit.h:493
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
Definition: SpellScript.h:873
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void StopMoving()
Definition: Unit.cpp:10049
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
uint64 GetHealth() const
Definition: Unit.h:776
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAllAuras()
Definition: Unit.cpp:4242
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
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)
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void RelocateOffset(Position const &offset)
Definition: Spell.cpp:122
boss_ingvar_the_plunderer(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
void DoAction(int32 actionId) override
void JustEngagedWith(Unit *who) override
void AttackStart(Unit *who) override
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) override
npc_annhylde_the_caller(Creature *creature)
void MoveInLineOfSight(Unit *) override
void MovementInform(uint32 type, uint32 id) override
void JustEngagedWith(Unit *) override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
npc_ingvar_throw_dummy(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
@ DATA_INGVAR
Definition: utgarde_keep.h:33
#define RegisterUtgardeKeepCreatureAI(ai_name)
Definition: utgarde_keep.h:96
@ NPC_THROW_TARGET
Definition: utgarde_keep.h:57
@ NPC_INGVAR
Definition: utgarde_keep.h:49
@ NPC_INGVAR_UNDEAD
Definition: utgarde_keep.h:56