TrinityCore
boss_randolph_moloch.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 "MotionMaster.h"
19#include "ScriptedCreature.h"
20#include "ScriptMgr.h"
21#include "the_stockade.h"
22
24{
26 SPELL_SWEEP = 86729,
27 SPELL_VANISH = 55964,
28 SPELL_SHADOWSTEP = 55966
29};
30
32{
38
41};
42
43enum Says
44{
45 SAY_PULL = 0, // Allow me to introduce myself. I am Randolph Moloch and I will be killing you all today.
46 SAY_VANISH = 1, // Area Trigger: %s vanishes!
47 SAY_DEATH = 2, // My epic schemes, my great plans! Gone!
48
49 MORTIMER_MOLOCH_DEATH = 0, // %s collapses from a heart attack!
50 MORTIMER_MOLOCH_EMOTE = 1, // Egad! My sophisticated heart!
51};
52
54{
56};
57
58Position const mortimerMolochPos = { 145.5811f, 0.7059f, -25.606f, 6.2f };
59
60// Randolph Moloch - 46383
62{
64 _secondVanish(false) { }
65
66 void Reset() override
67 {
68 _firstVanish = false;
69 _secondVanish = false;
70 }
71 void JustEngagedWith(Unit* who) override
72 {
74
76
79 }
80
81 void JustSummoned(Creature* summon) override
82 {
84
85 if (summon->GetEntry() == NPC_MORTIMER_MOLOCH)
86 {
87 summon->SetWalk(true);
89 }
90 }
91
92 void JustDied(Unit* killer) override
93 {
94 BossAI::JustDied(killer);
95
97
99 }
100
101 void ExecuteEvent(uint32 eventId) override
102 {
103 switch (eventId)
104 {
107 events.Repeat(8s, 12s);
108 break;
109 case EVENT_SWEEP:
112 break;
113 case EVENT_VANISH:
119 break;
121 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
122 DoCast(target, SPELL_SHADOWSTEP, true);
124 break;
125 default:
126 break;
127 }
128 }
129
130 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
131 {
132 if (me->HealthBelowPctDamaged(71, damage) && me->HealthAbovePct(59) && !_firstVanish)
133 {
134 _firstVanish = true;
136 }
137
138 if (me->HealthBelowPctDamaged(41, damage) && me->HealthAbovePct(29) && !_secondVanish)
139 {
140 _secondVanish = true;
142 }
143 }
144
145private:
148};
149
150// Mortimer Moloch - 46482
152{
153 npc_mortimer_moloch(Creature* creature) : ScriptedAI(creature) { }
154
155 void Reset() override
156 {
158 }
159
160 void MovementInform(uint32 type, uint32 id) override
161 {
162 if (type != POINT_MOTION_TYPE)
163 return;
164
165 if (id == POINT_FINISH)
166 {
167 scheduler.Schedule(4s, [this](TaskContext /*context*/)
168 {
170 });
171
172 scheduler.Schedule(7s, [this](TaskContext /*context*/)
173 {
175 me->KillSelf();
176 });
177 }
178 }
179
180 void UpdateAI(uint32 diff) override
181 {
182 scheduler.Update(diff);
183 }
184
185private:
187};
188
190{
193}
uint32_t uint32
Definition: Define.h:142
@ POINT_MOTION_TYPE
Spells
Definition: PlayerAI.cpp:32
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
DamageEffectType
Definition: UnitDefines.h:131
Says
@ MORTIMER_MOLOCH_EMOTE
@ MORTIMER_MOLOCH_DEATH
@ POINT_FINISH
@ SPELL_SHADOWSTEP
@ SPELL_WILDLY_STABBING
@ SPELL_VANISH
Position const mortimerMolochPos
void AddSC_boss_randolph_moloch()
@ EVENT_ATTACK_RANDOM
@ EVENT_MORTIMER_MOLOCH_EMOTE
@ EVENT_JUST_VANISHED
@ EVENT_VANISH
@ EVENT_MORTIMER_MOLOCH_DEATH
@ EVENT_WILDLY_STABBING
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void JustSummoned(Creature *summon) override
EventMap events
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void SetReactState(ReactStates st)
Definition: Creature.h:160
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
uint32 GetEntry() const
Definition: Object.h:161
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:782
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetWalk(bool enable)
Definition: Unit.cpp:12707
void RemoveAllAuras()
Definition: Unit.cpp:4242
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:921
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
void ExecuteEvent(uint32 eventId) override
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
void JustDied(Unit *killer) override
boss_randolph_moloch(Creature *creature)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void MovementInform(uint32 type, uint32 id) override
void UpdateAI(uint32 diff) override
npc_mortimer_moloch(Creature *creature)
@ DATA_RANDOLPH_MOLOCH
Definition: the_stockade.h:30
@ NPC_MORTIMER_MOLOCH
Definition: the_stockade.h:41
#define RegisterStormwindStockadesAI(AI)
Definition: the_stockade.h:50