Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_patchwerk.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "naxxramas.h"
9
18
27
35
40
42{
43public:
44 boss_patchwerk() : CreatureScript("boss_patchwerk") { }
45
46 struct boss_patchwerkAI : public BossAI
47 {
49 {
50 Enraged = false;
51 }
52
60
61 void KilledUnit(Unit* /*Victim*/) OVERRIDE
62 {
63 if (!(rand()%5))
65 }
66
67 void JustDied(Unit* /*killer*/) OVERRIDE
68 {
69 _JustDied();
71 }
72
73 void EnterCombat(Unit* /*who*/) OVERRIDE
74 {
76 Enraged = false;
78 events.ScheduleEvent(EVENT_HATEFUL, 1000);
79 events.ScheduleEvent(EVENT_BERSERK, 360000);
80
81 if (instance)
83 }
84
86 {
87 if (!UpdateVictim())
88 return;
89
90 events.Update(diff);
91
92 while (uint32 eventId = events.ExecuteEvent())
93 {
94 switch (eventId)
95 {
96 case EVENT_HATEFUL:
97 {
98 //Cast Hateful strike on the player with the highest
99 //amount of HP within melee distance
100 uint32 MostHP = 0;
101 Unit* pMostHPTarget = NULL;
102 std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
103 for (; i != me->getThreatManager().getThreatList().end(); ++i)
104 {
105 Unit* target = (*i)->getTarget();
106 if (target->IsAlive() && target != me->GetVictim() && target->GetHealth() > MostHP && me->IsWithinMeleeRange(target))
107 {
108 MostHP = target->GetHealth();
109 pMostHPTarget = target;
110 }
111 }
112
113 if (!pMostHPTarget)
114 pMostHPTarget = me->GetVictim();
115
117
118 events.ScheduleEvent(EVENT_HATEFUL, 1000);
119 break;
120 }
121 case EVENT_BERSERK:
122 DoCast(me, SPELL_BERSERK, true);
124 events.ScheduleEvent(EVENT_SLIME, 2000);
125 break;
126 case EVENT_SLIME:
128 events.ScheduleEvent(EVENT_SLIME, 2000);
129 break;
130 }
131 }
132
133 if (!Enraged && HealthBelowPct(5))
134 {
135 DoCast(me, SPELL_FRENZY, true);
137 Enraged = true;
138 }
139
141 }
142
143 private:
145 };
146
148 {
149 return new boss_patchwerkAI(creature);
150 }
151};
152
154{
155 new boss_patchwerk();
156}
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:158
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_FRENZY
@ EVENT_NONE
#define SPELL_BERSERK
@ EMOTE_ENRAGE
@ EMOTE_BERSERK
@ EVENT_BERSERK
@ ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT
@ SAY_DEATH
@ SAY_AGGRO
@ EMOTE_ENRAGE
@ SAY_SLAY
@ EMOTE_BERSERK
@ H_SPELL_HATEFUL_STRIKE
@ SPELL_SLIME_BOLT
@ SPELL_FRENZY
@ SPELL_HATEFUL_STRIKE
@ SPELL_BERSERK
void AddSC_boss_patchwerk()
@ EVENT_SLIME
@ EVENT_BERSERK
@ EVENT_HATEFUL
InstanceScript *const instance
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
bool IsAlive() const
Definition Unit.h:2032
uint32 GetHealth() const
Definition Unit.h:1600
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ BOSS_PATCHWERK
Definition naxxramas.h:19
Creature * me
bool HealthBelowPct(uint32 pct) const
const T & RAID_MODE(const T &normal10, const T &normal25) const
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE