TrinityCore
boss_pit_lord_argaloth.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 "baradin_hold.h"
20#include "Containers.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "ScriptedCreature.h"
24#include "SpellScript.h"
25
26/* TODO:
27- Fel Firestorm need completion
28- Need Correct timer
29*/
30
32{
36 SPELL_BERSERK = 47008
37};
38
40{
44};
45
47{
48 public:
49 boss_pit_lord_argaloth() : CreatureScript("boss_pit_lord_argaloth") { }
50
52 {
54
55 void JustEngagedWith(Unit* who) override
56 {
62 }
63
64 void EnterEvadeMode(EvadeReason /*why*/) override
65 {
68 }
69
70 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
71 {
72 if (me->HealthBelowPctDamaged(33, damage) ||
73 me->HealthBelowPctDamaged(66, damage))
74 {
76 }
77 }
78
79 void JustDied(Unit* /*killer*/) override
80 {
81 _JustDied();
83 }
84
85 void UpdateAI(uint32 diff) override
86 {
87 if (!UpdateVictim())
88 return;
89
90 events.Update(diff);
91
93 return;
94
95 while (uint32 eventId = events.ExecuteEvent())
96 {
97 switch (eventId)
98 {
102 break;
106 break;
107 case EVENT_BERSERK:
108 DoCast(me, SPELL_BERSERK, true);
109 break;
110 default:
111 break;
112 }
113 }
114
116 }
117 };
118
119 CreatureAI* GetAI(Creature* creature) const override
120 {
121 return GetBaradinHoldAI<boss_pit_lord_argalothAI>(creature);
122 }
123};
124
125// 88954 / 95173 - Consuming Darkness
127{
128 public:
129 spell_argaloth_consuming_darkness() : SpellScriptLoader("spell_argaloth_consuming_darkness") { }
130
132 {
133 void FilterTargets(std::list<WorldObject*>& targets)
134 {
135 Trinity::Containers::RandomResize(targets, GetCaster()->GetMap()->Is25ManRaid() ? 8 : 3);
136 }
137
138 void Register() override
139 {
141 }
142 };
143
144 SpellScript* GetSpellScript() const override
145 {
147 }
148};
149
150// 88942 / 95172 - Meteor Slash
152{
153 public:
154 spell_argaloth_meteor_slash() : SpellScriptLoader("spell_argaloth_meteor_slash") { }
155
157 {
158 void CountTargets(std::list<WorldObject*>& targets)
159 {
160 _targetCount = targets.size();
161 }
162
164 {
165 if (!_targetCount)
166 return;
167
169 }
170
171 void Register() override
172 {
175 }
176
177 private:
179 };
180
181 SpellScript* GetSpellScript() const override
182 {
184 }
185};
186
188{
192}
uint32_t uint32
Definition: Define.h:143
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
Spells
Definition: PlayerAI.cpp:32
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define SpellHitFn(F)
Definition: SpellScript.h:854
EvadeReason
Definition: UnitAICommon.h:30
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:267
@ DATA_ARGALOTH
Definition: baradin_hold.h:30
@ SPELL_CONSUMING_DARKNESS
@ SPELL_FEL_FIRESTORM
@ SPELL_METEOR_SLASH
void AddSC_boss_pit_lord_argaloth()
@ EVENT_CONSUMING_DARKNESS
@ EVENT_METEOR_SLASH
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void _JustDied()
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void SendEncounterUnit(uint32 type, Unit *unit=nullptr, uint8 priority=0)
int32 GetHitDamage() const
Unit * GetCaster() const
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
void SetHitDamage(int32 damage)
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:61
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:124
Definition: Unit.h:747
bool HasUnitState(const uint32 f) const
Definition: Unit.h:852
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:901
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
void RandomResize(C &container, std::size_t requestedSize)
Definition: Containers.h:67
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override