Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_mal_ganis.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/* Script Data Start
7SDName: Boss mal_ganis
8SDAuthor: Tartalo
9SD%Complete: 80
10SDComment: @todo Intro & outro
11SDCategory:
12Script Data End */
13
14#include "ScriptMgr.h"
15#include "ScriptedCreature.h"
17
19{
20 SPELL_CARRION_SWARM = 52720, //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec.
22 SPELL_MIND_BLAST = 52722, //Inflicts 4163 to 4837 Shadow damage to an enemy.
24 SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
26 SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack.
27 SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit
28 SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc
29};
30
43
49
51{
52public:
53 boss_mal_ganis() : CreatureScript("boss_mal_ganis") { }
54
56 {
57 return new boss_mal_ganisAI(creature);
58 }
59
61 {
62 boss_mal_ganisAI(Creature* creature) : ScriptedAI(creature)
63 {
64 instance = creature->GetInstanceScript();
65 }
66
71
74
75 bool bYelled;
77
79
81
83 {
84 bYelled = false;
85 bYelled2 = false;
86 Phase = COMBAT;
88 uiMindBlastTimer = 11000;
89 uiVampiricTouchTimer = std::rand() % 15000 + 10000;
90 uiSleepTimer = std::rand() % 20000 + 15000;
91 uiOutroTimer = 1000;
92
93 if (instance)
95 }
96
97 void EnterCombat(Unit* /*who*/) OVERRIDE
98 {
100 if (instance)
102 }
103
104 void DamageTaken(Unit* done_by, uint32 &damage) OVERRIDE
105 {
106 if (damage >= me->GetHealth() && done_by != me)
107 damage = me->GetHealth()-1;
108 }
109
111 {
112 switch (Phase)
113 {
114 case COMBAT:
115 //Return since we have no target
116 if (!UpdateVictim())
117 return;
118
119 if (!bYelled && HealthBelowPct(30))
120 {
122 bYelled = true;
123 }
124
125 if (!bYelled2 && HealthBelowPct(15))
126 {
128 bYelled2 = true;
129 }
130
131 if (HealthBelowPct(1))
132 {
133 //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent
135 uiOutroStep = 1;
136 Phase = OUTRO;
137 return;
138 }
139
140 if (Creature* pArthas = me->GetCreature(*me, instance ? instance->GetData64(DATA_ARTHAS) : 0))
141 if (pArthas->isDead())
142 {
144 me->DisappearAndDie();
145 if (instance)
147 }
148
149 if (uiCarrionSwarmTimer < diff)
150 {
152 uiCarrionSwarmTimer = 7000;
153 } else uiCarrionSwarmTimer -= diff;
154
155 if (uiMindBlastTimer < diff)
156 {
157 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
158 DoCast(target, SPELL_MIND_BLAST);
159 uiMindBlastTimer = 6000;
160 } else uiMindBlastTimer -= diff;
161
162 if (uiVampiricTouchTimer < diff)
163 {
165 uiVampiricTouchTimer = 32000;
166 } else uiVampiricTouchTimer -= diff;
167
168 if (uiSleepTimer < diff)
169 {
171 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
172 DoCast(target, SPELL_SLEEP);
173 uiSleepTimer = std::rand() % 20000 + 15000;
174 } else uiSleepTimer -= diff;
175
177 break;
178 case OUTRO:
179 if (uiOutroTimer < diff)
180 {
181 switch (uiOutroStep)
182 {
183 case 1:
185 me->GetMotionMaster()->MoveTargetedHome();
186 ++uiOutroStep;
187 uiOutroTimer = 8000;
188 break;
189 case 2:
190 me->SetTarget(instance ? instance->GetData64(DATA_ARTHAS) : 0);
191 me->HandleEmoteCommand(29);
193 ++uiOutroStep;
194 uiOutroTimer = 9000;
195 break;
196 case 3:
198 ++uiOutroStep;
199 uiOutroTimer = 16000;
200 break;
201 case 4:
202 me->HandleEmoteCommand(33);
203 ++uiOutroStep;
204 uiOutroTimer = 500;
205 break;
206 case 5:
207 me->SetVisible(false);
208 me->Kill(me);
209 break;
210 }
211 } else uiOutroTimer -= diff;
212 break;
213 }
214 }
215
216 void JustDied(Unit* /*killer*/) OVERRIDE
217 {
218 if (instance)
219 {
222 // give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc
224 }
225 }
226
228 {
229 if (victim->GetTypeId() != TypeID::TYPEID_PLAYER)
230 return;
231
232 Talk(SAY_SLAY);
233 }
234 };
235};
236
238{
239 new boss_mal_ganis();
240}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ FAIL
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition Object.h:55
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ SAY_SLAY
@ SPELL_CARRION_SWARM
#define SAY_AGGRO
#define SAY_KILL
@ SPELL_MIND_BLAST
@ SAY_SLEEP
@ SAY_ESCAPE_SPEECH_2
@ SAY_OUTRO
@ SAY_AGGRO
@ SAY_30HEALTH
@ SAY_SLEEP
@ SAY_SLAY
@ SAY_ESCAPE_SPEECH_1
@ SAY_15HEALTH
void AddSC_boss_mal_ganis()
@ H_SPELL_CARRION_SWARM
@ SPELL_SLEEP
@ SPELL_VAMPIRIC_TOUCH
@ SPELL_KILL_CREDIT
@ SPELL_MIND_BLAST
@ SPELL_MAL_GANIS_KILL_CREDIT
@ SPELL_CARRION_SWARM
@ H_SPELL_SLEEP
@ H_SPELL_MIND_BLAST
CombatPhases
@ COMBAT
@ OUTRO
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_MAL_GANIS_EVENT
Creature * me
bool HealthBelowPct(uint32 pct) const
ScriptedAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void KilledUnit(Unit *victim) OVERRIDE
void DamageTaken(Unit *done_by, uint32 &damage) OVERRIDE