TrinityCore
boss_darkmaster_gandling.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/*
19Name: Boss_Darkmaster_Gandling
20%Complete: 90
21Comment: Doors Not yet reopening.
22Category: Scholomance
23*/
24
25#include "ScriptMgr.h"
26#include "GameObject.h"
27#include "InstanceScript.h"
28#include "MotionMaster.h"
29#include "ObjectAccessor.h"
30#include "scholomance.h"
31#include "ScriptedCreature.h"
32#include "SpellInfo.h"
33#include "SpellScript.h"
34#include "TemporarySummon.h"
35
36enum Says
37{
39};
40
42{
45 SPELL_CURSE = 18702,
47};
48
50{
55};
56
58{
59 public: boss_darkmaster_gandling() : CreatureScript("boss_darkmaster_gandling") { }
60
62 {
64
65 void Reset() override
66 {
67 _Reset();
69 gate->SetGoState(GO_STATE_ACTIVE);
70 }
71
72 void JustDied(Unit* /*killer*/) override
73 {
74 _JustDied();
76 gate->SetGoState(GO_STATE_ACTIVE);
77 }
78
79 void JustEngagedWith(Unit* who) override
80 {
86
88 gate->SetGoState(GO_STATE_READY);
89 }
90
91 void IsSummonedBy(WorldObject* /*summoner*/) override
92 {
95 }
96
97 void UpdateAI(uint32 diff) override
98 {
99 if (!UpdateVictim())
100 return;
101
102 events.Update(diff);
103
105 return;
106
107 while (uint32 eventId = events.ExecuteEvent())
108 {
109 switch (eventId)
110 {
114 break;
118 break;
119 case EVENT_CURSE:
122 break;
124 if (HealthAbovePct(3))
125 {
128 }
129 }
130
132 return;
133 }
134 }
135 };
136
137 CreatureAI* GetAI(Creature* creature) const override
138 {
139 return GetScholomanceAI<boss_darkmaster_gandlingAI>(creature);
140 }
141};
142
143// Script for Shadow Portal spell 17950
145{
153
155{
163
164// 17950 - Shadow Portal
166{
167 public:
168 spell_shadow_portal() : SpellScriptLoader("spell_shadow_portal") { }
169
171 {
172 bool Load() override
173 {
176 }
177
178 void HandleCast(SpellEffIndex /*effIndex*/)
179 {
180 Unit* caster = GetCaster();
181 uint8 attempts = 0;
182 uint32 spellId = 0;
183
184 while (!spellId)
185 {
186 if (attempts++ >= 6) break;
187
188 switch (urand(0, 5))
189 {
192 if (go->GetGoState() == GO_STATE_ACTIVE)
194 break;
197 if (go->GetGoState() == GO_STATE_ACTIVE)
199 break;
200 case ROOM_THE_COVEN:
202 if (go->GetGoState() == GO_STATE_ACTIVE)
204 break;
207 if (go->GetGoState() == GO_STATE_ACTIVE)
209 break;
212 if (go->GetGoState() == GO_STATE_ACTIVE)
214 break;
217 if (go->GetGoState() == GO_STATE_ACTIVE)
219 break;
220 }
221
222 if (spellId)
223 GetHitUnit()->CastSpell(GetHitUnit(), spellId);
224 }
225 }
226
227 void Register() override
228 {
230 }
231
233 };
234
235 SpellScript* GetSpellScript() const override
236 {
238 }
239};
240
241// Script for Shadow Portal spells 17863, 17939, 17943, 17944, 17946, 17948
243{
244 // Hall of Secrects
245
246 // The Hall of the damned
247 { 177.9624f, -68.23893f, 84.95197f, 3.228859f },
248 { 183.7705f, -61.43489f, 84.92424f, 5.148721f },
249 { 184.7035f, -77.74805f, 84.92424f, 4.660029f },
250 // The Coven
251 { 111.7203f, -1.105035f, 85.45985f, 3.961897f },
252 { 118.0079f, 6.430664f, 85.31169f, 2.408554f },
253 { 120.0276f, -7.496636f, 85.31169f, 2.984513f },
254 // The Shadow Vault
255 { 245.3716f, 0.628038f, 72.73877f, 0.01745329f },
256 { 240.9920f, 3.405653f, 72.73877f, 6.143559f },
257 { 240.9543f, -3.182943f, 72.73877f, 0.2268928f },
258 // Barov Family Vault
259 { 181.8245f, -42.58117f, 75.4812f, 4.660029f },
260 { 177.7456f, -42.74745f, 75.4812f, 4.886922f },
261 { 185.6157f, -42.91200f, 75.4812f, 4.45059f },
262 // Vault of the Ravenian
263
264};
265
267{
268 NPC_RISEN_GUARDIAN = 11598
270
272{
280
281// 17863, 17939, 17943, 17944, 17946, 17948 - Shadow Portal
283{
284 public:
285 spell_shadow_portal_rooms() : SpellScriptLoader("spell_shadow_portal_rooms") { }
286
288 {
289 bool Load() override
290 {
293 }
294
296 {
297 // If only one player in threat list fail spell
298
299 Unit* caster = GetCaster();
300
301 int8 pos_to_summon = 0;
302 int8 phase_to_set = 0;
303 int32 gate_to_close = 0;
304
305 switch (GetEffectInfo().MiscValue)
306 {
308 pos_to_summon = 0; // Not yet spawned
309 phase_to_set = 1;
310 gate_to_close = GO_GATE_RAVENIAN;
311 break;
313 pos_to_summon = 0;
314 phase_to_set = 2;
315 gate_to_close = GO_GATE_THEOLEN;
316 break;
318 pos_to_summon = 3;
319 phase_to_set = 3;
320 gate_to_close = GO_GATE_MALICIA;
321 break;
323 pos_to_summon = 6;
324 phase_to_set = 4;
325 gate_to_close = GO_GATE_ILLUCIA;
326 break;
328 pos_to_summon = 9;
329 phase_to_set = 5;
330 gate_to_close = GO_GATE_BAROV;
331 break;
333 pos_to_summon = 0; // Not yet spawned
334 phase_to_set = 6;
335 gate_to_close = GO_GATE_POLKELT;
336 break;
337 default:
338 break;
339 }
340
341 if (gate_to_close)
342 {
343 for (uint8 i = 0; i < 3; ++i)
344 {
345 if (Creature* Summoned = caster->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2min))
346 {
347 Summoned->GetMotionMaster()->MoveRandom(5);
348 Summoned->AI()->SetData(0, phase_to_set);
349 }
350 }
351
352 if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(gate_to_close)))
353 gate->SetGoState(GO_STATE_READY);
354 }
355 }
356
357 void Register() override
358 {
360 }
361
363 };
364
365 SpellScript* GetSpellScript() const override
366 {
368 }
369};
370
372{
376}
TC_GAME_API bool InstanceHasScript(WorldObject const *obj, char const *scriptName)
uint8_t uint8
Definition: Define.h:144
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SEND_EVENT
@ GO_STATE_READY
@ GO_STATE_ACTIVE
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ UNIT_STATE_CASTING
Definition: Unit.h:270
Position const SummonPos[18]
void AddSC_boss_darkmaster_gandling()
@ SPELL_ARCANEMISSILES
@ ROOM_HALL_OF_THE_DAMNED
@ ROOM_BAROV_FAMILY_VAULT
@ ROOM_VAULT_OF_THE_RAVENIAN
@ SPELL_SHADOW_PORTAL_THECOVEN
@ SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED
@ SPELL_SHADOW_PORTAL_HALLOFSECRETS
@ SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT
@ SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN
@ SPELL_SHADOW_PORTAL_THESHADOWVAULT
@ SPELL_EVENT_HALLOFSECRETS
@ SPELL_EVENT_HALLOFTHEDAMNED
@ SPELL_EVENT_BAROVFAMILYVAULT
@ SPELL_EVENT_THESHADOWVAULT
@ SPELL_EVENT_VAULTOFTHERAVENIAN
@ EVENT_ARCANEMISSILES
Says
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
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
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_DEFAULT)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
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
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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:2025
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
@ DATA_DARKMASTERGANDLING
Definition: scholomance.h:34
#define ScholomanceScriptName
Definition: scholomance.h:23
@ GO_GATE_RAVENIAN
Definition: scholomance.h:57
@ GO_GATE_BAROV
Definition: scholomance.h:61
@ GO_GATE_POLKELT
Definition: scholomance.h:62
@ GO_GATE_GANDLING
Definition: scholomance.h:56
@ GO_GATE_THEOLEN
Definition: scholomance.h:58
@ GO_GATE_ILLUCIA
Definition: scholomance.h:59
@ GO_GATE_MALICIA
Definition: scholomance.h:60
bool HealthAbovePct(uint32 pct) const