TrinityCore
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
27{
30 SPELL_STOMP = 55292,
35 SPELL_ENRAGE = 55285,
40
41 // Rhino Spirit
45
46};
47
49{
56 EMOTE_IMPALE = 6
57};
58
60{
62 PHASE_RHINO = 2
63};
64
66{
74
77};
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
124 {
125 events.SetPhase(phase);
126 switch (phase)
127 {
128 case PHASE_TROLL:
131 break;
132 case PHASE_RHINO:
137 break;
138 }
139 }
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{
240 bool Validate(SpellInfo const* /*spellInfo*/) override
241 {
243 }
244
245 bool Load() override
246 {
248 }
249
250 void HandleScript(SpellEffIndex /*effIndex*/)
251 {
252 if (Unit* target = GetHitUnit())
253 {
254 Unit* caster = GetCaster();
255 target->CastSpell(caster, SPELL_IMPALING_CHARGE_CONTROL_VEHICLE, true);
256 caster->ToCreature()->AI()->SetGUID(target->GetGUID(), DATA_SHARE_THE_LOVE);
257 }
258 }
259
260 void Register() override
261 {
263 }
264};
265
266// 55220 - Stampede (Rhino Spirit Charge)
267// 59823 - Stampede (Rhino Spirit Charge)
269{
270 void OnHit(SpellEffIndex /*effIndex*/)
271 {
272 if (Creature* caster = GetCaster()->ToCreature())
273 caster->DespawnOrUnsummon(Seconds(1));
274 }
275
276 void Register() override
277 {
279 }
280};
281
282// 60022 - Clear Puncture
284{
285 bool Validate(SpellInfo const* /*spellInfo*/) override
286 {
288 }
289
290 void HandleScript(SpellEffIndex /*effIndex*/)
291 {
292 Unit* target = GetHitUnit();
294 }
295
296 void Register() override
297 {
299 }
300};
301
303{
304 public:
305 achievement_share_the_love() : AchievementCriteriaScript("achievement_share_the_love") { }
306
307 bool OnCheck(Player* /*player*/, Unit* target) override
308 {
309 if (!target)
310 return false;
311
312 if (Creature* GalDarah = target->ToCreature())
313 if (GalDarah->AI()->GetData(DATA_SHARE_THE_LOVE) >= 5)
314 return true;
315
316 return false;
317 }
318};
319
321{
327}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_EFFECT_CHARGE
@ SPELL_EFFECT_SCHOOL_DAMAGE
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
EvadeReason
Definition: UnitAICommon.h:30
@ 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
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool _EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:299
Creature *const me
Definition: CreatureAI.h:61
CreatureAI * AI() const
Definition: Creature.h:214
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
bool IsHeroic() const
Definition: Map.cpp:3282
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
virtual void SetGUID(ObjectGuid const &, int32=0)
Definition: UnitAI.h:75
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
Vehicle * GetVehicleKit() const
Definition: Unit.h:1711
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
Map * GetMap() const
Definition: Object.h:624
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool OnCheck(Player *, Unit *target) override
void HandleScript(SpellEffIndex)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
#define RegisterGundrakCreatureAI(ai_name)
Definition: gundrak.h:99
@ 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