TrinityCore
Loading...
Searching...
No Matches
mana_tombs.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 "
ScriptedCreature.h
"
20
#include "
SpellScript.h
"
21
#include "
Unit.h
"
22
#include "
mana_tombs.h
"
23
24
enum
YorSpells
25
{
26
SPELL_DOUBLE_BREATH
= 38361
27
};
28
29
// 22930 - Yor
30
struct
npc_yor
:
public
ScriptedAI
31
{
32
using
ScriptedAI::ScriptedAI
;
33
34
void
JustAppeared
()
override
35
{
36
_scheduler
.
Schedule
(1500ms, [
this
](
TaskContext
const
&
/*task*/
)
37
{
38
me
->
SetFaction
(
FACTION_MONSTER_2
);
39
});
40
}
41
42
void
Reset
()
override
43
{
44
_scheduler
.
CancelAll
();
45
}
46
47
void
JustEngagedWith
(
Unit
*
/*who*/
)
override
48
{
49
_scheduler
.
Schedule
(6s, 14s, [
this
](
TaskContext
& task)
50
{
51
DoCastVictim
(
SPELL_DOUBLE_BREATH
);
52
task.
Repeat
(8s, 14s);
53
});
54
}
55
56
void
UpdateAI
(
uint32
diff)
override
57
{
58
_scheduler
.
Update
(diff);
59
60
if
(!
UpdateVictim
())
61
return
;
62
}
63
64
private
:
65
TaskScheduler
_scheduler
;
66
};
67
68
enum
SummonArcaneFiends
69
{
70
SPELL_SUMMON_ARCANE_FIEND_1
= 32349,
71
SPELL_SUMMON_ARCANE_FIEND_2
= 32353
72
};
73
74
// 32348 - Summon Arcane Fiends
75
class
spell_mana_tombs_summon_arcane_fiends
:
public
SpellScript
76
{
77
bool
Validate
(
SpellInfo
const
*
/*spellInfo*/
)
override
78
{
79
return
ValidateSpellInfo
(
80
{
81
SPELL_SUMMON_ARCANE_FIEND_1
,
82
SPELL_SUMMON_ARCANE_FIEND_2
83
});
84
}
85
86
void
HandleScript
(
SpellEffIndex
/*effIndex*/
)
87
{
88
Unit
* caster =
GetCaster
();
89
caster->
CastSpell
(
nullptr
,
SPELL_SUMMON_ARCANE_FIEND_1
,
true
);
90
caster->
CastSpell
(
nullptr
,
SPELL_SUMMON_ARCANE_FIEND_2
,
true
);
91
}
92
93
void
Register
()
override
94
{
95
OnEffectHit
+=
SpellEffectFn
(
spell_mana_tombs_summon_arcane_fiends::HandleScript
,
EFFECT_0
,
SPELL_EFFECT_SCRIPT_EFFECT
);
96
}
97
};
98
99
void
AddSC_mana_tombs
()
100
{
101
RegisterManaTombsCreatureAI
(
npc_yor
);
102
RegisterSpellScript
(
spell_mana_tombs_summon_arcane_fiends
);
103
}
uint32
uint32_t uint32
Definition
Define.h:154
ScriptMgr.h
RegisterSpellScript
#define RegisterSpellScript(spell_script)
Definition
ScriptMgr.h:1383
ScriptedCreature.h
SpellEffIndex
SpellEffIndex
Definition
SharedDefines.h:29
EFFECT_0
@ EFFECT_0
Definition
SharedDefines.h:30
SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition
SharedDefines.h:1423
FACTION_MONSTER_2
@ FACTION_MONSTER_2
Definition
SharedDefines.h:226
SpellScript.h
SpellEffectFn
#define SpellEffectFn(F, I, N)
Definition
SpellScript.h:771
Unit.h
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:244
CreatureAI::me
Creature *const me
Definition
CreatureAI.h:63
SpellInfo
Definition
SpellInfo.h:324
SpellScriptBase::ValidateSpellInfo
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition
SpellScript.h:212
SpellScript
Definition
SpellScript.h:299
SpellScript::GetCaster
Unit * GetCaster() const
Definition
SpellScript.cpp:416
SpellScript::OnEffectHit
HookList< EffectHandler > OnEffectHit
Definition
SpellScript.h:768
TaskContext
Definition
TaskScheduler.h:370
TaskContext::Repeat
TaskContext & Repeat(TaskScheduler::duration_t duration)
Definition
TaskScheduler.cpp:319
TaskScheduler
Definition
TaskScheduler.h:49
TaskScheduler::CancelAll
TaskScheduler & CancelAll()
Definition
TaskScheduler.cpp:86
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
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.cpp:172
Unit
Definition
Unit.h:647
Unit::SetFaction
void SetFaction(uint32 faction) override
Definition
Unit.h:887
WorldObject::CastSpell
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition
Object.cpp:2222
spell_mana_tombs_summon_arcane_fiends
Definition
mana_tombs.cpp:76
spell_mana_tombs_summon_arcane_fiends::Validate
bool Validate(SpellInfo const *) override
Definition
mana_tombs.cpp:77
spell_mana_tombs_summon_arcane_fiends::HandleScript
void HandleScript(SpellEffIndex)
Definition
mana_tombs.cpp:86
spell_mana_tombs_summon_arcane_fiends::Register
void Register() override
Definition
mana_tombs.cpp:93
AddSC_mana_tombs
void AddSC_mana_tombs()
Definition
mana_tombs.cpp:99
SummonArcaneFiends
SummonArcaneFiends
Definition
mana_tombs.cpp:69
SPELL_SUMMON_ARCANE_FIEND_1
@ SPELL_SUMMON_ARCANE_FIEND_1
Definition
mana_tombs.cpp:70
SPELL_SUMMON_ARCANE_FIEND_2
@ SPELL_SUMMON_ARCANE_FIEND_2
Definition
mana_tombs.cpp:71
YorSpells
YorSpells
Definition
mana_tombs.cpp:25
SPELL_DOUBLE_BREATH
@ SPELL_DOUBLE_BREATH
Definition
mana_tombs.cpp:26
mana_tombs.h
RegisterManaTombsCreatureAI
#define RegisterManaTombsCreatureAI(ai_name)
Definition
mana_tombs.h:48
ScriptedAI
Definition
ScriptedCreature.h:135
ScriptedAI::ScriptedAI
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
Definition
ScriptedCreature.cpp:126
npc_yor
Definition
mana_tombs.cpp:31
npc_yor::JustAppeared
void JustAppeared() override
Definition
mana_tombs.cpp:34
npc_yor::UpdateAI
void UpdateAI(uint32 diff) override
Definition
mana_tombs.cpp:56
npc_yor::_scheduler
TaskScheduler _scheduler
Definition
mana_tombs.cpp:65
npc_yor::JustEngagedWith
void JustEngagedWith(Unit *) override
Definition
mana_tombs.cpp:47
npc_yor::Reset
void Reset() override
Definition
mana_tombs.cpp:42
server
scripts
Outland
Auchindoun
ManaTombs
mana_tombs.cpp
Generated by
1.9.8