TrinityCore
boss_loatheb.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 "InstanceScript.h"
20#include "naxxramas.h"
21#include "ScriptedCreature.h"
22#include "SpellAuras.h"
23#include "SpellScript.h"
24
26{
32
34};
35
37{
41};
42
44{
51};
52
54{
56};
57
58struct boss_loatheb : public BossAI
59{
60 boss_loatheb(Creature* creature) : BossAI(creature, BOSS_LOATHEB), _doomCounter(0), _sporeLoser(true) { }
61
62 void Reset() override
63 {
64 _Reset();
66 _doomCounter = 0;
67 _sporeLoser = true;
68 }
69
70 void JustEngagedWith(Unit* who) override
71 {
77 }
78
79 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
80 {
81 _sporeLoser = false;
82 summon->CastSpell(summon, SPELL_FUNGAL_CREEP, true);
83 }
84
85 uint32 GetData(uint32 id) const override
86 {
87 return (_sporeLoser && id == DATA_ACHIEVEMENT_SPORE_LOSER) ? 1u : 0u;
88 }
89
90 void UpdateAI(uint32 diff) override
91 {
92 if (!UpdateVictim())
93 return;
94
95 events.Update(diff);
96
97 while (uint32 eventId = events.ExecuteEvent())
98 {
99 switch (eventId)
100 {
106 events.Repeat(Seconds(20));
107 break;
108 case EVENT_DEATHBLOOM:
110 events.Repeat(Seconds(30));
111 break;
113 ++_doomCounter;
115 if (_doomCounter > 6)
116 events.Repeat((_doomCounter & 1) ? Seconds(14) : Seconds(17));
117 else
118 events.Repeat(Seconds(30));
119 break;
120 case EVENT_SPORE:
123 break;
126 break;
129 break;
130 default:
131 break;
132 }
133 }
134 }
135
136private:
139};
140
142{
143 public:
144 achievement_spore_loser() : AchievementCriteriaScript("achievement_spore_loser") { }
145
146 bool OnCheck(Player* /*source*/, Unit* target) override
147 {
148 return target && target->GetAI()->GetData(DATA_ACHIEVEMENT_SPORE_LOSER);
149 }
150};
151
152// 29865, 55053 - Deathbloom
154{
155 bool Validate(SpellInfo const* /*spell*/) override
156 {
158 }
159
161 {
162 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
163 return;
164
166 }
167
168 void Register() override
169 {
171 }
172};
173
175{
179}
Texts
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_DAMAGE
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
void AddSC_boss_loatheb()
Achievement
@ DATA_ACHIEVEMENT_SPORE_LOSER
@ SPELL_INEVITABLE_DOOM
@ SPELL_FUNGAL_CREEP
@ SPELL_SUMMON_SPORE
@ SPELL_DEATHBLOOM
@ SPELL_DEATHBLOOM_FINAL_DAMAGE
@ SPELL_NECROTIC_AURA
@ SAY_NECROTIC_AURA_REMOVED
@ SAY_NECROTIC_AURA_APPLIED
@ SAY_NECROTIC_AURA_FADING
@ EVENT_NECROTIC_AURA_FADING
@ EVENT_SPORE
@ EVENT_NECROTIC_AURA
@ EVENT_DEATHBLOOM
@ EVENT_NECROTIC_AURA_FADED
@ EVENT_INEVITABLE_DOOM
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetTarget() const
ObjectGuid GetCasterGUID() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
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
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:73
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
UnitAI * GetAI() const
Definition: Unit.h:660
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool OnCheck(Player *, Unit *target) override
void Register() override
void AfterRemove(AuraEffect const *eff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
@ BOSS_LOATHEB
Definition: naxxramas.h:35
#define RegisterNaxxramasCreatureAI(ai_name)
Definition: naxxramas.h:221
T const & RAID_MODE(T const &normal10, T const &normal25) const
void Reset() override
void JustEngagedWith(Unit *who) override
boss_loatheb(Creature *creature)
uint32 GetData(uint32 id) const override
void SummonedCreatureDies(Creature *summon, Unit *) override
void UpdateAI(uint32 diff) override