TrinityCore
Loading...
Searching...
No Matches
boss_landslide.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 "
maraudon.h
"
20
#include "
ScriptedCreature.h
"
21
22
enum
LandslideSpells
23
{
24
SPELL_KNOCK_AWAY
= 18670,
25
SPELL_TRAMPLE
= 5568,
26
SPELL_LANDSLIDE
= 21808
27
};
28
29
// 12203 - Landslide
30
struct
boss_landslide
:
public
BossAI
31
{
32
boss_landslide
(
Creature
* creature) :
BossAI
(creature,
BOSS_LANDSLIDE
),
_landslide
(false) { }
33
34
void
Reset
()
override
35
{
36
BossAI::Reset
();
37
38
_landslide
=
false
;
39
}
40
41
void
JustEngagedWith
(
Unit
* who)
override
42
{
43
BossAI::JustEngagedWith
(who);
44
45
scheduler
46
.
Schedule
(5s, 10s, [
this
](
TaskContext
& task)
47
{
48
DoCastVictim
(
SPELL_KNOCK_AWAY
);
49
task.
Repeat
(15s, 25s);
50
})
51
.Schedule(10s, 15s, [
this
](
TaskContext
& task)
52
{
53
DoCastSelf
(
SPELL_TRAMPLE
);
54
task.
Repeat
(10s, 20s);
55
});
56
}
57
58
void
DamageTaken
(
Unit
*
/*attacker*/
,
uint32
& damage,
DamageEffectType
/*damageType*/
,
SpellInfo
const
*
/*spellInfo = nullptr*/
)
override
59
{
60
if
(!
_landslide
&&
me
->
HealthBelowPctDamaged
(50, damage))
61
{
62
_landslide
=
true
;
63
64
scheduler
.
Schedule
(0s, [
this
](
TaskContext
& task)
65
{
66
DoCastSelf
(
SPELL_LANDSLIDE
);
67
task.
Repeat
(30s, 40s);
68
});
69
}
70
}
71
72
void
UpdateAI
(
uint32
diff)
override
73
{
74
if
(!
UpdateVictim
())
75
return
;
76
77
scheduler
.
Update
(diff);
78
}
79
80
private
:
81
bool
_landslide
;
82
};
83
84
void
AddSC_boss_landslide
()
85
{
86
RegisterMaraudonCreatureAI
(
boss_landslide
);
87
}
uint32
uint32_t uint32
Definition
Define.h:154
ScriptMgr.h
ScriptedCreature.h
DamageEffectType
DamageEffectType
Definition
UnitDefines.h:154
LandslideSpells
LandslideSpells
Definition
boss_landslide.cpp:23
SPELL_TRAMPLE
@ SPELL_TRAMPLE
Definition
boss_landslide.cpp:25
SPELL_LANDSLIDE
@ SPELL_LANDSLIDE
Definition
boss_landslide.cpp:26
SPELL_KNOCK_AWAY
@ SPELL_KNOCK_AWAY
Definition
boss_landslide.cpp:24
AddSC_boss_landslide
void AddSC_boss_landslide()
Definition
boss_landslide.cpp:84
BossAI
Definition
ScriptedCreature.h:313
BossAI::JustEngagedWith
void JustEngagedWith(Unit *who) override
Definition
ScriptedCreature.h:334
BossAI::scheduler
TaskScheduler scheduler
Definition
ScriptedCreature.h:353
BossAI::Reset
void Reset() override
Definition
ScriptedCreature.h:333
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:244
CreatureAI::me
Creature *const me
Definition
CreatureAI.h:63
Creature
Definition
Creature.h:82
SpellInfo
Definition
SpellInfo.h:324
TaskContext
Definition
TaskScheduler.h:370
TaskContext::Repeat
TaskContext & Repeat(TaskScheduler::duration_t duration)
Definition
TaskScheduler.cpp:319
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::DoCastSelf
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.h:160
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.cpp:172
Unit
Definition
Unit.h:647
Unit::HealthBelowPctDamaged
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition
Unit.h:805
maraudon.h
BOSS_LANDSLIDE
@ BOSS_LANDSLIDE
Definition
maraudon.h:32
RegisterMaraudonCreatureAI
#define RegisterMaraudonCreatureAI(ai_name)
Definition
maraudon.h:53
boss_landslide
Definition
boss_landslide.cpp:31
boss_landslide::JustEngagedWith
void JustEngagedWith(Unit *who) override
Definition
boss_landslide.cpp:41
boss_landslide::boss_landslide
boss_landslide(Creature *creature)
Definition
boss_landslide.cpp:32
boss_landslide::_landslide
bool _landslide
Definition
boss_landslide.cpp:81
boss_landslide::Reset
void Reset() override
Definition
boss_landslide.cpp:34
boss_landslide::UpdateAI
void UpdateAI(uint32 diff) override
Definition
boss_landslide.cpp:72
boss_landslide::DamageTaken
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
Definition
boss_landslide.cpp:58
server
scripts
Kalimdor
Maraudon
boss_landslide.cpp
Generated by
1.9.8