Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_trollgore.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "SpellScript.h"
9#include "SpellAuraEffects.h"
10#include "drak_tharon_keep.h"
11
28
29#define SPELL_CONSUME_BUFF_HELPER DUNGEON_MODE<uint32>(SPELL_CONSUME_BUFF, SPELL_CONSUME_BUFF_H)
30
39
45
54
55Position const Landing = { -263.0534f, -660.8658f, 26.50903f, 0.0f };
56
58{
59 public:
60 boss_trollgore() : CreatureScript("boss_trollgore") { }
61
62 struct boss_trollgoreAI : public BossAI
63 {
64 boss_trollgoreAI(Creature* creature) : BossAI(creature, DATA_TROLLGORE) { }
65
67 {
68 _Reset();
70 }
71
72 void EnterCombat(Unit* /*who*/) OVERRIDE
73 {
76
77 events.ScheduleEvent(EVENT_CONSUME, 15000);
78 events.ScheduleEvent(EVENT_CRUSH, std::rand() % 5000 + 1000);
79 events.ScheduleEvent(EVENT_INFECTED_WOUND, std::rand() % 60000 + 10000);
80 events.ScheduleEvent(EVENT_CORPSE_EXPLODE, 3000);
81 events.ScheduleEvent(EVENT_SPAWN, std::rand() % 40000 + 30000);
82 }
83
85 {
86 if (!UpdateVictim())
87 return;
88
89 events.Update(diff);
90
91 if (me->HasUnitState(UNIT_STATE_CASTING))
92 return;
93
94 while (uint32 eventId = events.ExecuteEvent())
95 {
96 switch (eventId)
97 {
98 case EVENT_CONSUME:
101 events.ScheduleEvent(EVENT_CONSUME, 15000);
102 break;
103 case EVENT_CRUSH:
105 events.ScheduleEvent(EVENT_CRUSH, std::rand() % 15000 + 10000);
106 break;
109 events.ScheduleEvent(EVENT_INFECTED_WOUND, std::rand() % 35000 + 25000);
110 break;
114 events.ScheduleEvent(EVENT_CORPSE_EXPLODE, std::rand() % 19000 + 15000);
115 break;
116 case EVENT_SPAWN:
117 for (uint8 i = 0; i < 3; ++i)
119 trigger->CastSpell(trigger, RAND(SPELL_SUMMON_INVADER_A, SPELL_SUMMON_INVADER_B, SPELL_SUMMON_INVADER_C), true, NULL, NULL, me->GetGUID());
120
121 events.ScheduleEvent(EVENT_SPAWN, std::rand() % 40000 + 30000);
122 break;
123 default:
124 break;
125 }
126 }
127
129 {
130 Aura* ConsumeAura = me->GetAura(SPELL_CONSUME_BUFF_HELPER);
131 if (ConsumeAura && ConsumeAura->GetStackAmount() > 9)
132 _consumptionJunction = false;
133 }
134
136 }
137
138 void JustDied(Unit* /*killer*/) OVERRIDE
139 {
140 _JustDied();
142 }
143
145 {
146 if (type == DATA_CONSUMPTION_JUNCTION)
147 return _consumptionJunction ? 1 : 0;
148
149 return 0;
150 }
151
153 {
154 if (victim->GetTypeId() != TypeID::TYPEID_PLAYER)
155 return;
156
157 Talk(SAY_KILL);
158 }
159
161 {
162 summon->GetMotionMaster()->MovePoint(POINT_LANDING, Landing);
163 summons.Summon(summon);
164 }
165
166 private:
168 };
169
171 {
173 }
174};
175
177{
178 public:
179 npc_drakkari_invader() : CreatureScript("npc_drakkari_invader") { }
180
182 {
183 npc_drakkari_invaderAI(Creature* creature) : ScriptedAI(creature) { }
184
186 {
187 if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING)
188 {
189 me->Dismount();
192 }
193 }
194 };
195
197 {
199 }
200};
201
202// 49380, 59803 - Consume
204{
205 public:
206 spell_trollgore_consume() : SpellScriptLoader("spell_trollgore_consume") { }
207
209 {
211
212 bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
213 {
214 if (!sSpellMgr->GetSpellInfo(SPELL_CONSUME_BUFF))
215 return false;
216 return true;
217 }
218
219 void HandleConsume(SpellEffIndex /*effIndex*/)
220 {
221 if (Unit* target = GetHitUnit())
222 target->CastSpell(GetCaster(), SPELL_CONSUME_BUFF, true);
223 }
224
229 };
230
235};
236
237// 49555, 59807 - Corpse Explode
239{
240 public:
241 spell_trollgore_corpse_explode() : SpellScriptLoader("spell_trollgore_corpse_explode") { }
242
244 {
246
247 bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
248 {
249 if (!sSpellMgr->GetSpellInfo(SPELL_CORPSE_EXPLODE_DAMAGE))
250 return false;
251 return true;
252 }
253
254 void PeriodicTick(AuraEffect const* aurEff)
255 {
256 if (aurEff->GetTickNumber() == 2)
257 if (Unit* caster = GetCaster())
258 caster->CastSpell(GetTarget(), SPELL_CORPSE_EXPLODE_DAMAGE, true, NULL, aurEff);
259 }
260
261 void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
262 {
263 if (Creature* target = GetTarget()->ToCreature())
264 target->DespawnOrUnsummon();
265 }
266
272 };
273
278};
279
280// 49405 - Invader Taunt Trigger
282{
283 public:
284 spell_trollgore_invader_taunt() : SpellScriptLoader("spell_trollgore_invader_taunt") { }
285
287 {
289
290 bool Validate(SpellInfo const* spellInfo) OVERRIDE
291 {
292 if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()))
293 return false;
294 return true;
295 }
296
297 void HandleTaunt(SpellEffIndex /*effIndex*/)
298 {
299 if (Unit* target = GetHitUnit())
300 target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
301 }
302
307 };
308
313};
314
316{
317 public:
318 achievement_consumption_junction() : AchievementCriteriaScript("achievement_consumption_junction")
319 {
320 }
321
322 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
323 {
324 if (!target)
325 return false;
326
327 if (Creature* Trollgore = target->ToCreature())
328 if (Trollgore->AI()->GetData(DATA_CONSUMPTION_JUNCTION))
329 return true;
330
331 return false;
332 }
333};
334
const T & RAND(const T &v1, const T &v2)
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_PERIODIC_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
#define sSpellMgr
Definition SpellMgr.h:744
#define SpellEffectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ UNIT_FIELD_FLAGS
@ EVENT_SPAWN
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ 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
AchievementCriteriaScript(const char *name)
uint32 GetTickNumber() const
uint8 GetStackAmount() const
Definition SpellAuras.h:133
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
static Creature * GetCreature(WorldObject const &u, uint64 guid)
Creature * ToCreature()
Definition Object.h:207
HookList< EffectHandler > OnEffectHitTarget
Unit * GetHitUnit()
int32 GetEffectValue()
Unit * GetCaster()
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
bool OnCheck(Player *, Unit *target) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareSpellScript(spell_trollgore_consume_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
AuraScript * GetAuraScript() const OVERRIDE
SpellScript * GetSpellScript() const OVERRIDE
AI * GetDrakTharonKeepAI(Creature *creature)
@ DATA_TROLLGORE_INVADER_SUMMONER_1
@ DATA_TROLLGORE
Creature * me
ScriptedAI(Creature *creature)
uint32 GetData(uint32 type) const OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
void KilledUnit(Unit *victim) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 type, uint32 pointId) OVERRIDE