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/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "blood_furnace.h"
24#include "GameObject.h"
25#include "GameObjectAI.h"
26#include "InstanceScript.h"
27#include "MotionMaster.h"
28#include "ScriptedCreature.h"
29#include "SpellAuraEffects.h"
30#include "SpellScript.h"
31
39
41{
42 // Broggok - Combat
46
47 // Broggok - Misc
50
51 // Nascent Fel Orc
53 SPELL_STOMP = 31900,
54
55 // Fel Orc Neophyte
56 SPELL_CHARGE = 22120,
57 SPELL_FRENZY = 8269
58};
59
72
74{
75 PATH_ROOM = 11049200
76};
77
78// 17380 - Broggok
79struct boss_broggok : public BossAI
80{
81 boss_broggok(Creature* creature) : BossAI(creature, DATA_BROGGOK) { }
82
88
99
100 // Do nothing, don't store summons, don't despawn them in case of wipe or death - correct behavior
101 void JustSummoned(Creature* /*summoned*/) override { }
102
103 void WaypointPathEnded(uint32 /*nodeId*/, uint32 /*pathId*/) override
104 {
106 }
107
108 void DoAction(int32 action) override
109 {
110 switch (action)
111 {
114 break;
117 break;
120 break;
121 default:
122 break;
123 }
124 }
125
127 {
128 events.Update(diff);
129
130 while (uint32 eventId = events.ExecuteEvent())
131 {
132 switch (eventId)
133 {
134 case EVENT_INTRO_1:
137 break;
138 case EVENT_INTRO_2:
140 break;
141
142 case EVENT_RELEASE_1:
146 break;
147 case EVENT_RELEASE_2:
150 break;
151 default:
152 break;
153 }
154 }
155 }
156
157 void UpdateAI(uint32 diff) override
158 {
159 if (!UpdateVictim())
160 {
162 return;
163 }
164
165 events.Update(diff);
166
168 return;
169
170 while (uint32 eventId = events.ExecuteEvent())
171 {
172 switch (eventId)
173 {
176 events.Repeat(10s, 15s);
177 break;
180 events.Repeat(10s, 15s);
181 break;
184 events.Repeat(10s, 25s);
185 break;
186 default:
187 break;
188 }
189
191 return;
192 }
193
195 }
196};
197
199{
200 BroggokPrisionerBaseAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()) { }
201
202 void JustAppeared() override
203 {
204 if (IsHighCellPrisoner())
205 {
208 me->SetImmuneToNPC(true);
209 }
210 else if (IsCellPrisoner())
211 {
215 }
216 }
217
218 void Reset() override
219 {
221 }
222
223 void JustEngagedWith(Unit* /*who*/) override
224 {
225 if (IsCellPrisoner())
227
229
230 if (roll_chance_i(15))
232 }
233
235 {
236 return me->HasStringId("BroggokPrisonerHighCell");
237 }
238
240 {
241 return me->HasStringId("BroggokPrisonerCell1") || me->HasStringId("BroggokPrisonerCell2") || me->HasStringId("BroggokPrisonerCell3") || me->HasStringId("BroggokPrisonerCell4");
242 }
243
244 void DoAction(int32 action) override
245 {
246 if (action == ACTION_PRISONER_ENGAGE)
247 {
251 }
252 }
253
255 {
256 // Timer is random but all prisoners from the same cell plays emote at the same time,
257 // meaning they are in same spawn group and event is linked to all spawn group members.
258 // We can't support that for now in an easy way
259 Scheduler.Schedule(6s, 12s, [this](TaskContext task)
260 {
261 switch (task.GetRepeatCounter() % 3)
262 {
263 case 0:
264 me->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT);
265 break;
266 case 1:
267 me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
268 break;
269 case 2:
270 me->HandleEmoteCommand(EMOTE_ONESHOT_BATTLE_ROAR);
271 break;
272 default:
273 break;
274 }
275
276 task.Repeat(6s, 12s);
277 });
278 }
279
280 virtual void ScheduleEvents() = 0;
281
282 void JustReachedHome() override
283 {
285
286 if (!IsCellPrisoner())
287 return;
288
290
291 // This is not correct in case of wipe. Flags aren't set back. We do it for safety reasons
295 }
296
297 void UpdateAI(uint32 diff) override
298 {
299 Scheduler.Update(diff);
300
301 if (!UpdateVictim())
302 return;
303
305 }
306
307protected:
310};
311
312// 17398 - Nascent Fel Orc
314{
316
317 void ScheduleEvents() override
318 {
320 .Schedule(5s, 15s, [this](TaskContext task)
321 {
323 task.Repeat(20s, 30s);
324 })
325 .Schedule(0s, 10s, [this](TaskContext task)
326 {
328 task.Repeat(10s, 20s);
329 });
330 }
331};
332
333// 17429 - Fel Orc Neophyte
335{
337
338 void ScheduleEvents() override
339 {
341 .Schedule(5s, 10s, [this](TaskContext task)
342 {
344 DoCast(target, SPELL_CHARGE);
345 task.Repeat(20s, 30s);
346 })
347 .Schedule(0s, 10s, [this](TaskContext task)
348 {
350 task.Repeat(120s);
351 });
352 }
353};
354
355// 181982 - Cell Door Lever
357{
358 go_broggok_lever(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()) { }
359
360 bool OnGossipHello(Player* /*player*/) override
361 {
364
366
367 return false;
368 }
369
370private:
372};
373
374// 30914, 38462 - Poison
376{
378
379 bool Validate(SpellInfo const* spellInfo) override
380 {
381 return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
382 }
383
384 void OnPeriodic(AuraEffect const* aurEff)
385 {
387 if (!aurEff->GetTotalTicks())
388 return;
389
390 uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell;
391 int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3);
392 GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod));
393 }
394
399};
400
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ FAIL
@ DONE
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ 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:249
#define RegisterBloodFurnaceCreatureAI(ai_name)
#define RegisterBloodFurnaceGameObjectAI(ai_name)
@ DATA_BROGGOK
@ DATA_PRISONERS_EVENT
@ ACTION_PERFORM_INTRO
@ ACTION_DESPAWN_TRIGGER
@ ACTION_PRISONER_ENGAGE
@ ACTION_RELEASE_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
void AddSC_boss_broggok()
BroggokMisc
@ PATH_ROOM
BroggokTexts
@ SAY_AGGRO
@ SAY_PRISONER_AGGRO
@ SAY_INTRO
BroggokEvents
@ EVENT_POISON_CLOUD
@ EVENT_INTRO_1
@ EVENT_RELEASE_2
@ EVENT_INTRO_2
@ EVENT_SLIME_SPRAY
@ EVENT_POISON_BOLT
@ EVENT_RELEASE_1
uint32 GetTickNumber() const
SpellEffectInfo const & GetSpellEffectInfo() const
uint32 GetTotalTicks() const
void PreventDefaultAction()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
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:128
bool HasStringId(std::string_view id) const
void SetImmuneToNPC(bool apply) override
Definition Creature.h:141
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 ActivateObject(GameObjectActions action, WorldObject *spellCaster=nullptr, uint32 spellId=0, int32 effectIndex=-1)
EncounterState GetBossState(uint32 id) const
void MovePath(uint32 pathId, bool repeatable)
uint32 TriggerSpell
Definition SpellInfo.h:228
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler::repeated_t GetRepeatCounter() const
Returns the repeat counter which increases every time the task is repeated.
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:783
MotionMaster * GetMotionMaster()
Definition Unit.h:1683
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:968
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *spellInfo) override
PrepareAuraScript(spell_broggok_poison_cloud)
void OnPeriodic(AuraEffect const *aurEff)
virtual void ScheduleEvents()=0
void JustAppeared() override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
BroggokPrisionerBaseAI(Creature *creature)
void JustReachedHome() override
void DoAction(int32 action) override
InstanceScript * Instance
void WaypointPathEnded(uint32, uint32) override
void JustAppeared() override
void UpdateOutOfCombatEvents(uint32 diff)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *) override
boss_broggok(Creature *creature)
void DoAction(int32 action) override
InstanceScript * _instance
go_broggok_lever(GameObject *go)
bool OnGossipHello(Player *) override
void ScheduleEvents() override
void ScheduleEvents() override