TrinityCore
Loading...
Searching...
No Matches
boss_scourgelord_tyrannus.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#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "pit_of_saron.h"
23#include "Player.h"
24#include "PlayerAI.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellScript.h"
28#include "TemporarySummon.h"
29#include "Vehicle.h"
30
61
78
96
104
112
113#define GUID_HOARFROST 1
114
115static const Position rimefangPos[10] =
116{
117 {1017.299f, 168.9740f, 642.9259f, 0.000000f},
118 {1047.868f, 126.4931f, 665.0453f, 0.000000f},
119 {1069.828f, 138.3837f, 665.0453f, 0.000000f},
120 {1063.042f, 164.5174f, 665.0453f, 0.000000f},
121 {1031.158f, 195.1441f, 665.0453f, 0.000000f},
122 {1019.087f, 197.8038f, 665.0453f, 0.000000f},
123 {967.6233f, 168.9670f, 665.0453f, 0.000000f},
124 {969.1198f, 140.4722f, 665.0453f, 0.000000f},
125 {986.7153f, 141.6424f, 665.0453f, 0.000000f},
126 {1012.601f, 142.4965f, 665.0453f, 0.000000f},
127};
128
129static Position const miscPos = { 1018.376f, 167.2495f, 628.2811f, 0.000000f }; // tyrannus combat start position
130
131struct boss_tyrannus : public BossAI
132{
134 {
135 }
136
137 void InitializeAI() override
138 {
140 Reset();
141 else
143 }
144
153
158
159 void JustEngagedWith(Unit* /*who*/) override
160 {
162 }
163
164 void AttackStart(Unit* victim) override
165 {
167 return;
168
169 if (victim && me->Attack(victim, true) && !events.IsInPhase(PHASE_INTRO))
170 me->GetMotionMaster()->MoveChase(victim);
171 }
172
173 void EnterEvadeMode(EvadeReason /*why*/) override
174 {
176 if (Creature* rimefang = GetRimefang())
177 rimefang->AI()->EnterEvadeMode();
178
180 }
181
182 void KilledUnit(Unit* victim) override
183 {
184 if (victim->GetTypeId() == TYPEID_PLAYER)
185 Talk(SAY_SLAY);
186 }
187
188 void JustDied(Unit* /*killer*/) override
189 {
192
193 // Prevent corpse despawning
194 if (TempSummon* summ = me->ToTempSummon())
195 summ->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN);
196
197 // Stop combat for Rimefang
198 if (Creature* rimefang = GetRimefang())
199 rimefang->AI()->DoAction(ACTION_END_COMBAT);
200 }
201
215
216 void UpdateAI(uint32 diff) override
217 {
219 return;
220
221 events.Update(diff);
222
223 while (uint32 eventId = events.ExecuteEvent())
224 {
225 switch (eventId)
226 {
227 case EVENT_INTRO_1:
228 //Talk(SAY_GORKUN_INTRO_2, pGorkunOrVictus);
229 break;
230 case EVENT_INTRO_2:
232 break;
233 case EVENT_INTRO_3:
234 me->ExitVehicle();
236 break;
239 rimefang->AI()->DoAction(ACTION_START_RIMEFANG); //set rimefang also infight
248 break;
250 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
253 break;
257 break;
263 break;
266 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
267 {
268 Talk(SAY_MARK_RIMEFANG_2, target);
270 }
272 break;
273 }
274
276 return;
277 }
278
280 }
281};
282
284{
285 boss_rimefang(Creature* creature) : ScriptedAI(creature)
286 {
287 Initialize();
288 }
289
291 {
294 }
295
296 void Reset() override
297 {
298 _events.Reset();
300 Initialize();
301 me->SetCanFly(true);
304 }
305
306 void JustReachedHome() override
307 {
308 if (Vehicle* _vehicle = me->GetVehicleKit())
309 _vehicle->InstallAllAccessories(false);
310 }
311
312 void DoAction(int32 actionId) override
313 {
314 if (actionId == ACTION_START_RIMEFANG)
315 {
320 }
321 else if (actionId == ACTION_END_COMBAT)
323 }
324
325 void SetGUID(ObjectGuid const& guid, int32 id) override
326 {
327 if (id == GUID_HOARFROST)
328 {
331 }
332 }
333
334 void UpdateAI(uint32 diff) override
335 {
337 return;
338
339 _events.Update(diff);
340
341 while (uint32 eventId = _events.ExecuteEvent())
342 {
343 switch (eventId)
344 {
345 case EVENT_MOVE_NEXT:
346 if (_currentWaypoint >= 10 || _currentWaypoint == 0)
351 break;
352 case EVENT_ICY_BLAST:
354 DoCast(target, SPELL_ICY_BLAST);
356 break;
357 case EVENT_HOARFROST:
359 {
360 DoCast(target, SPELL_HOARFROST);
362 }
363 break;
364 default:
365 break;
366 }
367 }
368 }
369
370private:
374};
375
377{
378 public:
379 player_overlord_brandAI(Player* player, ObjectGuid casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { }
380
381 void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) override
382 {
384 if (Unit* victim = tyrannus->GetVictim())
385 {
386 CastSpellExtraArgs args(tyrannus->GetGUID());
387 args.AddSpellBP0(damage);
389 }
390 }
391
392 void HealDone(Unit* /*target*/, uint32& addHealth) override
393 {
395 {
396 CastSpellExtraArgs args(tyrannus->GetGUID());
397 args.AddSpellBP0(addHealth * 5.5f);
398 me->CastSpell(tyrannus, SPELL_OVERLORD_BRAND_HEAL, args);
399 }
400 }
401
402 void UpdateAI(uint32 /*diff*/) override { }
403
404 private:
406};
407
408// 69172 - Overlord's Brand
410{
412
413 bool Load() override
414 {
415 return GetCaster() && GetCaster()->GetEntry() == NPC_TYRANNUS;
416 }
417
418 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
419 {
420 if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
421 return;
422
423 Player* pTarget = GetTarget()->ToPlayer();
425 }
426
427 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
428 {
429 if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
430 return;
431
432 GetTarget()->PopAI();
433 }
434
440};
441
442// 69275 - Mark of Rimefang
444{
446
447 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
448 {
449 Unit* caster = GetCaster();
450 if (!caster || caster->GetTypeId() != TYPEID_UNIT)
451 return;
452
453 if (InstanceScript* instance = caster->GetInstanceScript())
454 if (Creature* rimefang = ObjectAccessor::GetCreature(*caster, instance->GetGuidData(DATA_RIMEFANG)))
455 rimefang->AI()->SetGUID(GetTarget()->GetGUID(), GUID_HOARFROST);
456 }
457
462};
463
464// 69232 - Icy Blast
466{
468
469 bool Validate(SpellInfo const* /*spellInfo*/) override
470 {
472 }
473
475 {
476 PreventHitDefaultEffect(effIndex);
477 if (Position const* pos = GetHitDest())
478 if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 1min))
479 summon->CastSpell(summon, SPELL_ICY_BLAST_AURA, true);
480 }
481
486};
487
489{
490 public:
491 at_tyrannus_event_starter() : AreaTriggerScript("at_tyrannus_event_starter") { }
492
493 bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override
494 {
495 InstanceScript* instance = player->GetInstanceScript();
496 if (player->IsGameMaster() || !instance)
497 return false;
498
499 if (instance->GetBossState(DATA_TYRANNUS) != IN_PROGRESS && instance->GetBossState(DATA_TYRANNUS) != DONE)
500 if (Creature* tyrannus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(DATA_TYRANNUS)))
501 {
502 tyrannus->AI()->DoAction(ACTION_START_INTRO);
503 return true;
504 }
505
506 return false;
507 }
508};
509
Actions
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ FAIL
@ DONE
@ NOT_STARTED
@ TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN
@ TYPEID_UNIT
Definition ObjectGuid.h:38
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_TRIGGER_MISSILE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define SpellEffectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
#define GUID_HOARFROST
static const Position rimefangPos[10]
static Position const miscPos
@ SPELL_OVERLORD_BRAND_HEAL
@ SPELL_OVERLORD_BRAND_DAMAGE
@ SPELL_EJECT_ALL_PASSENGERS
void AddSC_boss_tyrannus()
Yells
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetCaster() const
Unit * GetTarget() const
ObjectGuid GetCasterGUID() const
InstanceScript *const instance
EventMap events
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void ExitVehicle(Position const *exitPosition=nullptr) override
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
static Player * ToPlayer(Object *o)
Definition Object.h:180
Player *const me
Definition PlayerAI.h:52
bool IsGameMaster() const
Definition Player.h:998
WorldLocation * GetHitDest() const
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
void PreventHitDefaultEffect(SpellEffIndex effIndex)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:953
TempSummon * ToTempSummon()
Definition Unit.h:1794
bool SetCanFly(bool enable, bool packetOnly=false)
Definition Unit.cpp:13374
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:5535
bool PopAI()
Definition Unit.cpp:9535
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
Vehicle * GetVehicleKit() const
Definition Unit.h:1735
void PushAI(UnitAI *newAI)
Definition Unit.cpp:9524
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
void HealDone(Unit *, uint32 &addHealth) override
void DamageDealt(Unit *, uint32 &damage, DamageEffectType) override
player_overlord_brandAI(Player *player, ObjectGuid casterGUID)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_tyrannus_mark_of_rimefang)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_tyrannus_overlord_brand)
void HandleTriggerMissile(SpellEffIndex effIndex)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_tyrannus_rimefang_icy_blast)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
#define RegisterPitOfSaronCreatureAI(ai_name)
@ DATA_RIMEFANG
@ DATA_TYRANNUS
@ NPC_ICY_BLAST
@ NPC_TYRANNUS
CastSpellExtraArgs & AddSpellBP0(int32 val)
void SetGUID(ObjectGuid const &guid, int32 id) override
void JustReachedHome() override
boss_rimefang(Creature *creature)
void DoAction(int32 actionId) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void AttackStart(Unit *victim) override
boss_tyrannus(Creature *creature)
void DoAction(int32 actionId) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *victim) override
void JustDied(Unit *) override