TrinityCore
Loading...
Searching...
No Matches
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#include "ScriptMgr.h"
19#include "GameObject.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "scholomance.h"
24#include "ScriptedCreature.h"
25#include "SpellInfo.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
33
41
49
50// 1853 - Darkmaster Gandling
52{
54
55 void Reset() override
56 {
57 _Reset();
59 gate->SetGoState(GO_STATE_ACTIVE);
60 }
61
62 void JustDied(Unit* /*killer*/) override
63 {
64 _JustDied();
66 gate->SetGoState(GO_STATE_ACTIVE);
67 }
68
80
81 void IsSummonedBy(WorldObject* /*summoner*/) override
82 {
85 }
86
87 void UpdateAI(uint32 diff) override
88 {
89 if (!UpdateVictim())
90 return;
91
92 events.Update(diff);
93
95 return;
96
97 while (uint32 eventId = events.ExecuteEvent())
98 {
99 switch (eventId)
100 {
103 events.Repeat(8s);
104 break;
107 events.Repeat(14s, 28s);
108 break;
109 case EVENT_CURSE:
111 events.Repeat(15s, 27s);
112 break;
114 if (HealthAbovePct(3))
115 {
117 events.Repeat(17s, 27s);
118 }
119 }
120
122 return;
123 }
124
126 }
127};
128
138
148
149// 17950 - Shadow Portal
151{
153
154 bool Load() override
155 {
158 }
159
160 void HandleCast(SpellEffIndex /*effIndex*/)
161 {
162 Unit* caster = GetCaster();
163 uint8 attempts = 0;
164 uint32 spellId = 0;
165
166 while (!spellId)
167 {
168 if (attempts++ >= 6) break;
169
170 switch (urand(0, 5))
171 {
174 if (go->GetGoState() == GO_STATE_ACTIVE)
176 break;
179 if (go->GetGoState() == GO_STATE_ACTIVE)
181 break;
182 case ROOM_THE_COVEN:
184 if (go->GetGoState() == GO_STATE_ACTIVE)
186 break;
189 if (go->GetGoState() == GO_STATE_ACTIVE)
191 break;
194 if (go->GetGoState() == GO_STATE_ACTIVE)
196 break;
199 if (go->GetGoState() == GO_STATE_ACTIVE)
201 break;
202 }
203
204 if (spellId)
205 GetHitUnit()->CastSpell(GetHitUnit(), spellId);
206 }
207 }
208
213
215};
216
217// Script for Shadow Portal spells 17863, 17939, 17943, 17944, 17946, 17948
219{
220 // Hall of Secrects
221
222 // The Hall of the damned
223 { 177.9624f, -68.23893f, 84.95197f, 3.228859f },
224 { 183.7705f, -61.43489f, 84.92424f, 5.148721f },
225 { 184.7035f, -77.74805f, 84.92424f, 4.660029f },
226 // The Coven
227 { 111.7203f, -1.105035f, 85.45985f, 3.961897f },
228 { 118.0079f, 6.430664f, 85.31169f, 2.408554f },
229 { 120.0276f, -7.496636f, 85.31169f, 2.984513f },
230 // The Shadow Vault
231 { 245.3716f, 0.628038f, 72.73877f, 0.01745329f },
232 { 240.9920f, 3.405653f, 72.73877f, 6.143559f },
233 { 240.9543f, -3.182943f, 72.73877f, 0.2268928f },
234 // Barov Family Vault
235 { 181.8245f, -42.58117f, 75.4812f, 4.660029f },
236 { 177.7456f, -42.74745f, 75.4812f, 4.886922f },
237 { 185.6157f, -42.91200f, 75.4812f, 4.45059f },
238 // Vault of the Ravenian
239
240};
241
243{
244 NPC_RISEN_GUARDIAN = 11598
246
256
257// 17863, 17939, 17943, 17944, 17946, 17948 - Shadow Portal
259{
261
262 bool Load() override
263 {
266 }
267
269 {
270 // If only one player in threat list fail spell
271
272 Unit* caster = GetCaster();
273
274 int8 pos_to_summon = 0;
275 int8 phase_to_set = 0;
276 int32 gate_to_close = 0;
277
278 switch (GetEffectInfo().MiscValue)
279 {
281 pos_to_summon = 0; // Not yet spawned
282 phase_to_set = 1;
283 gate_to_close = GO_GATE_RAVENIAN;
284 break;
286 pos_to_summon = 0;
287 phase_to_set = 2;
288 gate_to_close = GO_GATE_THEOLEN;
289 break;
291 pos_to_summon = 3;
292 phase_to_set = 3;
293 gate_to_close = GO_GATE_MALICIA;
294 break;
296 pos_to_summon = 6;
297 phase_to_set = 4;
298 gate_to_close = GO_GATE_ILLUCIA;
299 break;
301 pos_to_summon = 9;
302 phase_to_set = 5;
303 gate_to_close = GO_GATE_BAROV;
304 break;
306 pos_to_summon = 0; // Not yet spawned
307 phase_to_set = 6;
308 gate_to_close = GO_GATE_POLKELT;
309 break;
310 default:
311 break;
312 }
313
314 if (gate_to_close)
315 {
316 for (uint8 i = 0; i < 3; ++i)
317 {
318 if (Creature* Summoned = caster->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2min))
319 {
320 Summoned->GetMotionMaster()->MoveRandom(5);
321 Summoned->AI()->SetData(0, phase_to_set);
322 }
323 }
324
325 if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(gate_to_close)))
326 gate->SetGoState(GO_STATE_READY);
327 }
328 }
329
334
336};
337
TC_GAME_API bool InstanceHasScript(WorldObject const *obj, char const *scriptName)
uint8_t uint8
Definition Define.h:135
int8_t int8
Definition Define.h:131
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SEND_EVENT
@ GO_STATE_READY
@ GO_STATE_ACTIVE
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
Creatures
Position const SummonPos[18]
void AddSC_boss_darkmaster_gandling()
@ 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
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveRandom(float wanderDistance=0.0f)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
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:1992
PrepareSpellScript(spell_shadow_portal_rooms)
PrepareSpellScript(spell_shadow_portal)
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
@ DATA_DARKMASTER_GANDLING
Definition scholomance.h:36
#define ScholomanceScriptName
Definition scholomance.h:23
#define RegisterScholomanceCreatureAI(ai_name)
Definition scholomance.h:65
@ GO_GATE_RAVENIAN
Definition scholomance.h:50
@ GO_GATE_BAROV
Definition scholomance.h:54
@ GO_GATE_POLKELT
Definition scholomance.h:55
@ GO_GATE_GANDLING
Definition scholomance.h:49
@ GO_GATE_THEOLEN
Definition scholomance.h:51
@ GO_GATE_ILLUCIA
Definition scholomance.h:52
@ GO_GATE_MALICIA
Definition scholomance.h:53
bool HealthAbovePct(uint32 pct) const
void JustEngagedWith(Unit *who) override
boss_darkmaster_gandling(Creature *creature)
void IsSummonedBy(WorldObject *) override
void UpdateAI(uint32 diff) override