TrinityCore
Loading...
Searching...
No Matches
boss_gal_darah.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 "gundrak.h"
20#include "Map.h"
21#include "ObjectAccessor.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24#include "SpellScript.h"
25
47
58
64
78
79enum Misc
80{
82};
83
84struct boss_gal_darah : public BossAI
85{
87
88 void Reset() override
89 {
90 _Reset();
91 _impaledPlayers.clear();
92 _phaseCounter = 0;
94 }
95
96 void JustSummoned(Creature* summon) override
97 {
99 if (summon->GetEntry() == NPC_RHINO_SPIRIT)
100 {
101 summon->CastSpell(summon, SPELL_STAMPEDE_SPIRIT, true);
102 summon->CastSpell(summon, SPELL_STAMPEDE_SPIRIT_2, true);
105 }
106 }
107
108 void EnterEvadeMode(EvadeReason /*why*/) override
109 {
113 }
114
115 void JustEngagedWith(Unit* who) override
116 {
121 }
122
140
141 void SetGUID(ObjectGuid const& guid, int32 id) override
142 {
143 if (id == DATA_SHARE_THE_LOVE)
144 {
145 if (Unit* target = ObjectAccessor::GetUnit(*me, guid))
146 Talk(EMOTE_IMPALE, target);
147 _impaledPlayers.insert(guid);
148 }
149 }
150
151 uint32 GetData(uint32 type) const override
152 {
153 if (type == DATA_SHARE_THE_LOVE)
154 return _impaledPlayers.size();
155
156 return 0;
157 }
158
159 void JustDied(Unit* /*killer*/) override
160 {
161 _JustDied();
164 }
165
166 void KilledUnit(Unit* victim) override
167 {
168 if (victim->GetTypeId() == TYPEID_PLAYER)
169 Talk(SAY_SLAY);
170 }
171
172 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
173 {
174 if (spellInfo->Id == SPELL_TRANSFORM_BACK)
176 }
177
178 void ExecuteEvent(uint32 eventId) override
179 {
180 switch (eventId)
181 {
183 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 60.0f, true))
185 if (++_phaseCounter >= 2)
187 events.Repeat(Seconds(31));
188 break;
189 case EVENT_STOMP:
191 events.Repeat(Seconds(20));
192 break;
193 case EVENT_PUNCTURE:
196 break;
197 case EVENT_STAMPEDE:
200 events.Repeat(Seconds(15));
201 break;
204 if (++_phaseCounter >= 2)
206 events.Repeat(Seconds(21));
207 break;
208 case EVENT_ENRAGE:
210 events.Repeat(Seconds(20));
211 break;
212 case EVENT_TRANSFORM:
214 {
218 }
219 else if (events.IsInPhase(PHASE_RHINO))
220 {
224 }
225 _phaseCounter = 0;
226 break;
227 default:
228 break;
229 }
230 }
231
232private:
235};
236
237// 54956, 59827 - Impaling Charge
239{
241
242 bool Validate(SpellInfo const* /*spellInfo*/) override
243 {
245 }
246
247 bool Load() override
248 {
250 }
251
252 void HandleScript(SpellEffIndex /*effIndex*/)
253 {
254 if (Unit* target = GetHitUnit())
255 {
256 Unit* caster = GetCaster();
257 target->CastSpell(caster, SPELL_IMPALING_CHARGE_CONTROL_VEHICLE, true);
258 caster->ToCreature()->AI()->SetGUID(target->GetGUID(), DATA_SHARE_THE_LOVE);
259 }
260 }
261
266};
267
268// 55220 - Stampede (Rhino Spirit Charge)
269// 59823 - Stampede (Rhino Spirit Charge)
271{
273
274 void OnHit(SpellEffIndex /*effIndex*/)
275 {
276 if (Creature* caster = GetCaster()->ToCreature())
277 caster->DespawnOrUnsummon(Seconds(1));
278 }
279
284};
285
286// 60022 - Clear Puncture
307
309{
310 public:
311 achievement_share_the_love() : AchievementCriteriaScript("achievement_share_the_love") { }
312
313 bool OnCheck(Player* /*player*/, Unit* target) override
314 {
315 if (!target)
316 return false;
317
318 if (Creature* GalDarah = target->ToCreature())
319 if (GalDarah->AI()->GetData(DATA_SHARE_THE_LOVE) >= 5)
320 return true;
321
322 return false;
323 }
324};
325
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:260
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_CHARGE
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
@ DATA_SHARE_THE_LOVE
@ SAY_DEATH
@ SAY_SUMMON_RHINO
@ SAY_AGGRO
@ EMOTE_IMPALE
@ SAY_TRANSFORM_1
@ SAY_SLAY
@ SAY_TRANSFORM_2
@ SPELL_STOMP
@ SPELL_STAMPEDE_SPIRIT_2
@ SPELL_ENRAGE
@ SPELL_TRANSFORM_BACK
@ SPELL_IMPALING_CHARGE
@ SPELL_STAMPEDE
@ SPELL_HEARTH_BEAM_VISUAL
@ SPELL_PUNCTURE
@ SPELL_STAMPEDE_SPIRIT_CHARGE
@ SPELL_IMPALING_CHARGE_CONTROL_VEHICLE
@ SPELL_WHIRLING_SLASH
@ SPELL_STAMPEDE_SPIRIT
@ SPELL_TRANSFORM_RHINO
@ SPELL_CLEAR_PUNCTURE
@ SPELL_PUNCTURE_HEROIC
void AddSC_boss_gal_darah()
CombatPhase
@ PHASE_TROLL
@ PHASE_RHINO
@ EVENT_ENRAGE
@ EVENT_STAMPEDE
@ EVENT_WHIRLING_SLASH
@ EVENT_GROUP_TROLL
@ EVENT_STOMP
@ EVENT_IMPALING_CHARGE
@ EVENT_TRANSFORM
@ EVENT_PUNCTURE
@ EVENT_GROUP_RHINO
Yells
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Creature *const me
Definition CreatureAI.h:82
CreatureAI * AI() const
Definition Creature.h:154
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
bool IsHeroic() const
Definition Map.cpp:4256
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< HitHandler > OnHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void SetGUID(ObjectGuid const &, int32=0)
Definition UnitAI.h:157
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Vehicle * GetVehicleKit() const
Definition Unit.h:1735
Map * GetMap() const
Definition Object.h:449
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool OnCheck(Player *, Unit *target) override
PrepareSpellScript(spell_gal_darah_clear_puncture)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_gal_darah_impaling_charge)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_gal_darah_stampede_charge)
#define RegisterGundrakCreatureAI(ai_name)
Definition gundrak.h:101
@ DATA_GAL_DARAH
Definition gundrak.h:34
@ NPC_GAL_DARAH
Definition gundrak.h:58
@ NPC_RHINO_SPIRIT
Definition gundrak.h:63
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
boss_gal_darah(Creature *creature)
void JustDied(Unit *) override
void SetGUID(ObjectGuid const &guid, int32 id) override
void JustSummoned(Creature *summon) override
void ExecuteEvent(uint32 eventId) override
void Reset() override
void EnterEvadeMode(EvadeReason) override
uint32 GetData(uint32 type) const override
void KilledUnit(Unit *victim) override
void SetPhase(CombatPhase phase)
void JustEngagedWith(Unit *who) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override