TrinityCore
boss_corborus.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 "CreatureGroups.h"
20#include "InstanceScript.h"
21#include "ScriptedCreature.h"
22#include "stonecore.h"
23
24// TO-DO:
25// Find heroic sniffs and script spawning Crystal Shards on heroic mode.
26
28{
29 // Corborus intro
32 SPELL_DOOR_BREAK = 81232, // cast by World Trigger 22515
33
34 // Corborus boss
36 SPELL_CRYSTAL_BARRAGE = 86881, // 81638 triggers 81637
37// SPELL_CRYSTAL_BARRAGE_SHARD = 92012, // heroic only, summons Crystal Shard (TO-DO!)
40 SPELL_TRASHING_CHARGE_TELEPORT = 81839, // triggers 81864
41// SPELL_TRASHING_CHARGE_TELEPORT_2= 81838, // dummy, targets all players, threat update packet follows
43 SPELL_TRASHING_CHARGE_VISUAL = 81801, // cast time 3.5 sec
44 SPELL_TRASHING_CHARGE_EFFECT = 81828, // 40 yard radius
45 SPELL_EMERGE = 81948,
46
47 // Rock Borer npc (43917)
50};
51
52enum NPCs
53{
55// NPC_CRYSTAL_SHARD = 49267, // 49473
56};
57
59{
61
62 // Corborus intro
66
67 // Corborus boss
76
77 // Rock Borer
80};
81
83{
84 public:
85 boss_corborus() : CreatureScript("boss_corborus") { }
86
87 struct boss_corborusAI : public BossAI
88 {
90 {
92 }
93
94 void Reset() override
95 {
96 _Reset();
97
99
103 }
104
105 void DoAction(int32 action) override
106 {
107 switch (action)
108 {
109 case ACTION_CORBORUS_INTRO: // Executes Corborus intro event
110 {
111 if (stateIntro != NOT_STARTED)
112 return;
113
115
117 {
118 Millhouse->InterruptNonMeleeSpells(true);
119 Millhouse->RemoveAllAuras();
120 Millhouse->HandleEmoteCommand(EMOTE_ONESHOT_KNOCKDOWN);
121 }
122
124 break;
125 }
126 default:
127 break;
128 }
129 }
130
131 void UpdateAI(uint32 diff) override
132 {
134 return;
135
136 events.Update(diff);
137
139 return;
140
141 while (uint32 eventId = events.ExecuteEvent())
142 {
143 switch (eventId)
144 {
146 // Face Millhouse and other mobs
148
149 // Open rock gate and cast visual from nearby worldtrigger
151 if (Creature* worldtrigger = me->FindNearestCreature(NPC_WORLDTRIGGER, 60.0f))
152 worldtrigger->CastSpell(worldtrigger, SPELL_DOOR_BREAK, true);
153
154 // Make Corborus charge
156
158 break;
160 // Spawn Twilight Documents (quest gameobject)
162 Millhouse->CastSpell(Millhouse, SPELL_TWILIGHT_DOCUMENTS, true);
163
164 // Knockback Millhouse and other mobs
166
168 break;
170 // Face Corborus to players and set new home position
171 me->SetFacingTo(3.176499f);
172 me->SetHomePosition(1154.55f, 878.843f, 284.963f, 3.176499f);
174
175 // Despawn Millhouse and all trash
177
179 break;
183 break;
185 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
188 break;
189 case EVENT_SUBMERGE:
193
195 me->SetUninteractible(true);
197 me->AttackStop();
198
200
203 break;
204 case EVENT_TELEPORT:
205 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
208 if (countTrashingCharge <= 4)
210 else
212 break;
217 break;
218 case EVENT_EMERGE:
220 me->SetUninteractible(false);
223 break;
224 case EVENT_ATTACK:
226 break;
227 default:
228 break;
229 }
230 }
231 }
232
233 void JustSummoned(Creature* summon) override
234 {
235 if (summon->GetEntry() == NPC_TRASHING_CHARGE)
236 {
239 summon->DespawnOrUnsummon(6s);
240 }
241
242 BossAI::JustSummoned(summon);
243 }
244
245 private:
248 };
249
250 CreatureAI* GetAI(Creature* creature) const override
251 {
252 return GetStonecoreAI<boss_corborusAI>(creature);
253 }
254};
255
256// 43391 - Rock Borer
258{
259 public:
260 npc_rock_borer() : CreatureScript("npc_rock_borer") { }
261
263 {
264 npc_rock_borerAI(Creature* creature) : ScriptedAI(creature)
265 {
266 me->SetDisableGravity(true);
268 }
269
270 void IsSummonedBy(WorldObject* /*summoner*/) override
271 {
273 events.ScheduleEvent(EVENT_ROCK_BORE, 15s, 20s); // Need sniffs for this timer
276 }
277
278 void UpdateAI(uint32 diff) override
279 {
281 return;
282
283 events.Update(diff);
284
286 return;
287
288 while (uint32 eventId = events.ExecuteEvent())
289 {
290 switch (eventId)
291 {
292 case EVENT_EMERGED:
295 break;
296 case EVENT_ROCK_BORE:
298 events.ScheduleEvent(EVENT_ROCK_BORE, 15s, 20s); // Need sniffs for this timer
299 break;
300 default:
301 break;
302 }
303 }
304 }
305
306 private:
308 };
309
310 CreatureAI* GetAI(Creature* creature) const override
311 {
312 return GetStonecoreAI<npc_rock_borerAI>(creature);
313 }
314};
315
317{
318 new boss_corborus();
319 new npc_rock_borer();
320}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
EncounterState
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
@ EMOTE_ONESHOT_KNOCKDOWN
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_FLAG_IMMUNE_TO_PC
Definition: UnitDefines.h:152
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_corborus()
@ SPELL_DAMPENING_WAVE
@ SPELL_CLEAR_ALL_DEBUFFS
@ SPELL_SUMMON_TRASHING_CHARGE
@ SPELL_EMERGE
@ SPELL_TRASHING_CHARGE_EFFECT
@ SPELL_ROCK_BORER_EMERGE
@ SPELL_RING_WYRM_CHARGE
@ SPELL_TRASHING_CHARGE_TELEPORT
@ SPELL_ROCK_BORE
@ SPELL_CRYSTAL_BARRAGE
@ SPELL_TWILIGHT_DOCUMENTS
@ SPELL_DOOR_BREAK
@ SPELL_SUBMERGE
@ SPELL_TRASHING_CHARGE_VISUAL
@ NPC_TRASHING_CHARGE
@ EVENT_ATTACK
@ EVENT_EMERGE
@ EVENT_DAMPENING_WAVE
@ EVENT_TELEPORT
@ EVENT_SUMMON_BEETLE
@ EVENT_ROCK_BORE
@ EVENT_NONE
@ EVENT_CORBORUS_KNOCKBACK
@ EVENT_TRASHING_CHARGE
@ EVENT_CRYSTAL_BARRAGE
@ EVENT_SUBMERGE
@ EVENT_CORBORUS_CHARGE
@ EVENT_CORBORUS_FACEPLAYERS
@ EVENT_EMERGED
InstanceScript *const instance
void JustSummoned(Creature *summon) override
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:371
void SetReactState(ReactStates st)
Definition: Creature.h:160
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
ReactStates GetReactState() const
Definition: Creature.h:161
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
Creature * GetCreature(uint32 type)
uint32 GetEntry() const
Definition: Object.h:161
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAllAuras()
Definition: Unit.cpp:4242
bool AttackStop()
Definition: Unit.cpp:5781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
@ DATA_MILLHOUSE_EVENT_KNOCKBACK
Definition: stonecore.h:38
@ DATA_HANDLE_CORBORUS_ROCKDOOR
Definition: stonecore.h:37
@ DATA_CORBORUS
Definition: stonecore.h:29
@ DATA_MILLHOUSE_EVENT_DESPAWN
Definition: stonecore.h:39
@ DATA_MILLHOUSE_MANASTORM
Definition: stonecore.h:35
@ DATA_MILLHOUSE_EVENT_FACE
Definition: stonecore.h:36
@ ACTION_CORBORUS_INTRO
Definition: stonecore.h:51
@ NPC_WORLDTRIGGER
Definition: stonecore.h:54
boss_corborusAI(Creature *creature)
void JustSummoned(Creature *summon) override
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
npc_rock_borerAI(Creature *creature)
void UpdateAI(uint32 diff) override
void IsSummonedBy(WorldObject *) override