TrinityCore
boss_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 "SpellAuraEffects.h"
25#include "SpellScript.h"
26
28{
30};
31
33{
40};
41
43{
49};
50
51struct boss_argaloth : public BossAI
52{
54
55 void JustEngagedWith(Unit* who) override
56 {
62 }
63
64 void EnterEvadeMode(EvadeReason /*why*/) override
65 {
69 }
70
71 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
72 {
73 if (damage >= me->GetHealth() || _isInFelFirestormPhase)
74 return;
75
76 if ((me->HealthBelowPctDamaged(66, damage) && _felFirestormCount == 0) || (me->HealthBelowPctDamaged(33, damage) && _felFirestormCount == 1))
77 {
80 }
81 }
82
83 void JustDied(Unit* /*killer*/) override
84 {
85 _JustDied();
88 }
89
90 void UpdateAI(uint32 diff) override
91 {
92 if (!UpdateVictim())
93 return;
94
95 events.Update(diff);
96
98 return;
99
100 while (uint32 eventId = events.ExecuteEvent())
101 {
102 switch (eventId)
103 {
108 break;
112 break;
114 me->AttackStop();
122 break;
129 break;
130 case EVENT_BERSERK:
132 break;
133 default:
134 break;
135 }
136
138 return;
139 }
140 }
141private:
144};
145
146// 88954 - Consuming Darkness
148{
149 void HandlePeriodic(AuraEffect const* /*aurEff*/)
150 {
151 if (AuraEffect* aurEff = GetEffect(EFFECT_0))
152 {
153 int32 damage = aurEff->GetAmount() + CalculatePct(aurEff->GetAmount(), 10);
154 aurEff->SetAmount(damage);
155 }
156 }
157
158 void Register() override
159 {
161 }
162};
163
164// 88972 - Fel Firestorm
166{
167 bool Validate(SpellInfo const* /*spellInfo*/) override
168 {
170 }
171
172 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
173 {
175 }
176
177 void Register() override
178 {
180 }
181};
182
183// 88987 - Fel Firestorm
185{
186 void FilterTargets(std::list<WorldObject*>& targets)
187 {
188 if (targets.empty())
189 return;
190
191 size_t targetSize = GetCaster()->GetMap()->Is25ManRaid() ? 8 : 3;
192 if (targets.size() > targetSize)
193 Trinity::Containers::RandomResize(targets, targetSize);
194 }
195
196 void Register() override
197 {
199 }
200};
201
203{
208}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:230
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:2046
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
EvadeReason
Definition: UnitAICommon.h:30
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
T CalculatePct(T base, U pct)
Definition: Util.h:72
@ BOSS_ARGALOTH
Definition: baradin_hold.h:31
@ DATA_EXTINUISH_FEL_FLAMES
Definition: baradin_hold.h:36
#define RegisterBaradinHoldCreatureAI(ai_name)
Definition: baradin_hold.h:74
void AddSC_boss_argaloth()
ArgalothTexts
@ SAY_ANNOUNCE_FEL_FIRESTORM
ArgalothSpells
@ SPELL_CONSUMING_DARKNESS
@ SPELL_FEL_FIRESTORM
@ SPELL_METEOR_SLASH_VISUAL
@ SPELL_FEL_FIRESTORM_TRIGGERED
@ SPELL_BERSERK
@ SPELL_METEOR_SLASH
ArgalothEvents
@ EVENT_END_FEL_FIRESTORM
@ EVENT_FEL_FIRESTORM
@ EVENT_CONSUMING_DARKNESS
@ EVENT_METEOR_SLASH
@ EVENT_BERSERK
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:2045
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
AuraEffect * GetEffect(uint8 effIndex) const
Unit * GetTarget() const
InstanceScript *const instance
void JustEngagedWith(Unit *who) 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 UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void SetReactState(ReactStates st)
Definition: Creature.h:160
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 CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
bool Is25ManRaid() const
Definition: Map.cpp:3320
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
Definition: Unit.h:627
uint64 GetHealth() const
Definition: Unit.h:776
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
bool AttackStop()
Definition: Unit.cpp:5781
Map * GetMap() const
Definition: Object.h:624
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
void HandlePeriodic(AuraEffect const *)
void FilterTargets(std::list< WorldObject * > &targets)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
void RandomResize(C &container, std::size_t requestedSize)
Definition: Containers.h:67
bool Is25ManRaid() const
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_argaloth(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *who) override
uint8 _felFirestormCount
void UpdateAI(uint32 diff) override
bool _isInFelFirestormPhase
void JustDied(Unit *) override