TrinityCore
Loading...
Searching...
No Matches
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
41
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
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
234 };
235
236 SpellScript* GetSpellScript() const override
237 {
239 }
240};
241
242// 785 - True Fulfillment
272
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
SpellEffIndex
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_AURA_MOD_CHARM
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
EvadeReason
uint32 const BlinkSpells[3]
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SPLIT
@ SAY_SLAY
@ SPELL_TRUE_FULFILLMENT
@ SPELL_GENERIC_DISMOUNT
@ SPELL_TRUE_FULFILLMENT_2
@ SPELL_SUMMON_IMAGES
@ SPELL_ARCANE_EXPLOSION
@ SPELL_INITIALIZE_IMAGE
@ SPELL_EARTH_SHOCK
void AddSC_boss_skeram()
@ EVENT_BLINK
@ EVENT_ARCANE_EXPLOSION
@ EVENT_EARTH_SHOCK
@ EVENT_FULLFILMENT
Yells
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
SummonList summons
EventMap events
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:228
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:56
void Reset()
Definition EventMap.cpp:25
Creature * ToCreature()
Definition Object.h:121
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
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:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:710
void SetVisible(bool x)
Definition Unit.cpp:8768
float GetHealthPct() const
Definition Unit.h:796
void SetHealth(uint64 val)
Definition Unit.cpp:9973
uint64 GetMaxHealth() const
Definition Unit.h:789
bool IsSummon() const
Definition Unit.h:749
void SetMaxHealth(uint64 val)
Definition Unit.cpp:10004
Unit * GetVictim() const
Definition Unit.h:726
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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)
void KilledUnit(Unit *) override
void JustSummoned(Creature *creature) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason why) override
void JustEngagedWith(Unit *who) override
@ DATA_SKERAM