TrinityCore
Loading...
Searching...
No Matches
boss_soulbound_goliath.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 "Creature.h"
19#include "InstanceScript.h"
20#include "Map.h"
21#include "MotionMaster.h"
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "SpellAuraEffects.h"
25#include "SpellScript.h"
26#include "TaskScheduler.h"
27#include "TemporarySummon.h"
28#include "waycrest_manor.h"
29
40
51
58
64
65// 131667 - Soulbound Goliath
67{
69
70 void JustAppeared() override
71 {
73 {
75 me->SetImmuneToPC(false);
76 me->SetUninteractible(false);
77 }
78 }
79
88
103
111
112 void DoAction(int32 actionId) override
113 {
114 switch (actionId)
115 {
117 {
118 _scheduler.Schedule(1s + 500ms, [this](TaskContext const& /*task*/)
119 {
122 me->SetImmuneToPC(false);
123 me->SetUninteractible(false);
124 });
125 break;
126 }
127 default:
128 break;
129 }
130 }
131
132 void KilledUnit(Unit* victim) override
133 {
134 if (!victim->IsPlayer())
135 return;
136
137 Talk(SAY_SLAY);
138 }
139
140 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
141 {
142 if (spellInfo->Id == SPELL_BURNING_BRUSH)
144 }
145
146 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
147 {
148 if (spellInfo->Id == SPELL_SOUL_THORNS_SELECTOR)
149 Talk(SAY_PLAYER_THORNS, target);
150 }
151
152 void UpdateAI(uint32 diff) override
153 {
154 _scheduler.Update(diff);
155
156 if (!UpdateVictim())
157 return;
158
159 events.Update(diff);
160
162 return;
163
164 while (uint32 eventId = events.ExecuteEvent())
165 {
166 switch (eventId)
167 {
168 case EVENT_CRUSH:
169 {
171 events.Repeat(16200ms);
172 break;
173 }
175 {
178 events.Repeat(22500ms);
179 break;
180 }
182 {
184 events.Repeat(32s);
185 break;
186 }
187 default:
188 break;
189 }
190
192 return;
193 }
194 }
195
196private:
198};
199
200// 261580 - Soul Harvest
202{
203 bool Validate(SpellInfo const* /*spellInfo*/) override
204 {
206 }
207
208 void HandlePeriodic(AuraEffect const* /*aurEff*/)
209 {
210 Unit* target = GetTarget();
211 InstanceScript* instance = target->GetInstanceScript();
212 if (!instance)
213 return;
214
216 return;
217
218 target->CastSpell(target, SPELL_SOUL_HARVEST_DAMAGE, true);
219 }
220
225};
226
227// 260551 - Soul Thorns
245
246// 267907 - Soul Thorns
267
268// 267911 - Soul Thorns
270{
271 bool Validate(SpellInfo const* /*spellInfo*/) override
272 {
274 }
275
276 void HandleScript(SpellEffIndex /*effIndex*/)
277 {
278 if (TempSummon* target = GetHitUnit()->ToTempSummon())
279 {
280 if (Unit* summoner = target->GetSummonerUnit())
281 summoner->RemoveAurasDueToSpell(GetEffectValueAsInt());
282 }
283 }
284
289};
290
291// 260541 - Burning Brush
293{
294 void HandleScript(SpellEffIndex /*effIndex*/)
295 {
296 Creature* target = GetHitCreature();
297 if (!target)
298 return;
299
300 target->AttackStop();
302 target->GetMotionMaster()->Clear();
303 target->GetMotionMaster()->MoveRandom(2.0f);
304 }
305
310};
311
313{
314 bool Validate(SpellInfo const* /*spellInfo*/) override
315 {
317 }
318
319 void HandlePeriodic(AuraEffect const* /*aurEff*/)
320 {
321 Unit* target = GetTarget();
322
324 aurEff->GetBase()->ModStackAmount(-7);
325
326 if (target->GetMap()->IsHeroicOrHigher())
327 target->CastSpell(target, SPELL_BURNING_SOULS, false);
328 }
329
330 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
331 {
332 Creature* creatureTarget = GetTarget()->ToCreature();
333 if (!creatureTarget)
334 return;
335
336 creatureTarget->GetMotionMaster()->Clear();
337 creatureTarget->SetReactState(REACT_AGGRESSIVE);
338 }
339
345};
346
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ FAIL
@ DONE
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellAndAuraScriptPair(script_1, script_2)
Definition ScriptMgr.h:1381
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_TRIGGER_ACTION_SET
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_DEATH
@ SPELL_AURA_PERIODIC_DAMAGE
@ 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)
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:276
void AddSC_boss_soulbound_goliath()
@ SPELL_KILL_SOUL_THORN
@ SPELL_BURNING_SOULS
@ SPELL_SOUL_HARVEST_DAMAGE
@ SPELL_SOUL_HARVEST_PERIODIC
@ SPELL_SOUL_THORNS_SELECTOR
@ SPELL_SOUL_THORNS_STUN
@ EVENT_SOUL_HARVEST_WARNING
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
bool IsPlayer() const
Definition BaseEntity.h:173
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
void SetReactState(ReactStates st)
Definition Creature.h:174
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
virtual bool SetBossState(uint32 id, EncounterState state)
EncounterState GetBossState(uint32 id) const
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
bool IsHeroicOrHigher() const
Definition Map.cpp:3344
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::ForceWalk, MovementSlot slot=MOTION_SLOT_DEFAULT, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Creature * ToCreature()
Definition Object.h:121
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Creature * GetHitCreature() const
int32 GetEffectValueAsInt() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void PlayOneShotAnimKitId(uint16 animKitId)
Definition Unit.cpp:11160
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4604
void SetUninteractible(bool apply)
Definition Unit.cpp:8564
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool AttackStop()
Definition Unit.cpp:5965
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
Map * GetMap() const
Definition Object.h:411
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void HandleDamage(AuraEffect const *, AuraEffectHandleModes)
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
void DoAction(int32 actionId) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
boss_soulbound_goliath(Creature *creature)
void KilledUnit(Unit *victim) override
void JustEngagedWith(Unit *who) override
void EnterEvadeMode(EvadeReason) override
void UpdateAI(uint32 diff) override
@ SPELL_BURNING_BRUSH
#define RegisterWaycrestManorCreatureAI(ai_name)
@ DATA_SOULBOUND_GOLIATH_INTRO
@ DATA_SOULBOUND_GOLIATH
@ ACTION_SOULBOUND_GOLIATH_INTRO