TrinityCore
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 {
96 if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who))
97 if (who->HasAura(SPELL_MARK_DEATH))
98 who->CastSpell(who, SPELL_AURA_DEATH, 1);
99 }
100
101 void UpdateAI(uint32 diff) override
102 {
103 if (!UpdateVictim())
104 return;
105
106 _events.Update(diff);
107
109 return;
110
111 while (uint32 eventId = _events.ExecuteEvent())
112 {
113 switch (eventId)
114 {
115 case EVENT_ENRAGE:
116 if (!HealthAbovePct(20))
117 {
120 _inEnrage = true;
121 }
122 break;
123 case EVENT_OVERRUN:
127 break;
128 case EVENT_QUAKE:
129 if (urand(0, 1))
130 return;
131
133
134 //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
135 if (_inEnrage)
137
140 break;
141 case EVENT_CHAIN:
142 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
145 break;
146 case EVENT_ARMOR:
149 break;
150 default:
151 break;
152 }
153 }
154 }
155
156 private:
159};
160
162{
164}
Texts
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ 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:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
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 HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2991
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