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
ScriptedAI
31
{
32
boss_landslide
(
Creature
* creature) :
ScriptedAI
(creature),
_landslide
(false) { }
33
34
void
Reset
()
override
35
{
36
_scheduler
.
CancelAll
();
37
_landslide
=
false
;
38
}
39
40
void
JustEngagedWith
(
Unit
*
/*who*/
)
override
41
{
42
_scheduler
43
.
SetValidator
([
this
]
44
{
45
return
!
me
->
HasUnitState
(
UNIT_STATE_CASTING
);
46
})
47
.Schedule(5s, 10s, [
this
](
TaskContext
task)
48
{
49
DoCastVictim
(
SPELL_KNOCK_AWAY
);
50
task.
Repeat
(15s, 25s);
51
})
52
.Schedule(10s, 15s, [
this
](
TaskContext
task)
53
{
54
DoCastSelf
(
SPELL_TRAMPLE
);
55
task.
Repeat
(10s, 20s);
56
});
57
}
58
59
void
DamageTaken
(
Unit
*
/*attacker*/
,
uint32
& damage,
DamageEffectType
/*damageType*/
,
SpellInfo
const
*
/*spellInfo = nullptr*/
)
override
60
{
61
if
(!
_landslide
&&
me
->
HealthBelowPctDamaged
(50, damage))
62
{
63
_landslide
=
true
;
64
65
_scheduler
.
Schedule
(0s, [
this
](
TaskContext
task)
66
{
67
DoCastSelf
(
SPELL_LANDSLIDE
);
68
task.
Repeat
(30s, 40s);
69
});
70
}
71
}
72
73
void
UpdateAI
(
uint32
diff)
override
74
{
75
if
(!
UpdateVictim
())
76
return
;
77
78
_scheduler
.
Update
(diff, [
this
]
79
{
80
DoMeleeAttackIfReady
();
81
});
82
}
83
84
private
:
85
TaskScheduler
_scheduler
;
86
bool
_landslide
;
87
};
88
89
void
AddSC_boss_landslide
()
90
{
91
RegisterMaraudonCreatureAI
(
boss_landslide
);
92
}
uint32
uint32_t uint32
Definition
Define.h:133
ScriptMgr.h
ScriptedCreature.h
UNIT_STATE_CASTING
@ UNIT_STATE_CASTING
Definition
Unit.h:235
DamageEffectType
DamageEffectType
Definition
Unit.h:352
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:89
CreatureAI::UpdateVictim
bool UpdateVictim()
Definition
CreatureAI.cpp:240
CreatureAI::me
Creature *const me
Definition
CreatureAI.h:82
Creature
Definition
Creature.h:62
SpellInfo
Definition
SpellInfo.h:285
TaskContext
Definition
TaskScheduler.h:392
TaskContext::Repeat
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition
TaskScheduler.h:462
TaskScheduler
Definition
TaskScheduler.h:48
TaskScheduler::CancelAll
TaskScheduler & CancelAll()
Definition
TaskScheduler.cpp:45
TaskScheduler::Schedule
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition
TaskScheduler.h:225
TaskScheduler::Update
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition
TaskScheduler.cpp:27
TaskScheduler::SetValidator
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
Definition
TaskScheduler.h:190
UnitAI::DoMeleeAttackIfReady
void DoMeleeAttackIfReady()
Definition
UnitAI.cpp:54
UnitAI::DoCastSelf
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.h:241
UnitAI::DoCastVictim
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition
UnitAI.cpp:166
Unit
Definition
Unit.h:769
Unit::HasUnitState
bool HasUnitState(const uint32 f) const
Definition
Unit.h:876
Unit::HealthBelowPctDamaged
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition
Unit.h:918
maraudon.h
RegisterMaraudonCreatureAI
#define RegisterMaraudonCreatureAI(ai_name)
Definition
maraudon.h:31
ScriptedAI
Definition
ScriptedCreature.h:132
boss_landslide
Definition
boss_landslide.cpp:31
boss_landslide::boss_landslide
boss_landslide(Creature *creature)
Definition
boss_landslide.cpp:32
boss_landslide::JustEngagedWith
void JustEngagedWith(Unit *) override
Definition
boss_landslide.cpp:40
boss_landslide::_landslide
bool _landslide
Definition
boss_landslide.cpp:86
boss_landslide::_scheduler
TaskScheduler _scheduler
Definition
boss_landslide.cpp:85
boss_landslide::Reset
void Reset() override
Definition
boss_landslide.cpp:34
boss_landslide::UpdateAI
void UpdateAI(uint32 diff) override
Definition
boss_landslide.cpp:73
boss_landslide::DamageTaken
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
Definition
boss_landslide.cpp:59
server
scripts
Kalimdor
Maraudon
boss_landslide.cpp
Generated on Sun May 10 2026 02:30:20 for TrinityCore by
1.9.8