TrinityCore
Loading...
Searching...
No Matches
arena_the_robodrome.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 "Battleground.h"
19#include "BattlegroundScript.h"
20#include "Creature.h"
21#include "CreatureAI.h"
22#include "GameObject.h"
23#include "Map.h"
24#include "Player.h"
25#include "ScriptMgr.h"
26#include "SpellScript.h"
27#include "TaskScheduler.h"
28
29namespace TheRobodrome
30{
31 namespace MapIds
32 {
33 static constexpr uint32 TheRobodrome = 2167;
34 }
35
36 namespace Creatures
37 {
38 static constexpr uint32 PowerCoil = 154593;
39 }
40
41 namespace GameObjects
42 {
43 static constexpr uint32 Door01 = 329742;
44 static constexpr uint32 Door02 = 329743;
45 }
46
47 namespace Spells
48 {
49 static constexpr uint32 Zap = 300642;
50 }
51}
52
54{
56
57 void OnUpdate(uint32 diff) override
58 {
59 _scheduler.Update(diff);
60 }
61
62 void OnStart() override
63 {
64 for (ObjectGuid const& guid : _doorGUIDs)
65 {
66 if (GameObject* door = battlegroundMap->GetGameObject(guid))
67 {
68 door->UseDoorOrButton();
69 door->DespawnOrUnsummon(5s);
70 }
71 }
72
73 _scheduler.Schedule(5s, [&](TaskContext& context)
74 {
75 for (ObjectGuid const& guid : _powerCoilGUIDs)
76 if (Creature* coil = battlegroundMap->GetCreature(guid))
77 coil->CastSpell(nullptr, TheRobodrome::Spells::Zap);
78
79 context.Repeat();
80 });
81 }
82
83 void OnGameObjectCreate(GameObject* gameobject) override
84 {
85 switch (gameobject->GetEntry())
86 {
89 _doorGUIDs.emplace_back(gameobject->GetGUID());
90 break;
91 default:
92 break;
93 }
94 }
95
96 void OnCreatureCreate(Creature* creature) override
97 {
98 switch (creature->GetEntry())
99 {
101 _powerCoilGUIDs.emplace_back(creature->GetGUID());
102 break;
103 default:
104 break;
105 }
106 }
107
108private:
111
113};
114
115// 300642 - Zap (Damage mod)
117{
119 {
120 uint32 basePct = 16;
122
123 SetEffectValue(basePct + basePct * stackCount);
124 }
125
130};
131
uint32_t uint32
Definition Define.h:154
std::vector< ObjectGuid > GuidVector
Definition ObjectGuid.h:434
Spells
Definition PlayerAI.cpp:32
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition ScriptMgr.h:1447
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_2
@ SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
#define SpellEffectFn(F, I, N)
Creatures
void AddSC_arena_the_robodrome()
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
BattlegroundMap * battlegroundMap
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
uint32 GetEntry() const
Definition Object.h:89
void SetEffectValue(SpellEffectValue value)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4788
static constexpr uint32 PowerCoil
static constexpr uint32 Door01
static constexpr uint32 Door02
static constexpr uint32 TheRobodrome
static constexpr uint32 Zap
void OnUpdate(uint32 diff) override
void OnGameObjectCreate(GameObject *gameobject) override
void OnCreatureCreate(Creature *creature) override
arena_the_robodrome(BattlegroundMap *map)