TrinityCore
boss_supremus.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 "black_temple.h"
20#include "MotionMaster.h"
21#include "PassiveAI.h"
22#include "ScriptedCreature.h"
23
25{
29};
30
32{
41 SPELL_CHARGE = 41581
42};
43
45{
52};
53
55{
58 PHASE_CHASE = 3
59};
60
62{
64};
65struct boss_supremus : public BossAI
66{
67 boss_supremus(Creature* creature) : BossAI(creature, DATA_SUPREMUS) { }
68
69 void Reset() override
70 {
71 _Reset();
75 }
76
77 void EnterEvadeMode(EvadeReason /*why*/) override
78 {
81 }
82
83 void JustEngagedWith(Unit* who) override
84 {
89 }
90
92 {
94 {
102 }
103 else
104 {
111 }
115 }
116
118 {
119 uint64 health = 0;
120 Unit* target = nullptr;
121
122 for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
123 {
124 Unit* unit = ref->GetVictim();
125 if (me->IsWithinMeleeRange(unit))
126 {
127 if (unit->GetHealth() > health)
128 {
129 health = unit->GetHealth();
130 target = unit;
131 }
132 }
133 }
134
135 return target;
136 }
137
138 void ExecuteEvent(uint32 eventId) override
139 {
140 switch (eventId)
141 {
142 case EVENT_BERSERK:
144 break;
145 case EVENT_FLAME:
147 events.Repeat(Seconds(15), Seconds(20));
148 break;
150 if (Unit* target = CalculateHatefulStrikeTarget())
153 break;
155 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
156 {
158 AddThreat(target, 1000000.0f);
159 DoCast(target, SPELL_CHARGE);
161 }
162 events.Repeat(Seconds(10));
163 break;
164 case EVENT_VOLCANO:
167 events.Repeat(Seconds(10));
168 break;
170 ChangePhase();
171 break;
172 default:
173 break;
174 }
175 }
176};
177
179{
180 npc_molten_flame(Creature* creature) : NullCreatureAI(creature) { }
181
182 void InitializeAI() override
183 {
184 float x, y, z;
185 me->GetNearPoint(me, x, y, z, 100.0f, frand(0.f, 2.f * float(M_PI)));
186 me->GetMotionMaster()->MovePoint(0, x, y, z);
188 }
189};
190
192{
193 npc_volcano(Creature* creature) : NullCreatureAI(creature) { }
194
195 void Reset() override
196 {
197 _scheduler.Schedule(Seconds(3), [this](TaskContext /*context*/)
198 {
200 });
201 }
202
203 void DoAction(int32 action) override
204 {
205 if (action == ACTION_DISABLE_VULCANO)
206 {
209 }
210 }
211
212 void UpdateAI(uint32 diff) override
213 {
214 _scheduler.Update(diff);
215 }
216
217private:
219};
220
222{
226}
Texts
Actions
#define M_PI
Definition: Common.h:115
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
Spells
Definition: PlayerAI.cpp:32
float frand(float min, float max)
Definition: Random.cpp:55
@ SPELL_EFFECT_ATTACK_ME
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ SPELL_AURA_MOD_TAUNT
EvadeReason
Definition: UnitAICommon.h:30
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_SUPREMUS
Definition: black_temple.h:32
@ ACTION_DISABLE_VULCANO
@ SPELL_SNARE_SELF
@ SPELL_VOLCANIC_ERUPTION
@ SPELL_CHARGE
@ SPELL_VOLCANIC_GEYSER
@ SPELL_MOLTEN_FLAME
@ SPELL_HATEFUL_STRIKE
@ SPELL_VOLCANIC_SUMMON
@ SPELL_MOLTEN_PUNCH
@ SPELL_BERSERK
@ PHASE_INITIAL
@ PHASE_CHASE
@ PHASE_STRIKE
@ EMOTE_PUNCH_GROUND
@ EMOTE_NEW_TARGET
@ EMOTE_GROUND_CRACK
void AddSC_boss_supremus()
@ EVENT_VOLCANO
@ EVENT_FLAME
@ EVENT_SWITCH_TARGET
@ EVENT_BERSERK
@ EVENT_SWITCH_PHASE
@ EVENT_HATEFUL_STRIKE
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
Trinity::IteratorPair< ThreatListIterator, std::nullptr_t > GetUnsortedThreatList() const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
bool IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:699
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
uint64 GetHealth() const
Definition: Unit.h:776
Unit * GetVictim() const
Definition: Unit.h:715
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
Definition: Object.cpp:3368
void ResetThreatList(Unit *who=nullptr)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void Reset() override
Unit * CalculateHatefulStrikeTarget()
void JustEngagedWith(Unit *who) override
void ExecuteEvent(uint32 eventId) override
boss_supremus(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void InitializeAI() override
npc_molten_flame(Creature *creature)
npc_volcano(Creature *creature)
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
TaskScheduler _scheduler
void Reset() override