TrinityCore
Loading...
Searching...
No Matches
boss_hungarfen.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 "Containers.h"
19#include "ScriptMgr.h"
20#include "ScriptedCreature.h"
21#include "SpellAuras.h"
22#include "SpellScript.h"
23#include "the_underbog.h"
24
29
43
44// 17770 - Hungarfen
45struct boss_hungarfen : public BossAI
46{
47 boss_hungarfen(Creature* creature) : BossAI(creature, DATA_HUNGARFEN), _roared(false) { }
48
49 void Reset() override
50 {
52 _roared = false;
54 }
55
56 void JustEngagedWith(Unit* who) override
57 {
59 scheduler.Schedule(IsHeroic() ? 2500ms : 5s, [this](TaskContext task)
60 {
62 task.Repeat(IsHeroic() ? 2500ms : 10s);
63 });
64
65 if (IsHeroic())
66 {
67 scheduler.Schedule(3s, 5s, [this](TaskContext task)
68 {
71 task.Repeat(10s, 15s);
72 });
73 }
74 }
75
81
82 void JustDied(Unit* killer) override
83 {
85 BossAI::JustDied(killer);
86 }
87
88 void UpdateAI(uint32 diff) override
89 {
90 if (!UpdateVictim())
91 return;
92
93 scheduler.Update(diff, [this]
94 {
96 });
97
98 if (!HealthAbovePct(20) && !_roared)
99 {
101 _roared = true;
103
104 scheduler.Schedule(2s, [this](TaskContext /*task*/)
105 {
108 });
109 }
110 }
111
112private:
114};
115
116// 17990 - Underbog Mushroom
118{
119 npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature), _counter(0) { }
120
121 void InitializeAI() override
122 {
123 _counter = RAND(8, 9, 10);
127
128 _scheduler.Schedule(1s, [this](TaskContext task)
129 {
131
132 // It's random(sniffs), makes them grow to different size. We need here count of stacks
133 // and not task repeat counter because first stack is applied not when task is repeated
134 Aura* growAura = me->GetAura(SPELL_GROW);
135 if (growAura && growAura->GetStackAmount() != _counter)
136 task.Repeat(2s);
137 else
138 {
139 task.Schedule(1s, [this](TaskContext task)
140 {
142
143 task.Schedule(4s, [this](TaskContext /*task*/)
144 {
147 });
148 });
149 }
150 });
151 }
152
153 void UpdateAI(uint32 diff) override
154 {
155 _scheduler.Update(diff);
156 }
157
158private:
161};
162
163// 31693 - Putrid Mushroom Primer
195
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ TARGET_UNIT_SRC_AREA_ENEMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
void AddSC_boss_hungarfen()
HungarfenSpells
@ SPELL_SHRINK
@ SPELL_DESPAWN_UNDERBOG_MUSHROOMS
@ SPELL_FOUL_SPORES
@ SPELL_PUTRID_MUSHROOM_PRIMER
@ SPELL_SPORE_CLOUD
@ SPELL_ACID_GEYSER
@ SPELL_GROW
@ SPELL_PUTRID_MUSHROOM
@ SPELL_SUMMON_UNDERBOG_MUSHROOM
HungarfenTexts
@ EMOTE_ROARS
uint8 GetStackAmount() const
Definition SpellAuras.h:164
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
TaskScheduler scheduler
void Reset() override
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskContext & Schedule(std::chrono::duration< _Rep, _Period > const &time, TaskScheduler::task_handler_t const &task)
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
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
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4439
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_hungarfen_putrid_mushroom_primer)
bool Validate(SpellInfo const *) override
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
bool IsHeroic() const
bool HealthAbovePct(uint32 pct) const
boss_hungarfen(Creature *creature)
void UpdateAI(uint32 diff) override
void Reset() override
void JustDied(Unit *killer) override
void EnterEvadeMode(EvadeReason why) override
void JustEngagedWith(Unit *who) override
npc_underbog_mushroom(Creature *creature)
void InitializeAI() override
void UpdateAI(uint32 diff) override
#define RegisterTheUnderbogCreatureAI(ai_name)
@ DATA_HUNGARFEN