TrinityCore
Loading...
Searching...
No Matches
boss_doomwalker.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 "ScriptMgr.h"
20#include "ScriptedCreature.h"
21#include "SpellInfo.h"
22#include "SpellScript.h"
23
32
45
54
60
62{
63 boss_doomwalker(Creature* creature) : ScriptedAI(creature)
64 {
65 Initialize();
66 }
67
69 {
70 _inEnrage = false;
71 }
72
73 void Reset() override
74 {
75 _events.Reset();
81 Initialize();
82 }
83
84 void KilledUnit(Unit* victim) override
85 {
86 victim->CastSpell(victim, SPELL_MARK_DEATH, true);
87
88 if (urand(0, 4))
89 return;
90
92 }
93
94 void JustDied(Unit* /*killer*/) override
95 {
97 }
98
99 void JustEngagedWith(Unit* /*who*/) override
100 {
102 }
103
104 void MoveInLineOfSight(Unit* who) override
105 {
106 if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
107 if (who->HasAura(SPELL_MARK_DEATH))
108 who->CastSpell(who, SPELL_AURA_DEATH, true);
109 }
110
111 void MovementInform(uint32 type, uint32 id) override
112 {
113 if (type == POINT_MOTION_TYPE && id == POINT_OVERRUN)
114 {
117
118 if (Creature* overrunTarget = me->FindNearestCreature(NPC_OVERRUN_TARGET, 500.0f))
119 overrunTarget->DespawnOrUnsummon();
120 }
121 }
122
123 void UpdateAI(uint32 diff) override
124 {
125 if (!UpdateVictim())
126 return;
127
128 _events.Update(diff);
129
131 return;
132
133 while (uint32 eventId = _events.ExecuteEvent())
134 {
135 switch (eventId)
136 {
137 case EVENT_ENRAGE:
138 if (!HealthAbovePct(20))
139 {
142 _inEnrage = true;
143 }
144 break;
145 case EVENT_OVERRUN:
151 break;
152 case EVENT_QUAKE:
154
155 //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
156 if (_inEnrage)
158
161 break;
162 case EVENT_CHAIN:
163 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
166 break;
167 case EVENT_ARMOR:
170 break;
171 default:
172 break;
173 }
174 }
175 }
176
177 private:
180};
181
182// 32686 - Earthquake
183// 326405 - Earthquake
185{
186 bool Validate(SpellInfo const* /*spellInfo*/) override
187 {
189 }
190
191 void HandleKnockdown(AuraEffect const* /*aurEff*/) const
192 {
193 if (roll_chance(50))
195 }
196
201};
202
203// 32636 - Overrun
205{
206 void StartMovement() const
207 {
208 if (Creature* overrunTarget = GetCaster()->FindNearestCreature(NPC_OVERRUN_TARGET, 500.0f))
209 GetCaster()->GetMotionMaster()->MovePoint(0, overrunTarget->GetPosition(), true, {}, {}, MovementWalkRunSpeedSelectionMode::ForceRun);
210 }
211
216};
217
218// 32637 - Overrun
235
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_2
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_IGNORE_SET_FACING
Will not adjust facing to target (if any)
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ POINT_OVERRUN
@ NPC_OVERRUN_TARGET
@ SPELL_ENRAGE
@ SPELL_SUMMON_OVERRUN_TARGET
@ SPELL_EARTHQUAKE
@ SPELL_MARK_DEATH
@ SPELL_SUNDER_ARMOR
@ SPELL_AURA_DEATH
@ SPELL_CHAIN_LIGHTNING
@ SPELL_KNOCKDOWN
@ SPELL_OVERRUN
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_EARTHQUAKE
@ SAY_OVERRUN
@ SAY_SLAY
void AddSC_boss_doomwalker()
@ EVENT_ENRAGE
@ EVENT_ARMOR
@ EVENT_OVERRUN
@ EVENT_QUAKE
@ EVENT_CHAIN
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
Spell * GetSpell() const
SpellInfo const * GetSpellInfo() const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2324
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
void HandleKnockdown(AuraEffect const *) const
bool Validate(SpellInfo const *) override
void StartNextCast(SpellEffIndex) const
TriggerCastFlags TriggerFlags
bool HealthAbovePct(uint32 pct) const
void JustEngagedWith(Unit *) override
void KilledUnit(Unit *victim) override
void UpdateAI(uint32 diff) override
boss_doomwalker(Creature *creature)
void MovementInform(uint32 type, uint32 id) override
void Reset() override
void MoveInLineOfSight(Unit *who) override
void JustDied(Unit *) override