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 }
125};
126
136
146
147// 17950 - Shadow Portal
149{
150 bool Load() override
151 {
154 }
155
156 void HandleCast(SpellEffIndex /*effIndex*/)
157 {
158 Unit* caster = GetCaster();
159 uint8 attempts = 0;
160 uint32 spellId = 0;
161
162 while (!spellId)
163 {
164 if (attempts++ >= 6) break;
165
166 switch (urand(0, 5))
167 {
170 if (go->GetGoState() == GO_STATE_ACTIVE)
172 break;
175 if (go->GetGoState() == GO_STATE_ACTIVE)
177 break;
178 case ROOM_THE_COVEN:
180 if (go->GetGoState() == GO_STATE_ACTIVE)
182 break;
185 if (go->GetGoState() == GO_STATE_ACTIVE)
187 break;
190 if (go->GetGoState() == GO_STATE_ACTIVE)
192 break;
195 if (go->GetGoState() == GO_STATE_ACTIVE)
197 break;
198 }
199
200 if (spellId)
201 GetHitUnit()->CastSpell(GetHitUnit(), spellId);
202 }
203 }
204
209
211};
212
213// Script for Shadow Portal spells 17863, 17939, 17943, 17944, 17946, 17948
215{
216 // Hall of Secrects
217
218 // The Hall of the damned
219 { 177.9624f, -68.23893f, 84.95197f, 3.228859f },
220 { 183.7705f, -61.43489f, 84.92424f, 5.148721f },
221 { 184.7035f, -77.74805f, 84.92424f, 4.660029f },
222 // The Coven
223 { 111.7203f, -1.105035f, 85.45985f, 3.961897f },
224 { 118.0079f, 6.430664f, 85.31169f, 2.408554f },
225 { 120.0276f, -7.496636f, 85.31169f, 2.984513f },
226 // The Shadow Vault
227 { 245.3716f, 0.628038f, 72.73877f, 0.01745329f },
228 { 240.9920f, 3.405653f, 72.73877f, 6.143559f },
229 { 240.9543f, -3.182943f, 72.73877f, 0.2268928f },
230 // Barov Family Vault
231 { 181.8245f, -42.58117f, 75.4812f, 4.660029f },
232 { 177.7456f, -42.74745f, 75.4812f, 4.886922f },
233 { 185.6157f, -42.91200f, 75.4812f, 4.45059f },
234 // Vault of the Ravenian
235
236};
237
239{
240 NPC_RISEN_GUARDIAN = 11598
242
252
253// 17863, 17939, 17943, 17944, 17946, 17948 - Shadow Portal
255{
256 bool Load() override
257 {
260 }
261
263 {
264 // If only one player in threat list fail spell
265
266 Unit* caster = GetCaster();
267
268 int8 pos_to_summon = 0;
269 int8 phase_to_set = 0;
270 int32 gate_to_close = 0;
271
272 switch (GetEffectInfo().MiscValue)
273 {
275 pos_to_summon = 0; // Not yet spawned
276 phase_to_set = 1;
277 gate_to_close = GO_GATE_RAVENIAN;
278 break;
280 pos_to_summon = 0;
281 phase_to_set = 2;
282 gate_to_close = GO_GATE_THEOLEN;
283 break;
285 pos_to_summon = 3;
286 phase_to_set = 3;
287 gate_to_close = GO_GATE_MALICIA;
288 break;
290 pos_to_summon = 6;
291 phase_to_set = 4;
292 gate_to_close = GO_GATE_ILLUCIA;
293 break;
295 pos_to_summon = 9;
296 phase_to_set = 5;
297 gate_to_close = GO_GATE_BAROV;
298 break;
300 pos_to_summon = 0; // Not yet spawned
301 phase_to_set = 6;
302 gate_to_close = GO_GATE_POLKELT;
303 break;
304 default:
305 break;
306 }
307
308 if (gate_to_close)
309 {
310 for (uint8 i = 0; i < 3; ++i)
311 {
312 if (Creature* Summoned = caster->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 2min))
313 {
314 Summoned->GetMotionMaster()->MoveRandom(5);
315 Summoned->AI()->SetData(0, phase_to_set);
316 }
317 }
318
319 if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetGuidData(gate_to_close)))
320 gate->SetGoState(GO_STATE_READY);
321 }
322 }
323
328
330};
331
TC_GAME_API bool InstanceHasScript(WorldObject const *obj, char const *scriptName)
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:43
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
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:290
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::ForceWalk, MovementSlot slot=MOTION_SLOT_DEFAULT, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
InstanceScript * GetInstanceScript() const
Definition Object.cpp:394
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
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:1403
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
@ DATA_DARKMASTER_GANDLING
Definition scholomance.h:34
#define ScholomanceScriptName
Definition scholomance.h:23
#define RegisterScholomanceCreatureAI(ai_name)
Definition scholomance.h:72
@ 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
void JustEngagedWith(Unit *who) override
boss_darkmaster_gandling(Creature *creature)
void IsSummonedBy(WorldObject *) override
void UpdateAI(uint32 diff) override