TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 "ScriptMgr.h"
19#include "ScriptedCreature.h"
20
22{
27 SAY_DEATH = 4
28};
29
31{
36 SPELL_ENRAGE = 33653,
38 SPELL_AURA_DEATH = 37131
39};
40
42{
48};
49
51{
52 boss_doomwalker(Creature* creature) : ScriptedAI(creature)
53 {
54 Initialize();
55 }
56
58 {
59 _inEnrage = false;
60 }
61
62 void Reset() override
63 {
64 _events.Reset();
70 Initialize();
71 }
72
73 void KilledUnit(Unit* victim) override
74 {
75 victim->CastSpell(victim, SPELL_MARK_DEATH, true);
76
77 if (urand(0, 4))
78 return;
79
81 }
82
83 void JustDied(Unit* /*killer*/) override
84 {
86 }
87
88 void JustEngagedWith(Unit* /*who*/) override
89 {
91 }
92
93 void MoveInLineOfSight(Unit* who) override
94 {
95 if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
96 if (who->HasAura(SPELL_MARK_DEATH))
97 who->CastSpell(who, SPELL_AURA_DEATH, true);
98 }
99
100 void UpdateAI(uint32 diff) override
101 {
102 if (!UpdateVictim())
103 return;
104
105 _events.Update(diff);
106
108 return;
109
110 while (uint32 eventId = _events.ExecuteEvent())
111 {
112 switch (eventId)
113 {
114 case EVENT_ENRAGE:
115 if (!HealthAbovePct(20))
116 {
119 _inEnrage = true;
120 }
121 break;
122 case EVENT_OVERRUN:
126 break;
127 case EVENT_QUAKE:
128 if (urand(0, 1))
129 return;
130
132
133 //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
134 if (_inEnrage)
136
139 break;
140 case EVENT_CHAIN:
141 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
144 break;
145 case EVENT_ARMOR:
148 break;
149 default:
150 break;
151 }
152 }
154 }
155
156 private:
159};
160
162{
164}
uint32_t uint32
Definition: Define.h:133
@ TYPEID_PLAYER
Definition: ObjectGuid.h:39
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1140
@ UNIT_STATE_CASTING
Definition: Unit.h:235
Events
@ SPELL_ENRAGE
@ SPELL_EARTHQUAKE
@ SPELL_MARK_DEATH
@ SPELL_SUNDER_ARMOR
@ SPELL_AURA_DEATH
@ SPELL_CHAIN_LIGHTNING
@ 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
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:48
bool UpdateVictim()
Definition: CreatureAI.cpp:240
Creature *const me
Definition: CreatureAI.h:81
void Update(uint32 time)
Definition: EventMap.h:67
EventId ExecuteEvent()
Definition: EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:92
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:62
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:174
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:104
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:114
Definition: Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:4531
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3780
bool HasUnitState(const uint32 f) const
Definition: Unit.h:874
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2831
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2855
bool HealthAbovePct(uint32 pct) const
void JustEngagedWith(Unit *) override
void KilledUnit(Unit *victim) override
void UpdateAI(uint32 diff) override
boss_doomwalker(Creature *creature)
void Reset() override
void MoveInLineOfSight(Unit *who) override
void JustDied(Unit *) override