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
28
29// 12203 - Landslide
30struct boss_landslide : public BossAI
31{
32 boss_landslide(Creature* creature) : BossAI(creature, BOSS_LANDSLIDE), _landslide(false) { }
33
34 void Reset() override
35 {
37
38 _landslide = false;
39 }
40
41 void JustEngagedWith(Unit* who) override
42 {
44
46 .Schedule(5s, 10s, [this](TaskContext& task)
47 {
49 task.Repeat(15s, 25s);
50 })
51 .Schedule(10s, 15s, [this](TaskContext& task)
52 {
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 {
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
80private:
82};
83
uint32_t uint32
Definition Define.h:154
DamageEffectType
LandslideSpells
@ SPELL_TRAMPLE
@ SPELL_LANDSLIDE
@ SPELL_KNOCK_AWAY
void AddSC_boss_landslide()
void JustEngagedWith(Unit *who) override
TaskScheduler scheduler
void Reset() override
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Definition Unit.h:647
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
@ BOSS_LANDSLIDE
Definition maraudon.h:32
#define RegisterMaraudonCreatureAI(ai_name)
Definition maraudon.h:53
void JustEngagedWith(Unit *who) override
boss_landslide(Creature *creature)
void Reset() override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override