TrinityCore
Loading...
Searching...
No Matches
boss_lava_guard_gordoth.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 "GameObject.h"
19#include "InstanceScript.h"
20#include "MotionMaster.h"
21#include "Player.h"
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "TaskScheduler.h"
25#include "ragefire_chasm.h"
26
41
47
52
64
65constexpr Position GordothJumpPos = { -363.5392f, 203.36604f, -22.005634f, 0.308123469352722167f };
66
67// Areatrigger - 7899
69{
70public:
71 at_lava_guard_gordoth_intro() : OnlyOnceAreaTriggerScript("at_lava_guard_gordoth_intro") { }
72
73 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
74 {
75 if (player->IsGameMaster())
76 return false;
77
78 InstanceScript* instance = player->GetInstanceScript();
79 if (!instance)
80 return false;
81
82 Creature* gordoth = instance->GetCreature(BOSS_LAVA_GUARD_GORDOTH);
83 if (!gordoth)
84 return false;
85
86 gordoth->AI()->DoAction(ACTION_JUMP);
87
88 return true;
89 }
90};
91
92// 61528 - Lava Guard Gordoth
94{
96
102
103 void Reset() override
104 {
105 _Reset();
106
107 _enrageTriggered = false;
108 }
109
117
118 void JustDied(Unit* /*killer*/) override
119 {
120 _JustDied();
122 }
123
131
132 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
133 {
135 return;
136
137 if (me->HealthBelowPctDamaged(31, damage))
138 {
139 _enrageTriggered = true;
141 }
142 }
143
144 void DoAction(int32 action) override
145 {
146 if (action != ACTION_JUMP)
147 return;
148
152
153 scheduler.Schedule(30ms, [this](TaskContext const& /*task*/)
154 {
156 go->SetGoState(GO_STATE_ACTIVE);
157 });
158 }
159
160 void MovementInform(uint32 type, uint32 pointId) override
161 {
162 if (type != EFFECT_MOTION_TYPE)
163 return;
164
165 if (pointId == POINT_JUMP)
166 {
170
171 std::vector<GameObject*> labVialsList;
172 GetGameObjectListWithEntryInGrid(labVialsList, me, GO_LAB_VIAL, 25.0f);
173 for (GameObject* vial : labVialsList)
174 {
175 vial->SetGoState(GO_STATE_DESTROYED);
176 }
177
178 std::vector<Creature*> darkShamanResearcherList;
179 GetCreatureListWithEntryInGrid(darkShamanResearcherList, me, NPC_DARK_SHAMAN_RESEARCHER, 25.0f);
180 for (Creature* darkShamanResearcher : darkShamanResearcherList)
181 {
182 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_1, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
183 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_1, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
184 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_2, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
185 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_2, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
186 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
187 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, CastSpellExtraArgs(TRIGGERED_FULL_MASK));
188 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, CastSpellExtraArgs(TRIGGERED_FULL_MASK)); // According to sniff
189 darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_BLOODY_SUICIDE, false);
190 }
191 }
192 }
193
194 void UpdateAI(uint32 diff) override
195 {
196 if (!UpdateVictim())
197 return;
198
199 events.Update(diff);
200
202 return;
203
204 while (uint32 eventId = events.ExecuteEvent())
205 {
206 switch (eventId)
207 {
209 {
212 events.Repeat(12100ms);
213 break;
214 }
216 {
217 DoCast(nullptr, SPELL_SEISMIC_SLAM, CastSpellExtraArgs(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)); // cast earlier than category cd
218 events.Repeat(36300ms);
219 break;
220 }
221 default:
222 break;
223 }
224
226 return;
227 }
228 }
229
230private:
232};
233
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ NOT_STARTED
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ EFFECT_MOTION_TYPE
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool spawnedOnly=true)
void GetGameObjectListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ GO_STATE_DESTROYED
@ GO_STATE_ACTIVE
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore Spell and Category cooldowns.
EvadeReason
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
constexpr Position GordothJumpPos
@ NPC_DARK_SHAMAN_RESEARCHER
void AddSC_boss_lava_guard_gordoth()
@ SPELL_MEAT_EXPLOSION_1
@ SPELL_MEAT_EXPLOSION_3
@ SPELL_MEAT_EXPLOSION_2
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
TaskScheduler scheduler
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:386
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
void MoveJump(uint32 id, Position const &pos, std::variant< std::monostate, float, Milliseconds > speedOrTime={}, Optional< float > minHeight={}, Optional< float > maxHeight={}, MovementFacingTarget const &facing={}, bool orientationFixed=false, bool unlimitedSpeed=false, Optional< float > speedMultiplier={}, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
bool IsGameMaster() const
Definition Player.h:1309
TaskScheduler & Schedule(duration_t time, task_handler_t task)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void DoAction(int32 param)
Definition UnitAI.h:73
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 HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
void SetFacingTo(float const ori, bool force=true)
Definition Unit.cpp:13289
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
@ BOSS_LAVA_GUARD_GORDOTH
#define RegisterRagefireChasmCreatureAI(ai_name)
constexpr void Relocate(float x, float y)
Definition Position.h:74
constexpr float GetOrientation() const
Definition Position.h:90
boss_lava_guard_gordoth(Creature *creature)
void MovementInform(uint32 type, uint32 pointId) override
void JustEngagedWith(Unit *who) override
void DoAction(int32 action) override
void EnterEvadeMode(EvadeReason) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override