TrinityCore
Loading...
Searching...
No Matches
boss_ozruk.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "SpellScript.h"
21#include "SpellAuraEffects.h"
22#include "stonecore.h"
23#include "TemporarySummon.h"
24#include "Vehicle.h"
25
27{
32 SPELL_ENRAGE = 80467,
33
34 // Rupture Controller and Rupture
36// SPELL_RUPTURE_SUMMON_CENTER? = 95669, // summons rupture 8 yards front
37// SPELL_RUPTURE_SUMMON_LEFT? = 95348, // summons rupture 3 yards left?
38// SPELL_RUPTURE_SUMMON_RIGHT? = 92383, // summons rupture 3 yards right?
40};
41
42enum NPCs
43{
46 NPC_RUPTURE = 49576,
47};
48
57
70
71// TO-DO:
72// - Find heroic sniffs and spawn Ruptures using spells commented above.
73// - Make Bouncer Spikes enter ozruk without jump animation.
74
76{
77 public:
78 boss_ozruk() : CreatureScript("boss_ozruk") { }
79
80 struct boss_ozrukAI : public BossAI
81 {
82 boss_ozrukAI(Creature* creature) : BossAI(creature, DATA_OZRUK) { }
83
94
95 void JustEngagedWith(Unit* who) override
96 {
98
100 }
101
102 void JustSummoned(Creature* summon) override
103 {
104 if (summon->GetEntry() == NPC_RUPTURE_CONTROLLER)
105 {
106 summon->CastSpell(summon, SPELL_RUPTURE, true);
107 summon->DespawnOrUnsummon(10s);
108 }
109
110 BossAI::JustSummoned(summon);
111 }
112
113 void DamageTaken(Unit* /*attacker*/, uint32 &damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
114 {
115 if (!me->HealthBelowPctDamaged(25, damage) || me->HasAura(SPELL_ENRAGE))
116 return;
117
120 }
121
122 void JustDied(Unit* /*killer*/) override
123 {
124 _JustDied();
125
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 if (!UpdateVictim())
132 return;
133
134 events.Update(diff);
135
137 return;
138
139 while (uint32 eventId = events.ExecuteEvent())
140 {
141 switch (eventId)
142 {
146 break;
149 me->AttackStop();
152 break;
157 break;
158 case EVENT_SHATTER:
161 me->AttackStop();
164 // Spells are cast in same order everytime after Shatter, so we schedule them here
168 break;
172 break;
173 default:
174 break;
175 }
176 }
177 }
178 };
179
180 CreatureAI* GetAI(Creature* creature) const override
181 {
182 return GetStonecoreAI<boss_ozrukAI>(creature);
183 }
184};
185
186// 92393 - Rupture
188{
189public:
190 spell_rupture() : SpellScriptLoader("spell_rupture") { }
191
193 {
195 {
196 Unit* caster = GetCaster();
197
198 float dist = aurEff->GetTickNumber() * 8.0f;
199
200 // probably hack, should use spells (see Spells enum above)
201 Position pos = caster->GetNearPosition(dist, 0.0f);
202 SummonRupture(caster, pos);
203
204 pos = caster->GetNearPosition(dist, 0.2f);
205 SummonRupture(caster, pos);
206
207 pos = caster->GetNearPosition(dist, -0.2f);
208 SummonRupture(caster, pos);
209 }
210
211 void SummonRupture(Unit* caster, Position pos)
212 {
213 Creature* rupture = caster->SummonCreature(NPC_RUPTURE, pos, TEMPSUMMON_TIMED_DESPAWN, 2500ms);
214 if (!rupture)
215 return;
216
217 rupture->CastSpell(rupture, SPELL_RUPTURE_DAMAGE, true);
218 }
219
224 };
225
226 AuraScript* GetAuraScript() const override
227 {
228 return new spell_rupture_AuraScript();
229 }
230};
231
232// 78835 - Elementium Spike Shield
234{
235public:
236 spell_elementium_spike_shield() : SpellScriptLoader("spell_elementium_spike_shield") { }
237
239 {
241 {
242 Unit* caster = GetCaster();
243 Vehicle* vehicle = caster->GetVehicleKit();
244 if (!vehicle)
245 return;
246
247 for (uint8 i = 0; i < vehicle->GetAvailableSeatCount(); i++)
248 if (Creature* summon = caster->SummonCreature(NPC_BOUNCER_SPIKE, caster->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 10s))
249 summon->EnterVehicle(caster, i);
250 }
251
256 };
257
258 SpellScript* GetSpellScript() const override
259 {
261 }
262};
263
265{
266 new boss_ozruk();
267 new spell_rupture();
269}
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_TIMED_DESPAWN
Spells
Definition PlayerAI.cpp:32
@ EFFECT_0
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ SPELL_ELEMENTIUM_BULWARK
@ SPELL_ENRAGE
@ SPELL_ELEMENTIUM_SPIKE_SHIELD
@ SPELL_GROUND_SLAM
@ SPELL_RUPTURE_DAMAGE
@ SPELL_SHATTER
@ SPELL_RUPTURE
@ NPC_BOUNCER_SPIKE
@ NPC_RUPTURE_CONTROLLER
@ NPC_RUPTURE
void AddSC_boss_ozruk()
@ SAY_DEATH
@ SAY_ELEMENTIUM_SPIKE_SHIELD
@ SAY_AGGRO
@ SAY_ELEMENTIUM_BULWARK
@ SAY_ENRAGE
@ EVENT_ELEMENTIUM_SPIKE_SHIELD
@ EVENT_ENRAGE
@ EVENT_START_ATTACK
@ EVENT_SHATTER
@ EVENT_GROUND_SLAM
@ EVENT_NONE
@ EVENT_ELEMENTIUM_BULWARK
uint32 GetTickNumber() const
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
uint32 GetEntry() const
Definition Object.h:89
Unit * GetCaster() const
HookList< CastHandler > OnCast
void DespawnEntry(uint32 entry)
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
Unit * GetVictim() const
Definition Unit.h:726
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
Vehicle * GetVehicleKit() const
Definition Unit.h:1782
bool AttackStop()
Definition Unit.cpp:5965
uint8 GetAvailableSeatCount() const
Gets the available seat count.
Definition Vehicle.cpp:712
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
Position GetNearPosition(float dist, float angle)
Definition Object.cpp:2755
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
void HandleEffectPeriodic(AuraEffect const *aurEff)
void SummonRupture(Unit *caster, Position pos)
AuraScript * GetAuraScript() const override
@ DATA_OZRUK
Definition stonecore.h:31
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
void JustEngagedWith(Unit *who) override
boss_ozrukAI(Creature *creature)
void JustSummoned(Creature *summon) override
void JustDied(Unit *) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void Reset() override
void UpdateAI(uint32 diff) override