TrinityCore
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 "ScriptedCreature.h"
25#include "SpellAuraEffects.h"
26#include "SpellScript.h"
27
29{
30 SAY_AGGRO = 0
31};
32
34{
40
41 // Prisioners
42 SPELL_STOMP = 31900,
45 SPELL_CHARGE = 22120
46};
47
49{
53};
54
56{
57 public:
58 boss_broggok() : CreatureScript("boss_broggok") { }
59
60 struct boss_broggokAI : public BossAI
61 {
62 boss_broggokAI(Creature* creature) : BossAI(creature, DATA_BROGGOK) { }
63
64 void Reset() override
65 {
66 _Reset();
68 }
69
70 void JustEngagedWith(Unit* who) override
71 {
74 }
75
76 void JustSummoned(Creature* summoned) override
77 {
78 if (summoned->GetEntry() == NPC_BROGGOK_POISON_CLOUD)
79 {
81 summoned->CastSpell(summoned, SPELL_POISON_CLOUD_PASSIVE, true);
82 summons.Summon(summoned);
83 }
84 else if (summoned->GetEntry() == NPC_INCOMBAT_TRIGGER)
85 {
87 DoZoneInCombat(summoned);
88 summons.Summon(summoned);
89 }
90 }
91
92 void ExecuteEvent(uint32 eventId) override
93 {
94 switch (eventId)
95 {
99 break;
103 break;
107 break;
108 default:
109 break;
110 }
111 }
112
113 void DoAction(int32 action) override
114 {
115 switch (action)
116 {
119 break;
122 me->SetUninteractible(false);
127 break;
130 me->SetUninteractible(true);
134 {
135 lever->RemoveFlag(GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE);
136 lever->SetGoState(GO_STATE_READY);
137 }
138 break;
139 default:
140 break;
141 }
142 }
143 };
144
145 CreatureAI* GetAI(Creature* creature) const override
146 {
147 return GetBloodFurnaceAI<boss_broggokAI>(creature);
148 }
149};
150
151static Emote const PrisionersEmotes[] =
152{
156};
157
159{
160 BroggokPrisionersAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { }
161
162 void Reset() override
163 {
165 scheduler.Schedule(1s, 5s, [this](TaskContext emote)
166 {
168 emote.Repeat(6s, 9s);
169 });
170 }
171
172 void JustEngagedWith(Unit* /*who*/) override
173 {
176 }
177
178 virtual void ScheduleEvents() = 0;
179
180 void JustReachedHome() override
181 {
183 {
184 if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
185 broggok->AI()->DoAction(ACTION_RESET_BROGGOK);
186 }
187
189 }
190
191 void UpdateAI(uint32 diff) override
192 {
193 scheduler.Update(diff);
194
195 if (!UpdateVictim())
196 return;
197 }
198
199protected:
202};
203
205{
207
208 void ScheduleEvents() override
209 {
210 scheduler.Schedule(15s, [this](TaskContext concussionBlow)
211 {
213 concussionBlow.Repeat(8s, 11s);
214 }).Schedule(7s, [this](TaskContext stomp)
215 {
217 stomp.Repeat(16s, 21s);
218 });
219 }
220
221};
222
224{
226
227 void ScheduleEvents() override
228 {
229 scheduler.Schedule(5s, [this](TaskContext charge)
230 {
232 charge.Repeat(20s);
233 }).Schedule(1s, [this](TaskContext frenzy)
234 {
236 frenzy.Repeat(12s, 13s);
237 });
238 }
239
240};
241
243{
244 public:
245 go_broggok_lever() : GameObjectScript("go_broggok_lever") { }
246
248 {
249 go_broggok_leverAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
250
252
253 bool OnGossipHello(Player* /*player*/) override
254 {
256 {
258 if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
259 broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
260 }
261
264
265 return true;
266 }
267 };
268
269 GameObjectAI* GetAI(GameObject* go) const override
270 {
271 return GetBloodFurnaceAI<go_broggok_leverAI>(go);
272 }
273};
274
275// 30914, 38462 - Poison
277{
278 public:
279 spell_broggok_poison_cloud() : SpellScriptLoader("spell_broggok_poison_cloud") { }
280
282 {
283 bool Validate(SpellInfo const* spellInfo) override
284 {
285 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } }) && ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
286 }
287
288 void PeriodicTick(AuraEffect const* aurEff)
289 {
291 if (!aurEff->GetTotalTicks())
292 return;
293
294 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
295 int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
296 GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod));
297 }
298
299 void Register() override
300 {
302 }
303 };
304
305 AuraScript* GetAuraScript() const override
306 {
308 }
309};
310
312{
313 new boss_broggok();
316 new go_broggok_lever();
318}
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
@ EFFECT_0
Definition: SharedDefines.h:30
Emote
@ 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
Definition: SpellDefines.h:229
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
#define RegisterBloodFurnaceCreatureAI(ai_name)
Definition: blood_furnace.h:93
@ NPC_INCOMBAT_TRIGGER
Definition: blood_furnace.h:56
@ NPC_BROGGOK_POISON_CLOUD
Definition: blood_furnace.h:55
@ DATA_BROGGOK_LEVER
Definition: blood_furnace.h:45
@ DATA_BROGGOK
Definition: blood_furnace.h:32
@ ACTION_PREPARE_BROGGOK
Definition: blood_furnace.h:84
@ ACTION_ACTIVATE_BROGGOK
Definition: blood_furnace.h:82
@ ACTION_RESET_BROGGOK
Definition: blood_furnace.h:83
@ SAY_AGGRO
@ SPELL_STOMP
@ SPELL_CONCUSSION_BLOW
@ SPELL_CHARGE
@ SPELL_POISON_BOLT
@ SPELL_SUMMON_INCOMBAT_TRIGGER
@ SPELL_SLIME_SPRAY
@ SPELL_FRENZY
@ SPELL_POISON_CLOUD_PASSIVE
@ SPELL_POISON_CLOUD
void AddSC_boss_broggok()
static Emote const PrisionersEmotes[]
@ EVENT_POISON_CLOUD
@ EVENT_SLIME_SPRAY
@ EVENT_POISON_BOLT
Yells
uint32 GetTickNumber() const
SpellEffectInfo const & GetSpellEffectInfo() const
uint32 GetTotalTicks() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
virtual void JustReachedHome()
Definition: CreatureAI.h:159
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 SetReactState(ReactStates st)
Definition: Creature.h:160
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
GameObject *const me
Definition: GameObjectAI.h:50
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:274
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
uint32 GetEntry() const
Definition: Object.h:161
uint32 TriggerSpell
Definition: SpellInfo.h:237
uint32 const Id
Definition: SpellInfo.h:325
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
void Summon(Creature const *summon)
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
CreatureAI * GetAI(Creature *creature) const override
GameObjectAI * GetAI(GameObject *go) const override
AuraScript * GetAuraScript() const override
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
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 JustSummoned(Creature *summoned) override
void JustEngagedWith(Unit *who) override
void DoAction(int32 action) override
void ExecuteEvent(uint32 eventId) override
boss_broggokAI(Creature *creature)
bool OnGossipHello(Player *) override
void ScheduleEvents() override
npc_fel_orc_neophyte(Creature *creature)
void ScheduleEvents() override
npc_nascent_fel_orc(Creature *creature)