TrinityCore
Loading...
Searching...
No Matches
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
35
42
52
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
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
172};
173
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_PERIODIC_DAMAGE
#define AuraEffectRemoveFn(F, I, N, M)
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
Unit * GetTarget() const
ObjectGuid GetCasterGUID() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
virtual uint32 GetData(uint32 id) const
Definition UnitAI.h:74
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
UnitAI * GetAI() const
Definition Unit.h:668
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool OnCheck(Player *, Unit *target) 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