Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_baltharus_the_warborn.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 "ObjectMgr.h"
7#include "ScriptMgr.h"
8#include "ScriptedCreature.h"
9#include "SpellAuraEffects.h"
10#include "ruby_sanctum.h"
11
13{
14 SAY_BALTHARUS_INTRO = 0, // Your power wanes, ancient one.... Soon you will join your friends.
15 SAY_AGGRO = 1, // Ah, the entertainment has arrived.
16 SAY_KILL = 2, // Baltharus leaves no survivors! - This world has enough heroes.
17 SAY_CLONE = 3, // Twice the pain and half the fun.
18 SAY_DEATH = 4, // I... didn't see that coming....
19};
20
33
42
44{
46};
47
54
56{
57 public:
58 boss_baltharus_the_warborn() : CreatureScript("boss_baltharus_the_warborn") { }
59
61 {
66
68 {
69 _Reset();
70 events.SetPhase(PHASE_INTRO);
71 events.ScheduleEvent(EVENT_OOC_CHANNEL, 0, 0, PHASE_INTRO);
72 _cloneCount = RAID_MODE<uint8>(1, 2, 2, 2);
73 instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetMaxHealth());
74 }
75
76 void DoAction(int32 action) OVERRIDE
77 {
78 switch (action)
79 {
81 if (_introDone)
82 return;
83 _introDone = true;
84 me->setActive(true);
85 events.ScheduleEvent(EVENT_INTRO_TALK, 7000, 0, PHASE_INTRO);
86 break;
87 case ACTION_CLONE:
88 {
94 break;
95 }
96 default:
97 break;
98 }
99 }
100
101 void EnterCombat(Unit* /*who*/) OVERRIDE
102 {
103 me->InterruptNonMeleeSpells(false);
104 _EnterCombat();
105 events.Reset();
106 events.SetPhase(PHASE_COMBAT);
107 events.ScheduleEvent(EVENT_CLEAVE, 11000, 0, PHASE_COMBAT);
108 events.ScheduleEvent(EVENT_ENERVATING_BRAND, 13000, 0, PHASE_COMBAT);
109 events.ScheduleEvent(EVENT_BLADE_TEMPEST, 15000, 0, PHASE_COMBAT);
111 }
112
113 void JustDied(Unit* /*killer*/) OVERRIDE
114 {
115 _JustDied();
117 if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_XERESTRASZA)))
118 xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH);
119 }
120
122 {
123 if (victim->GetTypeId() == TypeID::TYPEID_PLAYER)
124 Talk(SAY_KILL);
125 }
126
128 {
129 summons.Summon(summon);
130 summon->SetHealth(me->GetHealth());
131 summon->CastSpell(summon, SPELL_SPAWN_EFFECT, true);
132 }
133
134 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
135 {
137 {
138 if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 1)
140 }
141 else
142 {
143 if (me->HealthBelowPctDamaged(66, damage) && _cloneCount == 2)
145 else if (me->HealthBelowPctDamaged(33, damage) && _cloneCount == 1)
147 }
148
149 if (me->GetHealth() > damage)
150 instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
151 }
152
154 {
155 bool introPhase = events.IsInPhase(PHASE_INTRO);
156 if (!UpdateVictim() && !introPhase)
157 return;
158
159 if (!introPhase)
160 me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
161
162 events.Update(diff);
163
164 if (me->HasUnitState(UNIT_STATE_CASTING) && !introPhase)
165 return;
166
167 while (uint32 eventId = events.ExecuteEvent())
168 {
169 switch (eventId)
170 {
171 case EVENT_INTRO_TALK:
173 break;
176 DoCast(channelTarget, SPELL_BARRIER_CHANNEL);
177 events.ScheduleEvent(EVENT_OOC_CHANNEL, 7000, 0, PHASE_INTRO);
178 break;
179 case EVENT_CLEAVE:
181 events.ScheduleEvent(EVENT_CLEAVE, 24000, 0, PHASE_COMBAT);
182 break;
185 events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000, 0, PHASE_COMBAT);
186 break;
188 for (uint8 i = 0; i < RAID_MODE<uint8>(4, 8, 8, 10); i++)
189 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
191 events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000, 0, PHASE_COMBAT);
192 break;
193 default:
194 break;
195 }
196 }
197
199 }
200
201 private:
204 };
205
207 {
209 }
210};
211
213{
214 public:
215 npc_baltharus_the_warborn_clone() : CreatureScript("npc_baltharus_the_warborn_clone") { }
216
218 {
220 _instance(creature->GetInstanceScript())
221 {
222 }
223
224 void EnterCombat(Unit* /*who*/) OVERRIDE
225 {
227 _events.Reset();
228 _events.ScheduleEvent(EVENT_CLEAVE, std::rand() % 10000 + 5000);
229 _events.ScheduleEvent(EVENT_BLADE_TEMPEST, std::rand() % 25000 + 18000);
230 _events.ScheduleEvent(EVENT_ENERVATING_BRAND, std::rand() % 15000 + 10000);
231 }
232
233 void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE
234 {
235 // Setting DATA_BALTHARUS_SHARED_HEALTH to 0 when killed would bug the boss.
236 if (_instance && me->GetHealth() > damage)
237 _instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
238 }
239
240 void JustDied(Unit* killer) OVERRIDE
241 {
242 // This is here because DamageTaken wont trigger if the damage is deadly.
243 if (_instance)
245 killer->Kill(baltharus);
246 }
247
249 {
250 if (!UpdateVictim())
251 return;
252
253 if (_instance)
254 me->SetHealth(_instance->GetData(DATA_BALTHARUS_SHARED_HEALTH));
255
256 _events.Update(diff);
257
258 if (me->HasUnitState(UNIT_STATE_CASTING))
259 return;
260
261 while (uint32 eventId = _events.ExecuteEvent())
262 {
263 switch (eventId)
264 {
265 case EVENT_CLEAVE:
267 _events.ScheduleEvent(EVENT_CLEAVE, 24000);
268 break;
271 _events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000);
272 break;
274 for (uint8 i = 0; i < RAID_MODE<uint8>(4, 8, 8, 10); i++)
275 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true))
277 _events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000);
278 break;
279 default:
280 break;
281 }
282 }
283
285 }
286
287 private:
290 };
291
293 {
295 }
296};
297
327
Actions
@ DIFFICULTY_10MAN_NORMAL
Definition DBCEnums.h:334
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ TYPEID_PLAYER
Definition Object.h:55
#define SpellHitFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_CLEAVE
@ EVENT_CLEAVE
@ PHASE_INTRO
@ PHASE_COMBAT
void AddSC_boss_baltharus_the_warborn()
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
InstanceScript *const instance
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
HookList< HitHandler > OnHit
Unit * GetHitUnit()
Unit * GetOriginalCaster()
SpellScriptLoader(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
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ ACTION_INTRO_BALTHARUS
@ ACTION_BALTHARUS_DEATH
CreatureAI * GetRubySanctumAI(Creature *creature)
@ DATA_CRYSTAL_CHANNEL_TARGET
@ DATA_BALTHARUS_SHARED_HEALTH
@ DATA_XERESTRASZA
@ DATA_BALTHARUS_THE_WARBORN
DifficultyID GetDifficulty() const
Creature * me
const T & RAID_MODE(const T &normal10, const T &normal25) const
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================