Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_ossirian.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 "ruins_of_ahnqiraj.h"
9#include "Player.h"
10#include "SpellInfo.h"
11#include "WorldPacket.h"
12#include "Opcodes.h"
13
22
33
38
45
47
48// You spin me right round, baby
49// right round like a record, baby
50// right round round round
52{
53 { -9394.230469f, 1951.808594f, 85.97733f, 0.0f },
54 { -9357.931641f, 1930.596802f, 85.556198f, 0.0f },
55 { -9383.113281f, 2011.042725f, 85.556389f, 0.0f },
56 { -9243.36f, 1979.04f, 85.556f, 0.0f },
57 { -9281.68f, 1886.66f, 85.5558f, 0.0f },
58 { -9241.8f, 1806.39f, 85.5557f, 0.0f },
59 { -9366.78f, 1781.76f, 85.5561f, 0.0f },
60 { -9430.37f, 1786.86f, 85.557f, 0.0f },
61 { -9406.73f, 1863.13f, 85.5558f, 0.0f }
62};
63
64float RoomRadius = 165.0f;
67uint32 const SpellWeakness[NUM_WEAKNESS] = { 25177, 25178, 25180, 25181, 25183 };
68Position const RoomCenter = { -9343.041992f, 1923.278198f, 85.555984f, 0.0 };
69
71{
72 public:
73 boss_ossirian() : CreatureScript("boss_ossirian") { }
74
75 struct boss_ossirianAI : public BossAI
76 {
78 {
79 SaidIntro = false;
80 }
81
86
88 {
89 _Reset();
91 TriggerGUID = 0;
92 CrystalGUID = 0;
93 }
94
95 void SpellHit(Unit* caster, SpellInfo const* spell) OVERRIDE
96 {
97 for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
98 {
99 if (spell->Id == SpellWeakness[i])
100 {
101 me->RemoveAurasDueToSpell(SPELL_SUPREME);
102 ((TempSummon*)caster)->UnSummon();
104 }
105 }
106 }
107
109 {
110 if (action == ACTION_TRIGGER_WEAKNESS)
111 if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID))
112 if (!Trigger->HasUnitState(UNIT_STATE_CASTING))
113 Trigger->CastSpell(Trigger, SpellWeakness[std::rand() % 4], false);
114 }
115
116 void EnterCombat(Unit* /*who*/) OVERRIDE
117 {
118 _EnterCombat();
119 events.Reset();
120 events.ScheduleEvent(EVENT_SILENCE, 30000);
121 events.ScheduleEvent(EVENT_CYCLONE, 20000);
122 events.ScheduleEvent(EVENT_STOMP, 30000);
123
126
127 if (instance)
128 {
129 Map* map = me->GetMap();
130 if (!map->IsRaid())
131 return;
132
133 WorldPacket data(SMSG_WEATHER, 4 + 4 + 1);
134 data << uint32(WEATHER_STATE_HEAVY_SANDSTORM); // WeatherID
135 data << float(1.0f); // Intensity
136 data.WriteBit(false); // Abrupt
137 data.FlushBits();
138 map->SendToPlayers(&data);
139
140 for (uint8 i = 0; i < NUM_TORNADOS; ++i)
141 {
142 Position Point;
143 me->GetRandomPoint(RoomCenter, RoomRadius, Point);
144 if (Creature* Tornado = me->GetMap()->SummonCreature(NPC_SAND_VORTEX, Point))
145 Tornado->CastSpell(Tornado, SPELL_SAND_STORM, true);
146 }
147
149 }
150 }
151
152 void KilledUnit(Unit* /*victim*/) OVERRIDE
153 {
154 Talk(SAY_SLAY);
155 }
156
158 {
159 Cleanup();
160 summons.DespawnAll();
162 }
163
164 void JustDied(Unit* /*killer*/) OVERRIDE
165 {
166 Cleanup();
167 _JustDied();
168 }
169
170 void Cleanup()
171 {
172 if (GameObject* Crystal = me->GetMap()->GetGameObject(CrystalGUID))
173 Crystal->Use(me);
174 }
175
177 {
179 CrystalIterator = 0;
180
181 if (Creature* Trigger = me->GetMap()->SummonCreature(NPC_OSSIRIAN_TRIGGER, CrystalCoordinates[CrystalIterator]))
182 {
183 TriggerGUID = Trigger->GetGUID();
184 if (GameObject* Crystal = Trigger->SummonGameObject(GO_OSSIRIAN_CRYSTAL,
185 CrystalCoordinates[CrystalIterator].GetPositionX(),
186 CrystalCoordinates[CrystalIterator].GetPositionY(),
187 CrystalCoordinates[CrystalIterator].GetPositionZ(),
188 0, 0, 0, 0, 0, uint32(-1)))
189 {
190 CrystalGUID = Crystal->GetGUID();
192 }
193 }
194 }
195
197
198 {
199 if (!SaidIntro)
200 {
202 SaidIntro = true;
203 }
205 }
206
208 {
209 if (!UpdateVictim())
210 return;
211
212 events.Update(diff);
213
214 // No kiting!
215 if (me->GetDistance(me->GetVictim()) > 60.00f && me->GetDistance(me->GetVictim()) < 120.00f)
217
218 bool ApplySupreme = true;
219
220 if (me->HasAura(SPELL_SUPREME))
221 ApplySupreme = false;
222 else
223 {
224 for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
225 {
226 if (me->HasAura(SpellWeakness[i]))
227 {
228 ApplySupreme = false;
229 break;
230 }
231 }
232 }
233
234 if (ApplySupreme)
235 {
238 }
239
240 while (uint32 eventId = events.ExecuteEvent())
241 {
242 switch (eventId)
243 {
244 case EVENT_SILENCE:
246 events.ScheduleEvent(EVENT_SILENCE, std::rand() % 30000 + 20000);
247 break;
248 case EVENT_CYCLONE:
250 events.ScheduleEvent(EVENT_CYCLONE, 20000);
251 break;
252 case EVENT_STOMP:
254 events.ScheduleEvent(EVENT_STOMP, 30000);
255 break;
256 default:
257 break;
258 }
259 }
260
262 }
263 };
264
266 {
267 return new boss_ossirianAI(creature);
268 }
269};
270
272{
273 public:
274 go_ossirian_crystal() : GameObjectScript("go_ossirian_crystal") { }
275
277 {
278 InstanceScript* Instance = player->GetInstanceScript();
279 if (!Instance)
280 return false;
281
282 Creature* Ossirian = player->FindNearestCreature(NPC_OSSIRIAN, 30.0f);
283 if (!Ossirian || Instance->GetBossState(DATA_OSSIRIAN) != IN_PROGRESS)
284 return false;
285
286 Ossirian->AI()->DoAction(ACTION_TRIGGER_WEAKNESS);
287 return true;
288 }
289};
290
292{
293 new boss_ossirian();
295}
Actions
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
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ SAY_SLAY
@ SAY_INTRO
#define SAY_DEATH
#define SAY_AGGRO
@ ACTION_TRIGGER_WEAKNESS
@ SPELL_STOMP
@ SPELL_SILENCE
@ SPELL_SUMMON_CRYSTAL
@ SPELL_SAND_STORM
@ SPELL_CYCLONE
@ SPELL_SUPREME
@ SPELL_SUMMON
uint8 const NUM_TORNADOS
Position CrystalCoordinates[NUM_CRYSTALS]
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_SUPREME
@ SAY_INTRO
Position const RoomCenter
uint8 const NUM_CRYSTALS
float RoomRadius
uint32 const SpellWeakness[NUM_WEAKNESS]
void AddSC_boss_ossirian()
@ EVENT_CYCLONE
@ EVENT_STOMP
@ EVENT_SILENCE
uint8 const NUM_WEAKNESS
@ EVENT_STOMP
@ SPELL_STOMP
Definition chapter5.cpp:158
InstanceScript *const instance
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
bool WriteBit(uint32 bit)
Definition ByteBuffer.h:164
void FlushBits()
Definition ByteBuffer.h:154
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
GameObjectScript(const char *name)
EncounterState GetBossState(uint32 id) const
Definition Map.h:238
bool IsRaid() const
Definition Map.h:372
void SendToPlayers(WorldPacket const *data) const
Definition Map.cpp:2525
virtual void DoAction(int32)
Definition UnitAI.h:126
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
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2801
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition Object.cpp:2729
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, GameObject *) OVERRIDE
@ SMSG_WEATHER
Definition Opcodes.h:1065
@ WEATHER_STATE_HEAVY_SANDSTORM
Definition Weather.h:45
@ GO_OSSIRIAN_CRYSTAL
@ NPC_OSSIRIAN_TRIGGER
@ NPC_SAND_VORTEX
@ NPC_OSSIRIAN
@ DATA_OSSIRIAN
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
void DoAction(int32 action) OVERRIDE
void SpellHit(Unit *caster, SpellInfo const *spell) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
void MoveInLineOfSight(Unit *who) OVERRIDE
boss_ossirianAI(Creature *creature)
void JustDied(Unit *) OVERRIDE