Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_heigan.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 "SpellScript.h"
9#include "naxxramas.h"
10#include "Player.h"
11
13{
14 SPELL_DECREPIT_FEVER = 29998, // 25-man: 55011
17
22};
23
32
38
44
46{
47public:
48 boss_heigan() : CreatureScript("boss_heigan") { }
49
51 {
52 return new boss_heiganAI(creature);
53 }
54
55 struct boss_heiganAI : public BossAI
56 {
57 boss_heiganAI(Creature* creature) : BossAI(creature, BOSS_HEIGAN) { }
58
63
65 {
66 if (!(rand()%5))
68 if (who->GetTypeId() == TypeID::TYPEID_PLAYER)
69 safetyDance = false;
70 }
71
73 {
74 if (id == DATA_SAFETY_DANCE)
75 safetyDance = data ? true : false;
76 }
77
79 {
80 if (type == DATA_SAFETY_DANCE)
81 return safetyDance ? 1 : 0;
82
83 return 0;
84 }
85
86 void JustDied(Unit* /*killer*/) OVERRIDE
87 {
88 _JustDied();
90 }
91
92 void EnterCombat(Unit* /*who*/) OVERRIDE
93 {
97 safetyDance = true;
98 }
99
100 void EnterPhase(Phases newPhase)
101 {
102 phase = newPhase;
103 events.Reset();
104 eruptSection = 3;
105 if (phase == PHASE_FIGHT)
106 {
107 events.ScheduleEvent(EVENT_DISRUPT, std::rand() % 25000 + 10000);
108 events.ScheduleEvent(EVENT_FEVER, std::rand() % 20000 + 15000);
109 events.ScheduleEvent(EVENT_PHASE, 90000);
110 events.ScheduleEvent(EVENT_ERUPT, 15000);
111 me->GetMotionMaster()->MoveChase(me->GetVictim());
112 }
113 else
114 {
115 float x, y, z, o;
116 me->GetHomePosition(x, y, z, o);
117 me->NearTeleportTo(x, y, z, o - G3D::halfPi());
118 me->GetMotionMaster()->Clear();
119 me->GetMotionMaster()->MoveIdle();
120 me->SetTarget(0);
122 events.ScheduleEvent(EVENT_PHASE, 45000);
123 events.ScheduleEvent(EVENT_ERUPT, 8000);
124 }
125 }
126
128 {
129 if (!UpdateVictim() || !CheckInRoom())
130 return;
131
132 events.Update(diff);
133
134 while (uint32 eventId = events.ExecuteEvent())
135 {
136 switch (eventId)
137 {
138 case EVENT_DISRUPT:
140 events.ScheduleEvent(EVENT_DISRUPT, std::rand() % 10000 + 5000);
141 break;
142 case EVENT_FEVER:
144 events.ScheduleEvent(EVENT_FEVER, std::rand() % 25000 + 20000);
145 break;
146 case EVENT_PHASE:
149 break;
150 case EVENT_ERUPT:
153
154 if (eruptSection == 0)
155 eruptDirection = true;
156 else if (eruptSection == 3)
157 eruptDirection = false;
158
160
161 events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000);
162 break;
163 }
164 }
165
167 }
168 };
169};
170
172{
173 public:
174 spell_heigan_eruption() : SpellScriptLoader("spell_heigan_eruption") { }
175
177 {
179
181 {
182 Unit* caster = GetCaster();
183 if (!caster || !GetHitPlayer())
184 return;
185
186 if (GetHitDamage() >= int32(GetHitPlayer()->GetHealth()))
187 if (InstanceScript* instance = caster->GetInstanceScript())
188 if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_HEIGAN)))
189 Heigan->AI()->SetData(DATA_SAFETY_DANCE, 0);
190 }
191
196 };
197
202};
203
205{
206 public:
208 {
209 }
210
211 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
212 {
213 if (!target)
214 return false;
215
216 if (Creature* Heigan = target->ToCreature())
217 if (Heigan->AI()->GetData(DATA_SAFETY_DANCE))
218 return true;
219
220 return false;
221 }
222};
223
225{
226 new boss_heigan();
229}
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ EVENT_NONE
@ ACTION_SAFETY_DANCE_FAIL
@ DATA_SAFETY_DANCE
Heigan
@ SAY_DEATH
@ SAY_AGGRO
@ SPELL_SPELL_DISRUPTION
@ SPELL_PLAGUE_CLOUD
@ SAY_SLAY
@ SPELL_DECREPIT_FEVER
void AddSC_boss_heigan()
Phases
@ PHASE_FIGHT
@ PHASE_DANCE
@ EVENT_ERUPT
@ EVENT_FEVER
@ EVENT_DISRUPT
@ EVENT_PHASE
AchievementCriteriaScript(const char *name)
InstanceScript *const instance
void TeleportCheaters()
bool CheckInRoom()
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Player * GetHitPlayer()
HookList< EffectHandler > OnEffectHitTarget
Unit * GetCaster()
int32 GetHitDamage()
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareSpellScript(spell_heigan_eruption_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
@ DATA_HEIGAN
Definition naxxramas.h:51
@ BOSS_HEIGAN
Definition naxxramas.h:17
@ DATA_HEIGAN_ERUPT
Definition naxxramas.h:32
Creature * me
boss_heiganAI(Creature *creature)
uint32 GetData(uint32 type) const OVERRIDE
void KilledUnit(Unit *who) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
void SetData(uint32 id, uint32 data) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterPhase(Phases newPhase)