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
43
44#define SPELL_CONSUME_BUFF_HELPER DUNGEON_MODE<uint32>(SPELL_CONSUME_BUFF, SPELL_CONSUME_BUFF_H)
45
54
60
69
70Position const Landing = { -263.0534f, -660.8658f, 26.50903f, 0.0f };
71
72struct boss_trollgore : public BossAI
73{
75 {
76 Initialize();
77 }
78
80 {
82 }
83
84 void Reset() override
85 {
86 _Reset();
87 Initialize();
88 }
89
101
102 void UpdateAI(uint32 diff) override
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
110 return;
111
112 while (uint32 eventId = events.ExecuteEvent())
113 {
114 switch (eventId)
115 {
116 case EVENT_CONSUME:
120 break;
121 case EVENT_CRUSH:
124 break;
128 break;
133 break;
134 case EVENT_SPAWN:
135 for (uint8 i = 0; i < 3; ++i)
138 .SetOriginalCaster(me->GetGUID()));
139
141 break;
142 default:
143 break;
144 }
145
147 return;
148 }
149
151 {
152 Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
153 if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
154 _consumptionJunction = false;
155 }
156 }
157
158 void JustDied(Unit* /*killer*/) override
159 {
160 _JustDied();
162 }
163
164 uint32 GetData(uint32 type) const override
165 {
166 if (type == DATA_CONSUMPTION_JUNCTION)
167 return _consumptionJunction ? 1 : 0;
168
169 return 0;
170 }
171
172 void KilledUnit(Unit* victim) override
173 {
174 if (victim->GetTypeId() != TYPEID_PLAYER)
175 return;
176
177 Talk(SAY_KILL);
178 }
179
180 void JustSummoned(Creature* summon) override
181 {
183 summons.Summon(summon);
184 }
185
186 private:
188};
189
191{
192 npc_drakkari_invader(Creature* creature) : ScriptedAI(creature) { }
193
194 void MovementInform(uint32 type, uint32 pointId) override
195 {
196 if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
197 {
198 me->Dismount();
199 me->SetImmuneToAll(false);
201 }
202 }
203};
204
205// 49380, 59803 - Consume
207{
208 bool Validate(SpellInfo const* /*spellInfo*/) override
209 {
211 }
212
213 void HandleConsume(SpellEffIndex /*effIndex*/)
214 {
215 if (Unit* target = GetHitUnit())
216 target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
217 }
218
223};
224
225// 49555, 59807 - Corpse Explode
227{
228 bool Validate(SpellInfo const* /*spellInfo*/) override
229 {
231 }
232
233 void PeriodicTick(AuraEffect const* aurEff)
234 {
235 if (aurEff->GetTickNumber() == 2)
236 if (Unit* caster = GetCaster())
237 caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
238 }
239
240 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
241 {
242 if (Creature* target = GetTarget()->ToCreature())
243 target->DespawnOrUnsummon();
244 }
245
251};
252
253// 49405 - Invader Taunt Trigger
255{
256 bool Validate(SpellInfo const* spellInfo) override
257 {
258 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } }) && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValueAsInt()) });
259 }
260
261 void HandleTaunt(SpellEffIndex /*effIndex*/)
262 {
263 if (Unit* target = GetHitUnit())
264 target->CastSpell(GetCaster(), uint32(GetEffectValueAsInt()), true);
265 }
266
271};
272
274{
275 public:
276 achievement_consumption_junction() : AchievementCriteriaScript("achievement_consumption_junction")
277 {
278 }
279
280 bool OnCheck(Player* /*player*/, Unit* target) override
281 {
282 if (!target)
283 return false;
284
285 if (Creature* Trollgore = target->ToCreature())
286 if (Trollgore->AI()->GetData(DATA_CONSUMPTION_JUNCTION))
287 return true;
288
289 return false;
290 }
291};
292
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DUMMY
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ DATA_CONSUMPTION_JUNCTION
@ POINT_LANDING
@ SAY_DEATH
@ SAY_CONSUME
@ SAY_AGGRO
@ SAY_EXPLODE
@ SAY_KILL
@ 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
void AddSC_boss_trollgore()
#define SPELL_CONSUME_BUFF_HELPER
Position const Landing
@ EVENT_INFECTED_WOUND
@ EVENT_SPAWN
@ EVENT_CONSUME
@ EVENT_CORPSE_EXPLODE
@ EVENT_CRUSH
Yells
uint32 GetTickNumber() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
uint8 GetStackAmount() const
Definition SpellAuras.h:238
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToAll(bool apply) override
Definition Creature.h:181
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Creature * ToCreature()
Definition Object.h:121
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Unit * GetCaster() const
int32 GetEffectValueAsInt() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void Summon(Creature const *summon)
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void Dismount()
Definition Unit.cpp:8317
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4700
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool OnCheck(Player *, Unit *target) override
bool Validate(SpellInfo const *) override
void HandleConsume(SpellEffIndex)
void HandleRemove(AuraEffect const *, AuraEffectHandleModes)
void PeriodicTick(AuraEffect const *aurEff)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *spellInfo) override
#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)