TrinityCore
boss_slad_ran.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 "gundrak.h"
20#include "MotionMaster.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "SpellAuras.h"
24#include "TemporarySummon.h"
25
27{
31 SPELL_SUMMON_SNAKES = 55060, // NYI
32 SPELL_SUMMON_CONSTRICTORS = 54969 // NYI
33};
34
36{
44};
45
47{
50};
51
53{
55 SPELL_SNAKE_WRAP = 55126, // 55099 -> 55126
57};
58
60{
61 {1783.81f, 646.637f, 133.948f, 3.71755f},
62 {1775.03f, 606.586f, 134.165f, 1.43117f},
63 {1717.39f, 630.041f, 129.282f, 5.96903f},
64 {1765.66f, 646.542f, 134.02f, 5.11381f},
65 {1716.76f, 635.159f, 129.282f, 0.191986f}
66};
67
68enum Misc
69{
71};
72
74{
78};
79
81{
82 GROUP_SNAKES = 0
83};
84
85struct boss_slad_ran : public BossAI
86{
88 {
89 Initialize();
90 }
91
93 {
95 }
96
97 void Reset() override
98 {
99 _Reset();
100 Initialize();
101 _wrappedPlayers.clear();
102 }
103
104 void JustEngagedWith(Unit* who) override
105 {
108 }
109
110 void ScheduleTasks() override
111 {
113 .Schedule(10s, [this](TaskContext task)
114 {
117 task.Repeat(15s);
118 })
119 .Schedule(3s, [this](TaskContext task)
120 {
122 task.Repeat(10s);
123 })
124 .Schedule(15s, [this](TaskContext task)
125 {
127 task.Repeat(10s);
128 });
129 }
130
131 void UpdateAI(uint32 diff) override
132 {
133 if (!UpdateVictim())
134 return;
135
136 scheduler.Update(diff);
137 }
138
139 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
140 {
142 {
145
147 {
148 for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
150
151 task.Repeat();
152 });
153 }
154
156 {
159
161 scheduler.Schedule(5s, [this](TaskContext task)
162 {
163 for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
165
166 task.Repeat();
167 });
168 }
169 }
170
171 void JustDied(Unit* /*killer*/) override
172 {
173 _JustDied();
176 }
177
178 void KilledUnit(Unit* who) override
179 {
180 if (who->GetTypeId() == TYPEID_PLAYER)
181 Talk(SAY_SLAY);
182 }
183
184 void JustSummoned(Creature* summon) override
185 {
187 summons.Summon(summon);
188 }
189
190 void SetGUID(ObjectGuid const& guid, int32 id) override
191 {
193 _wrappedPlayers.insert(guid);
194 }
195
196 bool WasWrapped(ObjectGuid guid) const
197 {
198 return _wrappedPlayers.count(guid) != 0;
199 }
200
201private:
204};
205
207{
209
210 void Reset() override
211 {
213 }
214
215 void JustEngagedWith(Unit* /*who*/) override
216 {
217 _scheduler.Schedule(2s, [this](TaskContext task)
218 {
219 Unit* target = me->GetVictim();
220
222
223 Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID());
224 if (grip && grip->GetStackAmount() == 5)
225 {
227 target->CastSpell(target, SPELL_SNAKE_WRAP, true);
228
229 if (TempSummon* _me = me->ToTempSummon())
230 if (Unit* summoner = _me->GetSummonerUnit())
231 if (Creature* sladran = summoner->ToCreature())
232 sladran->AI()->SetGUID(target->GetGUID(), DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES);
233
235 }
236
237 task.Repeat(3s, 6s);
238 });
239 }
240
241 void UpdateAI(uint32 diff) override
242 {
243 if (!UpdateVictim())
244 return;
245
246 _scheduler.Update(diff);
247 }
248private:
250};
251
253{
254 npc_slad_ran_viper(Creature* creature) : ScriptedAI(creature) { }
255
256 void Reset() override
257 {
259 }
260
261 void JustEngagedWith(Unit* /*who*/) override
262 {
263 _scheduler.Schedule(2s, [this](TaskContext task)
264 {
266 task.Repeat(10s);
267 });
268 }
269
270 void UpdateAI(uint32 diff) override
271 {
272 if (!UpdateVictim())
273 return;
274
275 _scheduler.Update(diff);
276 }
277private:
279};
280
282{
283 public:
284 achievement_snakes_whyd_it_have_to_be_snakes() : AchievementCriteriaScript("achievement_snakes_whyd_it_have_to_be_snakes") { }
285
286 bool OnCheck(Player* player, Unit* target) override
287 {
288 if (!target)
289 return false;
290
291 if (boss_slad_ran* sladRanAI = CAST_AI(boss_slad_ran, target->GetAI()))
292 return !sladRanAI->WasWrapped(player->GetGUID());
293 return false;
294 }
295};
296
298{
303}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
Spells
Definition: PlayerAI.cpp:32
#define CAST_AI(a, b)
Definition: UnitAI.h:28
DamageEffectType
Definition: UnitDefines.h:131
@ CREATURE_SNAKE
@ CREATURE_CONSTRICTORS
ConstrictorSpells
@ SPELL_SNAKE_WRAP
@ SPELL_GRIP_OF_SLAD_RAN
@ SPELL_VENOMOUS_BITE
@ DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES
@ SAY_DEATH
@ SAY_SUMMON_SNAKES
@ SAY_SUMMON_CONSTRICTORS
@ SAY_AGGRO
@ EMOTE_NOVA
@ SAY_SLAY
@ EMOTE_ACTIVATE_ALTAR
@ SPELL_SUMMON_SNAKES
@ SPELL_VENOM_BOLT
@ SPELL_POWERFULL_BITE
@ SPELL_POISON_NOVA
@ SPELL_SUMMON_CONSTRICTORS
void AddSC_boss_slad_ran()
static Position SpawnLoc[]
TaskGroup
@ GROUP_SNAKES
@ PHASE_NONE
@ PHASE_SNAKES
@ PHASE_CONSTRICTORS
Yells
uint8 GetStackAmount() const
Definition: SpellAuras.h:189
void JustEngagedWith(Unit *who) override
TaskScheduler scheduler
SummonList summons
void _JustDied()
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
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void Summon(Creature const *summon)
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelGroup(group_t group)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
TempSummon * ToTempSummon()
Definition: Unit.h:1756
UnitAI * GetAI() const
Definition: Unit.h:660
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
bool OnCheck(Player *player, Unit *target) override
#define RegisterGundrakCreatureAI(ai_name)
Definition: gundrak.h:99
@ DATA_SLAD_RAN
Definition: gundrak.h:31
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
bool HealthBelowPct(uint32 pct) const
bool WasWrapped(ObjectGuid guid) const
void KilledUnit(Unit *who) override
void Reset() override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
void JustSummoned(Creature *summon) override
void JustDied(Unit *) override
GuidSet _wrappedPlayers
void SetGUID(ObjectGuid const &guid, int32 id) override
void ScheduleTasks() override
void UpdateAI(uint32 diff) override
boss_slad_ran(Creature *creature)
void JustEngagedWith(Unit *who) override
npc_slad_ran_constrictor(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void Reset() override
TaskScheduler _scheduler
npc_slad_ran_viper(Creature *creature)