TrinityCore
Loading...
Searching...
No Matches
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 "ObjectAccessor.h"
22#include "PassiveAI.h"
23#include "ScriptedCreature.h"
24
31
44
54
61
66
67// 22898 - Supremus
68struct boss_supremus : public BossAI
69{
70 boss_supremus(Creature* creature) : BossAI(creature, DATA_SUPREMUS) { }
71
79
80 void EnterEvadeMode(EvadeReason /*why*/) override
81 {
84 }
85
93
119
121 {
122 uint32 health = 0;
123 Unit* target = nullptr;
124
125 for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
126 {
127 Unit* unit = ref->GetVictim();
128 if (me->IsWithinMeleeRange(unit))
129 {
130 if (unit->GetHealth() > health)
131 {
132 health = unit->GetHealth();
133 target = unit;
134 }
135 }
136 }
137
138 return target;
139 }
140
141 void ExecuteEvent(uint32 eventId) override
142 {
143 switch (eventId)
144 {
145 case EVENT_BERSERK:
147 break;
148 case EVENT_FLAME:
150 events.Repeat(15s, 20s);
151 break;
153 if (Unit* target = CalculateHatefulStrikeTarget())
155 events.Repeat(5s);
156 break;
158 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
159 {
161 AddThreat(target, 1000000.0f);
162 DoCast(target, SPELL_CHARGE);
164 }
165 events.Repeat(10s);
166 break;
167 case EVENT_VOLCANO:
170 events.Repeat(10s);
171 break;
173 ChangePhase();
174 break;
175 default:
176 break;
177 }
178 }
179};
180
181// 23095 - Supremus Punch Invis Stalker
183{
184 npc_molten_flame(Creature* creature) : NullCreatureAI(creature) { }
185
186 void InitializeAI() override
187 {
188 float x, y, z;
189 me->GetNearPoint(me, x, y, z, 100.0f, frand(0.f, 2.f * float(M_PI)));
190 me->GetMotionMaster()->MovePoint(0, x, y, z);
192 }
193};
194
195// 23085 - Supremus Volcano
197{
198 npc_volcano(Creature* creature) : NullCreatureAI(creature) { }
199
200 void Reset() override
201 {
202 _scheduler.Schedule(3s, [this](TaskContext /*context*/)
203 {
205 });
206 }
207
208 void DoAction(int32 action) override
209 {
210 if (action == ACTION_DISABLE_VULCANO)
211 {
214 }
215 }
216
217 void UpdateAI(uint32 diff) override
218 {
219 _scheduler.Update(diff);
220 }
221
222private:
224};
225
#define M_PI
Definition Common.h:72
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
float frand(float min, float max)
Definition Random.cpp:55
@ SPELL_EFFECT_ATTACK_ME
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ SPELL_AURA_MOD_TAUNT
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_SUPREMUS
SupremusSpells
@ 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
SupremusActions
@ ACTION_DISABLE_VULCANO
SupremusEvents
@ EVENT_VOLCANO
@ EVENT_FLAME
@ EVENT_SWITCH_TARGET
@ EVENT_BERSERK
@ EVENT_SWITCH_PHASE
@ EVENT_HATEFUL_STRIKE
void AddSC_boss_supremus()
SupremusTexts
@ EMOTE_PUNCH_GROUND
@ EMOTE_NEW_TARGET
@ EMOTE_GROUND_CRACK
SupremusPhases
@ PHASE_INITIAL
@ PHASE_CHASE
@ PHASE_STRIKE
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
Creature *const me
Definition CreatureAI.h:82
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Trinity::IteratorPair< ThreatListIterator, std::nullptr_t > GetUnsortedThreatList() const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:844
ThreatManager & GetThreatManager()
Definition Unit.h:1155
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
uint32 GetHealth() const
Definition Unit.h:913
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Unit * GetVictim() const
Definition Unit.h:859
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
Definition Object.cpp:3209
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