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
29
namespace
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
53
struct
arena_the_robodrome
:
ArenaScript
54
{
55
explicit
arena_the_robodrome
(
BattlegroundMap
* map) :
ArenaScript
(map) { }
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
{
87
case
TheRobodrome::GameObjects::Door01
:
88
case
TheRobodrome::GameObjects::Door02
:
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
{
100
case
TheRobodrome::Creatures::PowerCoil
:
101
_powerCoilGUIDs
.emplace_back(creature->
GetGUID
());
102
break
;
103
default
:
104
break
;
105
}
106
}
107
108
private
:
109
GuidVector
_doorGUIDs
;
110
GuidVector
_powerCoilGUIDs
;
111
112
TaskScheduler
_scheduler
;
113
};
114
115
// 300642 - Zap (Damage mod)
116
class
spell_the_robodrome_zap_damage
:
public
SpellScript
117
{
118
void
HandleHitTarget
(
SpellEffIndex
/*effIndex*/
)
119
{
120
uint32
basePct = 16;
121
uint32
stackCount =
GetHitUnit
()->
GetAuraCount
(
TheRobodrome::Spells::Zap
);
122
123
SetEffectValue
(basePct + basePct * stackCount);
124
}
125
126
void
Register
()
override
127
{
128
OnEffectHitTarget
+=
SpellEffectFn
(
spell_the_robodrome_zap_damage::HandleHitTarget
,
EFFECT_2
,
SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
);
129
}
130
};
131
132
void
AddSC_arena_the_robodrome
()
133
{
134
RegisterBattlegroundMapScript
(
arena_the_robodrome
,
TheRobodrome::MapIds::TheRobodrome
);
135
RegisterSpellScript
(
spell_the_robodrome_zap_damage
);
136
}
BattlegroundScript.h
Battleground.h
CreatureAI.h
Creature.h
uint32
uint32_t uint32
Definition
Define.h:154
GameObject.h
Map.h
GuidVector
std::vector< ObjectGuid > GuidVector
Definition
ObjectGuid.h:434
Spells
Spells
Definition
PlayerAI.cpp:32
Player.h
ScriptMgr.h
RegisterBattlegroundMapScript
#define RegisterBattlegroundMapScript(script_name, mapId)
Definition
ScriptMgr.h:1447
RegisterSpellScript
#define RegisterSpellScript(spell_script)
Definition
ScriptMgr.h:1383
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:29
EFFECT_2
@ EFFECT_2
Definition
SharedDefines.h:32
SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
@ SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
Definition
SharedDefines.h:1512
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:768
TaskScheduler.h
Creatures
Creatures
Definition
alterac_valley.cpp:38
AddSC_arena_the_robodrome
void AddSC_arena_the_robodrome()
Definition
arena_the_robodrome.cpp:132
ArenaScript
Definition
BattlegroundScript.h:67
BaseEntity::GetGUID
ObjectGuid const & GetGUID() const
Definition
BaseEntity.h:163
BattlegroundMap
Definition
Map.h:923
BattlegroundScript::battlegroundMap
BattlegroundMap * battlegroundMap
Definition
BattlegroundScript.h:56
Creature
Definition
Creature.h:82
GameObject
Definition
GameObject.h:166
Map::GetGameObject
GameObject * GetGameObject(ObjectGuid const &guid)
Definition
Map.cpp:3552
Map::GetCreature
Creature * GetCreature(ObjectGuid const &guid)
Definition
Map.cpp:3542
ObjectGuid
Definition
ObjectGuid.h:308
Object::GetEntry
uint32 GetEntry() const
Definition
Object.h:89
SpellScript
Definition
SpellScript.h:296
SpellScript::SetEffectValue
void SetEffectValue(SpellEffectValue value)
Definition
SpellScript.cpp:738
SpellScript::GetHitUnit
Unit * GetHitUnit() const
Definition
SpellScript.cpp:533
SpellScript::OnEffectHitTarget
HookList< EffectHandler > OnEffectHitTarget
Definition
SpellScript.h:766
TaskContext
Definition
TaskScheduler.h:370
TaskContext::Repeat
TaskContext & Repeat(TaskScheduler::duration_t duration)
Definition
TaskScheduler.cpp:319
TaskScheduler
Definition
TaskScheduler.h:49
TaskScheduler::Schedule
TaskScheduler & Schedule(duration_t time, task_handler_t task)
Definition
TaskScheduler.h:265
TaskScheduler::Update
TaskScheduler & Update()
Update the scheduler to the current time.
Definition
TaskScheduler.cpp:38
Unit::GetAuraCount
uint32 GetAuraCount(uint32 spellId) const
Definition
Unit.cpp:4788
spell_the_robodrome_zap_damage
Definition
arena_the_robodrome.cpp:117
spell_the_robodrome_zap_damage::Register
void Register() override
Definition
arena_the_robodrome.cpp:126
spell_the_robodrome_zap_damage::HandleHitTarget
void HandleHitTarget(SpellEffIndex)
Definition
arena_the_robodrome.cpp:118
GameObjects
GameObjects
Definition
instance_blackrock_depths.cpp:57
TheRobodrome::Creatures::PowerCoil
static constexpr uint32 PowerCoil
Definition
arena_the_robodrome.cpp:38
TheRobodrome::GameObjects::Door01
static constexpr uint32 Door01
Definition
arena_the_robodrome.cpp:43
TheRobodrome::GameObjects::Door02
static constexpr uint32 Door02
Definition
arena_the_robodrome.cpp:44
TheRobodrome::MapIds::TheRobodrome
static constexpr uint32 TheRobodrome
Definition
arena_the_robodrome.cpp:33
TheRobodrome::Spells::Zap
static constexpr uint32 Zap
Definition
arena_the_robodrome.cpp:49
TheRobodrome
Definition
arena_the_robodrome.cpp:30
arena_the_robodrome
Definition
arena_the_robodrome.cpp:54
arena_the_robodrome::OnUpdate
void OnUpdate(uint32 diff) override
Definition
arena_the_robodrome.cpp:57
arena_the_robodrome::_doorGUIDs
GuidVector _doorGUIDs
Definition
arena_the_robodrome.cpp:109
arena_the_robodrome::OnGameObjectCreate
void OnGameObjectCreate(GameObject *gameobject) override
Definition
arena_the_robodrome.cpp:83
arena_the_robodrome::_powerCoilGUIDs
GuidVector _powerCoilGUIDs
Definition
arena_the_robodrome.cpp:110
arena_the_robodrome::_scheduler
TaskScheduler _scheduler
Definition
arena_the_robodrome.cpp:112
arena_the_robodrome::OnCreatureCreate
void OnCreatureCreate(Creature *creature) override
Definition
arena_the_robodrome.cpp:96
arena_the_robodrome::OnStart
void OnStart() override
Definition
arena_the_robodrome.cpp:62
arena_the_robodrome::arena_the_robodrome
arena_the_robodrome(BattlegroundMap *map)
Definition
arena_the_robodrome.cpp:55
server
scripts
Battlegrounds
TheRobodrome
arena_the_robodrome.cpp
Generated on Sun May 10 2026 02:09:07 for TrinityCore by
1.9.8