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 .SetOriginalCaster(me->GetGUID()));
160
161 events.Repeat(30s, 40s);
162 break;
163 default:
164 break;
165 }
166
168 return;
169 }
170
172 {
173 Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
174 if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
175 _consumptionJunction = false;
176 }
177 }
178
179private:
181};
182
183// 27709, 27753, 27754 - Drakkari Invader
185{
186 npc_drakkari_invader(Creature* creature) : ScriptedAI(creature) { }
187
188 void MovementInform(uint32 type, uint32 pointId) override
189 {
190 if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
191 {
192 me->Dismount();
193 me->SetImmuneToAll(false);
195 }
196 }
197};
198
199// 49380, 59803 - Consume
201{
202 bool Validate(SpellInfo const* /*spellInfo*/) override
203 {
205 }
206
207 void HandleConsume(SpellEffIndex /*effIndex*/)
208 {
209 if (Unit* target = GetHitUnit())
210 target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
211 }
212
217};
218
219// 49555, 59807 - Corpse Explode
221{
222 bool Validate(SpellInfo const* /*spellInfo*/) override
223 {
225 }
226
227 void PeriodicTick(AuraEffect const* aurEff)
228 {
229 if (aurEff->GetTickNumber() == 2)
230 if (Unit* caster = GetCaster())
231 caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, aurEff);
232 }
233
234 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
235 {
236 if (Creature* target = GetTarget()->ToCreature())
237 target->DespawnOrUnsummon();
238 }
239
245};
246
247// 49405 - Invader Taunt Trigger
249{
250 bool Validate(SpellInfo const* spellInfo) override
251 {
252 return ValidateSpellEffect({ { spellInfo->Id, EFFECT_0 } }) && ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValueAsInt()) });
253 }
254
255 void HandleTaunt(SpellEffIndex /*effIndex*/)
256 {
257 if (Unit* target = GetHitUnit())
258 target->CastSpell(GetCaster(), uint32(GetEffectValueAsInt()), true);
259 }
260
265};
266
268{
269 public:
270 achievement_consumption_junction() : AchievementCriteriaScript("achievement_consumption_junction")
271 {
272 }
273
274 bool OnCheck(Player* /*player*/, Unit* target) override
275 {
276 if (!target)
277 return false;
278
279 if (Creature* Trollgore = target->ToCreature())
280 if (Trollgore->AI()->GetData(DATA_CONSUMPTION_JUNCTION))
281 return true;
282
283 return false;
284 }
285};
286
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
#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:290
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: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:187
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
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:590
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:172
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
void Dismount()
Definition Unit.cpp:8336
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4718
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
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)