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/* 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
61
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
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
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
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
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
418};
419
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
@ EFFECT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_1
@ EFFECT_0
@ TARGET_DEST_CASTER_BACK
@ EVENT_CHARGE
@ SPELL_AURA_PROC_TRIGGER_SPELL
#define AuraEffectProcFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraCheckProcFn(F)
DamageEffectType
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ SPELL_SCOURG_RESURRECTION_BEAM
@ SPELL_SCOURG_RESURRECTION
@ SPELL_SCOURG_RESURRECTION_DUMMY
@ SPELL_SHADOW_AXE_PERIODIC_DAMAGE
@ SPELL_SCOURG_RESURRECTION_HEAL
void AddSC_boss_ingvar_the_plunderer()
Yells
void PreventDefaultAction()
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
HookList< EffectProcHandler > OnEffectProc
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:593
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
bool IsInPhase(uint8 phase) const
Definition EventMap.h:222
void SetPhase(uint8 phase)
Definition EventMap.cpp:32
void Reset()
Definition EventMap.cpp:25
uint32 GetHeal() const
Definition Unit.h:482
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={})
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)
uint32 GetEntry() const
Definition Object.h:89
HealInfo * GetHealInfo() const
Definition Unit.h:512
Unit * GetActor() const
Definition Unit.h:499
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
virtual void AttackStart(Unit *victim)
Definition UnitAI.cpp:29
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:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void StopMoving()
Definition Unit.cpp:10680
void SetUninteractible(bool apply)
Definition Unit.cpp:8564
uint64 GetHealth() const
Definition Unit.h:788
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void RemoveAllAuras()
Definition Unit.cpp:4382
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:846
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:847
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
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:92
void RelocateOffset(Position const &offset)
Definition Spell.cpp:90
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void UpdateAI(uint32 diff) override
void DoAction(int32 actionId) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
npc_annhylde_the_caller(Creature *creature)
void MoveInLineOfSight(Unit *) override
void MovementInform(uint32 type, uint32 id) override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
npc_ingvar_throw_dummy(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
@ DATA_INGVAR
#define RegisterUtgardeKeepCreatureAI(ai_name)
@ NPC_THROW_TARGET
@ NPC_INGVAR
@ NPC_INGVAR_UNDEAD