TrinityCore
boss_skeram.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 "ScriptedCreature.h"
20#include "SpellScript.h"
21#include "temple_of_ahnqiraj.h"
22
24{
28 SAY_DEATH = 3
29};
30
32{
40};
41
43{
48};
49
50uint32 const BlinkSpells[3] = { 4801, 8195, 20449 };
51
53{
54 public:
55 boss_skeram() : CreatureScript("boss_skeram") { }
56
57 struct boss_skeramAI : public BossAI
58 {
59 boss_skeramAI(Creature* creature) : BossAI(creature, DATA_SKERAM)
60 {
61 Initialize();
62 }
63
65 {
66 _flag = 0;
67 _hpct = 75.0f;
68 }
69
70 void Reset() override
71 {
72 Initialize();
73 me->SetVisible(true);
74 }
75
76 void KilledUnit(Unit* /*victim*/) override
77 {
79 }
80
81 void EnterEvadeMode(EvadeReason why) override
82 {
84 if (me->IsSummon())
86 }
87
88 void JustSummoned(Creature* creature) override
89 {
90 // Shift the boss and images (Get it? *Shift*?)
91 uint8 rand = 0;
92 if (_flag != 0)
93 {
94 while (_flag & (1 << rand))
95 rand = urand(0, 2);
96 DoCast(me, BlinkSpells[rand]);
97 _flag |= (1 << rand);
98 _flag |= (1 << 7);
99 }
100
101 while (_flag & (1 << rand))
102 rand = urand(0, 2);
103 creature->CastSpell(creature, BlinkSpells[rand]);
104 _flag |= (1 << rand);
105
106 if (_flag & (1 << 7))
107 _flag = 0;
108
110 creature->AI()->AttackStart(Target);
111
112 float ImageHealthPct;
113
114 if (me->GetHealthPct() < 25.0f)
115 ImageHealthPct = 0.50f;
116 else if (me->GetHealthPct() < 50.0f)
117 ImageHealthPct = 0.20f;
118 else
119 ImageHealthPct = 0.10f;
120
121 creature->SetMaxHealth(me->GetMaxHealth() * ImageHealthPct);
122 creature->SetHealth(creature->GetMaxHealth() * (me->GetHealthPct() / 100.0f));
123
124 summons.Summon(creature);
125 }
126
127 void JustDied(Unit* killer) override
128 {
129 if (!me->IsSummon())
130 {
132 BossAI::JustDied(killer);
133 }
134 else
136 }
137
138 void JustEngagedWith(Unit* who) override
139 {
141 events.Reset();
142
147
149 }
150
151 void UpdateAI(uint32 diff) override
152 {
153 if (!UpdateVictim())
154 return;
155
156 events.Update(diff);
157
158 while (uint32 eventId = events.ExecuteEvent())
159 {
160 switch (eventId)
161 {
165 break;
167 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 45.0f, true))
170 break;
171 case EVENT_BLINK:
172 DoCast(me, BlinkSpells[urand(0, 2)]);
174 me->SetVisible(true);
176 break;
180 break;
181 }
182 }
183
184 if (!me->IsSummon() && me->GetHealthPct() < _hpct)
185 {
188 _hpct -= 25.0f;
189 me->SetVisible(false);
191 }
192
195 }
196
197 private:
198 float _hpct;
200 };
201
202 CreatureAI* GetAI(Creature* creature) const override
203 {
204 return GetAQ40AI<boss_skeramAI>(creature);
205 }
206};
207
208// 26192 - Arcane Explosion
210{
211 public:
212 spell_skeram_arcane_explosion() : SpellScriptLoader("spell_skeram_arcane_explosion") { }
213
215 {
216 void FilterTargets(std::list<WorldObject*>& targets)
217 {
218 targets.remove_if([](WorldObject* object) -> bool
219 {
220 if (object->GetTypeId() == TYPEID_PLAYER)
221 return false;
222
223 if (Creature* creature = object->ToCreature())
224 return !creature->IsPet();
225
226 return true;
227 });
228 }
229
230 void Register() override
231 {
233 }
234 };
235
236 SpellScript* GetSpellScript() const override
237 {
239 }
240};
241
242// 785 - True Fulfillment
244{
245public:
246 spell_skeram_true_fulfillment() : SpellScriptLoader("spell_skeram_true_fulfillment") { }
247
249 {
250 bool Validate(SpellInfo const* /*spellInfo*/) override
251 {
253 }
254
255 void HandleEffect(SpellEffIndex /*effIndex*/)
256 {
259 }
260
261 void Register() override
262 {
264 }
265 };
266
267 SpellScript* GetSpellScript() const override
268 {
270 }
271};
272
274{
275 new boss_skeram();
278}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
if(posix_memalign(&__mallocedMemory, __align, __size)) return NULL
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_AURA_MOD_CHARM
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
EvadeReason
Definition: UnitAICommon.h:30
uint32 const BlinkSpells[3]
Definition: boss_skeram.cpp:50
@ SAY_DEATH
Definition: boss_skeram.cpp:28
@ SAY_AGGRO
Definition: boss_skeram.cpp:25
@ SAY_SPLIT
Definition: boss_skeram.cpp:27
@ SAY_SLAY
Definition: boss_skeram.cpp:26
@ SPELL_TRUE_FULFILLMENT
Definition: boss_skeram.cpp:35
@ SPELL_GENERIC_DISMOUNT
Definition: boss_skeram.cpp:39
@ SPELL_TRUE_FULFILLMENT_2
Definition: boss_skeram.cpp:36
@ SPELL_SUMMON_IMAGES
Definition: boss_skeram.cpp:38
@ SPELL_ARCANE_EXPLOSION
Definition: boss_skeram.cpp:33
@ SPELL_INITIALIZE_IMAGE
Definition: boss_skeram.cpp:37
@ SPELL_EARTH_SHOCK
Definition: boss_skeram.cpp:34
void AddSC_boss_skeram()
@ EVENT_BLINK
Definition: boss_skeram.cpp:46
@ EVENT_ARCANE_EXPLOSION
Definition: boss_skeram.cpp:44
@ EVENT_EARTH_SHOCK
Definition: boss_skeram.cpp:47
@ EVENT_FULLFILMENT
Definition: boss_skeram.cpp:45
Yells
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
SummonList summons
EventMap events
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
CreatureAI * AI() const
Definition: Creature.h:214
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 RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
void Reset()
Definition: EventMap.cpp:21
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
void Summon(Creature const *summon)
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
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:699
void SetVisible(bool x)
Definition: Unit.cpp:8351
float GetHealthPct() const
Definition: Unit.h:784
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
uint64 GetMaxHealth() const
Definition: Unit.h:777
bool IsSummon() const
Definition: Unit.h:738
void SetMaxHealth(uint64 val)
Definition: Unit.cpp:9377
Unit * GetVictim() const
Definition: Unit.h:715
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
SpellScript * GetSpellScript() const override
void ResetThreatList(Unit *who=nullptr)
void JustDied(Unit *killer) override
boss_skeramAI(Creature *creature)
Definition: boss_skeram.cpp:59
void KilledUnit(Unit *) override
Definition: boss_skeram.cpp:76
void JustSummoned(Creature *creature) override
Definition: boss_skeram.cpp:88
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason why) override
Definition: boss_skeram.cpp:81
void JustEngagedWith(Unit *who) override
@ DATA_SKERAM