TrinityCore
Loading...
Searching...
No Matches
boss_trollgore.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 "drak_tharon_keep.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "ScriptedCreature.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26
35
52
53#define SPELL_CONSUME_BUFF_HELPER DUNGEON_MODE<uint32>(SPELL_CONSUME_BUFF, SPELL_CONSUME_BUFF_H)
54
63
69
70Position const Landing = { -263.0534f, -660.8658f, 26.50903f, 0.0f };
71
72// 26630 - Trollgore
73struct boss_trollgore : public BossAI
74{
76
77 void Reset() override
78 {
79 _Reset();
81 }
82
94
95 uint32 GetData(uint32 type) const override
96 {
97 if (type == DATA_CONSUMPTION_JUNCTION)
98 return _consumptionJunction ? 1 : 0;
99
100 return 0;
101 }
102
103 void JustSummoned(Creature* summon) override
104 {
106 summons.Summon(summon);
107 }
108
109 void KilledUnit(Unit* victim) override
110 {
111 if (victim->GetTypeId() != TYPEID_PLAYER)
112 return;
113
114 Talk(SAY_SLAY);
115 }
116
117 void JustDied(Unit* /*killer*/) override
118 {
119 _JustDied();
121 }
122
123 void UpdateAI(uint32 diff) override
124 {
125 if (!UpdateVictim())
126 return;
127
128 events.Update(diff);
129
131 return;
132
133 while (uint32 eventId = events.ExecuteEvent())
134 {
135 switch (eventId)
136 {
137 case EVENT_CONSUME:
140 events.Repeat(15s);
141 break;
142 case EVENT_CRUSH:
144 events.Repeat(10s, 15s);
145 break;
148 events.Repeat(25s, 35s);
149 break;
153 events.Repeat(15s, 19s);
154 break;
155 case EVENT_SPAWN:
156 for (uint8 i = 0; i < 3; ++i)
159
160 events.Repeat(30s, 40s);
161 break;
162 default:
163 break;
164 }
165
167 return;
168 }
169
171 {
172 Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
173 if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
174 _consumptionJunction = false;
175 }
176
178 }
179
180private:
182};
183
184// 27709, 27753, 27754 - Drakkari Invader
186{
187 npc_drakkari_invader(Creature* creature) : ScriptedAI(creature) { }
188
189 void MovementInform(uint32 type, uint32 pointId) override
190 {
191 if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
192 {
193 me->Dismount();
194 me->SetImmuneToAll(false);
196 }
197 }
198};
199
200// 49380, 59803 - Consume
202{
204
205 bool Validate(SpellInfo const* /*spellInfo*/) override
206 {
208 }
209
210 void HandleConsume(SpellEffIndex /*effIndex*/)
211 {
212 if (Unit* target = GetHitUnit())
213 target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
214 }
215
220};
221
222// 49555, 59807 - Corpse Explode
224{
226
227 bool Validate(SpellInfo const* /*spellInfo*/) override
228 {
230 }
231
232 void PeriodicTick(AuraEffect const* aurEff)
233 {
234 if (aurEff->GetTickNumber() == 2)
235 if (Unit* caster = GetCaster())
236 caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
237 }
238
239 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
240 {
241 if (Creature* target = GetTarget()->ToCreature())
242 target->DespawnOrUnsummon();
243 }
244
250};
251
252// 49405 - Invader Taunt Trigger
254{
256
257 bool Validate(SpellInfo const* spellInfo) override
258 {
259 return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) });
260 }
261
262 void HandleTaunt(SpellEffIndex /*effIndex*/)
263 {
264 if (Unit* target = GetHitUnit())
265 target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
266 }
267
272};
273
275{
276 public:
277 achievement_consumption_junction() : AchievementCriteriaScript("achievement_consumption_junction")
278 {
279 }
280
281 bool OnCheck(Player* /*player*/, Unit* target) override
282 {
283 if (!target)
284 return false;
285
286 if (Creature* Trollgore = target->ToCreature())
287 if (Trollgore->AI()->GetData(DATA_CONSUMPTION_JUNCTION))
288 return true;
289
290 return false;
291 }
292};
293
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
TrollgoreTexts
@ SAY_DEATH
@ SAY_CONSUME
@ SAY_AGGRO
@ SAY_EXPLODE
@ SAY_SLAY
void AddSC_boss_trollgore()
TrollgoreMisc
@ DATA_CONSUMPTION_JUNCTION
@ POINT_LANDING
#define SPELL_CONSUME_BUFF_HELPER
TrollgoreEvents
@ EVENT_INFECTED_WOUND
@ EVENT_SPAWN
@ EVENT_CONSUME
@ EVENT_CORPSE_EXPLODE
@ EVENT_CRUSH
Position const Landing
TrollgoreSpells
@ SPELL_CONSUME
@ SPELL_CORPSE_EXPLODE
@ SPELL_SUMMON_INVADER_C
@ SPELL_CONSUME_BUFF_H
@ SPELL_SUMMON_INVADER_A
@ SPELL_CONSUME_BUFF
@ SPELL_INVADER_TAUNT
@ SPELL_CORPSE_EXPLODE_DAMAGE
@ SPELL_INFECTED_WOUND
@ SPELL_SUMMON_INVADER_B
@ SPELL_CRUSH
uint32 GetTickNumber() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
uint8 GetStackAmount() const
Definition SpellAuras.h:164
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
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
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
Unit * GetCaster() const
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
void Summon(Creature const *summon)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4439
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void Dismount()
Definition Unit.cpp:8234
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
bool Validate(SpellInfo const *) override
void HandleConsume(SpellEffIndex)
PrepareSpellScript(spell_trollgore_consume)
PrepareAuraScript(spell_trollgore_corpse_explode)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
void PeriodicTick(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
PrepareSpellScript(spell_trollgore_invader_taunt)
#define RegisterDrakTharonKeepCreatureAI(ai_name)
@ DATA_TROLLGORE_INVADER_SUMMONER_1
@ DATA_TROLLGORE
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
uint32 GetData(uint32 type) const override
boss_trollgore(Creature *creature)
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summon) override
void JustDied(Unit *) override
void KilledUnit(Unit *victim) override
void JustEngagedWith(Unit *who) override
void Reset() override
void MovementInform(uint32 type, uint32 pointId) override
npc_drakkari_invader(Creature *creature)