TrinityCore
Loading...
Searching...
No Matches
boss_broggok.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 "blood_furnace.h"
20#include "Containers.h"
21#include "GameObject.h"
22#include "GameObjectAI.h"
23#include "InstanceScript.h"
24#include "MotionMaster.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellScript.h"
28
30{
32 SAY_AGGRO = 1
33};
34
53
66
73
74// 17380 - Broggok
75struct boss_broggok : public BossAI
76{
77 boss_broggok(Creature* creature) : BossAI(creature, DATA_BROGGOK) { }
78
79 void Reset() override
80 {
81 _Reset();
83 }
84
94
95 void JustSummoned(Creature* summoned) override
96 {
97 if (summoned->GetEntry() == NPC_BROGGOK_POISON_CLOUD)
98 {
100 summoned->CastSpell(summoned, SPELL_POISON_CLOUD_PASSIVE, true);
101 summons.Summon(summoned);
102 }
103 else if (summoned->GetEntry() == NPC_INCOMBAT_TRIGGER)
104 {
105 summoned->SetReactState(REACT_PASSIVE);
106 DoZoneInCombat(summoned);
107 summons.Summon(summoned);
108 }
109 }
110
118
119 void DoAction(int32 action) override
120 {
121 switch (action)
122 {
125 break;
128 break;
136 {
137 lever->RemoveFlag(GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE);
138 lever->SetGoState(GO_STATE_READY);
139 }
140 break;
141 default:
142 break;
143 }
144 }
145
146 void UpdateAI(uint32 diff) override
147 {
148 if (!UpdateVictim())
149 {
151 return;
152 }
153
154 events.Update(diff);
155
157 return;
158
159 while (uint32 eventId = events.ExecuteEvent())
160 {
161 switch (eventId)
162 {
165 events.Repeat(4s, 12s);
166 break;
169 events.Repeat(4s, 12s);
170 break;
173 events.Repeat(20s);
174 break;
175 default:
176 break;
177 }
178
180 return;
181 }
182
184 }
185
187 {
188 events.Update(diff);
189
190 while (uint32 eventId = events.ExecuteEvent())
191 {
192 switch (eventId)
193 {
194 case EVENT_INTRO_1:
197 break;
198 case EVENT_INTRO_2:
200 break;
201 case EVENT_ACTIVATE_1:
205 break;
206 case EVENT_ACTIVATE_2:
209 break;
210 default:
211 break;
212 }
213 }
214 }
215};
216
223
225{
226 BroggokPrisionersAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { }
227
228 void Reset() override
229 {
231 scheduler.Schedule(1s, 5s, [this](TaskContext task)
232 {
234 task.Repeat(6s, 9s);
235 });
236 }
237
238 void JustEngagedWith(Unit* /*who*/) override
239 {
242 }
243
244 virtual void ScheduleEvents() = 0;
245
246 void JustReachedHome() override
247 {
249 {
250 if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
251 broggok->AI()->DoAction(ACTION_RESET_BROGGOK);
252 }
253
255 }
256
257 void UpdateAI(uint32 diff) override
258 {
259 scheduler.Update(diff);
260
261 if (!UpdateVictim())
262 return;
263
265 }
266
267protected:
270};
271
272// 17398 - Nascent Fel Orc
274{
276
277 void ScheduleEvents() override
278 {
280 .Schedule(15s, [this](TaskContext task)
281 {
283 task.Repeat(8s, 11s);
284 })
285 .Schedule(7s, [this](TaskContext task)
286 {
288 task.Repeat(16s, 21s);
289 });
290 }
291};
292
293// 17429 - Fel Orc Neophyte
295{
297
298 void ScheduleEvents() override
299 {
301 .Schedule(5s, [this](TaskContext task)
302 {
304 DoCast(target, SPELL_CHARGE);
305 task.Repeat(20s);
306 })
307 .Schedule(1s, [this](TaskContext task)
308 {
310 task.Repeat(12s, 13s);
311 });
312 }
313};
314
315// 181982 - Cell Door Lever
317{
318 go_broggok_lever(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
319
321
322 bool OnGossipHello(Player* /*player*/) override
323 {
325 {
327 if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
328 broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
329 }
330
333
334 return true;
335 }
336};
337
338// 30914, 38462 - Poison
340{
342
343 bool Validate(SpellInfo const* spellInfo) override
344 {
345 return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
346 }
347
348 void PeriodicTick(AuraEffect const* aurEff)
349 {
351 if (!aurEff->GetTotalTicks())
352 return;
353
354 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
355 int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
356 GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod));
357 }
358
363};
364
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ EMOTE_ONESHOT_BATTLE_ROAR
@ EMOTE_ONESHOT_ROAR
@ EMOTE_ONESHOT_SHOUT
@ GO_FLAG_NOT_SELECTABLE
@ GO_FLAG_IN_USE
@ GO_STATE_READY
@ GO_STATE_ACTIVE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_RADIUS_MOD
#define AuraEffectPeriodicFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
#define RegisterBloodFurnaceCreatureAI(ai_name)
#define RegisterBloodFurnaceGameObjectAI(ai_name)
@ DATA_BROGGOK_LEVER
@ DATA_BROGGOK
@ ACTION_PREPARE_BROGGOK
@ ACTION_ACTIVATE_BROGGOK
@ ACTION_RESET_BROGGOK
BroggokSpells
@ SPELL_STOMP
@ SPELL_CONCUSSION_BLOW
@ SPELL_CHARGE
@ SPELL_DESPAWN_INCOMBAT_TRIGGER
@ SPELL_POISON_BOLT
@ SPELL_SUMMON_INCOMBAT_TRIGGER
@ SPELL_SLIME_SPRAY
@ SPELL_FRENZY
@ SPELL_POISON_CLOUD_PASSIVE
@ SPELL_POISON_CLOUD
void AddSC_boss_broggok()
BroggokMisc
@ NPC_INCOMBAT_TRIGGER
@ PATH_ROOM
@ NPC_BROGGOK_POISON_CLOUD
BroggokTexts
@ SAY_AGGRO
@ SAY_INTRO
BroggokEvents
@ EVENT_POISON_CLOUD
@ EVENT_ACTIVATE_1
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_SLIME_SPRAY
@ EVENT_POISON_BOLT
@ EVENT_ACTIVATE_2
static Emote const PrisionersEmotes[]
uint32 GetTickNumber() const
SpellEffectInfo const & GetSpellEffectInfo() const
uint32 GetTotalTicks() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
virtual void JustReachedHome()
Definition CreatureAI.h:178
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
GameObject *const me
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:171
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
void MovePath(uint32 pathId, bool repeatable)
uint32 GetEntry() const
Definition Object.h:81
uint32 TriggerSpell
Definition SpellInfo.h:228
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
void DespawnEntry(uint32 entry)
void Summon(Creature const *summon)
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void HandleEmoteCommand(Emote emoteId)
Definition Unit.cpp:1568
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *spellInfo) override
void PeriodicTick(AuraEffect const *aurEff)
PrepareAuraScript(spell_broggok_poison_cloud)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
void Reset() override
TaskScheduler scheduler
virtual void ScheduleEvents()=0
InstanceScript * instance
BroggokPrisionersAI(Creature *creature)
void JustReachedHome() override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void JustSummoned(Creature *summoned) override
void UpdateOutOfCombatEvents(uint32 diff)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
boss_broggok(Creature *creature)
void Reset() override
void DoAction(int32 action) override
InstanceScript * instance
go_broggok_lever(GameObject *go)
bool OnGossipHello(Player *) override
void ScheduleEvents() override
npc_fel_orc_neophyte(Creature *creature)
void ScheduleEvents() override
npc_nascent_fel_orc(Creature *creature)