Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_sjonnir.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 "halls_of_stone.h"
9
11{
12 SPELL_LIGHTING_RING = 51849, // Periodic Trigger (interval 2s) spell = 50841
13 SPELL_LIGHTING_RING_1 = 50840, // Periodic Trigger (interval 2s) spell = 50841
14 SPELL_STATIC_CHARGE = 50834, // Periodic Trigger 2s interval, spell =50835
18};
19
21{
25};
26
35
41
51
53{
54 { 1295.44f, 734.07f, 200.3f, 0.0f }, // left
55 { 1297.7f, 595.6f, 199.9f, 0.0f } // right
56};
57
58Position const CenterPoint = { 1295.21f, 667.157f, 189.691f, 0.0f };
59
61{
62 public:
63 boss_sjonnir() : CreatureScript("boss_sjonnir") { }
64
65 struct boss_sjonnirAI : public BossAI
66 {
67 boss_sjonnirAI(Creature* creature) : BossAI(creature, DATA_SJONNIR) { }
68
70 {
71 _Reset();
72 abuseTheOoze = 0;
73 }
74
76 {
77 if (!instance->CheckRequiredBosses(DATA_SJONNIR, who->ToPlayer()))
78 {
80 return;
81 }
82
85
86 events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, std::rand() % 8000 + 3000);
87 events.ScheduleEvent(EVENT_LIGHTNING_SHIELD, std::rand() % 25000 + 20000);
88 events.ScheduleEvent(EVENT_STATIC_CHARGE, std::rand() % 25000 + 20000);
89 events.ScheduleEvent(EVENT_LIGHTNING_RING, std::rand() % 35000 + 30000);
90 events.ScheduleEvent(EVENT_SUMMON, 5000);
91 events.ScheduleEvent(EVENT_FRENZY, 300000);
92 }
93
95 {
96 summon->GetMotionMaster()->MovePoint(0, CenterPoint);
97 /*if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
98 summon->AI()->AttackStart(target);*/
99 summons.Summon(summon);
100 }
101
102 void JustDied(Unit* /*killer*/) OVERRIDE
103 {
104 _JustDied();
106 }
107
109 {
110 if (who->GetTypeId() == TypeID::TYPEID_PLAYER)
111 Talk(SAY_SLAY);
112 }
113
115 {
116 if (action == ACTION_OOZE_DEAD)
117 ++abuseTheOoze;
118 }
119
121 {
122 if (type == DATA_ABUSE_THE_OOZE)
123 return abuseTheOoze;
124
125 return 0;
126 }
127
129 {
130 if (!UpdateVictim())
131 return;
132
133 events.Update(diff);
134
135 if (me->HasUnitState(UNIT_STATE_CASTING))
136 return;
137
138 while (uint32 eventId = events.ExecuteEvent())
139 {
140 switch (eventId)
141 {
143 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
145 events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, std::rand() % 15000 + 10000);
146 break;
149 break;
152 events.ScheduleEvent(EVENT_STATIC_CHARGE, std::rand() % 25000 + 20000);
153 break;
156 events.ScheduleEvent(EVENT_LIGHTNING_RING, std::rand() % 35000 + 30000);
157 break;
158 case EVENT_SUMMON:
159 {
160 uint8 summonPipe = std::rand() % 1;
161 if (HealthAbovePct(75))
163 else if (HealthAbovePct(50))
165 else if (HealthAbovePct(25))
167 else
169
170 events.ScheduleEvent(EVENT_SUMMON, 20000);
171 break;
172 }
173 case EVENT_FRENZY:
175 DoCast(me, SPELL_FRENZY, true);
176 break;
177 default:
178 break;
179 }
180 }
181
183 }
184
185 private:
187 };
188
190 {
191 return GetHallsOfStoneAI<boss_sjonnirAI>(creature);
192 }
193};
194
196{
197 public:
198 npc_malformed_ooze() : CreatureScript("npc_malformed_ooze") { }
199
201 {
202 npc_malformed_oozeAI(Creature* creature) : ScriptedAI(creature) { }
203
205 {
206 _mergeTimer = 10000;
207 }
208
210 {
211 if (_mergeTimer <= diff)
212 {
213 if (Creature* temp = me->FindNearestCreature(NPC_MALFORMED_OOZE, 3.0f, true))
214 {
216 temp->DisappearAndDie();
217 me->DisappearAndDie();
218 }
219 _mergeTimer = 3000;
220 }
221 else
222 _mergeTimer -= diff;
223
224 if (!UpdateVictim())
225 return;
226
228 }
229
230 private:
232 };
233
235 {
237 }
238};
239
241{
242 public:
243 npc_iron_sludge() : CreatureScript("npc_iron_sludge") { }
244
246 {
247 npc_iron_sludgeAI(Creature* creature) : ScriptedAI(creature)
248 {
249 instance = creature->GetInstanceScript();
250 }
251
253
254 void JustDied(Unit* /*killer*/) OVERRIDE
255 {
256 if (Creature* sjonnir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SJONNIR)))
257 sjonnir->AI()->DoAction(ACTION_OOZE_DEAD);
258 }
259 };
260
262 {
264 }
265};
266
268{
269 public:
271 {
272 }
273
274 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
275 {
276 if (!target)
277 return false;
278
279 if (Creature* Sjonnir = target->ToCreature())
280 if (Sjonnir->AI()->GetData(DATA_ABUSE_THE_OOZE) >= 5)
281 return true;
282
283 return false;
284 }
285};
286
288{
289 new boss_sjonnir();
290 new npc_malformed_ooze();
291 new npc_iron_sludge();
293}
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
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:73
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_FRENZY
@ EVENT_SUMMON
void AddSC_boss_sjonnir()
@ DATA_ABUSE_THE_OOZE
@ ACTION_OOZE_DEAD
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
Position const CenterPoint
@ SPELL_CHAIN_LIGHTING
@ SPELL_LIGHTING_SHIELD
@ SPELL_FRENZY
@ SPELL_LIGHTING_RING_1
@ SPELL_STATIC_CHARGE
@ SPELL_LIGHTING_RING
SjonnirCreatures
@ NPC_FORGED_IRON_DWARF
@ NPC_MALFORMED_OOZE
@ NPC_IRON_SLUDGE
@ NPC_FORGED_IRON_TROGG
@ NPC_EARTHEN_DWARF
Position const PipeLocations[]
@ EVENT_CHAIN_LIGHTNING
@ EVENT_LIGHTNING_RING
@ EVENT_STATIC_CHARGE
@ EVENT_LIGHTNING_SHIELD
@ EVENT_FRENZY
@ EVENT_SUMMON
AchievementCriteriaScript(const char *name)
InstanceScript *const instance
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Creature * ToCreature()
Definition Object.h:207
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
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
AI * GetHallsOfStoneAI(Creature *creature)
@ DATA_SJONNIR
Creature * me
bool HealthAbovePct(uint32 pct) const
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void DoAction(int32 action) OVERRIDE
void EnterCombat(Unit *who) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void KilledUnit(Unit *who) OVERRIDE
void JustDied(Unit *) OVERRIDE
uint32 GetData(uint32 type) const OVERRIDE
boss_sjonnirAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================