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 "ScriptedCreature.h"
25#include "SpellAuraEffects.h"
26#include "SpellScript.h"
27
29{
30 SAY_AGGRO = 0
31};
32
47
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
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 float mod = ((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 2 / 3;
296 GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod));
297 }
298
303 };
304
305 AuraScript* GetAuraScript() const override
306 {
308 }
309};
310
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition PlayerAI.cpp:32
@ 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
#define RegisterBloodFurnaceCreatureAI(ai_name)
@ NPC_INCOMBAT_TRIGGER
@ NPC_BROGGOK_POISON_CLOUD
@ DATA_BROGGOK_LEVER
@ DATA_BROGGOK
@ ACTION_PREPARE_BROGGOK
@ ACTION_ACTIVATE_BROGGOK
@ ACTION_RESET_BROGGOK
@ 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
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
virtual void JustReachedHome()
Definition CreatureAI.h:167
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
GameObject *const me
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:277
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:89
uint32 TriggerSpell
Definition SpellInfo.h:234
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
void Summon(Creature const *summon)
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void SetUninteractible(bool apply)
Definition Unit.cpp:8564
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
CreatureAI * GetAI(Creature *creature) const override
GameObjectAI * GetAI(GameObject *go) const override
AuraScript * GetAuraScript() const override
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
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)